Fix killMask initialization
The shader is run multiple times reusing the same routine state.
We need to set the mask correctly before each execution.
Test: dEQP-VK.glsl.discard.*
Change-Id: Ic34385715cc4a16d931a3ff4fae4eeaf48d52223
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30328
Tested-by: Chris Forbes <chrisforbes@google.com>
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index f1a490d..3b26f6d 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -67,7 +67,11 @@
routine.getVariable(it->second.Id)[it->second.FirstComponent] = As<Float4>(frontFacing);
}
- auto activeLaneMask = SIMD::Int(0xFFFFFFFF); // TODO: Control this.
+ // Note: all lanes initially active to facilitate derivatives etc. Actual coverage is
+ // handled separately, through the cMask.
+ auto activeLaneMask = SIMD::Int(0xFFFFFFFF);
+ routine.killMask = 0;
+
spirvShader->emit(&routine, activeLaneMask, descriptorSets);
spirvShader->emitEpilog(&routine);