[Piglit] [PATCH] tess: avoid reading past the end of the gl_in array

Ilia Mirkin imirkin at alum.mit.edu
Wed Jul 29 08:45:14 PDT 2015


Reading off the end causes out-of-bounds errors on nouveau, and one
might think that it's somehow barrier-related given the name of these
tests. If this is a valuable thing to test, there can be a separate test
for that.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 .../spec/arb_tessellation_shader/execution/barrier-patch.shader_test | 5 ++++-
 tests/spec/arb_tessellation_shader/execution/barrier.shader_test     | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test b/tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test
index d34fdc5..313e9d0 100644
--- a/tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test
+++ b/tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test
@@ -12,7 +12,10 @@ patch out int val[6];
 patch out vec4 pcolor;
 
 void main() {
-	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+	if (gl_InvocationID < gl_PatchVerticesIn)
+		gl_out[gl_InvocationID].gl_Position =
+			gl_in[gl_InvocationID].gl_Position;
+
         if (gl_InvocationID < val.length())
                 val[gl_InvocationID] = gl_InvocationID;
 
diff --git a/tests/spec/arb_tessellation_shader/execution/barrier.shader_test b/tests/spec/arb_tessellation_shader/execution/barrier.shader_test
index 8ac74f0..a505e79 100644
--- a/tests/spec/arb_tessellation_shader/execution/barrier.shader_test
+++ b/tests/spec/arb_tessellation_shader/execution/barrier.shader_test
@@ -12,7 +12,10 @@ out int val[];
 patch out vec4 pcolor;
 
 void main() {
-	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+	if (gl_InvocationID < gl_PatchVerticesIn)
+		gl_out[gl_InvocationID].gl_Position =
+			gl_in[gl_InvocationID].gl_Position;
+
         if (gl_InvocationID < val.length())
                 val[gl_InvocationID] = gl_InvocationID;
 
-- 
2.3.6



More information about the Piglit mailing list