On Wed, 2015-11-18 at 15:46 +0100, Gregory Hainaut wrote:
> Hello Timothy,
> 
> Normally the first of the 2 new SSO tests that I sent a couple of
> weeks ago cover this case. However my test is limited to the first
> location.
> 
> Hopefully my Mesa patches take care of the issue. I will check it with
> this new test (and rebase my patches)

Hi Gregory,

There seems to be 3 separate issues so I think we should have a separate tests
(or at least cleary labebled subtests) for each of them.

I also think you will need to rework your test a bit because with my fixes for
outputs it will max out the varying limits, this is consistent with the issue
you were having on the Nvidia blob.

Tim
> 
> Best regards,
> Gregory
> 
> On 11/17/15, Timothy Arceri <t_arc...@yahoo.com.au> wrote:
> > This tests a bug in Mesa where explicit locations are not taken into
> > account when assigning varying locations which results in two
> > inputs/outputs being given the same location.
> > 
> > Test results:
> > Nvidia GeForce 840M - NVIDIA 352.41: pass
> > i965 - Mesa 11.1-dev: fail
> > 
> > Cc: Ian Romanick <ian.d.roman...@intel.com>
> > Cc: Gregory Hainaut <gregory.hain...@gmail.com>
> > ---
> >  tests/all.py                                       |   2 +
> >  .../arb_separate_shader_objects/CMakeLists.gl.txt  |   1 +
> >  .../mixed_explicit_and_non_explicit_locations.c    | 158
> > +++++++++++++++++++++
> >  3 files changed, 161 insertions(+)
> >  create mode 100644
> > tests/spec/arb_separate_shader_objects/mixed_explicit_and_non_explicit_loc
> > ations.c
> > 
> > diff --git a/tests/all.py b/tests/all.py
> > index 4d6c781..376cad0 100644
> > --- a/tests/all.py
> > +++ b/tests/all.py
> > @@ -2150,6 +2150,8 @@ with profile.group_manager(
> >        'UseProgramStages - non-separable program')
> >      g(['arb_separate_shader_object-ProgramUniform-coverage'],
> >        'ProgramUniform coverage')
> > +
> > g(['arb_separate_shader_object-mixed_explicit_and_non_explicit_locations',
> > '-fbo'],
> > +      'Mixed explicit and non-explicit locations', run_concurrent=False)
> >      g(['arb_separate_shader_object-rendezvous_by_location', '-fbo'],
> >        'Rendezvous by location', run_concurrent=False)
> >      g(['arb_separate_shader_object-rendezvous_by_location-5-stages'],
> > diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> > b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> > index f1b15c0..e8311e3 100644
> > --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> > +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> > @@ -15,6 +15,7 @@ piglit_add_executable
> > (arb_separate_shader_object-compat-builtins compat-builtin
> >  piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv
> > GetProgramPipelineiv.c)
> >  piglit_add_executable (arb_separate_shader_object-IsProgramPipeline
> > IsProgramPipeline.c)
> >  piglit_add_executable (arb_separate_shader_object-ProgramUniform-coverage
> > ProgramUniform-coverage.c)
> > +piglit_add_executable
> > (arb_separate_shader_object-mixed_explicit_and_non_explicit_locations
> > mixed_explicit_and_non_explicit_locations.c)
> >  piglit_add_executable (arb_separate_shader_object-rendezvous_by_location
> > rendezvous_by_location.c)
> >  piglit_add_executable
> > (arb_separate_shader_object-rendezvous_by_location-3-stages
> > rendezvous_by_location-3-stages.c)
> >  piglit_add_executable
> > (arb_separate_shader_object-rendezvous_by_location-5-stages
> > rendezvous_by_location-5-stages.c)
> > diff --git
> > a/tests/spec/arb_separate_shader_objects/mixed_explicit_and_non_explicit_l
> > ocations.c
> > b/tests/spec/arb_separate_shader_objects/mixed_explicit_and_non_explicit_l
> > ocations.c
> > new file mode 100644
> > index 0000000..d0ad73c
> > --- /dev/null
> > +++
> > b/tests/spec/arb_separate_shader_objects/mixed_explicit_and_non_explicit_l
> > ocations.c
> > @@ -0,0 +1,158 @@
> > +/*
> > + * Copyright © 2015 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining
> > a
> > + * copy of this software and associated documentation files (the
> > "Software"),
> > + * to deal in the Software without restriction, including without
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> > sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the
> > next
> > + * paragraph) shall be included in all copies or substantial portions of
> > the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS
> > OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> > SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > DEALINGS
> > + * IN THE SOFTWARE.
> > + */
> > +
> > +/**
> > + * This tests a bug in Mesa where explicit locations are not taken into
> > + * account when assigning varying locations which results in two
> > + * inputs/outputs being given the same location.
> > + */
> > +#include "piglit-util-gl.h"
> > +
> > +PIGLIT_GL_TEST_CONFIG_BEGIN
> > +
> > +   config.supports_gl_compat_version = 10;
> > +   config.window_visual = PIGLIT_GL_VISUAL_RGB |
> > PIGLIT_GL_VISUAL_DOUBLE;
> > +
> > +PIGLIT_GL_TEST_CONFIG_END
> > +
> > +static GLuint pipeline;
> > +
> > +static const char *vs_code_template =
> > +   "#version %d\n"
> > +   "#extension GL_ARB_separate_shader_objects: require\n"
> > +   "#extension GL_ARB_explicit_attrib_location: require\n"
> > +   "\n"
> > +   "layout(location = 0) in vec4 piglit_vertex;\n"
> > +   "\n"
> > +   "layout(location = 0) out vec3 a;\n"
> > +        "out vec3 d;\n"
> > +        "out vec3 e;\n"
> > +   "layout(location = 1) out vec3 b;\n"
> > +        "out vec3 f;\n"
> > +   "layout(location = 2) out vec3 c;\n"
> > +   "\n"
> > +   "void main()\n"
> > +   "{\n"
> > +   "    gl_Position = piglit_vertex;\n"
> > +   "    a = vec3(0.25, 0, 0);\n"
> > +   "    b = vec3(0, 0.25, 0);\n"
> > +   "    c = vec3(0, 0, 0.25);\n"
> > +   "    d = vec3(0.5, 0, 0);\n"
> > +   "    e = vec3(0, 0.5, 0);\n"
> > +   "    f = vec3(0, 0, 0.5);\n"
> > +   "}\n"
> > +   ;
> > +
> > +static const char *fs_code_template =
> > +   "#version %d\n"
> > +   "#extension GL_ARB_separate_shader_objects: require\n"
> > +   "#extension GL_ARB_explicit_attrib_location: enable\n"
> > +   "\n"
> > +   "#if __VERSION__ >= 130\n"
> > +   "layout(location = 0) out vec4 out_color;\n"
> > +   "#else\n"
> > +   "#define out_color gl_FragColor\n"
> > +   "#endif\n"
> > +   "\n"
> > +   "layout(location = 0) in vec3 a; /* should get vec3(0.25, 0, 0)
> > */\n"
> > +        "in vec3 d;                      /* should get vec3(0.5, 0, 0)
> > */\n"
> > +        "in vec3 e;                      /* should get vec3(0, 0.5, 0)
> > */\n"
> > +   "layout(location = 1) in vec3 b; /* should get vec3(0, 0.25, 0)
> > */\n"
> > +        "in vec3 f;                      /* should get vec3(0, 0, 0.5)
> > */\n"
> > +   "layout(location = 2) in vec3 c; /* should get vec3(0, 0, 0.25)
> > */\n"
> > +   "\n"
> > +   "void main()\n"
> > +   "{\n"
> > +   "    out_color = vec4(a.x + d.x, b.y + e.y, c.z + f.z, 1);\n"
> > +   "}\n"
> > +   ;
> > +
> > +enum piglit_result
> > +piglit_display(void)
> > +{
> > +   static const float expected[] = {
> > +           0.75f, 0.75f, 0.75f, 1.0f
> > +   };
> > +   bool pass;
> > +
> > +   glClearColor(0.1f, 0.1f, 0.1f, 0.1f);
> > +   glClear(GL_COLOR_BUFFER_BIT);
> > +
> > +   glBindProgramPipeline(pipeline);
> > +   piglit_draw_rect(-1, -1, 2, 2);
> > +
> > +   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
> > +                                 expected);
> > +
> > +   piglit_present_results();
> > +   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> > +}
> > +
> > +void piglit_init(int argc, char **argv)
> > +{
> > +   unsigned glsl_version;
> > +   GLuint vs_prog;
> > +   GLuint fs_prog;
> > +   bool es;
> > +   int glsl_major;
> > +   int glsl_minor;
> > +   char *source;
> > +
> > +   piglit_require_vertex_shader();
> > +   piglit_require_fragment_shader();
> > +   piglit_require_extension("GL_ARB_separate_shader_objects");
> > +   piglit_require_extension("GL_ARB_explicit_attrib_location");
> > +
> > +   /* Some NVIDIA drivers have issues with layout qualifiers, 'in'
> > +    * keywords, and 'out' keywords in "lower" GLSL versions.  If the
> > +    * driver supports GLSL >= 1.40, use 1.40.  Otherwise, pick the
> > +    * highest version that the driver supports.
> > +    */
> > +   piglit_get_glsl_version(&es, &glsl_major, &glsl_minor);
> > +   glsl_version = ((glsl_major * 100) + glsl_minor) >= 140
> > +           ? 140 : ((glsl_major * 100) + glsl_minor);
> > +
> > +   asprintf(&source, vs_code_template, glsl_version);
> > +   vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
> > +                                    (const GLchar *const *)
> > &source);
> > +   piglit_link_check_status(vs_prog);
> > +   free(source);
> > +
> > +   asprintf(&source, fs_code_template, glsl_version);
> > +   fs_prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
> > +                                   (const GLchar *const *) &source);
> > +   piglit_link_check_status(fs_prog);
> > +   free(source);
> > +
> > +   glGenProgramPipelines(1, &pipeline);
> > +   glUseProgramStages(pipeline,
> > +                      GL_VERTEX_SHADER_BIT,
> > +                      vs_prog);
> > +   glUseProgramStages(pipeline,
> > +                      GL_FRAGMENT_SHADER_BIT,
> > +                      fs_prog);
> > +   piglit_program_pipeline_check_status(pipeline);
> > +
> > +   if (!piglit_check_gl_error(0))
> > +           piglit_report_result(PIGLIT_FAIL);
> > +}
> > --
> > 2.4.3
> > 
> > 
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to