<p dir="ltr">Same with this one</p>
<div class="gmail_quote">On Oct 25, 2015 07:08, "Gregory Hainaut" <<a href="mailto:gregory.hainaut@gmail.com">gregory.hainaut@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Test is composed of 2 major steps.<br>
<br>
First part ensure that a matching (same on both VS & FS) qualifier doesn't<br>
pertubate the location assignment<br>
<br>
Second part ensure that a non-matching qualifier also work. Final interpolation<br>
qualifier is the one of the FS.<br>
Technically it is only allowed from GLSL4.5. However I don't know if any gl<br>
implementation really implement this constraint.<br>
<br>
Signed-off-by: Gregory Hainaut <<a href="mailto:gregory.hainaut@gmail.com">gregory.hainaut@gmail.com</a>><br>
---<br>
 .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +<br>
 .../rendezvous_by_name_interpolation.c             | 210 +++++++++++++++++++++<br>
 2 files changed, 211 insertions(+)<br>
 create mode 100644 tests/spec/arb_separate_shader_objects/rendezvous_by_name_interpolation.c<br>
<br>
diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt<br>
index 9ab6606..22a04b7 100644<br>
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt<br>
@@ -19,5 +19,6 @@ piglit_add_executable (arb_separate_shader_object-rendezvous_by_location rendezv<br>
 piglit_add_executable (arb_separate_shader_object-rendezvous_by_location-3-stages rendezvous_by_location-3-stages.c)<br>
 piglit_add_executable (arb_separate_shader_object-rendezvous_by_location-5-stages rendezvous_by_location-5-stages.c)<br>
 piglit_add_executable (arb_separate_shader_object-rendezvous_by_name rendezvous_by_name.c)<br>
+piglit_add_executable (arb_separate_shader_object-rendezvous_by_name_interpolation rendezvous_by_name_interpolation.c)<br>
 piglit_add_executable (arb_separate_shader_object-UseProgramStages-non-separable UseProgramStages-non-separable.c)<br>
 piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline ValidateProgramPipeline.c)<br>
diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_name_interpolation.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_name_interpolation.c<br>
new file mode 100644<br>
index 0000000..5a99871<br>
--- /dev/null<br>
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_name_interpolation.c<br>
@@ -0,0 +1,210 @@<br>
+/*<br>
+ * Copyright © 2015 Gregory Hainaut <<a href="mailto:gregory.hainaut@gmail.com">gregory.hainaut@gmail.com</a>><br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * \file rendezvous_by_name_interpolation.c<br>
+ * Simple test for separate shader objects that use rendezvous-by-name.<br>
+ *<br>
+ * The test ensures that multiple interpolation qualifier doesn't break<br>
+ * the interface matching.<br>
+ */<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_compat_version = 10;<br>
+       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static GLuint pipeline_match[4];<br>
+static GLuint pipeline_unmatch[4];<br>
+<br>
+static const char *vs_code_template =<br>
+       "#version %d\n"<br>
+       "#extension GL_ARB_separate_shader_objects: require\n"<br>
+       "#extension GL_ARB_explicit_attrib_location: require\n"<br>
+       "\n"<br>
+       "layout(location = 0) in vec4 piglit_vertex;\n"<br>
+       "\n"<br>
+       "%s out vec4 blue;\n"<br>
+       "%s out vec4 green;\n"<br>
+       "%s out vec4 red;\n"<br>
+       "\n"<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "    gl_Position = piglit_vertex;\n"<br>
+       "    red   = vec4(1, 0, 0, 0);\n"<br>
+       "    green = vec4(0, 1, 0, 0);\n"<br>
+       "    blue  = vec4(0, 0, 1, 0);\n"<br>
+       "}\n"<br>
+       ;<br>
+<br>
+static const char *fs_code_template =<br>
+       "#version %d\n"<br>
+       "#extension GL_ARB_separate_shader_objects: require\n"<br>
+       "#extension GL_ARB_explicit_attrib_location: enable\n"<br>
+       "\n"<br>
+       "#if __VERSION__ >= 130\n"<br>
+       "layout(location = 0) out vec4 out_color;\n"<br>
+       "#else\n"<br>
+       "#define out_color gl_FragColor\n"<br>
+       "#endif\n"<br>
+       "\n"<br>
+       "%s in vec4 blue;\n"<br>
+       "%s in vec4 green;\n"<br>
+       "%s in vec4 red;\n"<br>
+       "\n"<br>
+       "void main()\n"<br>
+       "{\n"<br>
+       "    out_color = vec4(red.r, green.g, blue.b, 1);\n"<br>
+       "}\n"<br>
+       ;<br>
+<br>
+static const char *qualifiers[] = {<br>
+       "",<br>
+       "flat",<br>
+       "smooth",<br>
+       "noperspective"<br>
+};<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       static const float expected[] = {<br>
+               1.0f, 1.0f, 1.0f, 1.0f<br>
+       };<br>
+       bool pass = true;<br>
+       int i;<br>
+<br>
+       glClearColor(0.1f, 0.1f, 0.1f, 0.1f);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+       for (i = 0; i < 4; i++) {<br>
+               float w = 0.5;<br>
+               float x = -1.0 + w * i;<br>
+               /*<br>
+                * Match qualifier on bottom row<br>
+                */<br>
+               glBindProgramPipeline(pipeline_match[i]);<br>
+               piglit_draw_rect(x, -1, w, 1);<br>
+<br>
+               /*<br>
+                * Unmatch qualifier on top row<br>
+                */<br>
+               glBindProgramPipeline(pipeline_unmatch[i]);<br>
+               piglit_draw_rect(x, 0, w, 1);<br>
+       }<br>
+<br>
+       pass &= piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,<br>
+                                     expected);<br>
+<br>
+       piglit_present_results();<br>
+<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
+<br>
+GLuint format_and_link_program(GLenum type, const char* code, unsigned glsl_version,<br>
+               unsigned q1, unsigned q2, unsigned q3)<br>
+{<br>
+       char *source;<br>
+       GLuint prog;<br>
+<br>
+       asprintf(&source, code, glsl_version, qualifiers[q1], qualifiers[q2], qualifiers[q3]);<br>
+       prog = glCreateShaderProgramv(type, 1,<br>
+                       (const GLchar *const *) &source);<br>
+<br>
+       piglit_link_check_status(prog);<br>
+       free(source);<br>
+<br>
+       return prog;<br>
+}<br>
+<br>
+void piglit_init(int argc, char **argv)<br>
+{<br>
+       unsigned i;<br>
+       unsigned glsl_version;<br>
+       GLuint vs_prog[4];<br>
+       GLuint fs_prog_match[4];<br>
+       GLuint fs_prog_unmatch[4];<br>
+       bool es;<br>
+       int glsl_major;<br>
+       int glsl_minor;<br>
+<br>
+       piglit_require_vertex_shader();<br>
+       piglit_require_fragment_shader();<br>
+       piglit_require_GLSL_version(130); /* Support layout index on output color */<br>
+       piglit_require_extension("GL_ARB_separate_shader_objects");<br>
+       piglit_require_extension("GL_ARB_explicit_attrib_location");<br>
+       piglit_require_extension("GL_ARB_blend_func_extended");<br>
+<br>
+       /* Some NVIDIA drivers have issues with layout qualifiers, 'in'<br>
+        * keywords, and 'out' keywords in "lower" GLSL versions.  If the<br>
+        * driver supports GLSL >= 1.40, use 1.40.  Otherwise, pick the<br>
+        * highest version that the driver supports.<br>
+        */<br>
+       piglit_get_glsl_version(&es, &glsl_major, &glsl_minor);<br>
+       glsl_version = ((glsl_major * 100) + glsl_minor) >= 140<br>
+               ? 140 : ((glsl_major * 100) + glsl_minor);<br>
+<br>
+       /*<br>
+        * Program compilation and link<br>
+        */<br>
+       for (i = 0; i < 4; i++) {<br>
+               int next = (i+1) % 4;<br>
+               int prev = (i-1) % 4;<br>
+               printf("Compile vs_prog[%d]\n", i);<br>
+               vs_prog[i] = format_and_link_program(GL_VERTEX_SHADER,<br>
+                               vs_code_template, glsl_version, prev, i, next);<br>
+<br>
+               printf("Compile fs_prog_match[%d]\n", i);<br>
+               fs_prog_match[i] = format_and_link_program(GL_FRAGMENT_SHADER,<br>
+                               fs_code_template, glsl_version, prev, i, next);<br>
+<br>
+               printf("Compile fs_prog_unmatch[%d]\n", i);<br>
+               fs_prog_unmatch[i] = format_and_link_program(GL_FRAGMENT_SHADER,<br>
+                               fs_code_template, glsl_version, next, prev, i);<br>
+       }<br>
+<br>
+       /*<br>
+        * Pipeline creation<br>
+        */<br>
+       glGenProgramPipelines(4, pipeline_match);<br>
+       glGenProgramPipelines(4, pipeline_unmatch);<br>
+       for (i = 0; i < 4; i++) {<br>
+               glBindProgramPipeline(pipeline_match[i]);<br>
+               glUseProgramStages(pipeline_match[i],<br>
+                               GL_VERTEX_SHADER_BIT, vs_prog[i]);<br>
+               glUseProgramStages(pipeline_match[i],<br>
+                               GL_FRAGMENT_SHADER_BIT, fs_prog_match[i]);<br>
+<br>
+               glBindProgramPipeline(pipeline_unmatch[i]);<br>
+               glUseProgramStages(pipeline_unmatch[i],<br>
+                               GL_VERTEX_SHADER_BIT, vs_prog[i]);<br>
+               glUseProgramStages(pipeline_unmatch[i],<br>
+                               GL_FRAGMENT_SHADER_BIT, fs_prog_unmatch[i]);<br>
+       }<br>
+<br>
+       if (!piglit_check_gl_error(0))<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+}<br>
--<br>
2.1.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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</blockquote></div>