On 31 August 2012 16:06, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The ARB_explicit_attrib_location tests layout-12.frag and layout-13.frag<br>
were incorrect: they both used index == 2 (which is invalid) and<br>
expected the compile to succeed. Although the extension spec doesn't<br>
state anything about generating an error on indices other than 0 or 1,<br>
the GLSL 4.30 spec clarifies this as a compile error. This matches the<br>
behavior of the API call defined in ARB_blend_func_extended,<br>
glBindFragDataLocationIndexed, which generates INVALID_VALUE for indices<br>
other than 0 or 1.<br>
<br>
This patch changes layout-13.frag to use index = 1 so it will actually<br>
test the intended behavior.<br>
<br>
layout-12.frag was just bogus: the comment said "Even though the<br>
specified locations overlap [...]" but the test only had one variable.<br>
This patch turns it into a negative test to ensure index == 2 is a<br>
compile error.<br>
<br>
This patch also adds layout-14.frag, a test to check that index < 0 is<br>
also a compile error.<br></blockquote><div><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
.../1.20/compiler/layout-12.frag | 27 ++++++----------------<br>
.../1.20/compiler/layout-13.frag | 4 ++--<br>
.../1.20/compiler/layout-14.frag | 21 +++++++++++++++++<br>
3 files changed, 30 insertions(+), 22 deletions(-)<br>
create mode 100644 tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-14.frag<br>
<br>
diff --git a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-12.frag b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-12.frag<br>
index d337eb5..e7dab5d 100644<br>
--- a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-12.frag<br>
+++ b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-12.frag<br>
@@ -1,28 +1,15 @@<br>
// [config]<br>
-// expect_result: pass<br>
+// expect_result: fail<br>
// glsl_version: 1.20<br>
// require_extensions: GL_ARB_explicit_attrib_location GL_ARB_blend_func_extended<br>
// [end config]<br>
//<br>
-// Even though the specified locations overlap, the spec says that a *link*<br>
-// error is generated. The changes to section 3.9.2 say:<br>
-//<br>
-// "Output binding assignments will cause LinkProgram to fail:<br>
-//<br>
-// * if the number of active outputs is greater than the value of<br>
-// MAX_DRAW_BUFFERS;<br>
-//<br>
-// * if the program has an active output assigned to a location<br>
-// greater than or equal to the value of<br>
-// MAX_DUAL_SOURCE_DRAW_BUFFERS and has an active output assigned<br>
-// an index greater than or equal to one;<br>
-//<br>
-// * if more than one varying out variable is bound to the same<br>
-// number and index; or<br>
-//<br>
-// * if the explicit binding assigments do not leave enough space<br>
-// for the linker to automatically assign a location for a varying<br>
-// out array, which requires multiple contiguous locations."<br>
+// While the GL_ARB_explicit_attrib_location specification does not say<br>
+// anything about generating errors for invalid indices, the GLSL 4.30<br>
+// spec clarifies this: "It is also a compile-time error if a fragment shader<br>
+// sets a layout index to less than 0 or greater than 1." This matches the<br>
+// behavior of the equivalent API call, glBindFragDataLocationIndexed, which<br>
+// generates an INVALID_VALUE error if <index> is not 0 or 1.<br>
<br>
#version 120<br>
#extension GL_ARB_explicit_attrib_location: require<br>
diff --git a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag<br>
index 3124e7f..a57a108 100644<br>
--- a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag<br>
+++ b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag<br>
@@ -26,8 +26,8 @@<br>
<br>
#version 120<br>
#extension GL_ARB_explicit_attrib_location: require<br>
-layout(location = 0, index = 2) out vec4 color;<br>
-layout(location = 0, index = 2) out vec4 factor;<br>
+layout(location = 0, index = 1) out vec4 color;<br>
+layout(location = 0, index = 1) out vec4 factor;<br>
<br>
void main()<br>
{<br>
diff --git a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-14.frag b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-14.frag<br>
new file mode 100644<br>
index 0000000..045fb8e<br>
--- /dev/null<br>
+++ b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-14.frag<br>
@@ -0,0 +1,21 @@<br>
+// [config]<br>
+// expect_result: fail<br>
+// glsl_version: 1.20<br>
+// require_extensions: GL_ARB_explicit_attrib_location GL_ARB_blend_func_extended<br>
+// [end config]<br>
+//<br>
+// While the GL_ARB_explicit_attrib_location specification does not say<br>
+// anything about generating errors for invalid indices, the GLSL 4.30<br>
+// spec clarifies this: "It is also a compile-time error if a fragment shader<br>
+// sets a layout index to less than 0 or greater than 1." This matches the<br>
+// behavior of the equivalent API call, glBindFragDataLocationIndexed, which<br>
+// generates an INVALID_VALUE error if <index> is not 0 or 1.<br>
+<br>
+#version 120<br>
+#extension GL_ARB_explicit_attrib_location: require<br>
+layout(location = 0, index = -5) out vec4 color;<br>
+<br>
+void main()<br>
+{<br>
+ color = vec4(1.0);<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br>