[Piglit] [PATCH] arb_shader_ballot: Fix the test values for gl_SubGroupG{e, t}MaskARB

Neil Roberts nroberts at igalia.com
Tue Oct 31 17:58:30 UTC 2017


The previous comparison values were calculated by shifting ~0 by the
invocation index. This would end up including bits higher than
gl_SubGroupSizeARB.
---
 .../arb_shader_ballot/execution/fs-builtin-variables.shader_test     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test b/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test
index cd75bca..15987b6 100644
--- a/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test
+++ b/tests/spec/arb_shader_ballot/execution/fs-builtin-variables.shader_test
@@ -16,6 +16,7 @@ void main() {
 	uint64_t active_set = ballotARB(true);
 
 	uint id = gl_SubGroupInvocationARB;
+	uint64_t group_mask = ~0ul >> (64u - gl_SubGroupSizeARB);
 
 	if (id >= gl_SubGroupSizeARB) {
 		outcolor = vec4(1.0, 0 / 255.0, id / 255.0, gl_SubGroupSizeARB / 255.0);
@@ -27,12 +28,12 @@ void main() {
 		return;
 	}
 
-	if (gl_SubGroupGeMaskARB != (~0ul << id)) {
+	if (gl_SubGroupGeMaskARB != ((~0ul << id) & group_mask)) {
 		outcolor = vec4(1.0, 2 / 255.0, id / 255.0, 0.0);
 		return;
 	}
 
-	if (gl_SubGroupGtMaskARB != (~1ul << id)) {
+	if (gl_SubGroupGtMaskARB != ((~1ul << id) & group_mask)) {
 		outcolor = vec4(1.0, 2 / 255.0, id / 255.0, 0.0);
 		return;
 	}
-- 
2.9.5



More information about the Piglit mailing list