Skip to content

Commit 0b44a21

Browse files
committed
Fix DCE with KillAlpha
1 parent 2638a0d commit 0b44a21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

h3d/shader/KillAlpha.hx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ class KillAlpha extends hxsl.Shader {
88
var pixelColor : Vec4;
99

1010
function fragment() {
11-
if( pixelColor.a < threshold ) discard;
11+
// Put the result of the check in a var. This way the DCE can correctly say that only the alpha channel of pixelColor is needed.
12+
var doDiscard = pixelColor.a < threshold;
13+
if( doDiscard ) discard;
1214
}
1315
}
1416

0 commit comments

Comments
 (0)