On 12/10/2013 05:50 PM, Anuj Phogat wrote: > Also, use piglit_link_simple_program(). It ensures that > piglit_vertex gets assigned to the proper attribute slot.
Using piglit_build_simple_program would enable removal of even more code. :) See below. > This patch fixes these tests currently failing on mesa. > > Signed-off-by: Anuj Phogat <[email protected]> > --- > .../arb_sample_shading/execution/builtin-gl-num-samples.cpp | 12 > +++++------- > .../execution/builtin-gl-sample-position.cpp | 12 > +++++------- > 2 files changed, 10 insertions(+), 14 deletions(-) > > diff --git > a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp > b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp > index 00de307..1e250ff 100644 > --- a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp > +++ b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp > @@ -35,6 +35,7 @@ const int pattern_width = 128; const int pattern_height = > 128; > PIGLIT_GL_TEST_CONFIG_BEGIN > > config.supports_gl_compat_version = 21; > + config.supports_gl_core_version = 31; > > config.window_width = pattern_width; > config.window_height = pattern_height; > @@ -58,10 +59,10 @@ compile_shader(void) > { > static const char *vert = > "#version 130\n" > - "in vec2 pos;\n" > + "in vec4 piglit_vertex;\n" > "void main()\n" > "{\n" > - " gl_Position = vec4(pos, 0.0, 1.0);\n" > + " gl_Position = piglit_vertex;\n" > "}\n"; > static const char *frag = > "#version 130\n" > @@ -78,12 +79,9 @@ compile_shader(void) > /* Compile program */ > prog = glCreateProgram(); > GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert); > - glAttachShader(prog, vs); > - piglit_check_gl_error(GL_NO_ERROR); > GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag); > - glAttachShader(prog, fs); > - glBindAttribLocation(prog, 0, "pos"); > - glLinkProgram(prog); > + piglit_check_gl_error(GL_NO_ERROR); > + prog = piglit_link_simple_program(vs, fs); > if (!piglit_link_check_status(prog)) { > piglit_report_result(PIGLIT_FAIL); > } This whole block could be prog = piglit_build_simple_program(vert, frag); if (prog == 0) piglit_report_result(PIGLIT_FAIL); With that change in this test and the other test, the patch is Reviewed-by: Ian Romanick <[email protected]> > diff --git > a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp > b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp > index 1698f56..0a7bad8 100644 > --- a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp > +++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp > @@ -36,6 +36,7 @@ const int pattern_width = 128; const int pattern_height = > 128; > PIGLIT_GL_TEST_CONFIG_BEGIN > > config.supports_gl_compat_version = 21; > + config.supports_gl_core_version = 31; > > config.window_width = pattern_width; > config.window_height = pattern_height; > @@ -59,10 +60,10 @@ compile_shader(void) > { > static const char *vert = > "#version 130\n" > - "in vec2 pos;\n" > + "in vec4 piglit_vertex;\n" > "void main()\n" > "{\n" > - " gl_Position = vec4(pos, 0.0, 1.0);\n" > + " gl_Position = piglit_vertex;\n" > "}\n"; > static const char *frag = > "#version 130\n" > @@ -81,12 +82,9 @@ compile_shader(void) > /* Compile program */ > prog = glCreateProgram(); > GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert); > - glAttachShader(prog, vs); > - piglit_check_gl_error(GL_NO_ERROR); > GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag); > - glAttachShader(prog, fs); > - glBindAttribLocation(prog, 0, "pos"); > - glLinkProgram(prog); > + piglit_check_gl_error(GL_NO_ERROR); > + prog = piglit_link_simple_program(vs, fs); > if (!piglit_link_check_status(prog)) { > piglit_report_result(PIGLIT_FAIL); > } > _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
