<div dir="ltr">On 12 September 2013 10:47, Nicholas Mack <span dir="ltr"><<a href="mailto:nichmack@gmail.com" target="_blank">nichmack@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
 .../gs-also-uses-smooth-flat-noperspective.geom    | 25 ++++++<br>
 ...also-uses-smooth-flat-noperspective.shader_test | 91 ++++++++++++++++++++++<br>
 2 files changed, 116 insertions(+)<br>
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom<br>
 create mode 100644 tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test<br>
<br>
diff --git a/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom<br>
new file mode 100644<br>
index 0000000..f1ab41e<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/compiler/gs-also-uses-smooth-flat-noperspective.geom<br>
@@ -0,0 +1,25 @@<br>
+// [config]<br>
+// expect_result: pass<br>
+// glsl_version: 1.50<br>
+// check_link: true<br>
+// [end config]<br>
+<br>
+#version 150<br>
+<br>
+layout(points) in;<br>
+layout(points, max_vertices = 1) out;<br>
+<br>
+flat in int a[];<br>
+noperspective in int b[];<br>
+smooth in int c[];<br>
+<br>
+flat out int aa;<br>
+noperspective out int bb;<br>
+smooth out int cc;<br>
+<br>
+void main()<br>
+{<br>
+       aa = a[0];<br>
+       bb = b[0];<br>
+       cc = c[0];<br>
+}<br></blockquote><div><br></div><div>This test looks good to me.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
diff --git a/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test<br>
new file mode 100644<br>
index 0000000..e302806<br>
--- /dev/null<br>
+++ b/tests/spec/glsl-1.50/execution/gs-also-uses-smooth-flat-noperspective.shader_test<br>
@@ -0,0 +1,91 @@<br>
+# Test that the qualifiers 'smooth', 'flat', and 'noperspective' can appear on<br>
+#  geometry shader ins and outs.<br>
+#<br>
+# From the GLSL 1.50 specification, section 4.3 ("Storage Qualifiers"):<br>
+#<br>
+# "Outputs from shader (out) and inputs to a shader (in) can be further<br>
+#  qualified with one of these interpolation qualifiers:<br>
+#      smooth<br>
+#      flat<br>
+#      noperspective"<br>
+<br>
+[require]<br>
+GL >= 3.2<br>
+GLSL >= 1.50<br>
+<br>
+[vertex shader]<br>
+<br>
+uniform float ref;<br>
+<br>
+in vec4 vertex;<br>
+<br>
+out vec4 pos;<br>
+flat out float a;<br>
+noperspective out float b;<br>
+smooth out float c;<br>
+<br>
+void main()<br>
+{<br>
+       gl_Position = vertex;<br>
+       pos = vertex;<br>
+       a = ref + 1;<br>
+       b = ref + 2;<br>
+       c = ref + 3;<br>
+}<br>
+<br>
+[geometry shader]<br>
+<br>
+uniform float ref;<br>
+<br>
+layout(triangles) in;<br>
+layout(triangle_strip, max_vertices = 3) out;<br>
+<br>
+in vec4 pos[];<br>
+flat in float a[];<br>
+noperspective in float b[];<br>
+smooth in float c[];<br>
+<br>
+flat out float aa;<br>
+noperspective out float bb;<br>
+smooth out float cc;<br>
+<br>
+void main()<br>
+{<br>
+       for(int i = 0; i < 3; i++) {<br>
+               gl_Position = pos[i];<br>
+               aa = a[i] + 1;<br>
+               bb = b[i] + 2;<br>
+               cc = c[i] + 3;<br>
+               EmitVertex();<br>
+       }<br>
+}<br>
+<br>
+[fragment shader]<br>
+<br>
+uniform float ref;<br>
+<br>
+flat in float aa;<br>
+noperspective in float bb;<br>
+smooth in float cc;<br>
+<br>
+out vec4 color;<br>
+<br>
+void main()<br>
+{<br>
+       if ((aa != ref + 2) || (bb != ref + 4) || (cc != ref + 6))<br>
+               color = vec4(1.0, 0.0, 0.0, 1.0);<br>
+       else<br>
+               color = vec4(0.0, 1.0, 0.0, 1.0);<br>
+}<br>
+<br>
+[vertex data]<br>
+vertex/float/2<br>
+-1.0 -1.0<br>
+ 1.0 -1.0<br>
+ 1.0  1.0<br>
+-1.0  1.0<br>
+<br>
+[test]<br>
+uniform float ref 37.29060007<br>
+draw arrays GL_TRIANGLE_FAN 0 4<br>
+probe all rgba 0.0 1.0 0.0 1.0<br></blockquote><div><br></div><div>For this test, I think we need to go a step further and actually verify that aa, bb, and cc are properly interpolated.  (As is, the test would pass even if the compiler just ignored the interpolation qualifiers and did smooth interpolation on everything).  I'd recommend doing something like what's done in tests/spec/glsl-1.30/execution/interpolation/interpolation-mixed.shader_test, but with a geometry shader also present in the pipeline.  (Note that interpolation-mixed.shader_test currently makes use of gl_ModelViewProjectionMatrix and the "frustum" command, which only exist in the compatibility profile.  These will have to be translated into their core profile equivalents.)<br>
</div></div></div></div>