Re: [Piglit] [PATCH] Add test to verify interpolation at sample position
On 9 January 2014 15:43, Anuj Phogat anuj.pho...@gmail.com wrote: +void +piglit_init(int argc, char**argv) +{ + if (argc != 2) + print_usage_and_exit(argv[0]); + + /* 1st arg: num_samples */ + char *endptr = NULL; + num_samples = strtol(argv[1], endptr, 0); + if (endptr != argv[1] + strlen(argv[1])) + print_usage_and_exit(argv[0]); + + piglit_require_extension(GL_ARB_texture_multisample); + piglit_require_extension(GL_ARB_sample_shading); + piglit_require_GLSL_version(130); + + /* Skip the test if num_samples GL_MAX_SAMPLES */ + GLint max_samples; + glGetIntegerv(GL_MAX_SAMPLES, max_samples); + if (num_samples == 0 || num_samples max_samples) + piglit_report_result(PIGLIT_SKIP); + + piglit_fbo_config msConfig(num_samples, piglit_width, piglit_height); +msConfig.attach_texture = true; + multisampled_fbo.setup(msConfig); + + /* Reduced tolerence for stricter color matching */ + piglit_set_tolerance_for_bits(16, 16, 16, 16); + draw_prog_left = piglit_build_simple_program( + #version 130\n + #extension GL_ARB_sample_shading: require\n + in vec4 piglit_vertex;\n + out vec2 test;\n + void main() {\n + gl_Position = piglit_vertex;\n + test = piglit_vertex.xy;\n + }\n, + + #version 130\n + #extension GL_ARB_sample_shading: require\n + in vec2 test;\n + void main() {\n + gl_FragColor = vec4(abs(test), 0, 1);\n + }\n); + + draw_prog_right = piglit_build_simple_program( + #version 130\n + uniform vec2 sample_pos;\n + in vec4 piglit_vertex;\n + out vec2 ref;\n + void main() {\n + gl_Position = piglit_vertex;\n + ref = piglit_vertex.xy;\n + /* Add an offset to account for interplolation +* at sample position. +*/ + ref += (sample_pos - 0.5) / 64;\n As with the patch Add test to verify 'centroid' qualifier is ignored in case of persample shading, it would be nice to have a comment here explaining the origin of the magic number 64 (it comes from the fact that pattern_width == pattern_height == 128, so the scaling factor between normalized device coordinates and pixels is 128/2 == 64). With that fixed, and with the Fbo and FboConfig renames you mentioned in your follow-up email, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com Sorry for the slow review! ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/2] Test that continue works properly inside a do-while loop.
On 1 February 2014 01:24, Pohjolainen, Topi topi.pohjolai...@intel.comwrote: On Fri, Jan 31, 2014 at 01:12:09PM -0800, Paul Berry wrote: --- .../glsl-fs-continue-inside-do-while.shader_test | 51 + .../glsl-vs-continue-inside-do-while.shader_test | 52 ++ 2 files changed, 103 insertions(+) create mode 100644 tests/shaders/glsl-fs-continue-inside-do-while.shader_test create mode 100644 tests/shaders/glsl-vs-continue-inside-do-while.shader_test diff --git a/tests/shaders/glsl-fs-continue-inside-do-while.shader_test b/tests/shaders/glsl-fs-continue-inside-do-while.shader_test new file mode 100644 index 000..9f5e491 --- /dev/null +++ b/tests/shaders/glsl-fs-continue-inside-do-while.shader_test @@ -0,0 +1,51 @@ +# From the GLSL 4.40 spec, section 6.4 (Jumps): +# +# The continue jump is used only in loops. It skips the remainder +# of the body of the inner most loop of which it is inside. For +# while and do-while loops, this jump is to the next evaluation of +# the loop condition-expression from which the loop continues as +# previously defined. +# +# As of 1/31/2014 (commit db8b6fb), Mesa handles continue inside a +# do-while loop incorrectly; instead of jumping to the loop +# condition-expression, it jumps to the top of the loop. This is +# particularly problematic because it can lead to infinite loops. +# +# This test verifies correct behaviour of continue inside do-while +# loops without risking an infinite loop. + +[require] +GLSL = 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +void main() +{ + int x = 0; + int y = 0; + do { // 1st iteration 2nd iteration 3rd iteration +++x; // x - 1 x - 2 x - 3 +if (x = 4)// false false false + break; This guarding is for the infinite looping case of the broken mesa to terminate after finite amount of iterations, right? Without this extra check the following continue would always jump to the top of the loop (as you explained) causing the final guarding while (x 3) to be infinitely skipped. If this is the case, would it make sense to add a small comment for the future when the problem in mesa not present anymore and somebody might wonder why the extra guarding is needed? I already have a comment hinting at this (This test verifies correct behaviour of 'continue' inside do-while loops without risking an infinite loop). I'll expand the comment so that it's clearer. Still need to add that this is one the best documented tests that I've seen. Thanks Paul, makes really nice reading! Thanks! Can I consider that a Reviewed-by? +if (x = 2)// false true true + continue; +++y; // y=1skippedskipped + } while (x 3); // true true false + + // The continue should skip ++y on all iterations but the first, + // so y should now be 1. The continue should not skip (x 3) + // ever, so the loop should terminate when x == 3 (not 4). + if (x == 3 y == 1) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/shaders/glsl-vs-continue-inside-do-while.shader_test b/tests/shaders/glsl-vs-continue-inside-do-while.shader_test new file mode 100644 index 000..aa6d3e6 --- /dev/null +++ b/tests/shaders/glsl-vs-continue-inside-do-while.shader_test @@ -0,0 +1,52 @@ +# From the GLSL 4.40 spec, section 6.4 (Jumps): +# +# The continue jump is used only in loops. It skips the remainder +# of the body of the inner most loop of which it is inside. For +# while and do-while loops, this jump is to the next evaluation of +# the loop condition-expression from which the loop continues as +# previously defined. +# +# As of 1/31/2014 (commit db8b6fb), Mesa handles continue inside a +# do-while loop incorrectly; instead of jumping to the loop +# condition-expression, it jumps to the top of the loop. This is +# particularly problematic because it can lead to infinite loops. +# +# This test verifies correct behaviour of continue inside do-while +# loops without risking an infinite loop. + +[require] +GLSL = 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; + int x = 0; + int y = 0; + do { // 1st iteration 2nd iteration 3rd iteration +++x; // x - 1 x - 2 x - 3 +if (x = 4)// false false false + break; +if (x = 2)// false true true + continue; +++y; // y=1skippedskipped + } while (x 3
[Piglit] [PATCH 2/2] Test that continue works in a switch statement within a do-while loop.
--- ...l-fs-continue-in-switch-in-do-while.shader_test | 94 + ...l-vs-continue-in-switch-in-do-while.shader_test | 95 ++ 2 files changed, 189 insertions(+) create mode 100644 tests/shaders/glsl-fs-continue-in-switch-in-do-while.shader_test create mode 100644 tests/shaders/glsl-vs-continue-in-switch-in-do-while.shader_test diff --git a/tests/shaders/glsl-fs-continue-in-switch-in-do-while.shader_test b/tests/shaders/glsl-fs-continue-in-switch-in-do-while.shader_test new file mode 100644 index 000..58dc50d --- /dev/null +++ b/tests/shaders/glsl-fs-continue-in-switch-in-do-while.shader_test @@ -0,0 +1,94 @@ +# From the GLSL 4.40 spec, section 6.4 (Jumps): +# +# The continue jump is used only in loops. It skips the remainder +# of the body of the inner most loop of which it is inside. For +# while and do-while loops, this jump is to the next evaluation of +# the loop condition-expression from which the loop continues as +# previously defined. +# +# One way that do-while loops might be implemented is to convert them +# to infinite loops that terminate in a conditional break (this is +# what Mesa does). In such an implementation, an easy way to +# implement the proper behaviour of continue in a do-while loop is +# to replicate the conditional break at the site of the continue. +# For example, this code: +# +# do { +# ... +# if (...) { +# ... +# continue; +# } +# ... +# } while (condition); +# +# would get translated to: +# +# loop { +# ... +# if (...) { +# ... +# if (!condition) +# break; +# continue; +# } +# ... +# if (!condition) +# break; +# } +# +# However, we must be careful in making this transformation if the +# continue occurs inside a switch statement, since break inside a +# switch statement normally exits the switch statement, not the +# surrounding loop. +# +# This test verifies that continue behaves properly when invoked +# inside a switch statement which is itself inside a do-while loop. + +[require] +GLSL = 1.30 + +[vertex shader] +#version 130 +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +#version 130 +void main() +{ + int w = 0; + int x = 0; + int y = 0; + int z = 0; + do { // 1st iteration 2nd iteration +++w; // w - 1 w - 2 +switch (w) { // Jump to case 1 Jump to case 2 + case 1: +++x; // x - 1 +break; // Jump to ++z + case 2: +continue; // Jump to (w 2) + case 3: +++y; // (this case is never executed) +break; +} +++z; // z - 1 skipped + } while (w 2); // truefalse + + // The loop should execute for two iterations, so w should be 2. X + // should be incremented on the first iteration only, so it should + // be 1. Y should never be incremented (since w never reaches 3), + // so it should be 0. The continue should skip ++z on the second + // iteration, so z should be 1. + if (w == 2 x == 1 y == 0 z == 1) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/shaders/glsl-vs-continue-in-switch-in-do-while.shader_test b/tests/shaders/glsl-vs-continue-in-switch-in-do-while.shader_test new file mode 100644 index 000..88fcfb9 --- /dev/null +++ b/tests/shaders/glsl-vs-continue-in-switch-in-do-while.shader_test @@ -0,0 +1,95 @@ +# From the GLSL 4.40 spec, section 6.4 (Jumps): +# +# The continue jump is used only in loops. It skips the remainder +# of the body of the inner most loop of which it is inside. For +# while and do-while loops, this jump is to the next evaluation of +# the loop condition-expression from which the loop continues as +# previously defined. +# +# One way that do-while loops might be implemented is to convert them +# to infinite loops that terminate in a conditional break (this is +# what Mesa does). In such an implementation, an easy way to +# implement the proper behaviour of continue in a do-while loop is +# to replicate the conditional break at the site of the continue. +# For example, this code: +# +# do { +# ... +# if (...) { +# ... +# continue; +# } +# ... +# } while (condition); +# +# would get translated to: +# +# loop { +# ... +# if (...) { +# ... +# if (!condition) +# break; +# continue; +# } +# ... +# if (!condition) +# break; +# } +# +# However, we must be careful in making this transformation if the +# continue occurs inside a switch statement, since break inside a +# switch statement normally exits the switch statement, not the +# surrounding loop. +# +# This test verifies that
[Piglit] [PATCH 1/2] Test that continue works properly inside a do-while loop.
--- .../glsl-fs-continue-inside-do-while.shader_test | 51 + .../glsl-vs-continue-inside-do-while.shader_test | 52 ++ 2 files changed, 103 insertions(+) create mode 100644 tests/shaders/glsl-fs-continue-inside-do-while.shader_test create mode 100644 tests/shaders/glsl-vs-continue-inside-do-while.shader_test diff --git a/tests/shaders/glsl-fs-continue-inside-do-while.shader_test b/tests/shaders/glsl-fs-continue-inside-do-while.shader_test new file mode 100644 index 000..9f5e491 --- /dev/null +++ b/tests/shaders/glsl-fs-continue-inside-do-while.shader_test @@ -0,0 +1,51 @@ +# From the GLSL 4.40 spec, section 6.4 (Jumps): +# +# The continue jump is used only in loops. It skips the remainder +# of the body of the inner most loop of which it is inside. For +# while and do-while loops, this jump is to the next evaluation of +# the loop condition-expression from which the loop continues as +# previously defined. +# +# As of 1/31/2014 (commit db8b6fb), Mesa handles continue inside a +# do-while loop incorrectly; instead of jumping to the loop +# condition-expression, it jumps to the top of the loop. This is +# particularly problematic because it can lead to infinite loops. +# +# This test verifies correct behaviour of continue inside do-while +# loops without risking an infinite loop. + +[require] +GLSL = 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +void main() +{ + int x = 0; + int y = 0; + do { // 1st iteration 2nd iteration 3rd iteration +++x; // x - 1 x - 2 x - 3 +if (x = 4)// false false false + break; +if (x = 2)// false true true + continue; +++y; // y=1skippedskipped + } while (x 3); // true true false + + // The continue should skip ++y on all iterations but the first, + // so y should now be 1. The continue should not skip (x 3) + // ever, so the loop should terminate when x == 3 (not 4). + if (x == 3 y == 1) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/shaders/glsl-vs-continue-inside-do-while.shader_test b/tests/shaders/glsl-vs-continue-inside-do-while.shader_test new file mode 100644 index 000..aa6d3e6 --- /dev/null +++ b/tests/shaders/glsl-vs-continue-inside-do-while.shader_test @@ -0,0 +1,52 @@ +# From the GLSL 4.40 spec, section 6.4 (Jumps): +# +# The continue jump is used only in loops. It skips the remainder +# of the body of the inner most loop of which it is inside. For +# while and do-while loops, this jump is to the next evaluation of +# the loop condition-expression from which the loop continues as +# previously defined. +# +# As of 1/31/2014 (commit db8b6fb), Mesa handles continue inside a +# do-while loop incorrectly; instead of jumping to the loop +# condition-expression, it jumps to the top of the loop. This is +# particularly problematic because it can lead to infinite loops. +# +# This test verifies correct behaviour of continue inside do-while +# loops without risking an infinite loop. + +[require] +GLSL = 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; + int x = 0; + int y = 0; + do { // 1st iteration 2nd iteration 3rd iteration +++x; // x - 1 x - 2 x - 3 +if (x = 4)// false false false + break; +if (x = 2)// false true true + continue; +++y; // y=1skippedskipped + } while (x 3); // true true false + + // The continue should skip ++y on all iterations but the first, + // so y should now be 1. The continue should not skip (x 3) + // ever, so the loop should terminate when x == 3 (not 4). + if (x == 3 y == 1) +gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[fragment shader] +void main() +{ + gl_FragColor = gl_Color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.5.3 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V2] Add test to verify 'centroid' qualifier is ignored in case of persample shading
draw_prog_left, draw_prog_right, test_prog; + +enum piglit_result +piglit_display(void) +{ + float pos[2]; + bool result = true, pass = true; + + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_fbo.handle); + glClear(GL_COLOR_BUFFER_BIT); + + /* Draw test image in to left half of multisample fbo*/ + glUseProgram(draw_prog_left); + glViewport(0, 0, pattern_width, pattern_height); + glEnable(GL_SAMPLE_SHADING); + glMinSampleShading(1.0); + piglit_draw_rect(-1, -1, 2, 2); + glDisable(GL_SAMPLE_SHADING); + + for(int i = 0; i num_samples; i++) { + /* Draw reference image in to right half of multisample fbo */ + glUseProgram(draw_prog_right); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_fbo.handle); + glGetMultisamplefv(GL_SAMPLE_POSITION, i, pos); + glUniform2fv(sample_pos_loc, 1, pos); + glEnable(GL_SCISSOR_TEST); + glScissor(pattern_width, 0, pattern_width, pattern_height); + glViewport(pattern_width, 0, pattern_width, pattern_height); + glClear(GL_COLOR_BUFFER_BIT); + piglit_draw_rect(-1, -1, 2, 2); + glDisable(GL_SCISSOR_TEST); + + /* Draw sample color from multisample texture in to winsys fbo */ + glUseProgram(test_prog); + glUniform1i(sample_id_loc, i); + glViewport(0, 0, 2 * pattern_width, pattern_height); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo); + glClear(GL_COLOR_BUFFER_BIT); + piglit_draw_rect(-1, -1, 2, 2); + + result = piglit_probe_rect_halves_equal_rgba(0, 0, +piglit_width, + piglit_height); + pass = pass result; + printf(sample_id = %d, result = %s\n, i, + result ? pass : fail); + } + piglit_present_results(); + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +static void +print_usage_and_exit(char *prog_name) +{ +printf(Usage: %s num_samples\n, prog_name); +piglit_report_result(PIGLIT_FAIL); +} + +void +piglit_init(int argc, char**argv) +{ + if (argc != 2) + print_usage_and_exit(argv[0]); + + /* 1st arg: num_samples */ + char *endptr = NULL; + num_samples = strtol(argv[1], endptr, 0); + if (endptr != argv[1] + strlen(argv[1])) + print_usage_and_exit(argv[0]); + + piglit_require_extension(GL_ARB_texture_multisample); + piglit_require_extension(GL_ARB_sample_shading); + piglit_require_GLSL_version(130); + + /* Skip the test if num_samples GL_MAX_SAMPLES */ + GLint max_samples; + glGetIntegerv(GL_MAX_SAMPLES, max_samples); + if (num_samples == 0 || num_samples max_samples) + piglit_report_result(PIGLIT_SKIP); + + FboConfig msConfig(num_samples, piglit_width, piglit_height); +msConfig.attach_texture = true; + multisampled_fbo.setup(msConfig); + + /* Reduced tolerence for stricter color matching */ + piglit_set_tolerance_for_bits(16, 16, 16, 16); + draw_prog_left = piglit_build_simple_program( + #version 130\n + #extension GL_ARB_sample_shading: require\n + in vec4 piglit_vertex;\n + centroid out vec2 test;\n + void main() {\n + gl_Position = piglit_vertex;\n + test = piglit_vertex.xy;\n + }\n, + + #version 130\n + #extension GL_ARB_sample_shading: require\n + centroid in vec2 test;\n + void main() {\n + gl_FragColor = vec4(abs(test), 0, 1);\n + }\n); + + draw_prog_right = piglit_build_simple_program( + #version 130\n + uniform vec2 sample_pos;\n + in vec4 piglit_vertex;\n + out vec2 ref;\n + void main() {\n + gl_Position = piglit_vertex;\n + ref = piglit_vertex.xy;\n + /* Add an offset to account for interplolation +* at sample position. +*/ + ref += (sample_pos - 0.5) / 64;\n It would be nice to have a comment here explaining the origin of the magic number 64 (it comes from the fact that pattern_width == pattern_height == 128, so the scaling factor between normalized device coordinates and pixels is 128/2 == 64). With that changed, the test is: Reviewed-by: Paul Berry stereotype...@gmail.com + }\n, + + #version 130\n + in vec2 ref;\n + void main
Re: [Piglit] [PATCH 04/12] Test compilation rules related to compute shader layout qualifiers.
On 22 January 2014 18:21, Anuj Phogat anuj.pho...@gmail.com wrote: On Thu, Jan 9, 2014 at 10:59 AM, Paul Berry stereotype...@gmail.com wrote: --- .../compiler/default_local_size.comp | 39 ++ .../compiler/mismatched_local_size.comp| 21 .../compiler/negative_local_size.comp | 26 +++ .../compiler/zero_local_size.comp | 26 +++ 4 files changed, 112 insertions(+) create mode 100644 tests/spec/arb_compute_shader/compiler/default_local_size.comp create mode 100644 tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp create mode 100644 tests/spec/arb_compute_shader/compiler/negative_local_size.comp create mode 100644 tests/spec/arb_compute_shader/compiler/zero_local_size.comp diff --git a/tests/spec/arb_compute_shader/compiler/default_local_size.comp b/tests/spec/arb_compute_shader/compiler/default_local_size.comp new file mode 100644 index 000..81fb6e3 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/default_local_size.comp @@ -0,0 +1,39 @@ +// [config] +// expect_result: pass +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// From the ARB_compute_shader spec: +// +// Layout qualifier identifiers for compute shader inputs are the work-group extra white space after work-group Fixed, thanks. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 10/12] shader_runner: Add support for compute shaders.
Currently there is no way for shader_runner to accept output from compute shaders; however this should still be useful for linker tests. --- tests/shaders/shader_runner.c | 44 +-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index d78514b..ce6171d 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -101,6 +101,8 @@ GLuint geometry_shaders[256]; unsigned num_geometry_shaders = 0; GLuint fragment_shaders[256]; unsigned num_fragment_shaders = 0; +GLuint compute_shaders[256]; +unsigned num_compute_shaders = 0; int num_uniform_blocks; GLuint *uniform_block_bos; GLenum geometry_layout_input_type = GL_TRIANGLES; @@ -131,6 +133,8 @@ enum states { fragment_shader, fragment_shader_file, fragment_program, + compute_shader, + compute_shader_file, vertex_data, test, }; @@ -234,6 +238,8 @@ target_to_short_name(GLenum target) return FS; case GL_GEOMETRY_SHADER: return GS; + case GL_COMPUTE_SHADER: + return CS; default: return ???; } @@ -257,6 +263,10 @@ compile_glsl(GLenum target, bool release_text) if (gl_version.num 32) piglit_require_extension(GL_ARB_geometry_shader4); break; + case GL_COMPUTE_SHADER: + if (gl_version.num 43) + piglit_require_extension(GL_ARB_compute_shader); + break; } if (!glsl_req_version.num) { @@ -328,6 +338,10 @@ compile_glsl(GLenum target, bool release_text) fragment_shaders[num_fragment_shaders] = shader; num_fragment_shaders++; break; + case GL_COMPUTE_SHADER: + compute_shaders[num_compute_shaders] = shader; + num_compute_shaders++; + break; } } @@ -720,6 +734,15 @@ leave_state(enum states state, const char *line) line - shader_string); break; + case compute_shader: + shader_string_size = line - shader_string; + compile_glsl(GL_COMPUTE_SHADER, false); + break; + + case compute_shader_file: + compile_glsl(GL_COMPUTE_SHADER, true); + break; + case vertex_data: vertex_data_end = line; break; @@ -742,7 +765,8 @@ link_and_use_shaders(void) if ((num_vertex_shaders == 0) (num_fragment_shaders == 0) -(num_geometry_shaders == 0)) +(num_geometry_shaders == 0) +(num_compute_shaders == 0)) return; prog = glCreateProgram(); @@ -759,6 +783,10 @@ link_and_use_shaders(void) glAttachShader(prog, fragment_shaders[i]); } + for (i = 0; i num_compute_shaders; i++) { + glAttachShader(prog, compute_shaders[i]); + } + #ifdef PIGLIT_USE_OPENGL if (geometry_layout_input_type != GL_TRIANGLES) { glProgramParameteriARB(prog, GL_GEOMETRY_INPUT_TYPE_ARB, @@ -795,6 +823,10 @@ link_and_use_shaders(void) glDeleteShader(fragment_shaders[i]); } + for (i = 0; i num_compute_shaders; i++) { + glDeleteShader(compute_shaders[i]); + } + glGetProgramiv(prog, GL_LINK_STATUS, ok); if (ok) { link_ok = true; @@ -862,7 +894,7 @@ process_test_script(const char *script_name) state = geometry_shader; shader_string = NULL; } else if (string_match([geometry shader file], line)) { - state = vertex_shader_file; + state = geometry_shader_file; shader_string = NULL; } else if (string_match([geometry layout], line)) { state = geometry_layout; @@ -876,6 +908,12 @@ process_test_script(const char *script_name) } else if (string_match([fragment shader file], line)) { state = fragment_shader_file; shader_string = NULL; + } else if (string_match([compute shader], line)) { + state = compute_shader; + shader_string = NULL; + } else if (string_match([compute shader file], line)) { + state = compute_shader_file; + shader_string = NULL; } else if (string_match([vertex data], line)) { state = vertex_data; vertex_data_start = NULL; @@ -904,6
[Piglit] [PATCH 01/12] glapi: Rename ARB_compute_shader LOCAL - WORK_GROUP.
The piglit glapi files, which are derived from files published on www.opengl.org, contained nonstandard names for two enums: COMPUTE_LOCAL_WORK_SIZE and MAX_COMPUTE_LOCAL_INVOCATIONS. The ARB_compute_shader spec, the OpenGL specs, and the OpenGL wiki all agree that these should be called COMPUTE_WORK_GROUP_SIZE and MAX_COMPUTE_WORK_GROUP_INVOCATIONS. So rename them in piglit to be consistent. --- glapi/enum.spec| 4 ++-- glapi/enumext.spec | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/glapi/enum.spec b/glapi/enum.spec index abe64de..c854b91 100644 --- a/glapi/enum.spec +++ b/glapi/enum.spec @@ -3592,7 +3592,7 @@ ARB_compute_shader enum: MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264 MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265 MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266 - COMPUTE_LOCAL_WORK_SIZE = 0x8267 + COMPUTE_WORK_GROUP_SIZE = 0x8267 # Also VERSION_4_3 KHR_debug enum: (additional; see above) @@ -8681,7 +8681,7 @@ ARB_stencil_texturing enum: # Also VERSION_4_3 ARB_compute_shader enum: - MAX_COMPUTE_LOCAL_INVOCATIONS = 0x90EB + MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED DISPATCH_INDIRECT_BUFFER= 0x90EE diff --git a/glapi/enumext.spec b/glapi/enumext.spec index 044ee6a..c08024f 100644 --- a/glapi/enumext.spec +++ b/glapi/enumext.spec @@ -1825,10 +1825,10 @@ passthru: /* Reuse tokens from ARB_compute_shader */ use ARB_compute_shader MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS use ARB_compute_shader MAX_COMPUTE_ATOMIC_COUNTERS use ARB_compute_shader MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS - use ARB_compute_shader MAX_COMPUTE_LOCAL_INVOCATIONS + use ARB_compute_shader MAX_COMPUTE_WORK_GROUP_INVOCATIONS use ARB_compute_shader MAX_COMPUTE_WORK_GROUP_COUNT use ARB_compute_shader MAX_COMPUTE_WORK_GROUP_SIZE - use ARB_compute_shader COMPUTE_LOCAL_WORK_SIZE + use ARB_compute_shader COMPUTE_WORK_GROUP_SIZE use ARB_compute_shader UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER use ARB_compute_shader ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER use ARB_compute_shader DISPATCH_INDIRECT_BUFFER @@ -3773,10 +3773,10 @@ ARB_compute_shader enum: MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264 MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265 MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266 - MAX_COMPUTE_LOCAL_INVOCATIONS = 0x90EB + MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB MAX_COMPUTE_WORK_GROUP_COUNT= 0x91BE MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF - COMPUTE_LOCAL_WORK_SIZE = 0x8267 + COMPUTE_WORK_GROUP_SIZE = 0x8267 UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED DISPATCH_INDIRECT_BUFFER= 0x90EE -- 1.8.5.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 07/12] Test ARB_compute_shader built-in constant gl_MaxComputeWorkGroupCount.
--- .../compiler/gl_MaxComputeWorkGroupCount.comp| 20 1 file changed, 20 insertions(+) create mode 100644 tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp diff --git a/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp new file mode 100644 index 000..f8da3e2 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp @@ -0,0 +1,20 @@ +// [config] +// expect_result: pass +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// Test the minimum values for gl_MaxComputeWorkGroupCount specified +// in ARB_compute_shader. + +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 1) in; + +void main() +{ + int x[gl_MaxComputeWorkGroupCount.x = 65535 ? 1 : -1]; + int y[gl_MaxComputeWorkGroupCount.y = 65535 ? 1 : -1]; + int z[gl_MaxComputeWorkGroupCount.z = 65535 ? 1 : -1]; +} -- 1.8.5.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 06/12] Test ARB_compute_shader built-in constant gl_WorkGroupSize.
--- .../compiler/gl_WorkGroupSize_before_layout.comp | 22 .../compiler/gl_WorkGroupSize_matches_layout.comp | 29 ++ .../compiler/gl_WorkGroupSize_without_layout.comp | 18 ++ 3 files changed, 69 insertions(+) create mode 100644 tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp create mode 100644 tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp create mode 100644 tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp diff --git a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp new file mode 100644 index 000..23324e3 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables): +// +// It is a compile-time error to use gl_WorkGroupSize in a shader +// that does not declare a fixed local group size, or before that +// shader has declared a fixed local group size, using +// local_size_x, local_size_y, and local_size_z. + +#version 330 +#extension GL_ARB_compute_shader: enable + +void main() +{ + ivec3 size = gl_WorkGroupSize; +} + +layout(local_size_x = 3, local_size_y = 5, local_size_z = 7) in; diff --git a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp new file mode 100644 index 000..094bcd9 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp @@ -0,0 +1,29 @@ +// [config] +// expect_result: pass +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables): +// +// The built-in constant gl_WorkGroupSize is a compute-shader +// constant containing the local work-group size of the +// shader. The size of the work group in the X, Y, and Z +// dimensions is stored in the x, y, and z components. The +// constants values in gl_WorkGroupSize will match those specified +// in the required local_size_x, local_size_y, and local_size_z +// layout qualifiers for the current shader. This is a constant so +// that it can be used to size arrays of memory that can be shared +// within the local work group. + +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 3, local_size_y = 5, local_size_z = 7) in; + +void main() +{ + int x[gl_WorkGroupSize.x == 3 ? 1 : -1]; + int y[gl_WorkGroupSize.y == 5 ? 1 : -1]; + int z[gl_WorkGroupSize.z == 7 ? 1 : -1]; +} diff --git a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp new file mode 100644 index 000..cec8c45 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp @@ -0,0 +1,18 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables): +// +// It is a compile-time error to use gl_WorkGroupSize in a shader +// that does not declare a fixed local group size ... + +#version 330 +#extension GL_ARB_compute_shader: enable + +void main() +{ + ivec3 size = gl_WorkGroupSize; +} -- 1.8.5.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 03/12] Add minmax test for ARB_compute_shader.
--- tests/all.tests | 1 + tests/spec/CMakeLists.txt | 1 + tests/spec/arb_compute_shader/CMakeLists.gl.txt | 15 ++ tests/spec/arb_compute_shader/CMakeLists.txt| 1 + tests/spec/arb_compute_shader/minmax.c | 71 + tests/util/minmax-test.c| 24 + tests/util/minmax-test.h| 2 + 7 files changed, 115 insertions(+) create mode 100644 tests/spec/arb_compute_shader/CMakeLists.gl.txt create mode 100644 tests/spec/arb_compute_shader/CMakeLists.txt create mode 100644 tests/spec/arb_compute_shader/minmax.c diff --git a/tests/all.tests b/tests/all.tests index 29d012b..91a9450 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2783,6 +2783,7 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'], arb_compute_shader = Group() spec['ARB_compute_shader'] = arb_compute_shader +arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax') import_glsl_parser_tests(spec['ARB_compute_shader'], os.path.join(testsDir, 'spec', 'arb_compute_shader'), ['compiler']) diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 7f6bf47..d49872a 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory (amd_performance_monitor) add_subdirectory (arb_base_instance) add_subdirectory (arb_color_buffer_float) +add_subdirectory (arb_compute_shader) add_subdirectory (arb_debug_output) add_subdirectory (khr_debug) add_subdirectory (arb_depth_clamp) diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt b/tests/spec/arb_compute_shader/CMakeLists.gl.txt new file mode 100644 index 000..b79cbf9 --- /dev/null +++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt @@ -0,0 +1,15 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} + ${piglit_SOURCE_DIR}/tests/util +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +add_executable (arb_compute_shader-minmax minmax.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_compute_shader/CMakeLists.txt b/tests/spec/arb_compute_shader/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_compute_shader/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_compute_shader/minmax.c b/tests/spec/arb_compute_shader/minmax.c new file mode 100644 index 000..9df6d9b --- /dev/null +++ b/tests/spec/arb_compute_shader/minmax.c @@ -0,0 +1,71 @@ +/* + * Copyright © 2014 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. + */ + +/** \file + * + * Test for the minimum maximum values specified in the + * ARB_compute_shader extension. + */ + +#include piglit-util-gl-common.h +#include minmax-test.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + piglit_require_extension(GL_ARB_compute_shader); + piglit_print_minmax_header(); + + piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, 65535); + piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, 65535); + piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, 65535); + piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, 1024); + piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, 1024); + piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, 64); + piglit_test_min_int(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, 1024); + piglit_test_min_int(GL_MAX_COMPUTE_UNIFORM_BLOCKS, 12); +
[Piglit] [PATCH 05/12] Test that compute shader work group sizes are properly bounds checked.
--- tests/all.tests| 2 + tests/spec/arb_compute_shader/CMakeLists.txt | 1 + .../arb_compute_shader/compiler/CMakeLists.gl.txt | 15 ++ .../arb_compute_shader/compiler/CMakeLists.txt | 1 + .../compiler/work_group_size_too_large.c | 180 + 5 files changed, 199 insertions(+) create mode 100644 tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt create mode 100644 tests/spec/arb_compute_shader/compiler/CMakeLists.txt create mode 100644 tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c diff --git a/tests/all.tests b/tests/all.tests index 91a9450..eb2faf0 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2784,6 +2784,8 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'], arb_compute_shader = Group() spec['ARB_compute_shader'] = arb_compute_shader arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax') +arb_compute_shader['compiler/work_group_size_too_large'] = \ +concurrent_test('arb_compute_shader-work_group_size_too_large') import_glsl_parser_tests(spec['ARB_compute_shader'], os.path.join(testsDir, 'spec', 'arb_compute_shader'), ['compiler']) diff --git a/tests/spec/arb_compute_shader/CMakeLists.txt b/tests/spec/arb_compute_shader/CMakeLists.txt index 144a306..16df30d 100644 --- a/tests/spec/arb_compute_shader/CMakeLists.txt +++ b/tests/spec/arb_compute_shader/CMakeLists.txt @@ -1 +1,2 @@ +add_subdirectory (compiler) piglit_include_target_api() diff --git a/tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt b/tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt new file mode 100644 index 000..f96a656 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt @@ -0,0 +1,15 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} + ${piglit_SOURCE_DIR}/tests/util +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +add_executable (arb_compute_shader-work_group_size_too_large work_group_size_too_large.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_compute_shader/compiler/CMakeLists.txt b/tests/spec/arb_compute_shader/compiler/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c b/tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c new file mode 100644 index 000..44052b6 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c @@ -0,0 +1,180 @@ +/* + * Copyright © 2014 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. + */ + +/** \file + * + * Test that exceeding the implementation's size work group size + * limits results in a compile error. + * + * From the ARB_compute_shader specification: + * + * If the local size of the shader in any dimension is greater + * than the maximum size supported by the implementation for that + * dimension, a compile-time error results. + * + * It is not clear from the spec how the error should be reported if + * the total size of the work group exceeds + * MAX_COMPUTE_WORK_GROUP_INVOCATIONS, but it seems reasonable to + * assume that this is reported at compile time as well. + */ + +#include piglit-util-gl-common.h +#include math.h +#include limits.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 33; + config.supports_gl_core_version = 33; + +PIGLIT_GL_TEST_CONFIG_END + + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + + +static const char *cs_template = + #version 330\n + #extension
[Piglit] [PATCH 09/12] Test that compute shaders may not have user-defined ins/outs.
--- .../compiler/no_user_defined_in.comp | 21 + .../compiler/no_user_defined_out.comp | 22 ++ 2 files changed, 43 insertions(+) create mode 100644 tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp create mode 100644 tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp diff --git a/tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp b/tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp new file mode 100644 index 000..1d1d160 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp @@ -0,0 +1,21 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// From the ARB_compute_shader spec: +// +// Compute shaders do not permit user-defined input variables and +// do not form a formal interface with any other shader stage. + +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 1) in; + +in int i; + +void main() +{ +} diff --git a/tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp b/tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp new file mode 100644 index 000..5b01be0 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// From the ARB_compute_shader spec: +// +// Compute shaders have no built-in output variables, do not +// support user-defined output variables and do not form a formal +// interface with any other shader stage. + +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 1) in; + +out int i; + +void main() +{ +} -- 1.8.5.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 11/12] Linker tests for compute shaders: local work sizes.
These tests verify the linker rules for local work sizes (they must be specified in at least one shader, and they must not conflict). --- tests/all.tests| 3 ++ .../linker/matched_local_work_sizes.shader_test| 42 + .../linker/mismatched_local_work_sizes.shader_test | 43 ++ .../linker/mix_compute_and_non_compute.shader_test | 32 .../linker/no_local_work_size.shader_test | 28 ++ .../linker/one_local_work_size.shader_test | 41 + 6 files changed, 189 insertions(+) create mode 100644 tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test create mode 100644 tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test create mode 100644 tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test create mode 100644 tests/spec/arb_compute_shader/linker/no_local_work_size.shader_test create mode 100644 tests/spec/arb_compute_shader/linker/one_local_work_size.shader_test diff --git a/tests/all.tests b/tests/all.tests index eb2faf0..5bb0ed5 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2786,6 +2786,9 @@ spec['ARB_compute_shader'] = arb_compute_shader arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax') arb_compute_shader['compiler/work_group_size_too_large'] = \ concurrent_test('arb_compute_shader-work_group_size_too_large') +add_shader_test_dir(spec['ARB_compute_shader'], +os.path.join(testsDir, 'spec', 'arb_compute_shader'), +recursive=True) import_glsl_parser_tests(spec['ARB_compute_shader'], os.path.join(testsDir, 'spec', 'arb_compute_shader'), ['compiler']) diff --git a/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test b/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test new file mode 100644 index 000..67e850c --- /dev/null +++ b/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test @@ -0,0 +1,42 @@ +# From the ARB_compute_shader spec, in the section describing local +# size declarations: +# +# If multiple compute shaders attached to a single program object +# declare local work-group size, the declarations must be +# identical; otherwise a link-time error results. Furthermore, if +# a program object contains any compute shaders, at least one must +# contain an input layout qualifier specifying the local work +# sizes of the program, or a link-time error will occur. +# +# In this test, we link two shaders that have the same local work size. + +[require] +GL = 3.3 +GLSL = 3.30 +GL_ARB_compute_shader + +[compute shader] +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 2) in; + +void foo(); + +void main() +{ + foo(); +} + +[compute shader] +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 2) in; + +void foo() +{ +} + +[test] +link success diff --git a/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test b/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test new file mode 100644 index 000..e4872e1 --- /dev/null +++ b/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test @@ -0,0 +1,43 @@ +# From the ARB_compute_shader spec, in the section describing local +# size declarations: +# +# If multiple compute shaders attached to a single program object +# declare local work-group size, the declarations must be +# identical; otherwise a link-time error results. Furthermore, if +# a program object contains any compute shaders, at least one must +# contain an input layout qualifier specifying the local work +# sizes of the program, or a link-time error will occur. +# +# In this test, we try to link two shaders that have different local +# work sizes. + +[require] +GL = 3.3 +GLSL = 3.30 +GL_ARB_compute_shader + +[compute shader] +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 2) in; + +void foo(); + +void main() +{ + foo(); +} + +[compute shader] +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_y = 2) in; + +void foo() +{ +} + +[test] +link error diff --git a/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test b/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test new file mode 100644 index 000..603cbe7 --- /dev/null +++ b/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test @@ -0,0 +1,32 @@ +# From the ARB_compute_shader spec: +# +# In section 2.11.3, Program Objects, add to the reasons that LinkProgram +# may fail, p. 61: +# +# * The program object contains objects to form a compute shader (see +# section 5.5) and objects to form any other type of
[Piglit] [PATCH 08/12] Test ARB_compute_shader built-in constant gl_MaxComputeWorkGroupSize.
--- .../compiler/gl_MaxComputeWorkGroupSize.comp | 20 1 file changed, 20 insertions(+) create mode 100644 tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp diff --git a/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp new file mode 100644 index 000..8291dd8 --- /dev/null +++ b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp @@ -0,0 +1,20 @@ +// [config] +// expect_result: pass +// glsl_version: 3.30 +// require_extensions: GL_ARB_compute_shader +// [end config] +// +// Test the minimum values for gl_MaxComputeWorkGroupSize specified in +// ARB_compute_shader. + +#version 330 +#extension GL_ARB_compute_shader: enable + +layout(local_size_x = 1) in; + +void main() +{ + int x[gl_MaxComputeWorkGroupSize.x = 1024 ? 1 : -1]; + int y[gl_MaxComputeWorkGroupSize.y = 1024 ? 1 : -1]; + int z[gl_MaxComputeWorkGroupSize.z = 64 ? 1 : -1]; +} -- 1.8.5.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 12/12] Test API errors for compute shaders related to COMPUTE_WORK_GROUP_SIZE query.
This test can be expanded in the future to check for other compute shader API errors. --- tests/all.tests | 1 + tests/spec/arb_compute_shader/CMakeLists.gl.txt | 1 + tests/spec/arb_compute_shader/api_errors.c | 211 3 files changed, 213 insertions(+) create mode 100644 tests/spec/arb_compute_shader/api_errors.c diff --git a/tests/all.tests b/tests/all.tests index 5bb0ed5..8999643 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2783,6 +2783,7 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'], arb_compute_shader = Group() spec['ARB_compute_shader'] = arb_compute_shader +arb_compute_shader['api_errors'] = concurrent_test('arb_compute_shader-api_errors') arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax') arb_compute_shader['compiler/work_group_size_too_large'] = \ concurrent_test('arb_compute_shader-work_group_size_too_large') diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt b/tests/spec/arb_compute_shader/CMakeLists.gl.txt index b79cbf9..9202761 100644 --- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt +++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt @@ -10,6 +10,7 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) +add_executable (arb_compute_shader-api_errors api_errors.c) add_executable (arb_compute_shader-minmax minmax.c) # vim: ft=cmake: diff --git a/tests/spec/arb_compute_shader/api_errors.c b/tests/spec/arb_compute_shader/api_errors.c new file mode 100644 index 000..e069750 --- /dev/null +++ b/tests/spec/arb_compute_shader/api_errors.c @@ -0,0 +1,211 @@ +/* + * Copyright © 2014 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. + */ + +/** \file + * + * Test cases in which the ARB_compute_shader API is expected to + * generate an error. + */ + +#include piglit-util-gl-common.h +#include piglit-shader.h + + +static struct piglit_gl_test_config *piglit_config; + + +PIGLIT_GL_TEST_CONFIG_BEGIN + piglit_config = config; + config.supports_gl_compat_version = 33; + config.supports_gl_core_version = 33; +PIGLIT_GL_TEST_CONFIG_END + + +static const char *trivial_correct_shader = + #version 330\n + #extension GL_ARB_compute_shader: enable\n + \n + layout(local_size_x = 1) in;\n + \n + void main()\n + {\n + }\n; + + +static const char *trivial_link_fail_shader = + #version 330\n + #extension GL_ARB_compute_shader: enable\n + \n + void main()\n + {\n + }\n; + + +static const char *trivial_vertex_shader = + #version 330\n + \n + void main()\n + {\n + gl_Position = vec4(0.0);\n + }\n; + + +static enum piglit_result +query_work_group_size_expect_error(GLint prog) +{ + const GLint orig_query_result[3] = { 1234, 2345, 3456 }; + GLint query_result[3]; + int i; + + for (i = 0; i 3; i++) + query_result[i] = orig_query_result[i]; + + glGetProgramiv(prog, GL_COMPUTE_WORK_GROUP_SIZE, query_result); + + if (!piglit_check_gl_error(GL_INVALID_OPERATION)) + return PIGLIT_FAIL; + for (i = 0; i 3; i++) { + if (query_result[i] != orig_query_result[i]) { + printf(Error was generated, but query returned a + result anyway.); + return PIGLIT_FAIL; + } + } + return PIGLIT_PASS; +} + + +static enum piglit_result +query_work_group_size_unlinked(void *data) +{ + /* From the ARB_compute_shader spec, in the description of the +* COMPUTE_WORK_GROUP_SIZE query: +* +* If program is the name of a program that has not been +* successfully linked, or is the name of a linked program +* object that contains no compute shaders, then an +*
[Piglit] [PATCH 00/12] Initial batch of compute shader tests.
These tests exercise some very basic pieces of compute shader functionality, such as minimum maximums, compute shader layout qualifiers, a few built-in GLSL constants, and the fact that in/out variables are not allowed in compute shaders. None of the tests actually runs a compute shader; I plan to do that in future patch series. [PATCH 01/12] glapi: Rename ARB_compute_shader LOCAL - WORK_GROUP. [PATCH 02/12] util: Add ARB_compute_shader support to piglit_get_gl_enum_name(). [PATCH 03/12] Add minmax test for ARB_compute_shader. [PATCH 04/12] Test compilation rules related to compute shader layout qualifiers. [PATCH 05/12] Test that compute shader work group sizes are properly bounds checked. [PATCH 06/12] Test ARB_compute_shader built-in constant gl_WorkGroupSize. [PATCH 07/12] Test ARB_compute_shader built-in constant gl_MaxComputeWorkGroupCount. [PATCH 08/12] Test ARB_compute_shader built-in constant gl_MaxComputeWorkGroupSize. [PATCH 09/12] Test that compute shaders may not have user-defined ins/outs. [PATCH 10/12] shader_runner: Add support for compute shaders. [PATCH 11/12] Linker tests for compute shaders: local work sizes. [PATCH 12/12] Test API errors for compute shaders related to COMPUTE_WORK_GROUP_SIZE query. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test full framebuffer clear color with mismatched layer count.
GL 3.2 allows different framebuffer attachments to have different layer counts. Rendering to layers that do not exist in all attachments is undefined; however, clearing the framebuffer should still clear all layers of all attachments. --- tests/all.tests| 1 + .../gl-3.2/layered-rendering/CMakeLists.gl.txt | 1 + .../clear-color-mismatched-layer-count.c | 187 + 3 files changed, 189 insertions(+) create mode 100644 tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c diff --git a/tests/all.tests b/tests/all.tests index edf066b..2dcfb77 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -748,6 +748,7 @@ for texture_type in ['3d', '2d_array', '2d_multisample_array', '1d_array', texture_type, test_type) spec['!OpenGL 3.2/layered-rendering/' + cmdline] = \ concurrent_test('gl-3.2-layered-rendering-' + cmdline) +spec['!OpenGL 3.2/layered-rendering/clear-color-mismatched-layer-count'] = concurrent_test('gl-3.2-layered-rendering-clear-color-mismatched-layer-count') spec['!OpenGL 3.2/layered-rendering/clear-depth'] = concurrent_test('gl-3.2-layered-rendering-clear-depth') spec['!OpenGL 3.2/layered-rendering/framebuffertexture'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture') spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures') diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt index a24ed8f..5d88b81 100644 --- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt @@ -12,6 +12,7 @@ link_libraries ( piglit_add_executable (gl-3.2-layered-rendering-blit blit.c) piglit_add_executable (gl-3.2-layered-rendering-clear-color clear-color.c) piglit_add_executable (gl-3.2-layered-rendering-clear-color-all-types clear-color-all-types.c) +piglit_add_executable (gl-3.2-layered-rendering-clear-color-mismatched-layer-count clear-color-mismatched-layer-count.c) piglit_add_executable (gl-3.2-layered-rendering-clear-depth clear-depth.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layered-attachments framebuffer-layered-attachments.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layer-attachment-mismatch framebuffer-layer-attachment-mismatch.c) diff --git a/tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c b/tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c new file mode 100644 index 000..e27ecc7 --- /dev/null +++ b/tests/spec/gl-3.2/layered-rendering/clear-color-mismatched-layer-count.c @@ -0,0 +1,187 @@ +/* + * Copyright © 2013 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. + */ + +/** \file + * + * Test that a layered color clear clears all layers of all + * framebuffer attachments, even if not all framebuffer attachments + * have the same layer count. + * + * The test operates as follows: + * + * - Two textures are created, each with a different layer count. + * + * - Every layer of both textures is individually cleared to red. + * + * - Every layer of both textures is checked to verify that it has + * been properly cleared to red. + * + * - Both textures are bound to a single framebuffer in layered + * fashion, and then the entire framebuffer is cleared to green all + * at once. + * + * - Every layer of both textures is checked to verify that it has + * been cleared to green. + */ + +#include piglit-util-gl-common.h +#include piglit-util.h + +#define TEX_SIZE 128 + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; + config.supports_gl_core_version = 32; + config.window_visual = PIGLIT_GL_VISUAL_RGBA |
[Piglit] [PATCH] Test that a layered fbo can have attachments with different layer counts.
--- tests/all.tests| 1 + .../gl-3.2/layered-rendering/CMakeLists.gl.txt | 1 + .../framebuffer-layer-count-mismatch.c | 107 + 3 files changed, 109 insertions(+) create mode 100644 tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c diff --git a/tests/all.tests b/tests/all.tests index edf066b..70ab814 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -755,6 +755,7 @@ spec['!OpenGL 3.2/layered-rendering/framebuffertexture-defaults'] = concurrent_t spec['!OpenGL 3.2/layered-rendering/readpixels'] = concurrent_test('gl-3.2-layered-rendering-readpixels') spec['!OpenGL 3.2/layered-rendering/framebuffer-layer-attachment-mismatch'] = concurrent_test('gl-3.2-layered-rendering-framebuffer-layer-attachment-mismatch') spec['!OpenGL 3.2/layered-rendering/framebuffer-layer-complete'] = concurrent_test('gl-3.2-layered-rendering-framebuffer-layer-complete') +spec['!OpenGL 3.2/layered-rendering/framebuffer-layer-count-mismatch'] = concurrent_test('gl-3.2-layered-rendering-framebuffer-layer-count-mismatch') spec['!OpenGL 3.2/layered-rendering/framebuffer-layered-attachments'] = concurrent_test('gl-3.2-layered-rendering-framebuffer-layered-attachments') spec['!OpenGL 3.2/layered-rendering/gl-layer'] = concurrent_test('gl-3.2-layered-rendering-gl-layer') spec['!OpenGL 3.2/layered-rendering/gl-layer-cube-map'] = concurrent_test('gl-3.2-layered-rendering-gl-layer-cube-map') diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt index a24ed8f..496b5a1 100644 --- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt @@ -16,6 +16,7 @@ piglit_add_executable (gl-3.2-layered-rendering-clear-depth clear-depth.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layered-attachments framebuffer-layered-attachments.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layer-attachment-mismatch framebuffer-layer-attachment-mismatch.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layer-complete framebuffer-layer-complete.c) +piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layer-count-mismatch framebuffer-layer-count-mismatch.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffertexture framebuffertexture.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffertexture-buffer-textures framebuffertexture-buffer-textures.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffertexture-defaults framebuffertexture-defaults.c) diff --git a/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c b/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c new file mode 100644 index 000..05cb8ec --- /dev/null +++ b/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-count-mismatch.c @@ -0,0 +1,107 @@ +/* + * Copyright © 2013 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. + */ + +/** \file + * + * ARB_geometry_shader4 doesn't permit layered framebuffers to have + * mismatched layer counts. From ARB_geometry_shader4, under the + * heading add to the list of conditions necessary for completeness: + * + * * If any framebuffer attachment is layered, all attachments + * must have the same layer count. For three-dimensional + * textures, the layer count is the depth of the attached + * volume. For cube map textures, the layer count is always + * six. For one- and two-dimensional array textures, the layer + * count is simply the number of layers in the array texture. + * { FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB } + * + * However, this restriction was lifted when geometry shaders were + * adopted into OpenGL 3.2. Instead, OpenGL 3.2 states, in section + * 4.4.7 (Layered
Re: [Piglit] [PATCH V3 4/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleMask[]
, + pattern_height)); + + FboConfig msConfig(num_samples, pattern_width, pattern_height); + multisampled_fbo.setup(msConfig); +msConfig.attach_texture = true; + multisampled_tex.setup(msConfig); + + compile_shader(); + if (!piglit_check_gl_error(GL_NO_ERROR)) { + piglit_report_result(PIGLIT_FAIL); + } +} + +enum piglit_result +piglit_display() +{ + bool pass = true; + GLint samples; +GLfloat expected[4] = {0.0, 1.0, 0.0, 1.0}; + + glUseProgram(prog_0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_fbo.handle); + glGetIntegerv(GL_SAMPLES, samples); + glClear(GL_COLOR_BUFFER_BIT); + glUniform1i(glGetUniformLocation(prog_0, samples), samples); +piglit_draw_rect(0, 0, pattern_width, pattern_height); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_fbo.handle); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_tex.handle); + glClear(GL_COLOR_BUFFER_BIT); + glBlitFramebuffer(0, 0, + pattern_width, pattern_height, + 0, 0, + pattern_width, pattern_height, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); As with the previous patch, it seems unnecessary to render into a multisampled FBO and then blit into a multisampled texture. You should be able to render into a multisampled texture directly. + + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo); + glClear(GL_COLOR_BUFFER_BIT); + glUseProgram(prog_1); + glUniform1i(glGetUniformLocation(prog_1, tex), 0); + glUniform1i(glGetUniformLocation(prog_1, samples), samples); + piglit_draw_rect_tex(0, 0, pattern_width, pattern_height, +0, 0, pattern_width, pattern_height); As with the previous patch, it's not necessary to use piglit_draw_rect_tex, since your shader doesn't need a texture coordinate. Just use piglit_draw_rect(). + + glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo); + pass = piglit_probe_rect_rgba(0, 0, pattern_width, + pattern_width, expected) +pass; + piglit_present_results(); + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} -- 1.8.1.4 Sorry for the delay in reviewing these, Anuj. Once the above issues are fixed, you can consider this patch: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V3 4/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleMask[]
On 9 December 2013 18:42, Anuj Phogat anuj.pho...@gmail.com wrote: On Mon, Dec 9, 2013 at 10:02 AM, Paul Berry stereotype...@gmail.comwrote: On 6 November 2013 17:24, Anuj Phogat anuj.pho...@gmail.com wrote: + static const char *frag_template = + #version 130\n + %s\n + uniform %s tex;\n + uniform int samples;\n + out vec4 out_color;\n + void main()\n + {\n + int i = 0;\n + bool pass = true;\n + int mask = (int(gl_FragCoord.x) * 0x10204081) ^\n +(int(gl_FragCoord.y) * 0x01010101);\n + vec4 green = vec4(0.0, 1.0, 0.0, 1.0);\n + vec4 black = vec4(0.0, 0.0, 0.0, 0.0);\n + do {\n Any particular reason not to use a for loop here? (i.e. for (int i = 0; i samples; i++)) I used do-while to include testing of 'samples == 0' case. Oh, ok. Would you mind putting a comment just above the loop to explain that? With the comment added I'm ok with the loop as is. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V3 3/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleID
(GL_MAX_SAMPLES, max_samples); + if (num_samples max_samples) + piglit_report_result(PIGLIT_SKIP); + + piglit_ortho_projection(pattern_width, pattern_height, false); + FboConfig msConfig(num_samples, pattern_width, pattern_height); + multisampled_fbo.setup(msConfig); +msConfig.attach_texture = true; + multisampled_tex.setup(msConfig); + + compile_shader(); + if (!piglit_check_gl_error(GL_NO_ERROR)) { + piglit_report_result(PIGLIT_FAIL); + } +} + +enum piglit_result +piglit_display() +{ + bool pass = true; + int samples; +float expected[4] = {0.0, 1.0, 0.0, 1.0}; + + glUseProgram(prog_0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_fbo.handle); + glGetIntegerv(GL_SAMPLES, samples); + glClear(GL_COLOR_BUFFER_BIT); + glUniform1i(glGetUniformLocation(prog_0, samples), samples); +piglit_draw_rect(0, 0, pattern_width, pattern_height); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_fbo.handle); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_tex.handle); + glClear(GL_COLOR_BUFFER_BIT); + glBlitFramebuffer(0, 0, + pattern_width, pattern_height, + 0, 0, + pattern_width, pattern_height, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); It looks like you're drawing into an FBO that's backed by a multisampled renderbuffer, then blitting that to an FBO that's backed by a multisampled texture, then checking the result. Why not just drop the first FBO and draw directly into the second? + + glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_tex.handle); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo); + glClear(GL_COLOR_BUFFER_BIT); + if (samples == 0) { + glBlitFramebuffer(0, 0, + pattern_width, pattern_height, + 0, 0, + pattern_width, pattern_height, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); + } else { + glUseProgram(prog_1); + glUniform1i(glGetUniformLocation(prog_1, ms_tex), 0); + glUniform1i(glGetUniformLocation(prog_1, samples), samples); + piglit_draw_rect_tex(0, 0, pattern_width, pattern_height, +0, 0, pattern_width, pattern_height); Since your vertex shader doesn't use piglit_texcoord, you should just call piglit_draw_rect() here. + } + glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo); + pass = piglit_probe_rect_rgba(0, 0, pattern_width, + pattern_width, expected) +pass; + piglit_present_results(); + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} -- 1.8.1.4 With those changes, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test a geometry shader that does an item-by-item copy of gl_ClipDistance.
This is similar to the existing test clip-distance-bulk-copy, except that it copies the elements of gl_ClipDistance one at a time instead of as a bulk assignment. This test is known to crash with Mesa as of commit ec79c05. --- .../clip-distance-itemized-copy.shader_test| 98 ++ 1 file changed, 98 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/clip-distance-itemized-copy.shader_test diff --git a/tests/spec/glsl-1.50/execution/geometry/clip-distance-itemized-copy.shader_test b/tests/spec/glsl-1.50/execution/geometry/clip-distance-itemized-copy.shader_test new file mode 100644 index 000..3494110 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/clip-distance-itemized-copy.shader_test @@ -0,0 +1,98 @@ +# This test checks that the geometry shader can perform an +# item-by-item copy of the entire gl_ClipDistance array from input to +# output. + +[require] +GL = 2.0 +GLSL = 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; +in float offset; +out float offset_to_gs; +out gl_PerVertex { + vec4 gl_Position; + float gl_ClipDistance[8]; +}; + +void main() +{ + gl_Position = vertex; + offset_to_gs = offset; + for (int i = 0; i 8; i++) { +gl_ClipDistance[i] = offset + float(i); + } +} + +[geometry shader] +#version 150 + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in float offset_to_gs[3]; +in gl_PerVertex { + vec4 gl_Position; + float gl_ClipDistance[8]; +} gl_in[]; +out float offset_to_fs; +out gl_PerVertex { + vec4 gl_Position; + float gl_ClipDistance[8]; +}; + +void main() +{ + bool ok = true; + for (int i = 0; i 3; i++) { +gl_Position = gl_in[i].gl_Position; +for (int j = 0; j 8; j++) + gl_ClipDistance[j] = gl_in[i].gl_ClipDistance[j]; +offset_to_fs = offset_to_gs[i]; +EmitVertex(); + } +} + +[fragment shader] +#version 150 + +in float gl_ClipDistance[8]; +in float offset_to_fs; + +void main() +{ + bool ok = true; + for (int i = 0; i 8; i++) { +if (distance(gl_ClipDistance[i], offset_to_fs + float(i)) 1e-6) + ok = false; + } + if (ok) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[vertex data] +vertex/float/2 offset/float/1 +-1.0 -1.0 1.0 + 1.0 -1.0 2.0 + 1.0 1.0 3.0 +-1.0 1.0 4.0 + +[test] +# Since the fragment shader's gl_ClipDistance array is only defined +# for elements that have clipping enabled, we need to enable all 8 +# clip planes. Fortunately the values we use for gl_ClipDistance are +# always positive, so no pixels are actually clipped. +enable GL_CLIP_PLANE0 +enable GL_CLIP_PLANE1 +enable GL_CLIP_PLANE2 +enable GL_CLIP_PLANE3 +enable GL_CLIP_PLANE4 +enable GL_CLIP_PLANE5 +enable GL_CLIP_PLANE6 +enable GL_CLIP_PLANE7 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test layered color clears with all layered texture types.
This test is similar to the existing clear-color test, except that it tests all possible layered attachment types, and it's capable of testing both mipmapped and non-mipmapped textures. Verified using the Nvidia proprietary driver for Linux, version 313.18. --- tests/all.tests| 9 + .../gl-3.2/layered-rendering/CMakeLists.gl.txt | 1 + .../layered-rendering/clear-color-all-types.c | 403 + 3 files changed, 413 insertions(+) create mode 100644 tests/spec/gl-3.2/layered-rendering/clear-color-all-types.c diff --git a/tests/all.tests b/tests/all.tests index e9a579c..132c2f4 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -754,6 +754,15 @@ spec['!OpenGL 3.2/get-integer-64iv'] = concurrent_test('gl-3.2-get-integer-64iv' spec['!OpenGL 3.2/get-integer-64v'] = concurrent_test('gl-3.2-get-integer-64v') spec['!OpenGL 3.2/layered-rendering/blit'] = concurrent_test('gl-3.2-layered-rendering-blit') spec['!OpenGL 3.2/layered-rendering/clear-color'] = concurrent_test('gl-3.2-layered-rendering-clear-color') +for texture_type in ['3d', '2d_array', '2d_multisample_array', '1d_array', + 'cube_map', 'cube_map_array']: +for test_type in ['single_level', 'mipmapped']: +if texture_type == '2d_multisample_array' and test_type == 'mipmapped': +continue +cmdline = 'clear-color-all-types {0} {1}'.format( +texture_type, test_type) +spec['!OpenGL 3.2/layered-rendering/' + cmdline] = \ +concurrent_test('gl-3.2-layered-rendering-' + cmdline) spec['!OpenGL 3.2/layered-rendering/clear-depth'] = concurrent_test('gl-3.2-layered-rendering-clear-depth') spec['!OpenGL 3.2/layered-rendering/framebuffertexture'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture') spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures') diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt index 9ce5552..c769b15 100644 --- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt +++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt @@ -11,6 +11,7 @@ link_libraries ( piglit_add_executable (gl-3.2-layered-rendering-blit blit.c) piglit_add_executable (gl-3.2-layered-rendering-clear-color clear-color.c) +piglit_add_executable (gl-3.2-layered-rendering-clear-color-all-types clear-color-all-types.c) piglit_add_executable (gl-3.2-layered-rendering-clear-depth clear-depth.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layered-attachments framebuffer-layered-attachments.c) piglit_add_executable (gl-3.2-layered-rendering-framebuffer-layer-complete framebuffer-layer-complete.c) diff --git a/tests/spec/gl-3.2/layered-rendering/clear-color-all-types.c b/tests/spec/gl-3.2/layered-rendering/clear-color-all-types.c new file mode 100644 index 000..facb1d5 --- /dev/null +++ b/tests/spec/gl-3.2/layered-rendering/clear-color-all-types.c @@ -0,0 +1,403 @@ +/* + * Copyright © 2013 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. + */ + +/** \file + * + * Test that layered color clear works properly with all of the + * following texture types: + * + * - GL_TEXTURE_3D + * - GL_TEXTURE_2D_ARRAY + * - GL_TEXTURE_2D_MULTISAMPLE_ARRAY + * - GL_TEXTURE_1D_ARRAY + * - GL_TEXTURE_CUBE_MAP + * - GL_TEXTURE_CUBE_MAP_ARRAY (requires GL_ARB_texture_cube_map_array) + * + * The test can be run in two modes: + * + * - single_level, which tests layered clears on a texture with just a + * single miplevel. + * + * - mipmapped, which tests layered clears on a mipmapped texture. + * + * The test operates as follows: + * + * - A texture is created with the requested type and the appropriate + * number of miplevels for the test. + * + * - Every
[Piglit] [PATCH] Check that uniform block link errors are detected when skipping stages.
In Mesa, as of commit f38ac41, uniform blocks are only validated between adjacent shader stages. That means that if a program contains vertex, geometry, and fragment shader stages, and the vertex and fragment shader stages refer to a uniform block that isn't referred to by the geometry stage, then some linker checks may not be performed. Most possible link errors get detected at a later stage of linking, but I found one case that wasn't; this test exercises that case. Test is known to fail with Mesa f38ac41. --- ...e-uniform-block-array-size-mismatch.shader_test | 48 ++ 1 file changed, 48 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test diff --git a/tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test new file mode 100644 index 000..dd83093 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test @@ -0,0 +1,48 @@ +// From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +// +// Furthermore, if a matching block is declared as an array, then +// the array sizes must also match (or follow array matching rules +// for the interface between a vertex and a geometry shader). +// +// In this test, we deliberately create a uniform block array in both +// the vertex and fragment shaders, using different array sizes. The +// geometry shader does not access the uniform block array. Then we +// check that the implementation correctly reported an error. + +[require] +GLSL = 1.50 + +[vertex shader] +uniform Foo { + vec4 x; +} foo[3]; + +void main() +{ + gl_Position = vec4(foo[0].x); +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +void main() +{ + for (int i = 0; i 3; i++) { +gl_Position = gl_in[i].gl_Position; +EmitVertex(); + } +} + +[fragment shader] +uniform Foo { + vec4 x; +} bar[2]; + +void main() +{ + gl_FragColor = bar[0].x; +} + +[test] +link error -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Add a Contributing Patches section to the HACKING file.
--- I received an email this morning asking for information about how to contribute to Piglit, and I couldn't find adequate documentation in the source tree, so I figured I'd add some more information to the HACKING file. HACKING | 30 ++ 1 file changed, 30 insertions(+) diff --git a/HACKING b/HACKING index d96b994..9eff4ef 100644 --- a/HACKING +++ b/HACKING @@ -146,3 +146,33 @@ RELEASE and create an appropriate tag in the git repository. This tag is the official way of marking a release, so the tarballs provided automatically by the cgit frontend are official release tarballs. + +\ Contributing Patches + - + +If you want to contribute patches, please subscribe to the piglit +mailing list (http://lists.freedesktop.org/mailman/listinfo/piglit) +and then send them to piglit@lists.freedesktop.org using git +send-email. One of the core piglit developers should respond with +comments and suggested improvements. The piglit mailing list is also +a good place for general discussion about piglit development, such as +future plans for the project, and coordinating work between +developers. + +For developers who are new to piglit: when submitting a patch, it is +helpful to add a note (after the --- line in the patch file) +indicating that you are new to the project and don't have commit +access; that way once your patch has been revised to meet our +standards of correctness and coding style, we will know that we should +commit it for you. If we forget, please remind us! Once you have +successfully contributed a handful of patches, feel free to apply for +commit access usind the process described here: +http://www.freedesktop.org/wiki/AccountRequests/ + +Please be patient--most of us develop graphics drivers (such as Mesa) +as our primary job, so we have limited time to respond to your patches +on the piglit mailing list. If your patch hasn't received a reply in +a week, send a follow-up email to make sure we haven't missed it. If +you have questions that are better discussed in real time, many piglit +developers can also be found in the #dri-devel channel on Freenode +IRC. -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Add a comment to HACKING describing the use of *-by in commit messages.
Suggested-by: Frank Henigman fjhenig...@google.com --- HACKING | 6 ++ 1 file changed, 6 insertions(+) diff --git a/HACKING b/HACKING index 9eff4ef..738ae18 100644 --- a/HACKING +++ b/HACKING @@ -159,6 +159,12 @@ a good place for general discussion about piglit development, such as future plans for the project, and coordinating work between developers. +Note that Piglit patches use the terms Reviewed-by, Tested-by, and +Acked-by in the same way as they are used for Linux kernel patches +(see https://www.kernel.org/doc/Documentation/SubmittingPatches). You +are also welcome to add a Signed-off-by line to your patch, but it +is not required. + For developers who are new to piglit: when submitting a patch, it is helpful to add a note (after the --- line in the patch file) indicating that you are new to the project and don't have commit -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] Require Signed-off-by for patches?
On 13 November 2013 12:06, Jordan Justen jljus...@gmail.com wrote: On Wed, Nov 13, 2013 at 11:26 AM, Paul Berry stereotype...@gmail.com wrote: On 13 November 2013 11:01, Frank Henigman fjhenig...@google.com wrote: I'd like to see an explanation of signed-off-by, reviewed-by etc. Maybe as simple as: Use the tags signed-off-by, reviewed-by, tested-by, acked-by as for linux kernel patches (see https://www.kernel.org/doc/Documentation/SubmittingPatches). That seems reasonable. Note, however, that Piglit doesn't consistently use signed-off-by: $ git log master | grep '^commit' | wc 48859770 234480 $ git log master | grep -i 'signed-off-by' | wc 12414969 70925 (If you'd like to encourage us to start using signed-off-by consistently, I'm happy to have a policy discussion about that, but the discussion should happen in its own email thread rather than here, so that more people will see it). What are the arguments against just following the kernel's Signed-off-by practice? It can't be difficultly since 'git commit -s' makes this trivial. :) -Jordan I don't have a particularly strong opinion either way. I just wanted to make sure that if we decide to require it, the decision happens in the open rather than in the reply to a patch, where it might get missed by a lot of people. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/2] query_renderer: Add some common infrastructure for GLX_MESA_query_renderer tests
On 25 October 2013 11:13, Ian Romanick i...@freedesktop.org wrote: From: Ian Romanick ian.d.roman...@intel.com All of the tests for this extension will require a bunch of function pointers, etc. This patch adds a function to get these function pointers and some macros to wrap calls using them. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- .../query-renderer-common.c| 70 + .../query-renderer-common.h| 72 ++ 2 files changed, 142 insertions(+) create mode 100644 tests/spec/glx_mesa_query_renderer/query-renderer-common.c create mode 100644 tests/spec/glx_mesa_query_renderer/query-renderer-common.h diff --git a/tests/spec/glx_mesa_query_renderer/query-renderer-common.c b/tests/spec/glx_mesa_query_renderer/query-renderer-common.c new file mode 100644 index 000..429f360 --- /dev/null +++ b/tests/spec/glx_mesa_query_renderer/query-renderer-common.c @@ -0,0 +1,70 @@ +/* Copyright © 2013 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. + */ +#include piglit-util-gl-common.h +#include piglit-glx-util.h +#include query-renderer-common.h + +PFNGLXQUERYRENDERERSTRINGMESAPROC __piglit_glXQueryRendererStringMESA = NULL; +PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC __piglit_glXQueryCurrentRendererStringMESA = NULL; +PFNGLXQUERYRENDERERINTEGERMESAPROC __piglit_glXQueryRendererIntegerMESA = NULL; +PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC __piglit_glXQueryCurrentRendererIntegerMESA = NULL; +PFNGLXCREATECONTEXTATTRIBSARBPROC __piglit_glXCreateContextAttribsARB = NULL; Identifiers beginning with __ are reserved by ISO C. Change these to piglit_glX... and the patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Fix improperly-named geometry shader tests.
Several geometry shader tests were improperly added to all.tests with names like spec/glsl-1.50/glsl-1.50-geometry-foo instead of spec/glsl-1.50/execution/geometry/foo. This patch renames the tests to follow our usual piglit conventions. --- tests/all.tests | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/all.tests b/tests/all.tests index af5dcf3..9df7b11 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -994,20 +994,22 @@ spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants te # maximum number of geometry shader output vertices supported by the # hardware. for i in [31, 32, 33, 34, 127, 128, 129, 130, 0]: -add_concurrent_test(spec['glsl-1.50'], -'glsl-1.50-geometry-end-primitive {0}'.format(i)) +cmdline = 'end-primitive {0}'.format(i) +spec['glsl-1.50']['execution']['geometry'][cmdline] = \ +concurrent_test('glsl-1.50-geometry-' + cmdline) for prim_type in ['GL_POINTS', 'GL_LINE_LOOP', 'GL_LINE_STRIP', 'GL_LINES', 'GL_TRIANGLES', 'GL_TRIANGLE_STRIP', 'GL_TRIANGLE_FAN', 'GL_LINES_ADJACENCY', 'GL_LINE_STRIP_ADJACENCY', 'GL_TRIANGLES_ADJACENCY', 'GL_TRIANGLE_STRIP_ADJACENCY']: -add_concurrent_test(spec['glsl-1.50'], -'glsl-1.50-geometry-primitive-types {0}'.format( -prim_type)) +cmdline = 'primitive-types {0}'.format(prim_type) +spec['glsl-1.50']['execution']['geometry'][cmdline] = \ +concurrent_test('glsl-1.50-geometry-' + cmdline) for restart_index in ['ffs', 'other']: -add_concurrent_test(spec['glsl-1.50'], -'glsl-1.50-geometry-primitive-id-restart {0} {1}'.format( -prim_type, restart_index)) +cmdline = 'primitive-id-restart {0} {1}'.format( +prim_type, restart_index) +spec['glsl-1.50']['execution']['geometry'][cmdline] = \ +concurrent_test('glsl-1.50-geometry-' + cmdline) for layout_type in ['points', 'lines', 'lines_adjacency', 'triangles', 'triangles_adjacency']: @@ -1017,9 +1019,10 @@ for layout_type in ['points', 'lines', 'lines_adjacency', 'triangles', for prim_type in ['GL_TRIANGLE_STRIP', 'GL_TRIANGLE_STRIP_ADJACENCY']: for restart_index in ['ffs', 'other']: -add_concurrent_test(spec['glsl-1.50'], - 'glsl-1.50-geometry-tri-strip-ordering-with-prim-restart {0} {1}'.format( -prim_type, restart_index)) +cmdline = 'tri-strip-ordering-with-prim-restart {0} {1}'.format( +prim_type, restart_index) +spec['glsl-1.50']['execution']['geometry'][cmdline] = \ +concurrent_test('glsl-1.50-geometry-' + cmdline) for input_layout in ['points', 'lines', 'lines_adjacency', 'triangles', 'triangles_adjacency', 'line_strip', 'triangle_strip']: -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] gs: Test redeclaring either gl_PerVertex in or out, and using both.
On 6 November 2013 14:06, Ian Romanick i...@freedesktop.org wrote: On 10/15/2013 03:53 PM, Paul Berry wrote: This test is Reviewed-by: Ian Romanick ian.d.roman...@intel.com Do we already have tests that redeclare these blocks but try to use fields that were not in the redeclaration? Yes: - gs-redeclares-pervertex-in-before-other-usage.geom - gs-redeclares-pervertex-out-before-other-usage.geom - vs-redeclares-pervertex-out-before-other-usage.vert --- .../gs-redeclares-pervertex-in-only.shader_test| 55 ++ .../gs-redeclares-pervertex-out-only.shader_test | 53 + 2 files changed, 108 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test create mode 100644 tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test diff --git a/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test new file mode 100644 index 000..f28bd7f --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test @@ -0,0 +1,55 @@ +# This test verifies that a geometry shader can redeclare just the +# gl_PerVertex input block, but still use members of the gl_PerVertex +# output block (whether or not those members were included in the +# redeclaration of the input block). + +[require] +GLSL = 1.50 + +[vertex shader] +in vec4 piglit_vertex; +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() +{ + gl_Position = piglit_vertex; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; +} gl_in[]; + +void main() +{ + for (int i = 0; i 3; i++) { +gl_Position = gl_in[i].gl_Position; +gl_ClipDistance[0] = 1.0; +EmitVertex(); + } +} + +[fragment shader] +void main() +{ + if (gl_ClipDistance[0] == 1.0) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +# Since the fragment shader's gl_ClipDistance array is only defined +# for elements that have clipping enabled, we need to enable clip +# plane 0. Fortunately the values we use for gl_ClipDistance are +# always positive, so no pixels are actually clipped. +enable GL_CLIP_PLANE0 +clear color 0.0 0.0 0.0 0.0 +clear +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test new file mode 100644 index 000..e3f3dbd --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test @@ -0,0 +1,53 @@ +# This test verifies that a geometry shader can redeclare just the +# gl_PerVertex output block, but still use members of the gl_PerVertex +# input block (whether or not those members were included in the +# redeclaration of the output block). + +[require] +GLSL = 1.50 + +[vertex shader] +in vec4 piglit_vertex; + +void main() +{ + gl_Position = piglit_vertex; + gl_PointSize = dot(piglit_vertex, vec4(1.0)); +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +out gl_PerVertex { + vec4 gl_Position; +}; +out vec4 color; + +void main() +{ + bool ok = true; + for (int i = 0; i 3; i++) { +if (gl_in[i].gl_PointSize != dot(gl_in[i].gl_Position, vec4(1.0))) + ok = false; + } + for (int i = 0; i 3; i++) { +gl_Position = gl_in[i].gl_Position; +color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +EmitVertex(); + } +} + +[fragment shader] +in vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] Check that transform feedback size/type comes from gs, not vs.
On 6 November 2013 14:21, Ian Romanick i...@freedesktop.org wrote: On 10/23/2013 01:01 PM, Paul Berry wrote: When the current program has both a geometry shader and a vertex shader, transform feedback needs to link with the geometry shader. This test verifies that the type and size of the varyings captured by transform feedback match their declarations in the geometry shader, even if there are vertex shader outputs with the same names and different types. This will be even more fun with separate shader objects. Do we have a similar test that verifies that vertex shader outputs cannot be named by glTransformFeedbackVaryings? So, rename vertex shader foo to foo2 and rename varyings foo to foo2. There are a couple similar xfb cases that I plan to write for SSO. If we don't already have non-SSO versions, I can make them. I'm not aware of any tests like that. Thanks! Anyway... This test is Reviewed-by: Ian Romanick ian.d.roman...@intel.com The test exercises one built-in shader output (gl_ClipDistance) and one user-defined shader output. --- tests/all.tests| 1 + .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + .../geometry/transform-feedback-type-and-size.c| 227 + 3 files changed, 229 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c diff --git a/tests/all.tests b/tests/all.tests index 9502ead..213114a 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -983,6 +983,7 @@ spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('glsl-1.50-gs-emit spec['glsl-1.50']['gs-end-primitive-optional-with-points-out'] = concurrent_test('glsl-1.50-geometry-end-primitive-optional-with-points-out') spec['glsl-1.50']['getshaderiv-may-return-GS'] = concurrent_test('glsl-1.50-getshaderiv-may-return-GS') spec['glsl-1.50']['query-gs-prim-types'] = concurrent_test('glsl-1.50-query-gs-prim-types') +spec['glsl-1.50']['transform-feedback-type-and-size'] = concurrent_test('glsl-1.50-transform-feedback-type-and-size') spec['glsl-3.30'] = Group() spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-3.30/minimum-maximums.txt') diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 3e6bc4b..447c92b 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -19,3 +19,4 @@ piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) +piglit_add_executable (glsl-1.50-transform-feedback-type-and-size transform-feedback-type-and-size.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c b/tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c new file mode 100644 index 000..07f31cc --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c @@ -0,0 +1,227 @@ +/* + * Copyright © 2013 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. + */ + +/** \file + * + * Verify that when transform feedback is applied to a program + * containing both a geometry shader and a vertex shader, the size and + * type of the data captured (as well as the data itself) are + * determined by the geometry shader and not the vertex shader. + * + * This test creates a geometry and a vertex shader which both
Re: [Piglit] [PATCH] ext_framebuffer_multisample: Initialize Test::filter_mode.
On 3 November 2013 15:16, Vinson Lee v...@freedesktop.org wrote: Fixes Uninitialized scalar field reported by Coverity. Signed-off-by: Vinson Lee v...@freedesktop.org Reviewed-by: Paul Berry stereotype...@gmail.com --- tests/spec/ext_framebuffer_multisample/common.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp index 5d4a0be..09585e7 100644 --- a/tests/spec/ext_framebuffer_multisample/common.cpp +++ b/tests/spec/ext_framebuffer_multisample/common.cpp @@ -260,7 +260,8 @@ Test::Test(TestPattern *pattern, ManifestProgram *manifest_program, pattern_height(0), supersample_factor(0), srgb(srgb), - downsample_prog() + downsample_prog(), + filter_mode(GL_NONE) { } -- 1.8.3.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] fbo-blit-scaled-linear: Require GLSL 1.30.
On 3 November 2013 15:58, Vinson Lee v...@freedesktop.org wrote: Signed-off-by: Vinson Lee v...@freedesktop.org --- tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp | 1 + 1 file changed, 1 insertion(+) Reviewed-by: Paul Berry stereotype...@gmail.com diff --git a/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp b/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp index 5a3a485..a656abe 100644 --- a/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp +++ b/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp @@ -183,6 +183,7 @@ piglit_init(int argc, char **argv) { piglit_require_gl_version(21); piglit_require_extension(GL_ARB_vertex_array_object); + piglit_require_GLSL_version(130); /* Create two singlesample FBOs with same format and dimensions but * different color attachment types. -- 1.8.3.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] update the HACKING file's Coding style section
On 1 November 2013 08:14, Brian Paul bri...@vmware.com wrote: I've tried to describe Piglit's coding style and conventions in more detail. Hopefully, new contributors will read this and it'll save some some time and effort for the reviewers. Please feel free to add/update this info. Reviewed-by: Paul Berry stereotype...@gmail.com --- HACKING | 57 - 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/HACKING b/HACKING index a227fc6..03519e5 100644 --- a/HACKING +++ b/HACKING @@ -63,25 +63,56 @@ entirely new project. The most important reasons are: +\ Coding style + - -\ Ugly Things (or: Coding style) - --- +Basic formatting: -As a rule of thumb, coding style should be preserved in test code taken from -other projects, as long as that code is self-contained. +* Indent with 8-column tabs +* Limit lines to 78 characters or less +* Function return type and name go on successive lines +* Opening function brace goes on line by itself +* Opening statement braces go on same line as the 'for' or 'else' -Apart from that, the following rules are cast in stone: +The following indent command will generally format your code for piglit's +style: -1. Use tabulators for indentation -2. Use spaces for alignment -3. No whitespace at the end of a line + indent -br -i8 -npcs -ce input.c -o output.c -See http://electroly.com/mt/archives/02.html for a well-written rationale. +Though, that doesn't give perfect results. It messes up the +PIGLIT_GL_TEST_CONFIG_BEGIN/END section. And array initializers sometimes +come out funny. -Use whatever tabulator size you want: -If you adhere to the rules above, the tab size does not matter. Tab size 4 -is recommended because it keeps the line lengths reasonable, but in the end, -that's purely a matter of personal taste. +When in doubt see other recently added piglit tests for coding style. + + +Code conventions: + +* Use const qualifiers whenever possible on array declarations, pointers + and global variables. +* Use static const for initialized arrays whenever possible. +* Preprocessor macros should be UPPER_CASE +* Enumeration tokens should be UPPER_CASE +* Most other identifiers are lower_case_with_underscores +* Use int, float, bool except when GL types (GLint, GLfloat) are really needed +* Don't put declarations after code. For example: + if (x 3) + x = 0; + int y = x * x; + This will not compile with MSVC. The 'int y' declaration must be at the + top of the brace-block. +* Don't use named/designated initializers. They don't compile with MSVC. +* Write tests that are easily read, understood and debugged. Long, complicated + functions are frowned upon. +* Don't try to test too much in a single test program. Most piglit programs + are less than 300 lines long. + + +Utility code: + +Piglit has a rich set of utility functions for basic drawing, setting +up shaders, probing pixels, error checking, etc. Try to use them before +rolling your own. -- 1.7.10.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] New test for partial blits after a buffer swap
On 29 October 2013 14:46, Eric Anholt e...@anholt.net wrote: Federico Mena Quintero federico.mena.li...@gmail.com writes: Hello, everyone, Attached is a new test for piglit which exposes a bug in Mesa's software rendering (and another bug in hardware rendering, but that's not its main purpose). The bug is as follows. With software rendering, after doing a buffer swap, glBlitFrameBufferEXT() appears to to copy the whole framebuffer instead of just the specified region. This breaks clutter and cogl, since they keep track of a dirty region themselves, and they use blits instead of full buffer swaps to avoid updating the whole display on every frame unnecessarily. What is happening is actually a bit more complicated. glBlitFrameBufferEXT()'s basic machinery works correctly, but if there has been a buffer swap before it, the following happens: Hah. Apparently the problem is you're hitting this line of platform_x11.c in EGL: /* FIXME: Does EGL support front buffer rendering at all? */ FYI, we discussed this issue back in May but didn't really come to a clear consensus of what we wanted to do about it: http://lists.freedesktop.org/archives/mesa-dev/2013-May/040059.html. (Note that the replies happened in July so the mesa-dev archives don't thread them well. See http://lists.freedesktop.org/archives/mesa-dev/2013-June/subject.html#40129for the replies.) ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/4] More tests for vs-gs interface block array matching rules.
--- .../interface-vs-named-to-gs-array.shader_test | 77 ++ ...nterface-vs-array-to-gs-array-sized.shader_test | 52 +++ 2 files changed, 129 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test diff --git a/tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test b/tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test new file mode 100644 index 000..364ca61 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test @@ -0,0 +1,77 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# This test verifies that trying to link a named VS output interface +# to a GS input interface array succeeds, even if the instance names +# differ. + +[require] +GLSL = 1.50 + +[vertex shader] +out block { + vec4 a; + vec4 b; +} vs_block; + +void main() +{ + vs_block.a = vec4(0.0, 1.0, 2.0, 3.0) + 10.0 * float(gl_VertexID); + vs_block.b = vec4(4.0, 5.0, 6.0, 7.0) + 10.0 * float(gl_VertexID); +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 4) out; + +in block { + vec4 a; + vec4 b; +} gs_block[3]; +out vec4 color; + +void main() +{ + const vec4 vertices[4] = vec4[4]( +vec4(-1.0, -1.0, 0.0, 1.0), +vec4(-1.0, 1.0, 0.0, 1.0), +vec4( 1.0, -1.0, 0.0, 1.0), +vec4( 1.0, 1.0, 0.0, 1.0) + ); + + bool ok = true; + for (int i = 0; i 3; i++) { +if (gs_block[i].a != vec4(0.0, 1.0, 2.0, 3.0) + 10.0 * float(i)) + ok = false; +if (gs_block[i].b != vec4(4.0, 5.0, 6.0, 7.0) + 10.0 * float(i)) + ok = false; + } + + for (int i = 0; i 4; i++) { +color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +gl_Position = vertices[i]; +EmitVertex(); + } +} + +[fragment shader] +in vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +draw arrays GL_TRIANGLES 0 3 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test new file mode 100644 index 000..080235c --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test @@ -0,0 +1,52 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# This test verifies that trying to link a VS output interface array +# to a sized GS input interface array fails, even if the size of the +# GS input interface array matches the size of the VS output interface +# array. + +[require] +GLSL = 1.50 + +[vertex shader] +out block { +vec4 a; +vec4 b; +} vs_block[3]; + +void main() +{ + for(int i = 0; i 3; i++) { + vs_block[i].a = vec4(1., 0., 0., 1.); + } +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +in block { +vec4 a; +vec4 b; +} vs_block[3]; + +out vec4 color; + +void main() +{ + for(int i = 0; i 2; i++) { + color = vs_block[i].a; + } +} + +[test] +link error -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 4/4] More tests for vs-fs interface block matching rules.
Note: as of Mesa 5cb80f0, tests interface-vs-array-to-fs-unnamed and interface-vs-unnamed-to-fs-array are known to fail. --- .../interface-vs-unnamed-to-fs-unnamed.shader_test | 58 ++ .../interface-vs-array-to-fs-named.shader_test | 57 + .../interface-vs-array-to-fs-unnamed.shader_test | 57 + .../interface-vs-named-to-fs-array.shader_test | 55 .../interface-vs-unnamed-to-fs-array.shader_test | 55 5 files changed, 282 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-named-to-fs-array.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-unnamed-to-fs-array.shader_test diff --git a/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test b/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test new file mode 100644 index 000..76d1d94 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test @@ -0,0 +1,58 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# This test verifies that trying to link an unnamed VS output interface +# to an unnamed FS input interface succeeds. + +[require] +GLSL = 1.50 + +[vertex shader] +in vec4 piglit_vertex; + +out block { + vec4 a; + vec4 b; +}; + +out float ref; + +void main() +{ + gl_Position = piglit_vertex; + ref = 10.0 * float(gl_VertexID); + a = ref + vec4(0.0, 1.0, 2.0, 3.0); + b = ref + vec4(4.0, 5.0, 6.0, 7.0); +} + +[fragment shader] +in block { + vec4 a; + vec4 b; +}; + +in float ref; + +void main() +{ + bool ok = true; + if (distance(a, ref + vec4(0.0, 1.0, 2.0, 3.0)) 1.0e-5) +ok = false; + if (distance(b, ref + vec4(4.0, 5.0, 6.0, 7.0)) 1.0e-5) +ok = false; + gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test new file mode 100644 index 000..0db615a --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test @@ -0,0 +1,57 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# This test verifies that trying to link a VS output interface array +# to a named FS input interface fails. + +[require] +GLSL = 1.50 + +[vertex shader] +in vec4 piglit_vertex; + +out block { + vec4 a; + vec4 b; +} inst[2]; + +out float ref; + +void main() +{ + gl_Position = piglit_vertex; + ref = 10.0 * float(gl_VertexID); + inst[0].a = ref + vec4(0.0, 1.0, 2.0, 3.0); + inst[0].b = ref + vec4(4.0, 5.0, 6.0, 7.0); + inst[1].a = ref + vec4(0.0, 1.0, 2.0, 3.0); + inst[1].b = ref + vec4(4.0, 5.0, 6.0, 7.0); +} + +[fragment shader] +in block { + vec4 a; + vec4 b; +} inst; + +in float ref; + +void main() +{ + bool ok = true; + if (distance(inst.a, ref + vec4(0.0, 1.0, 2.0, 3.0)) 1.0e-5) +ok = false; + if (distance(inst.b, ref + vec4(4.0, 5.0, 6.0, 7.0)) 1.0e-5) +ok = false; + gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test new file mode 100644 index 000..c166ece --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test @@ -0,0 +1,57 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched
[Piglit] [PATCH 1/4] Test intrastage interface block array matching rules.
Note: as of Mesa 5cb80f0, test intrastage-interface-unnamed-array is known to fail. --- ...ge-interface-arrays-unmatched-sizes.shader_test | 42 +++ .../intrastage-interface-named-array.shader_test | 47 ++ .../intrastage-interface-unnamed-array.shader_test | 47 ++ 3 files changed, 136 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test diff --git a/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test b/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test new file mode 100644 index 000..b1f60fc --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test @@ -0,0 +1,42 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# This test verifies that a link error is generated if intrastage +# array sizes don't match. + +[require] +GLSL = 1.50 + +[vertex shader] +out blk { + vec4 foo; +} inst[2]; + +void f() +{ + inst[1].foo = vec4(1.0); +} + +[vertex shader] +out blk { + vec4 foo; +} inst[3]; + +void f(); + +void main() +{ + f(); + inst[2].foo = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test b/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test new file mode 100644 index 000..a8ef627 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test @@ -0,0 +1,47 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# Although it's not explicitly stated, it's clear that when doing +# intrastage linking, interface block arrays can only match other +# interface block arrays. +# +# This test verifies that a link error occurs if we try to do +# intrastage linking of a named interface block to an interface block +# array. + +[require] +GLSL = 1.50 + +[vertex shader] +out blk { + vec4 foo; +} inst; + +void f() +{ + inst.foo = vec4(1.0); +} + +[vertex shader] +out blk { + vec4 foo; +} inst[3]; + +void f(); + +void main() +{ + f(); + inst[2].foo = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test b/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test new file mode 100644 index 000..1dee998 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test @@ -0,0 +1,47 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# Although it's not explicitly stated, it's clear that when doing +# intrastage linking, interface block arrays can only match other +# interface block arrays. +# +# This test verifies that a link error occurs if we try to do +# intrastage linking of an unnamed interface block to an interface +# block array. + +[require] +GLSL = 1.50 + +[vertex shader] +out blk { + vec4 foo; +}; + +void f() +{ + foo = vec4(1.0); +} + +[vertex shader] +out blk { + vec4 foo; +} inst[3]; + +void f(); + +void main() +{ + f(); + inst[2].foo = vec4(1.0); +} + +[test] +link error -- 1.8.4.2 ___ Piglit mailing list
[Piglit] [PATCH 2/4] Rename and clarify interface-blocks-vs-gs-array-size-mismatch.shader_test.
The test was correct, but not for the reasons stated in the comment. The reason a sized VS output interface array should fail to match an unsized GS input interface array is because geometry shader inputs require an extra level of array indexing to match corresponding vertex shader outputs. This patch renames the test, and updates the comment, to reflect what's actually being tested. --- ...ce-blocks-vs-gs-array-size-mismatch.shader_test | 41 - ...erface-vs-array-to-gs-array-unsized.shader_test | 52 ++ 2 files changed, 52 insertions(+), 41 deletions(-) delete mode 100644 tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test diff --git a/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test deleted file mode 100644 index 5581ba8..000 --- a/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test +++ /dev/null @@ -1,41 +0,0 @@ -# Test interface blocks declared as arrays must match array sizes. -# -# GLSLangSpec.1.50.11, 4.3.7 Interface Blocks: -# if a matching block is declared as an array, then the array sizes must -# also match -[require] -GLSL = 1.50 - -[vertex shader] -out block { -vec4 a; -vec4 b; -} vs_block[3]; - -void main() -{ - for(int i = 0; i 3; i++) { - vs_block[i].a = vec4(1., 0., 0., 1.); - } -} - -[geometry shader] -layout(triangles) in; -layout(triangle_strip, max_vertices=3) out; - -in block { -vec4 a; -vec4 b; -} vs_block[]; - -out vec4 color; - -void main() -{ - for(int i = 0; i 2; i++) { - color = vs_block[i].a; - } -} - -[test] -link error diff --git a/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test new file mode 100644 index 000..54498f1 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test @@ -0,0 +1,52 @@ +# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks): +# +# Matched block names within an interface (as defined above) must +# match in terms of having the same number of declarations with +# the same sequence of types and the same sequence of member +# names, as well as having the same member-wise layout +# qualification (see next section). Furthermore, if a matching +# block is declared as an array, then the array sizes must also +# match (or follow array matching rules for the interface between +# a vertex and a geometry shader). +# +# This test verifies that trying to link a VS output interface array +# to an unsized GS input interface array fails, even if the implicit +# size of the GS input interface array matches the explicit size of +# the VS output interface array. + +[require] +GLSL = 1.50 + +[vertex shader] +out block { +vec4 a; +vec4 b; +} vs_block[3]; + +void main() +{ + for(int i = 0; i 3; i++) { + vs_block[i].a = vec4(1., 0., 0., 1.); + } +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +in block { +vec4 a; +vec4 b; +} vs_block[]; + +out vec4 color; + +void main() +{ + for(int i = 0; i 2; i++) { + color = vs_block[i].a; + } +} + +[test] +link error -- 1.8.4.2 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V2 1/6] ARB_sample_shading: Add test to verify new functions and enums
+ +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 + +enum piglit_result +piglit_display(void) +{ + /* Unreached */ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + float value; + bool pass = true; + piglit_require_extension(GL_ARB_sample_shading); + + pass = !glIsEnabled(GL_SAMPLE_SHADING_ARB) pass; + glEnable(GL_SAMPLE_SHADING_ARB); + pass = glIsEnabled(GL_SAMPLE_SHADING_ARB) pass; + glDisable(GL_SAMPLE_SHADING_ARB); + pass = !glIsEnabled(GL_SAMPLE_SHADING_ARB) pass; + piglit_check_gl_error(GL_NO_ERROR); + + glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE_ARB, value); + pass = (value == 0.0) pass; + glMinSampleShadingARB(0.5); + glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE_ARB, value); + pass = (value == 0.5) pass; + piglit_check_gl_error(GL_NO_ERROR); While we're at it, can we also verify that GL_MIN_SAMPLE_SHADING_VALUE_ARB is clamped to the range [0, 1]? With that added, this test is: Reviewed-by: Paul Berry stereotype...@gmail.com + + piglit_report_result( pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.1.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V2 2/6] ARB_sample_shading: Add test to verify the functionality of gl_NumSamples
) +pass; + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} -- 1.8.1.4 With those minor changes, and Chris's comments addressed, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V2 3/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleID
On 25 October 2013 16:49, Anuj Phogat anuj.pho...@gmail.com wrote: V2: Get rid of redundant projection matrix. Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- tests/all.tests| 5 + .../arb_sample_shading/execution/CMakeLists.gl.txt | 1 + .../execution/builtin-gl-sample-id.cpp | 230 + 3 files changed, 236 insertions(+) create mode 100644 tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp I'm not comfortable with this test. It doesn't verify that gl_SampleID is correct for each sample. It just averages together float(gl_SampleID)/float(gl_NumSamples) for all samples and verifies that is equals the expected value (which will always be near 0.5). In particular, if there's a bug causing gl_SampleID to identify the samples in an incorrect order, that won't be caught by this test. I'd recommend keeping your vertex and fragment shader, but instead of drawing to a renderbuffer, draw to a multisampled texture (using ARB_texture_multisample). Then you can have a second shader which reads from the multisampled texture and verifies that every sample is correct at every pixel location. Also, Chris's suggestion from patch 2 (about reinventing piglit_draw_rect) applies here as well. diff --git a/tests/all.tests b/tests/all.tests index 1fcd08a..d861a91 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1342,6 +1342,11 @@ for num_samples in TEST_SAMPLE_COUNTS: executable = 'arb_sample_shading-{0} -auto'.format(test_name) arb_sample_shading[test_name] = PlainExecTest(executable) +for num_samples in TEST_SAMPLE_COUNTS: +test_name = 'builtin-gl-sample-id {0}'.format(num_samples) +executable = 'arb_sample_shading-{0} -auto'.format(test_name) +arb_sample_shading[test_name] = PlainExecTest(executable) + # Group ARB_debug_output arb_debug_output = Group() spec['ARB_debug_output'] = arb_debug_output diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt index 56fa0da..35f2905 100644 --- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt +++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt @@ -12,4 +12,5 @@ link_libraries ( piglit_add_executable (arb_sample_shading-api api.c) piglit_add_executable (arb_sample_shading-builtin-gl-num-samples builtin-gl-num-samples.cpp) +piglit_add_executable (arb_sample_shading-builtin-gl-sample-id builtin-gl-sample-id.cpp) # vim: ft=cmake: diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp new file mode 100644 index 000..143dc95 --- /dev/null +++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp @@ -0,0 +1,230 @@ +/* + * Copyright © 2013 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. + */ + +/** \file builtin-gl-sample-id.cpp + * This test verifies that using gl_SampleID in fragment shader program + * works as per ARB_sample_shading specification. + * + **/ + +#include piglit-fbo.h +using namespace piglit_util_fbo; + +const int pattern_width = 128; const int pattern_height = 128; + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_width = pattern_width; + config.window_height = pattern_height; + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +static int num_samples; +static unsigned prog, vao, vertex_buf; +static Fbo multisampled_fbo, singlesampled_fbo; + +static void +print_usage_and_exit(char *prog_name) +{ + printf(Usage: %s num_samples\n, prog_name); + piglit_report_result(PIGLIT_FAIL); +} + +void +compile_shader(void) +{ +
Re: [Piglit] [PATCH V2 4/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleMask[]
On 25 October 2013 16:49, Anuj Phogat anuj.pho...@gmail.com wrote: V2: Get rid of redundant projection matrix. Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- tests/all.tests| 5 + .../arb_sample_shading/execution/CMakeLists.gl.txt | 1 + .../execution/builtin-gl-sample-mask.cpp | 236 + 3 files changed, 242 insertions(+) create mode 100644 tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp I have similar concerns with this patch to the concerns I have with patch 3. The test should be rewritten to use ARB_texture_multisample so that we can verify the correct mapping of gl_SampleMask bits to samples. As it is, this test would still pass if the implementation got the bits in the wrong order. Also, I notice that the loop in piglit_display() tests the following sequence of sample masks: 0x00 0x01 0x03 0x07 0x0f 0x1f 0x3f 0x7f 0xff That's a problem because: (a) some implementations support 8 sample MSAA; on those implementations we only test the first 8 samples. (b) all of the values tested consist of a sequence of 0 bits followed by a sequence of 1 bits. We also need to test bit sequences which alternate between 1's and 0's. (c) we aren't doing anything to verify that the upper bits of gl_SampleMask[0] (those beyond the first gl_NumSamples bits) are ignored. (d) since we are setting gl_SampleMask[0] to a uniform value, we won't catch bugs if the implementation mixes up sample masks between one fragment and a nearby fragment. Here's a possible way to revise the test: 1. In the fragment shader, instead of setting gl_SampleMask[0] to a uniform value, set it to a value that's dynamically computed based on gl_FragCoord. For example, a possible formula might be (int(gl_FragCoord.x) * 0x10204081) ^ (int(gl_FragCoord.y) * 0x01010101). (The nice thing about this formula is that for your 128x128 image size, it produces a bit pattern where no two bits of gl_SampleMask[0] are correllated, so it should exercise the hardware pretty thoroughly). 2. Render to a multisample texture. 3. Read from the multisample texture using a second fragment shader that computes the same formula, figures out for each pixel which samples are expected to be green vs. black, and checks that all the samples have the expected color. diff --git a/tests/all.tests b/tests/all.tests index d861a91..c5dd80c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1347,6 +1347,11 @@ for num_samples in TEST_SAMPLE_COUNTS: executable = 'arb_sample_shading-{0} -auto'.format(test_name) arb_sample_shading[test_name] = PlainExecTest(executable) +for num_samples in TEST_SAMPLE_COUNTS: +test_name = 'builtin-gl-sample-mask {0}'.format(num_samples) +executable = 'arb_sample_shading-{0} -auto'.format(test_name) +arb_sample_shading[test_name] = PlainExecTest(executable) + # Group ARB_debug_output arb_debug_output = Group() spec['ARB_debug_output'] = arb_debug_output diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt index 35f2905..d2f1f4a 100644 --- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt +++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt @@ -13,4 +13,5 @@ link_libraries ( piglit_add_executable (arb_sample_shading-api api.c) piglit_add_executable (arb_sample_shading-builtin-gl-num-samples builtin-gl-num-samples.cpp) piglit_add_executable (arb_sample_shading-builtin-gl-sample-id builtin-gl-sample-id.cpp) +piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask builtin-gl-sample-mask.cpp) # vim: ft=cmake: diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp new file mode 100644 index 000..2b4e7d7 --- /dev/null +++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp @@ -0,0 +1,236 @@ +/* + * Copyright © 2013 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
Re: [Piglit] [PATCH V2 5/6] ARB_sample_shading: Add test to verify the functionality of gl_SamplePosition
])); + printf(sample[%d]_pos = {%f, %f}\n, + i, sample_pos[2 * i], sample_pos[2 * i + 1]); + } + + glClear(GL_COLOR_BUFFER_BIT); + draw_pattern(samples, sample_pos); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, ms_fbo.handle); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, singlesampled_fbo.handle); + glClear(GL_COLOR_BUFFER_BIT); + glBlitFramebuffer(0, 0, + pattern_width, pattern_height, + 0, 0, + pattern_width, pattern_height, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, singlesampled_fbo.handle); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo); + + pass = piglit_probe_rect_rgba(0, 0, pattern_width, + pattern_width, expected) +pass; + glClear(GL_COLOR_BUFFER_BIT); + glBlitFramebuffer(0, 0, + pattern_width, pattern_height, + 0, 0, + pattern_width, pattern_height, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); + + piglit_present_results(); + return pass; +} + +enum piglit_result +piglit_display() +{ + bool pass = true; + pass = test_ms_blit_scaled(multisampled_fbo) +pass; + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} -- 1.8.1.4 With those changes, the patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH V2 6/6] ARB_sample_shading: Add compiler tests for new builtins
On 25 October 2013 16:49, Anuj Phogat anuj.pho...@gmail.com wrote: Tests gl_SamplePosition, gl_SampleID, gl_NumSamples, gl_SampleMask[] Signed-off-by: Anuj Phogat anuj.pho...@gmail.com Personally, I don't think these tests are necessary. The previous patches adequately exercise compilation of these new built-ins. I don't feel terribly strongly, though. If you want to keep them, you can consider this patch: Reviewed-by: Paul Berry stereotype...@gmail.com --- tests/all.tests | 4 tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag | 12 tests/spec/arb_sample_shading/compiler/gl_SampleID.frag | 12 tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag | 13 + .../spec/arb_sample_shading/compiler/gl_SamplePosition.frag | 12 5 files changed, 53 insertions(+) create mode 100644 tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag create mode 100644 tests/spec/arb_sample_shading/compiler/gl_SampleID.frag create mode 100644 tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag create mode 100644 tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag diff --git a/tests/all.tests b/tests/all.tests index 9df5a94..717d41f 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1357,6 +1357,10 @@ for num_samples in TEST_SAMPLE_COUNTS: executable = 'arb_sample_shading-{0} -auto'.format(test_name) arb_sample_shading[test_name] = PlainExecTest(executable) +import_glsl_parser_tests(spec['ARB_sample_shading'], + os.path.join(testsDir, 'spec', 'arb_sample_shading'), + ['compiler']) + # Group ARB_debug_output arb_debug_output = Group() spec['ARB_debug_output'] = arb_debug_output diff --git a/tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag b/tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag new file mode 100644 index 000..d99e8b8 --- /dev/null +++ b/tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag @@ -0,0 +1,12 @@ +// [config] +// expect_result: pass +// glsl_version: 1.30 +// require_extensions: GL_ARB_sample_shading +// [end config] +#version 130 +#extension GL_ARB_sample_shading : enable + +int func() +{ + return gl_NumSamples; +} diff --git a/tests/spec/arb_sample_shading/compiler/gl_SampleID.frag b/tests/spec/arb_sample_shading/compiler/gl_SampleID.frag new file mode 100644 index 000..0d202be --- /dev/null +++ b/tests/spec/arb_sample_shading/compiler/gl_SampleID.frag @@ -0,0 +1,12 @@ +// [config] +// expect_result: pass +// glsl_version: 1.30 +// require_extensions: GL_ARB_sample_shading +// [end config] +#version 130 +#extension GL_ARB_sample_shading : enable + +int func() +{ + return gl_SampleID; +} diff --git a/tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag b/tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag new file mode 100644 index 000..1e659bc --- /dev/null +++ b/tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag @@ -0,0 +1,13 @@ +// [config] +// expect_result: pass +// glsl_version: 1.30 +// require_extensions: GL_ARB_sample_shading +// [end config] +#version 130 +#extension GL_ARB_sample_shading : enable + +int func() +{ +gl_SampleMask[0] = 0xff; + return 0; +} diff --git a/tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag b/tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag new file mode 100644 index 000..be42d90 --- /dev/null +++ b/tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag @@ -0,0 +1,12 @@ +// [config] +// expect_result: pass +// glsl_version: 1.30 +// require_extensions: GL_ARB_sample_shading +// [end config] +#version 130 +#extension GL_ARB_sample_shading : enable + +vec2 func() +{ + return gl_SamplePosition; +} -- 1.8.1.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/3] Test upsampling blits in GL_LINEAR filter mode.
Since upsampling blits require the source and destination rectangles to be exactly the same size, GL_LINEAR and GL_NEAREST filtering should be equivalent. So just add an option to the upsample test that causes it to do a GL_LINEAR upsampling blit. --- tests/all.tests | 11 --- tests/spec/ext_framebuffer_multisample/upsample.cpp | 15 +-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/all.tests b/tests/all.tests index 6b04c64..284440a 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1718,10 +1718,15 @@ for num_samples in MSAA_SAMPLE_COUNTS: for num_samples in MSAA_SAMPLE_COUNTS: for buffer_type in ('color', 'depth', 'stencil'): -test_name = ' '.join(['upsample', str(num_samples), buffer_type]) -executable = 'ext_framebuffer_multisample-{0} -auto'.format( +sensible_options = [] +if buffer_type == 'color': +sensible_options.append('linear') +for options in power_set(sensible_options): +test_name = ' '.join(['upsample', str(num_samples), buffer_type] + + options) +executable = 'ext_framebuffer_multisample-{0} -auto'.format( test_name) -ext_framebuffer_multisample[test_name] = PlainExecTest(executable) +ext_framebuffer_multisample[test_name] = PlainExecTest(executable) for num_samples in MSAA_SAMPLE_COUNTS: for buffer_type in ('color', 'depth', 'stencil'): diff --git a/tests/spec/ext_framebuffer_multisample/upsample.cpp b/tests/spec/ext_framebuffer_multisample/upsample.cpp index 10e5ad7..67854bf 100644 --- a/tests/spec/ext_framebuffer_multisample/upsample.cpp +++ b/tests/spec/ext_framebuffer_multisample/upsample.cpp @@ -71,6 +71,7 @@ Fbo multisample_fbo; TestPattern *test_pattern = NULL; ManifestProgram *manifest_program = NULL; GLbitfield buffer_to_test; +GLenum filter_mode = GL_NEAREST; void print_usage_and_exit(char *prog_name) @@ -79,7 +80,9 @@ print_usage_and_exit(char *prog_name) where buffer_type is one of:\n color\n stencil\n - depth\n, + depth\n + Available options:\n + linear: use GL_LINEAR filter mode\n, prog_name); piglit_report_result(PIGLIT_FAIL); } @@ -121,6 +124,14 @@ piglit_init(int argc, char **argv) } else { print_usage_and_exit(argv[0]); } + + for (int i = 3; i argc; i++) { + if (strcmp(argv[i], linear) == 0) + filter_mode = GL_LINEAR; + else + print_usage_and_exit(argv[0]); + } + test_pattern-compile(); if (manifest_program) manifest_program-compile(); @@ -158,7 +169,7 @@ piglit_display() glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisample_fbo.handle); glBlitFramebuffer(pattern_width, 0, pattern_width*2, pattern_height, 0, 0, pattern_width, pattern_height, - buffer_to_test, GL_NEAREST); + buffer_to_test, filter_mode); if (manifest_program) { /* Manifest the test pattern in the main framebuffer. */ -- 1.8.4.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/3] Test downsampling blits in GL_LINEAR filter mode.
Since downsampling blits require the source and destination rectangles to be exactly the same size, GL_LINEAR and GL_NEAREST filtering should be equivalent. So just add an option to the accuracy test that causes it to do a GL_LINEAR downsampling blit. --- tests/all.tests| 5 - tests/spec/ext_framebuffer_multisample/accuracy.cpp| 9 +++-- tests/spec/ext_framebuffer_multisample/common.cpp | 10 ++ tests/spec/ext_framebuffer_multisample/common.h| 9 +++-- tests/spec/ext_framebuffer_multisample/turn-on-off.cpp | 3 ++- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/all.tests b/tests/all.tests index 9502ead..6b04c64 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1701,7 +1701,10 @@ ext_framebuffer_multisample['alpha-blending'] = PlainExecTest('ext_framebuffer_m for num_samples in MSAA_SAMPLE_COUNTS: for test_type in ('color', 'srgb', 'stencil_draw', 'stencil_resolve', 'depth_draw', 'depth_resolve'): -for options in power_set(('small', 'depthstencil')): +sensible_options = ['small', 'depthstencil'] +if test_type in ('color', 'srgb'): +sensible_options.append('linear') +for options in power_set(sensible_options): test_name = ' '.join(['accuracy', str(num_samples), test_type] + options) executable = 'ext_framebuffer_multisample-{0} -auto'.format( diff --git a/tests/spec/ext_framebuffer_multisample/accuracy.cpp b/tests/spec/ext_framebuffer_multisample/accuracy.cpp index 9ff36d9..2c0d445 100644 --- a/tests/spec/ext_framebuffer_multisample/accuracy.cpp +++ b/tests/spec/ext_framebuffer_multisample/accuracy.cpp @@ -71,7 +71,8 @@ print_usage_and_exit(char *prog_name) depth_resolve: test resolve of MSAA depth buffer\n Available options:\n small: use a very small (16x16) MSAA buffer\n - depthstencil: use a combined depth/stencil buffer\n, + depthstencil: use a combined depth/stencil buffer\n + linear: use GL_LINEAR filter mode\n, prog_name); piglit_report_result(PIGLIT_FAIL); } @@ -83,6 +84,7 @@ piglit_init(int argc, char **argv) int i, num_samples; bool small = false; bool combine_depth_stencil = false; + GLenum filter_mode = GL_NEAREST; if (argc 3) print_usage_and_exit(argv[0]); @@ -98,6 +100,8 @@ piglit_init(int argc, char **argv) small = true; } else if (strcmp(argv[i], depthstencil) == 0) { combine_depth_stencil = true; + } else if (strcmp(argv[i], linear) == 0) { + filter_mode = GL_LINEAR; } else { print_usage_and_exit(argv[0]); } @@ -130,7 +134,8 @@ piglit_init(int argc, char **argv) } test = create_test(test_type, num_samples, small, combine_depth_stencil, - pattern_width, pattern_height, supersample_factor); + pattern_width, pattern_height, supersample_factor, + filter_mode); } enum piglit_result diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp index 80e95c1..5d4a0be 100644 --- a/tests/spec/ext_framebuffer_multisample/common.cpp +++ b/tests/spec/ext_framebuffer_multisample/common.cpp @@ -266,12 +266,14 @@ Test::Test(TestPattern *pattern, ManifestProgram *manifest_program, void Test::init(int num_samples, bool small, bool combine_depth_stencil, - int pattern_width, int pattern_height, int supersample_factor) + int pattern_width, int pattern_height, int supersample_factor, + GLenum filter_mode) { this-num_samples = num_samples; this-pattern_width = pattern_width; this-pattern_height = pattern_height; this-supersample_factor = supersample_factor; + this-filter_mode = filter_mode; FboConfig test_fbo_config(0, small ? 16 : pattern_width, @@ -322,7 +324,7 @@ Test::resolve(Fbo *fbo, GLbitfield which_buffers) glBlitFramebuffer(0, 0, fbo-config.width, fbo-config.height, 0, 0, resolve_fbo.config.width, resolve_fbo.config.height, - which_buffers, GL_NEAREST); + which_buffers, filter_mode); } /** @@ -569,7 +571,7 @@ Test::run() Test * create_test(test_type_enum test_type, int n_samples, bool small, bool combine_depth_stencil, int pattern_width, int pattern_height, - int supersample_factor) + int supersample_factor, GLenum filter_mode) { Test *test = NULL; switch (test_type) { @@ -608,6
[Piglit] [PATCH 3/3] Test MSAA-to-MSAA blits in GL_LINEAR filter mode.
Since MSAA-to-MSAA blits require the source and destination rectangles to be exactly the same size, GL_LINEAR and GL_NEAREST filtering should be equivalent. So just add an option to the multisample-blit test that causes it to do a GL_LINEAR blit. --- tests/all.tests | 11 --- .../spec/ext_framebuffer_multisample/multisample-blit.cpp | 15 +-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/all.tests b/tests/all.tests index 284440a..2dd3d6f 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1730,10 +1730,15 @@ for num_samples in MSAA_SAMPLE_COUNTS: for num_samples in MSAA_SAMPLE_COUNTS: for buffer_type in ('color', 'depth', 'stencil'): -test_name = ' ' .join(['multisample-blit', str(num_samples), buffer_type]) -executable = 'ext_framebuffer_multisample-{0} -auto'.format( +sensible_options = [] +if buffer_type == 'color': +sensible_options.append('linear') +for options in power_set(sensible_options): +test_name = ' ' .join(['multisample-blit', str(num_samples), + buffer_type] + options) +executable = 'ext_framebuffer_multisample-{0} -auto'.format( test_name) -ext_framebuffer_multisample[test_name] = PlainExecTest(executable) +ext_framebuffer_multisample[test_name] = PlainExecTest(executable) for num_samples in MSAA_SAMPLE_COUNTS: for buffer_type in ('color', 'depth', 'stencil'): diff --git a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp index 9bfe4ab..e601fee 100644 --- a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp +++ b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp @@ -56,6 +56,7 @@ Fbo dst_fbo; TestPattern *test_pattern = NULL; ManifestProgram *manifest_program = NULL; GLbitfield buffer_to_test; +GLenum filter_mode = GL_NEAREST; void print_usage_and_exit(char *prog_name) @@ -64,7 +65,9 @@ print_usage_and_exit(char *prog_name) where buffer_type is one of:\n color\n stencil\n - depth\n, + depth\n + Available options:\n + linear: use GL_LINEAR filter mode\n, prog_name); piglit_report_result(PIGLIT_FAIL); } @@ -106,6 +109,14 @@ piglit_init(int argc, char **argv) } else { print_usage_and_exit(argv[0]); } + + for (int i = 3; i argc; i++) { + if (strcmp(argv[i], linear) == 0) + filter_mode = GL_LINEAR; + else + print_usage_and_exit(argv[0]); + } + test_pattern-compile(); if (manifest_program) manifest_program-compile(); @@ -129,7 +140,7 @@ piglit_display() glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo.handle); glBlitFramebuffer(0, 0, pattern_width, pattern_height, 0, 0, pattern_width, pattern_height, - buffer_to_test, GL_NEAREST); + buffer_to_test, filter_mode); /* If necessary, manifest the depth/stencil image in dst_fbo * into a color image. This ensures that the blit that -- 1.8.4.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Check that transform feedback size/type comes from gs, not vs.
When the current program has both a geometry shader and a vertex shader, transform feedback needs to link with the geometry shader. This test verifies that the type and size of the varyings captured by transform feedback match their declarations in the geometry shader, even if there are vertex shader outputs with the same names and different types. The test exercises one built-in shader output (gl_ClipDistance) and one user-defined shader output. --- tests/all.tests| 1 + .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 1 + .../geometry/transform-feedback-type-and-size.c| 227 + 3 files changed, 229 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c diff --git a/tests/all.tests b/tests/all.tests index 9502ead..213114a 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -983,6 +983,7 @@ spec['glsl-1.50']['gs-emits-too-few-verts'] = concurrent_test('glsl-1.50-gs-emit spec['glsl-1.50']['gs-end-primitive-optional-with-points-out'] = concurrent_test('glsl-1.50-geometry-end-primitive-optional-with-points-out') spec['glsl-1.50']['getshaderiv-may-return-GS'] = concurrent_test('glsl-1.50-getshaderiv-may-return-GS') spec['glsl-1.50']['query-gs-prim-types'] = concurrent_test('glsl-1.50-query-gs-prim-types') +spec['glsl-1.50']['transform-feedback-type-and-size'] = concurrent_test('glsl-1.50-transform-feedback-type-and-size') spec['glsl-3.30'] = Group() spec['glsl-3.30']['built-in constants'] = concurrent_test('built-in-constants tests/spec/glsl-3.30/minimum-maximums.txt') diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 3e6bc4b..447c92b 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -19,3 +19,4 @@ piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) +piglit_add_executable (glsl-1.50-transform-feedback-type-and-size transform-feedback-type-and-size.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c b/tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c new file mode 100644 index 000..07f31cc --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/transform-feedback-type-and-size.c @@ -0,0 +1,227 @@ +/* + * Copyright © 2013 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. + */ + +/** \file + * + * Verify that when transform feedback is applied to a program + * containing both a geometry shader and a vertex shader, the size and + * type of the data captured (as well as the data itself) are + * determined by the geometry shader and not the vertex shader. + * + * This test creates a geometry and a vertex shader which both output + * the following variables: + * + * - foo + * - gl_ClipDistance + * + * but declare them to have different types and array sizes, and + * output different data to them. + * + * Then it verifies that: + * + * - glGetTransformFeedbackVarying() returns information based on the + * types and array sizes declared in the geometry shader. + * + * - The data captured by transform feedback is consistent with the + * declarations in the geometry shader. + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + config.supports_gl_compat_version = 32; + config.supports_gl_core_version = 32; +PIGLIT_GL_TEST_CONFIG_END + +/** + * This vertex shader should generate the following outputs (assuming + * that 2 vertices are processed): + * + * foo
[Piglit] [PATCH] Escape HTML output when generating test result pages.
If a test generates output containing '', '', or '', we need to HTML escape it so that the web browser doesn't interpret it as containing HTML tags. While we're at it, go ahead and HTML escape the traceback and dmesg outputs too. --- templates/test_result.mako | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/test_result.mako b/templates/test_result.mako index b23fb8e..a2c749c 100644 --- a/templates/test_result.mako +++ b/templates/test_result.mako @@ -31,7 +31,7 @@ tr tdInfo/td td - pre${info}/pre + pre${info | h}/pre /td /tr tr @@ -43,13 +43,13 @@ tr tdTraceback/td td - pre${traceback}/pre + pre${traceback | h}/pre /td /tr tr tddmesg/td td - pre${dmesg}/pre + pre${dmesg | h}/pre /td /tr /table -- 1.8.4.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/4 v3] GS: Test that geometry shader input/output layout qualifiers only compile if valid
On 21 October 2013 09:51, Nicholas Mack nichm...@gmail.com wrote: v2: Tests check against list of valid layouts instead of invalid layouts v3: Remove vertex shader info, remove linking, check compile status, rewrite error messages --- tests/all.tests| 12 ++ .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 2 + .../geometry/gs-input-layout-qualifiers.c | 133 + .../geometry/gs-output-layout-qualifiers.c | 130 4 files changed, 277 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-output-layout-qualifiers.c diff --git a/tests/all.tests b/tests/all.tests index c919f19..2485b39 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1017,6 +1017,18 @@ for prim_type in ['GL_TRIANGLE_STRIP', 'GL_TRIANGLE_STRIP_ADJACENCY']: 'glsl-1.50-geometry-tri-strip-ordering-with-prim-restart {0} {1}'.format( prim_type, restart_index)) +for input_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-input-layout-qualifiers {0}'.format( +input_layout)) + +for output_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-output-layout-qualifiers {0}'.format( +output_layout)) + spec['glsl-3.30'] = Group() import_glsl_parser_tests(spec['glsl-3.30'], os.path.join(testsDir, 'spec', 'glsl-3.30'), diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index 3e6bc4b..d759c6b 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -19,3 +19,5 @@ piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) +piglit_add_executable (glsl-1.50-gs-input-layout-qualifiers gs-input-layout-qualifiers.c) +piglit_add_executable (glsl-1.50-gs-output-layout-qualifiers gs-output-layout-qualifiers.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c new file mode 100644 index 000..0afc4e8 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c @@ -0,0 +1,133 @@ +/** + * Copyright © 2013 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. + */ + +/** + * Test that geometry shaders only compile with valid input layout qualifiers + * + * Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: + * Geometry shaders allow input layout qualifiers only on the interface + * qualifier in, not on an input block, block member, or variable. The layout + * qualifier identifiers for geometry shader inputs are + * points + * lines + * lines_adjacency + * triangles + * triangles_adjacency + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; +config.supports_gl_core_version = 32; + + config.window_visual = PIGLIT_GL_VISUAL_RGB |
[Piglit] [PATCH] Test that the fs gl_PrimitiveID input works even when there's no gs.
For i965/gen7 hardware, the driver has to go to extra work to make gl_PrimitiveID work in the case where there is no geometry shader. So we need a separate test to make sure that works properly. --- .../execution/primitive-id-no-gs.shader_test | 60 ++ 1 file changed, 60 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test diff --git a/tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test b/tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test new file mode 100644 index 000..7f89a8a --- /dev/null +++ b/tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test @@ -0,0 +1,60 @@ +# Check proper functioning of the gl_PrimitiveID fragment shader +# input, in the case where there is no geometry shader. + +[require] +GLSL = 1.50 + +[vertex shader] +#version 150 + +in vec4 piglit_vertex; +flat out int vertex_id; + +void main() +{ + gl_Position = piglit_vertex; + vertex_id = gl_VertexID; +} + +[fragment shader] +#version 150 + +flat in int vertex_id; + +void main() +{ + /* We draw a triangle fan containing 6 vertices, so the relationship between + * the primitive ID and the input vertex ID's should be: + * + * Primitive ID Vertex ID's Provoking vertex ID + * 0 0 1 22 + * 1 0 2 33 + * 2 0 3 44 + * 3 0 4 55 + * + * Since vertex_id uses interpolation qualifier flat, it should + * always receive the value from the provoking vertex. Therefore, + * by the table above, it should always be 2 greater than the + * expected value of gl_PrimitiveID. + */ + int expected_primitive_id = vertex_id - 2; + if (expected_primitive_id == gl_PrimitiveID) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[vertex data] +piglit_vertex/float/2 +-1.0 -1.0 +-1.0 1.0 + 0.0 1.0 + 1.0 1.0 + 1.0 0.0 + 1.0 -1.0 + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +draw arrays GL_TRIANGLE_FAN 0 6 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.4.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/5] util: Move command-line parsing out of piglit_gl_test_config_init
On 15 October 2013 17:32, Ian Romanick i...@freedesktop.org wrote: From: Ian Romanick ian.d.roman...@intel.com Create a new function, piglit_gl_process_args, that does the command-line parsing. This happens after the test code between PIGLIT_GL_TEST_CONFIG_BEGIN and PIGLIT_GL_TEST_CONFIG_END. By having an explicit function that does this, tests can call it inside the BEGIN/END block. This may be useful for tests that expect certain arguments to be in specific positions. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: Chad Versace chad.vers...@linux.intel.com I spent a while worrying about the fact that this change causes some tests to call piglit_gl_process_args() twice (once explicitly, and once implicitly from PIGLIT_GL_TEST_CONFIG_END). Would you mind adding a note to the commit message explaining that piglit_gl_process_args() is idempotent (since it removes the args it processes), so that it's safe to call more than once from a single test? With that change, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com --- tests/texturing/shaders/texelFetch.c | 10 ++ tests/texturing/shaders/textureSize.c | 10 ++ tests/util/piglit-framework-gl.c | 24 ++-- tests/util/piglit-framework-gl.h | 10 +++--- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/tests/texturing/shaders/texelFetch.c b/tests/texturing/shaders/texelFetch.c index ebd48cd..bc6cc8f 100644 --- a/tests/texturing/shaders/texelFetch.c +++ b/tests/texturing/shaders/texelFetch.c @@ -84,6 +84,12 @@ static enum shader_target test_stage = UNKNOWN; PIGLIT_GL_TEST_CONFIG_BEGIN + config.window_width = 900; + config.window_height = 600; + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; + + piglit_gl_process_args(argc, argv, config); + parse_args(argc, argv); if (test_stage == GS) { config.supports_gl_compat_version = 32; @@ -93,10 +99,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_core_version = 31; } - config.window_width = 900; - config.window_height = 600; - config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; - PIGLIT_GL_TEST_CONFIG_END #define MAX_LOD_OR_SAMPLES 10.0 diff --git a/tests/texturing/shaders/textureSize.c b/tests/texturing/shaders/textureSize.c index f010d9c..ee64b07 100644 --- a/tests/texturing/shaders/textureSize.c +++ b/tests/texturing/shaders/textureSize.c @@ -52,6 +52,12 @@ static enum shader_target test_stage = UNKNOWN; PIGLIT_GL_TEST_CONFIG_BEGIN + config.window_width = 150; + config.window_height = 30; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + + piglit_gl_process_args(argc, argv, config); + parse_args(argc, argv); if (test_stage == GS) { config.supports_gl_compat_version = 32; @@ -61,10 +67,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_core_version = 31; } - config.window_width = 150; - config.window_height = 30; - config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; - PIGLIT_GL_TEST_CONFIG_END static int lod_location; diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 2a315be..dd2e6a5 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -43,18 +43,9 @@ static void process_args(int *argc, char *argv[], unsigned *force_samples); void -piglit_gl_test_config_init(int *argc, char *argv[], - struct piglit_gl_test_config *config) +piglit_gl_test_config_init(struct piglit_gl_test_config *config) { - unsigned force_samples = 0; - memset(config, 0, sizeof(*config)); - - process_args(argc, argv, force_samples); - - if (force_samples 1) - config-window_samples = force_samples; - } static void @@ -125,6 +116,19 @@ process_args(int *argc, char *argv[], unsigned *force_samples) } void +piglit_gl_process_args(int *argc, char *argv[], + struct piglit_gl_test_config *config) +{ + unsigned force_samples = 0; + + process_args(argc, argv, force_samples); + + if (force_samples 1) + config-window_samples = force_samples; + +} + +void piglit_gl_test_run(int argc, char *argv[], const struct piglit_gl_test_config *config) { diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h index 7520f38..fcc1594 100644 --- a/tests/util/piglit-framework-gl.h +++ b/tests/util/piglit-framework-gl.h @@ -175,8 +175,11 @@ struct piglit_gl_test_config { * from command line arguments. */ void -piglit_gl_test_config_init(int *argc, char *argv[], - struct piglit_gl_test_config
Re: [Piglit] [PATCH v2] Interface Blocks: Test how interface block members are accessed from API
On 21 October 2013 16:04, Nicholas Mack nichm...@gmail.com wrote: v2: Add checks to also test invalid names --- tests/all.tests| 1 + tests/spec/glsl-1.50/execution/CMakeLists.gl.txt | 1 + .../interface-blocks-api-access-members.c | 173 + 3 files changed, 175 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c Reviewed-by: Paul Berry stereotype...@gmail.com diff --git a/tests/all.tests b/tests/all.tests index c919f19..d2e685c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -966,6 +966,7 @@ import_glsl_parser_tests(spec['glsl-1.50'], add_shader_test_dir(spec['glsl-1.50'], os.path.join(testsDir, 'spec', 'glsl-1.50'), recursive=True) +spec['glsl-1.50']['execution']['interface-blocks-api-access-members'] = concurrent_test('glsl-1.50-interface-blocks-api-access-members') spec['glsl-1.50']['execution']['get-active-attrib-array'] = concurrent_test('glsl-1.50-get-active-attrib-array') spec['glsl-1.50']['execution']['vs-input-arrays'] = concurrent_test('glsl-1.50-vs-input-arrays') spec['glsl-1.50']['execution']['vs-named-block-no-modify'] = concurrent_test('glsl-1.50-vs-named-block-no-modify') diff --git a/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt index 693f69a..114867b 100644 --- a/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/CMakeLists.gl.txt @@ -13,3 +13,4 @@ ${OPENGL_glu_LIBRARY} piglit_add_executable (glsl-1.50-vs-input-arrays vs-input-arrays.c) piglit_add_executable (glsl-1.50-get-active-attrib-array get-active-attrib-array.c) piglit_add_executable (glsl-1.50-vs-named-block-no-modify vs-named-block-no-modify.c) +piglit_add_executable (glsl-1.50-interface-blocks-api-access-members interface-blocks-api-access-members.c) diff --git a/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c b/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c new file mode 100644 index 000..77089f8 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/interface-blocks-api-access-members.c @@ -0,0 +1,173 @@ +/** + * Copyright © 2013 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. + */ + +/** + * Test the syntax for accessing interface block members through the API + * + * From the GLSL 1.50 core spec, section 4.3.7 (Interface Blocks): + * Outside the shading language (i.e., in the API), members are similarly + * identified except the block name is always used in place of the instance + * name (API accesses are to interfaces, not to shaders). If there is no + * instance name, then the API does not use the block name to access a member, + * just the member name. + * + * For blocks declared as arrays, the array index must also be included when + * accessing members + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 32; + config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vstext = + #version 150\n + in vec4 vertex;\n + void main()\n + {\n + gl_Position = vertex;\n + }\n; + +static const char *gstext = + #version 150\n + layout(points) in;\n + layout(points, max_vertices = 3) out;\n + out NoInst {\n + float a;\n + vec3 b;\n + };\n + out WithInst {\n + float c;\n + vec3 d;\n + } inst;\n + out WithInstArray {\n + float e;\n + vec3 f;\n + } instArray[3];\n + void main()\n + {\n + a = 1.0;\n + b = vec3
Re: [Piglit] [PATCH v2] Interface Blocks: Test how interface block members are accessed from API
+ inst.d = vec3(4.0);\n + for(int i = 0; i 3; i++) {\n + instArray[i].e = 5.0 + 2 * i;\n + instArray[i].f = vec3(6.0 + 2 * i);\n + }\n + }\n; + +static GLuint prog; + +static const char *valid_varying_names[] = { + /* correct names to access block members */ + a, b, + WithInst.c, WithInst.d, + WithInstArray[0].e, WithInstArray[0].f, + WithInstArray[1].e, WithInstArray[1].f, + WithInstArray[2].e, WithInstArray[2].f +}; + +static const char *invalid_varying_names[] = { + /* incorrect names to access block members */ + c, d, + inst.c, inst.d, + e, f, + instArray.e, instArray.f, + WithInstArray.e, WithInstArray.f, + instArray[0].e, instArray[0].f, + instArray[1].e, instArray[1].f, + instArray[2].e, instArray[2].f +}; + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLuint vs = 0, gs = 0; + int i; + + prog = glCreateProgram(); + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); + gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gstext); + glAttachShader(prog, vs); + glAttachShader(prog, gs); + + /* check that invalid_varying_names fail to link */ + for (i = 0; i ARRAY_SIZE(invalid_varying_names); i++) { + glTransformFeedbackVaryings(prog, + 1, + invalid_varying_names[i], + GL_INTERLEAVED_ATTRIBS); + glLinkProgram(prog); + if (piglit_link_check_status(prog)) { Whoops, I just noticed one other thing. This should be piglit_link_check_status_quiet(...). Otherwise the piglit framework will panic about the link error (which piglit_link_check_status() prints to standard error) and the test will show up as warn instead of pass. Ok, with that fixed, the test is: Reviewed-by: Paul Berry stereotype...@gmail.com + printf(%s is not valid but it was allowed.\n, + invalid_varying_names[i]); + pass = false; + } + } + + /* check that valid_varying_names link properly */ + glTransformFeedbackVaryings(prog, + ARRAY_SIZE(valid_varying_names), + valid_varying_names, + GL_INTERLEAVED_ATTRIBS); + glLinkProgram(prog); + if (!piglit_link_check_status(prog)) { + glDeleteProgram(prog); + printf(Transform feedback varyings failed to link properly +with valid names.\n); + piglit_report_result(PIGLIT_FAIL); + } + + glUseProgram(prog); + + for (i = 0; i ARRAY_SIZE(valid_varying_names); i++) { + char varName[50]; + GLsizei nameLength = 0, varSize = 0; + GLenum varType = GL_NONE; + glGetTransformFeedbackVarying( prog, + i, + sizeof(varName), + nameLength, + varSize, + varType, + varName); + printf(Name: %s\t\tType: %s\n, + varName, piglit_get_gl_enum_name(varType)); + } + + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + /* DIES IN A FIRE */ + return PIGLIT_FAIL; +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/2] shader_runner: support SIZE in requirement section of a shader_test
On 11 October 2013 10:38, Jordan Justen jordan.l.jus...@intel.com wrote: If a test requires a certain size, it adds 'SIZE Width Height' to the requirements section. Width and Height must be unsigned integers. Signed-off-by: Jordan Justen jordan.l.jus...@intel.com --- tests/shaders/shader_runner.c | 40 +++- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index fbc1964..2667aed 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -38,22 +38,25 @@ #include parser_utils.h static void -get_required_versions(const char *script_name, - struct piglit_gl_test_config *config); +get_required_config(const char *script_name, + struct piglit_gl_test_config *config); GLenum decode_drawing_mode(const char *mode_str); -PIGLIT_GL_TEST_CONFIG_BEGIN +void +get_uints(const char *line, unsigned *uints, unsigned count); - if (argc 1) - get_required_versions(argv[1], config); - else - config.supports_gl_compat_version = 10; +PIGLIT_GL_TEST_CONFIG_BEGIN config.window_width = 250; config.window_height = 250; Once we've identified all the piglit tests that require a specific size, we should come back and delete these two lines, so that shader tests that don't require a specific size will run with the piglit default window size. config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; + if (argc 1) + get_required_config(argv[1], config); + else + config.supports_gl_compat_version = 10; + PIGLIT_GL_TEST_CONFIG_END const char passthrough_vertex_shader_source[] = @@ -934,13 +937,15 @@ process_test_script(const char *script_name) struct requirement_parse_results { bool found_gl; bool found_glsl; + bool found_size; struct component_version gl_version; struct component_version glsl_version; + unsigned size[2]; }; static void -parse_required_versions(struct requirement_parse_results *results, -const char *script_name) +parse_required_config(struct requirement_parse_results *results, + const char *script_name) { unsigned text_size; char *text = piglit_load_text_file(script_name, text_size); @@ -949,6 +954,7 @@ parse_required_versions(struct requirement_parse_results *results, results-found_gl = false; results-found_glsl = false; + results-found_size = false; if (line == NULL) { printf(could not read file \%s\\n, script_name); @@ -993,6 +999,9 @@ parse_required_versions(struct requirement_parse_results *results, results-found_gl = true; version_copy(results-gl_version, version); } + } else if (string_match(SIZE, line)) { + results-found_size = true; + get_uints(line+4, results-size, 2); } } @@ -1018,7 +1027,7 @@ parse_required_versions(struct requirement_parse_results *results, static void choose_required_gl_version(struct requirement_parse_results *parse_results, - struct component_version *gl_version) + struct component_version *gl_version) Spurious whitespace change here. With that fixed, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com { if (parse_results-found_gl) { version_copy(gl_version, parse_results-gl_version); @@ -1053,15 +1062,20 @@ choose_required_gl_version(struct requirement_parse_results *parse_results, * the GL and GLSL version requirements. Use these to guide context creation. */ void -get_required_versions(const char *script_name, - struct piglit_gl_test_config *config) +get_required_config(const char *script_name, + struct piglit_gl_test_config *config) { struct requirement_parse_results parse_results; struct component_version required_gl_version; - parse_required_versions(parse_results, script_name); + parse_required_config(parse_results, script_name); choose_required_gl_version(parse_results, required_gl_version); + if (parse_results.found_size) { + config-window_width = parse_results.size[0]; + config-window_height = parse_results.size[1]; + } + if (required_gl_version.es) { config-supports_gl_es_version = required_gl_version.num; } else if (required_gl_version.num = 31) { -- 1.7.10.4 ___ Piglit mailing list
Re: [Piglit] [PATCH 2/2] glsl-1.50: add size requirements to 3 shader_test tests
On 11 October 2013 10:38, Jordan Justen jordan.l.jus...@intel.com wrote: Signed-off-by: Jordan Justen jordan.l.jus...@intel.com --- .../spec/glsl-1.50/execution/geometry/point-size-out.shader_test |5 +++-- .../execution/redeclare-pervertex-out-subset-gs.shader_test |5 +++-- .../glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test |5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) Reviewed-by: Paul Berry stereotype...@gmail.com diff --git a/tests/spec/glsl-1.50/execution/geometry/point-size-out.shader_test b/tests/spec/glsl-1.50/execution/geometry/point-size-out.shader_test index d5fc03c..fefdc2a 100644 --- a/tests/spec/glsl-1.50/execution/geometry/point-size-out.shader_test +++ b/tests/spec/glsl-1.50/execution/geometry/point-size-out.shader_test @@ -7,11 +7,12 @@ # # NOTE: since gl_PointSize is expressed in pixels, but gl_Position is # expressed relative to the window size, this test is dependent upon -# the window size. It assumes a window size of 250x250, which is the -# shader_runner default. +# the window size. It uses a window size of 250x250, which is +# specified as the size requirement for the test. [require] GLSL = 1.50 +SIZE 250 250 [vertex shader] #version 150 diff --git a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test index 77309cf..ce6afbc 100644 --- a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test +++ b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test @@ -34,11 +34,12 @@ # # NOTE: since gl_PointSize is expressed in pixels, but gl_Position is # expressed relative to the window size, this test is dependent upon -# the window size. It assumes a window size of 250x250, which is the -# shader_runner default. +# the window size. It uses a window size of 250x250, which is the +# specified as the size requirement for the test. [require] GLSL = 1.50 +SIZE 250 250 [vertex shader] void main() diff --git a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test index 416bb7f..e34f016 100644 --- a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test +++ b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test @@ -34,11 +34,12 @@ # # NOTE: since gl_PointSize is expressed in pixels, but gl_Position is # expressed relative to the window size, this test is dependent upon -# the window size. It assumes a window size of 250x250, which is the -# shader_runner default. +# the window size. It uses a window size of 250x250, which is +# specified as the size requirement for the test. [require] GLSL = 1.50 +SIZE 250 250 [vertex shader] in vec4 pos; -- 1.7.10.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 00/10] shader_runner support for micro benchmarks
On 16 October 2013 13:33, Jordan Justen jljus...@gmail.com wrote: On Wed, Oct 16, 2013 at 10:58 AM, Eric Anholt e...@anholt.net wrote: Jordan Justen jordan.l.jus...@intel.com writes: git://people.freedesktop.org/~jljusten/piglit shader_runner-time-v1 I think shader_runner could be an easy way to develop quick micro-benchmarks when working on performance. I found shader_runner only required a few tweaks to be usable for this with depth clears. I'm not suggesting (at least in this series), that we add any micro benchmark scripts to the tree. Rather I would just like to make it possible to write such scripts for shader_runner. The last patch in this series provides an example usage, but I don't want that patch to be added to piglit. I don't think we should add this to shader_runner. So, none of the patches? For example, are 1 2 valuable? My thought is, aren't many/most shader_test's indifferent to the window size? So, perhaps we could shrink the default size down smaller for Linux runs? (I know windows has some lower bound for size.) I think patches 1 and 2 are valuable and should be kept. You spent more code putting this in shader_runner than it would have taken to just hack something up standalone, Possibly. The shader_runner changes aren't that fancy though. But, I find tweaking and re-running a shader_test is faster/easier. Regarding the 'time' commands, I thought it might be an convenient way to micro benchmark shader code issue, although my series doesn't do this. But, if you don't agree that this is valuable, well, then it probably isn't. and shader_runner is already a frankenstein. Without a doubt. Have we officially drawn a line that shader_runner is too much of a monster, and we should avoid adding new features to it? I don't think we've drawn that line. Yes, shader_runner is ugly and hacky, but there's a large class of tests where it's way easier to write shader_runner tests than to write c tests. If we can broaden this class by small, incremental improvements to shader_runner, I'm all for it. If someone wants to submit some patches that make shader_runner less hacky, I'm in favor of that too. I do most of my throwaway microbenchmarks in the mesa-demos repo. Would you be willing to consider ways to make this convenient in piglit, such as patch 3/piglit_get_microseconds? -Jordan ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test that all desktop GLSL versions can be cross-linked.
Verified using the NVIDIA proprietary driver for Linux (version 313.18). --- tests/all.tests | 3 + tests/shaders/CMakeLists.gl.txt | 1 + tests/shaders/version-mixing.c | 264 3 files changed, 268 insertions(+) create mode 100644 tests/shaders/version-mixing.c diff --git a/tests/all.tests b/tests/all.tests index c919f19..9502ead 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -348,6 +348,9 @@ add_plain_test(shaders, 'useprogram-refcount-1') add_plain_test(shaders, 'useshaderprogram-bad-type') add_plain_test(shaders, 'useshaderprogram-bad-program') add_plain_test(shaders, 'useshaderprogram-flushverts-1') +for subtest in ('interstage', 'intrastage'): +cmdline = 'version-mixing {0}'.format(subtest) +shaders[cmdline] = concurrent_test(cmdline) def add_vpfpgeneric(group, name): group[name] = PlainExecTest(['vpfp-generic', '-auto', testsDir + '/shaders/generic/' + name + '.vpfp']) diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt index fcb303b..f1cf9dd 100644 --- a/tests/shaders/CMakeLists.gl.txt +++ b/tests/shaders/CMakeLists.gl.txt @@ -168,5 +168,6 @@ piglit_add_executable (useprogram-refcount-1 useprogram-refcount-1.c) piglit_add_executable (useshaderprogram-bad-type useshaderprogram-bad-type.c) piglit_add_executable (useshaderprogram-bad-program useshaderprogram-bad-program.c) piglit_add_executable (useshaderprogram-flushverts-1 useshaderprogram-flushverts-1.c) +piglit_add_executable (version-mixing version-mixing.c) # vim: ft=cmake: diff --git a/tests/shaders/version-mixing.c b/tests/shaders/version-mixing.c new file mode 100644 index 000..be84812 --- /dev/null +++ b/tests/shaders/version-mixing.c @@ -0,0 +1,264 @@ +/* + * Copyright © 2013 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. + */ + +/** \file + * + * Test that any desktop GLSL version may be linked with any other + * desktop GLSL version. + * + * From the GLSL 4.30 spec, section 3.3 (Preprocessor): + * + * Shaders for the core or compatibility profiles that declare + * different versions can be linked together. + * + * This is a deliberate relaxation of the cross-version linking rules + * from previous versions of the GLSL spec (which prohibited some + * combinations of GLSL versions from being linked together). It was + * made because existing implementations didn't follow the old + * cross-version linking rules (see Khronos bug 8463). So it seems + * reasonable to expect all implementations to follow the new relaxed + * rules. + * + * This test can be run in two ways: interstage and intrastage. + * interstage checks that a vertex shader of one version can be + * linked with a fragment shader of another version. intrastage + * checks that two vertex shaders of different versions can be linked + * together. + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.supports_gl_core_version = 31; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *interstage_vs = + #version %d\n + \n + void main()\n + {\n + gl_Position = vec4(0.0);\n + }\n; + +static const char *interstage_fs = + #version %d\n + \n + void main()\n + {\n + gl_FragColor = vec4(0.0);\n + }\n; + +static const char *intrastage_vs1 = + #version %d\n + \n + void f();\n + void main()\n + {\n + f();\n + }\n; + +static const char *intrastage_vs2 = + #version %d\n + \n + void f()\n + {\n + gl_Position = vec4(0.0);\n + }\n; + +static int all_glsl_versions[] = { + 110, 120, 130, 140, 150, 330, 400, 410, 420, 430, 440 +}; + + +static void +print_usage_and_exit(const char *prog_name) +{ + printf(Usage: %s subtest\n +
Re: [Piglit] [RFC PATCH] Test that in/out qualifiers are required when redeclaring gl_ClipDistance.
On 16 October 2013 00:26, Jordan Justen jljus...@gmail.com wrote: On Tue, Oct 8, 2013 at 11:29 AM, Paul Berry stereotype...@gmail.com wrote: Although it is not explicitly stated in the GLSL spec, all examples of redeclaring built-in in/out variables (such as gl_ClipDistance) include the in or out qualifier, so it seems like failure to do so should cause a compile error. At present: - Mesa (as of commit a50c5f8) does not generate an error. - The NVIDIA proprietary driver for Linux (version 313.18) does not generate an error; however, if gl_ClipDistance is redeclared in the fragment shader without specifying the in keyword, it fails to work properly. By 'fails to work properly', do you mean that it is unlikely that an app could be relying on this behavior? If so, it seems fine to add this test and make mesa generate a compile error. Without the in keyword, gl_ClipDistance receives garbage data. So yeah, I think it's unlikely that there's an app out there that relies on this. Regarding 'out' with the VS, do you think you've tested it enough to be sure that an app also could not accidentally be relying on this behavior? Unfortunately, on NVIDIA, forgetting out when redeclaring gl_ClipDistance in the VS doesn't appear to lead to any problems. So I can't rule out the possibility that an app out there somewhere relies on it. If we are pretty confident that apps won't break, then Reviewed-by: Jordan Justen jordan.l.jus...@intel.com Also, perhaps we should log a spec bug to ask the spec to clarify this? IMHO, the intent is already clear from the fact that all the redeclaration examples in the spec include the in/out qualifier. The fact that the NVIDIA compiler sometimes misbehaves if in/out is absent seems like adequate confirmation to me. Spec bugs frequently take weeks or months to get resolved, so I guess I'm having trouble convincing myself that it's worth it in this case. Anyone else want to weigh in with an opinion on this? Idr? -Jordan --- .../clip-distance-redeclare-without-inout.frag | 21 + .../clip-distance-redeclare-without-inout.vert | 21 + 2 files changed, 42 insertions(+) create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag new file mode 100644 index 000..60f0650 --- /dev/null +++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.30 + * check_link: true + * [end config] + * + * Although it is not explicitly stated in the GLSL spec, in all + * examples, redeclarations of built-in variables (such as + * gl_ClipDistance) preserve the in/out qualifiers. + * + * This test verifies that a shader is rejected if it tries to + * redeclare gl_ClipDistance without an in/out qualifier. + */ +#version 130 + +float gl_ClipDistance[3]; + +void main() +{ + gl_FragColor = vec4(0.0); +} diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert new file mode 100644 index 000..d385cc7 --- /dev/null +++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.30 + * check_link: true + * [end config] + * + * Although it is not explicitly stated in the GLSL spec, in all + * examples, redeclarations of built-in variables (such as + * gl_ClipDistance) preserve the in/out qualifiers. + * + * This test verifies that a shader is rejected if it tries to + * redeclare gl_ClipDistance without an in/out qualifier. + */ +#version 130 + +float gl_ClipDistance[3]; + +void main() +{ + gl_Position = vec4(0.0); +} -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [RFC PATCH] Test that in/out qualifiers are required when redeclaring gl_ClipDistance.
On 16 October 2013 13:50, Ian Romanick i...@freedesktop.org wrote: On 10/16/2013 01:46 PM, Ian Romanick wrote: On 10/16/2013 07:43 AM, Paul Berry wrote: On 16 October 2013 00:26, Jordan Justen jljus...@gmail.com wrote: Also, perhaps we should log a spec bug to ask the spec to clarify this? IMHO, the intent is already clear from the fact that all the redeclaration examples in the spec include the in/out qualifier. The fact that the NVIDIA compiler sometimes misbehaves if in/out is absent seems like adequate confirmation to me. Spec bugs frequently take weeks or months to get resolved, so I guess I'm having trouble convincing myself that it's worth it in this case. Anyone else want to weigh in with an opinion on this? Idr? I think the spec is already clear, and NVIDIA's implementation is just buggy. Arg... but let me be clear. It is already explicitly an error to do: in vec4 foo; vec4 foo; or vec4 foo; centroid in vec4 foo; or in vec4 foo; centroid in vec4 foo; // this one is okay. Actually my reading of GLSL 1.50 is that only built-ins can be redeclared for purposes of changing their interpolation qualifiers. So I think this is illegal too. Does that change your opinion? vec4 foo; // this one is not. There is no reason to believe built-in variables should have a different set of rules. Right? ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [RFC PATCH] Test that in/out qualifiers are required when redeclaring gl_ClipDistance.
On 16 October 2013 14:19, Ian Romanick i...@freedesktop.org wrote: On 10/16/2013 02:04 PM, Paul Berry wrote: On 16 October 2013 13:50, Ian Romanick i...@freedesktop.org mailto:i...@freedesktop.org wrote: On 10/16/2013 01:46 PM, Ian Romanick wrote: On 10/16/2013 07:43 AM, Paul Berry wrote: On 16 October 2013 00:26, Jordan Justen jljus...@gmail.com mailto:jljus...@gmail.com wrote: Also, perhaps we should log a spec bug to ask the spec to clarify this? IMHO, the intent is already clear from the fact that all the redeclaration examples in the spec include the in/out qualifier. The fact that the NVIDIA compiler sometimes misbehaves if in/out is absent seems like adequate confirmation to me. Spec bugs frequently take weeks or months to get resolved, so I guess I'm having trouble convincing myself that it's worth it in this case. Anyone else want to weigh in with an opinion on this? Idr? I think the spec is already clear, and NVIDIA's implementation is just buggy. Arg... but let me be clear. It is already explicitly an error to do: in vec4 foo; vec4 foo; or vec4 foo; centroid in vec4 foo; or in vec4 foo; centroid in vec4 foo; // this one is okay. Actually my reading of GLSL 1.50 is that only built-ins can be redeclared for purposes of changing their interpolation qualifiers. So I think this is illegal too. Does that change your opinion? Maybe... I would have to dig around with the spec. Is there some specific text you had in mind? 3.7 (Identifiers) says: However, as noted in the specification, there are some cases where previously declared variables can be redeclared to change or add some property, and predeclared gl_ names are allowed to be redeclared in a shader only for these specific purposes. More generally, it is an error to redeclare a variable, including those starting gl_. And the text that allows redeclaration to change interpolation qualifiers is in section 4.3.9.1 (Redeclaring Built-in Interpolation Variables in the Compatibility Profile). It begins: The following predeclared variables can be redeclared with an interpolation qualifier when using the compatibility profile: I can't find any text saying that non-built-in variables can be redeclared with an interpolation qualifier, so the text from 3.7 saying that it's an error to redeclare a variable seems like it applies. If this is in fact the case, then NVIDIA may well be following the letter of the spec in the fragment shader. Redeclaring gl_ClipDistance without in makes it a plain global variable... that is never initialized, so reading results in garbage data. Lol. I suspect this is what the driver is doing, but I don't see any spec text indicating that it's ok. Changing an input into an ordinary global is definitely *not* one of the specific purposes that the spec outlines where redeclaration is allowed. At the moment I'm fairly convinced that redeclaring gl_ClipDistance to remove in should be an error, and NVIDIA's compiler is just failing to detect the error condition and going off into the weeds. vec4 foo; // this one is not. There is no reason to believe built-in variables should have a different set of rules. Right? ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] Test a corner case involving arrays, structs, and interface blocks.
This patch exercises the same corner case as https://bugs.freedesktop.org/show_bug.cgi?id=70368. --- .../interface-block-struct-nesting.shader_test | 54 ++ 1 file changed, 54 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test diff --git a/tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test b/tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test new file mode 100644 index 000..a51b8b4 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/interface-block-struct-nesting.shader_test @@ -0,0 +1,54 @@ +# This test exercises a particular corner case involving interface +# blocks and structs which is broken as of Mesa 975c6ce. +# +# The corner case occurs when an unnamed interface block contains a +# struct (or an array of structs), and the struct contains an array. + +[require] +GLSL = 1.50 + +[vertex shader] +struct A { + float b[2]; +}; +out Block { + A a; + A aa[2]; +}; +in vec4 piglit_vertex; + +void main() +{ + gl_Position = piglit_vertex; + a.b[0] = 1.0; + a.b[1] = 2.0; + aa[0].b[0] = 3.0; + aa[0].b[1] = 4.0; + aa[1].b[0] = 5.0; + aa[1].b[1] = 6.0; +} + +[fragment shader] +struct A { + float b[2]; +}; +in Block { + A a; + A aa[2]; +}; + +void main() +{ + bool ok = true; + if (a.b[0] != 1.0) ok = false; + if (a.b[1] != 2.0) ok = false; + if (aa[0].b[0] != 3.0) ok = false; + if (aa[0].b[1] != 4.0) ok = false; + if (aa[1].b[0] != 5.0) ok = false; + if (aa[1].b[1] != 6.0) ok = false; + gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] gs: Test redeclaring either gl_PerVertex in or out, and using both.
--- .../gs-redeclares-pervertex-in-only.shader_test| 55 ++ .../gs-redeclares-pervertex-out-only.shader_test | 53 + 2 files changed, 108 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test create mode 100644 tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test diff --git a/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test new file mode 100644 index 000..f28bd7f --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-in-only.shader_test @@ -0,0 +1,55 @@ +# This test verifies that a geometry shader can redeclare just the +# gl_PerVertex input block, but still use members of the gl_PerVertex +# output block (whether or not those members were included in the +# redeclaration of the input block). + +[require] +GLSL = 1.50 + +[vertex shader] +in vec4 piglit_vertex; +out gl_PerVertex { + vec4 gl_Position; +}; + +void main() +{ + gl_Position = piglit_vertex; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; +} gl_in[]; + +void main() +{ + for (int i = 0; i 3; i++) { +gl_Position = gl_in[i].gl_Position; +gl_ClipDistance[0] = 1.0; +EmitVertex(); + } +} + +[fragment shader] +void main() +{ + if (gl_ClipDistance[0] == 1.0) +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); + else +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} + +[test] +# Since the fragment shader's gl_ClipDistance array is only defined +# for elements that have clipping enabled, we need to enable clip +# plane 0. Fortunately the values we use for gl_ClipDistance are +# always positive, so no pixels are actually clipped. +enable GL_CLIP_PLANE0 +clear color 0.0 0.0 0.0 0.0 +clear +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test new file mode 100644 index 000..e3f3dbd --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-redeclares-pervertex-out-only.shader_test @@ -0,0 +1,53 @@ +# This test verifies that a geometry shader can redeclare just the +# gl_PerVertex output block, but still use members of the gl_PerVertex +# input block (whether or not those members were included in the +# redeclaration of the output block). + +[require] +GLSL = 1.50 + +[vertex shader] +in vec4 piglit_vertex; + +void main() +{ + gl_Position = piglit_vertex; + gl_PointSize = dot(piglit_vertex, vec4(1.0)); +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +out gl_PerVertex { + vec4 gl_Position; +}; +out vec4 color; + +void main() +{ + bool ok = true; + for (int i = 0; i 3; i++) { +if (gl_in[i].gl_PointSize != dot(gl_in[i].gl_Position, vec4(1.0))) + ok = false; + } + for (int i = 0; i 3; i++) { +gl_Position = gl_in[i].gl_Position; +color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +EmitVertex(); + } +} + +[fragment shader] +in vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] gs: Fix geometry layout case insensitivity tests.
These tests use check_link: true, which means that they each need to specify a complete set of geometry shader layout qualifiers in order to pass. --- tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-in.geom | 1 + tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-max-vert.geom | 2 ++ tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-out.geom | 2 ++ 3 files changed, 5 insertions(+) diff --git a/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-in.geom b/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-in.geom index d5d8ec5..23a5d26 100644 --- a/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-in.geom +++ b/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-in.geom @@ -11,6 +11,7 @@ #version 150 layout(TriAngleS) in; +layout(triangle_strip, max_vertices = 3) out; void main() { diff --git a/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-max-vert.geom b/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-max-vert.geom index 4838b33..9632127 100644 --- a/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-max-vert.geom +++ b/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-max-vert.geom @@ -11,6 +11,8 @@ #version 150 layout(maX_VERTices = 50) out; +layout(triangles) in; +layout(triangle_strip) out; void main() { diff --git a/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-out.geom b/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-out.geom index eaadf8a..de8f25f 100644 --- a/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-out.geom +++ b/tests/spec/glsl-1.50/compiler/layout-not-case-sensitive-out.geom @@ -11,6 +11,8 @@ #version 150 layout(pOiNtS) out; +layout(triangles) in; +layout(max_vertices = 3) out; void main() { -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/4] GS: Test that geometry shader input/output layout qualifiers only compile if valid
On 30 September 2013 15:38, Nicholas Mack nichm...@gmail.com wrote: v2: Tests check against list of valid layouts instead of invalid layouts Last time I reviewed this patch I pointed out that it's not necessary to have vertex and fragment shaders in the test, since the error is supposed to be detected at compile time. It looks like you've removed the fragment shader but not the vertex shader. Can you please also remove the vertex shader (and the linking step)? Other comments below. --- tests/all.tests| 12 ++ .../glsl-1.50/execution/geometry/CMakeLists.gl.txt | 2 + .../geometry/gs-input-layout-qualifiers.c | 128 + .../geometry/gs-output-layout-qualifiers.c | 125 4 files changed, 267 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-output-layout-qualifiers.c diff --git a/tests/all.tests b/tests/all.tests index d0085d3..f66d9f9 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -999,6 +999,18 @@ for prim_type in ['GL_TRIANGLE_STRIP', 'GL_TRIANGLE_STRIP_ADJACENCY']: 'glsl-1.50-geometry-tri-strip-ordering-with-prim-restart {0} {1}'.format( prim_type, restart_index)) +for input_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-input-layout-qualifiers {0}'.format( +input_layout)) + +for output_layout in ['points', 'lines', 'lines_adjacency', 'triangles', + 'triangles_adjacency', 'line_strip', 'triangle_strip']: +add_concurrent_test(spec['glsl-1.50'], +'glsl-1.50-gs-output-layout-qualifiers {0}'.format( +output_layout)) + spec['glsl-3.30'] = Group() import_glsl_parser_tests(spec['glsl-3.30'], os.path.join(testsDir, 'spec', 'glsl-3.30'), diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt index f168f0a..6fc1986 100644 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt @@ -18,3 +18,5 @@ piglit_add_executable (glsl-1.50-gs-emits-too-few-verts gs-emits-too-few-verts.c piglit_add_executable (glsl-1.50-getshaderiv-may-return-GS getshaderiv-may-return-GS.c) piglit_add_executable (glsl-1.50-gs-mismatch-prim-type gs-mismatch-prim-type.c) piglit_add_executable (glsl-1.50-query-gs-prim-types query-gs-prim-types.c) +piglit_add_executable (glsl-1.50-gs-input-layout-qualifiers gs-input-layout-qualifiers.c) +piglit_add_executable (glsl-1.50-gs-output-layout-qualifiers gs-output-layout-qualifiers.c) diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c new file mode 100644 index 000..82ec9c5 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-input-layout-qualifiers.c @@ -0,0 +1,128 @@ +/** + * Copyright © 2013 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. + */ + +/** + * Test that geometry shaders only compile with valid input layout qualifiers + * + * Section 4.3.8.1(Input Layout Qualifiers) of the GLSL 1.50 spec says: + * Geometry shaders allow input layout qualifiers only on the interface + * qualifier in, not on an input block, block member, or variable. The layout + * qualifier identifiers for geometry shader inputs are + * points + * lines + * lines_adjacency + * triangles + *
Re: [Piglit] [PATCH 4/4 v2] GS: Test that max_vertices cannot be set to INT_MAX
On 30 September 2013 15:38, Nicholas Mack nichm...@gmail.com wrote: v2: Add comment I sent a comment on patch 1. Patches 2-4 are: Reviewed-by: Paul Berry stereotype...@gmail.com Reviewed-by: Paul Berry stereotype...@gmail.com --- .../compiler/layout-max-verts-limited.geom | 23 ++ 1 file changed, 23 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom diff --git a/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom new file mode 100644 index 000..9b763a7 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/layout-max-verts-limited.geom @@ -0,0 +1,23 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Section 4.3.8 (Output Layout Qualifiers) of the GLSL 1.50 spec says: +// It is an error for the maximum number of vertices to be greater than +// gl_MaxGeometryOutputVertices. +// +// Unfortunately, we can't easlily try to set max_vertices to +// gl_MaxGeometryOutputVertices+1, since max_vertices= must be +// followed by an integer-constant (not a constant expression), so as +// a stop gap, we just verify that setting max_vertices = INT_MAX +// leads to an error. + +#version 150 + +layout(max_vertices = 2147483647) out; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/3] sso: Test mixing separable and non-separable programs in various ways
+ }\n; + bool pass = true; + + piglit_require_extension(GL_ARB_separate_shader_objects); + + /* Standard program (ie not separate) */ + prog = piglit_build_simple_program(vs_source, fs_source_r); + + /* Now create program for the pipeline program */ + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source); + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source_g); + + vs_prog = glCreateProgram(); + glProgramParameteri(vs_prog, GL_PROGRAM_SEPARABLE, GL_TRUE); + glAttachShader(vs_prog, vs); + glLinkProgram(vs_prog); + pass = piglit_link_check_status(vs_prog) pass; + glDeleteShader(vs); + + fs_prog = glCreateProgram(); + glProgramParameteri(fs_prog, GL_PROGRAM_SEPARABLE, GL_TRUE); + glAttachShader(fs_prog, fs); + glLinkProgram(fs_prog); + pass = piglit_link_check_status(fs_prog) pass; + glDeleteShader(fs); + + glGenProgramPipelines(1, pipe); + glUseProgramStages(pipe, GL_VERTEX_SHADER_BIT, vs_prog); + glUseProgramStages(pipe, GL_FRAGMENT_SHADER_BIT, fs_prog); + glActiveShaderProgram(pipe, fs_prog); + pass = piglit_program_pipeline_check_status(pipe) pass; + + /* Sanity check initial state. +*/ + pass = check_GetInteger_value(GL_PROGRAM_PIPELINE_BINDING, 0) pass; + pass = check_GetInteger_value(GL_CURRENT_PROGRAM, 0) pass; + + pass = piglit_check_gl_error(GL_NO_ERROR) pass; + + /* If the set up went bad, none of the subtests will work. Bail out +* now. +*/ + if (!pass) + piglit_report_result(PIGLIT_FAIL); +} Finally, this comment, from my previous review, doesn't seem to have been addressed: The only parts of this test that rely on compatibility behaviour are the VS's use of gl_Vertex, and this final sanity test. It seems to me that the final sanity test is tangential to the primary purpose of the test; I'd rather see this subtest removed, and gl_Vertex changed to a user-defined vertex attribute, so that we can add supports_gl_core_version to the config block. With those issues addressed, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/3] sso: Verify that rendezvous by location also works
On 1 October 2013 18:22, Ian Romanick i...@freedesktop.org wrote: From: Ian Romanick ian.d.roman...@intel.com Separate shader objects can either connect outputs to inputs by matching names (rendezvous by name) or by assigning explicit locations via the layout(location=...) (rendezvous by location). This is a simple test that a vertex shader with a different name than the fragment shader input can by matched by the location. v2: Fix some dumb bugs in the test. Use multiple values to ensure we're not matching using rendezvous-by-dumb-luck. v3: * Fix a bug in the ordering of cross product parameters. Noticed by Paul. * Add another test case where the fragment shader variables are listed in a different order. Add some explanitory text with rationalization for the tests chosen. * Dynamically set the #version line depending on driver support. This works around some bugs in the NVIDIA driver noticed by Paul. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Reviewed-by: Paul Berry stereotype...@gmail.com --- tests/all.tests| 1 + .../arb_separate_shader_objects/CMakeLists.gl.txt | 1 + .../rendezvous_by_location.c | 202 + 3 files changed, 204 insertions(+) create mode 100644 tests/spec/arb_separate_shader_objects/rendezvous_by_location.c diff --git a/tests/all.tests b/tests/all.tests index e0cdc8b..33556af 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1277,6 +1277,7 @@ arb_separate_shader_objects['IsProgramPipeline'] = concurrent_test('arb_separate arb_separate_shader_objects['UseProgramStages - non-separable program'] = concurrent_test('arb_separate_shader_object-UseProgramStages-non-separable') arb_separate_shader_objects['Mix BindProgramPipeline and UseProgram'] = concurrent_test('arb_separate_shader_object-mix_pipeline_useprogram') arb_separate_shader_objects['ProgramUniform coverage'] = concurrent_test('arb_separate_shader_object-ProgramUniform-coverage') +arb_separate_shader_objects['Rendezvous by location'] = plain_test('arb_separate_shader_object-rendezvous_by_location -fbo') arb_separate_shader_objects['ValidateProgramPipeline'] = concurrent_test('arb_separate_shader_object-ValidateProgramPipeline') # Group ARB_sampler_objects diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt index 0ed3e2f..32a28ba 100644 --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt @@ -13,5 +13,6 @@ piglit_add_executable (arb_separate_shader_object-GetProgramPipelineiv GetProgra piglit_add_executable (arb_separate_shader_object-IsProgramPipeline IsProgramPipeline.c) piglit_add_executable (arb_separate_shader_object-mix_pipeline_useprogram mix_pipeline_useprogram.c) piglit_add_executable (arb_separate_shader_object-ProgramUniform-coverage ProgramUniform-coverage.c) +piglit_add_executable (arb_separate_shader_object-rendezvous_by_location rendezvous_by_location.c) piglit_add_executable (arb_separate_shader_object-UseProgramStages-non-separable UseProgramStages-non-separable.c) piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline ValidateProgramPipeline.c) diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c new file mode 100644 index 000..4193ea5 --- /dev/null +++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c @@ -0,0 +1,202 @@ +/* + * Copyright © 2013 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. + */ + +/** + * \file rendezvous_by_location.c + * Simple test for separate shader objects that use rendezvous-by-location
Re: [Piglit] [PATCH 3/3] sso: Combine 20 vertex shaders and 20 fragment shaders in various ways.
of combinations of vertex shader programs and +* fragment shader programs that will be used together. This is all +* the possible combinations. The next step is to shuffle list so +* that there's (hopefully) no pattern to the access combination... to +* uncover driver bugs. +*/ + idx = 0; + for (i = 0; i ARRAY_SIZE(vs_programs); i++) { + for (j = 0; j ARRAY_SIZE(fs_programs); j++) { + combinations[idx].row = j; + combinations[idx].col = i; + idx++; + } + } + + for (i = 0; i (5 * ARRAY_SIZE(combinations)); i++) { + /* Pick a random element from the array. +*/ + const unsigned src = rand() % ARRAY_SIZE(combinations); + + /* Pick a random element from the array that is not the same +* as the previous element. This is done by picking a second +* number on the range [1, ARRAY_SIZE(combinations) - 2] and +* adding it (using modular addition) to the first. +*/ + const unsigned delta = + (rand() % (ARRAY_SIZE(combinations) - 1)) + 1; + const unsigned dst = (src + delta) % ARRAY_SIZE(combinations); + + /* Exchange the two selected elements. +*/ + const struct combination temp = combinations[dst]; + combinations[dst] = combinations[src]; + combinations[src] = temp; + } A less ad-hoc algorithm for shuffling an array is: for (i = ARRAY_SIZE(combinations); i 1; i--) { j = rand() % i; if (j != i - 1) swap elements j and i - 1 } Neglecting deficiencies in rand(), this algorithm produces all possible permutations with equal probability. With the above two changes, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com +} diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt index 32a28ba..2e2e1b8 100644 --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt @@ -9,6 +9,7 @@ link_libraries ( ${OPENGL_glu_LIBRARY} ) +piglit_add_executable (arb_separate_shader_object-400-combinations 400-combinations.c) 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-mix_pipeline_useprogram mix_pipeline_useprogram.c) -- 1.8.1.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] sso: Add compile tests for the location layout qualifier
On 2 October 2013 11:04, Ian Romanick i...@freedesktop.org wrote: From: Ian Romanick ian.d.roman...@intel.com NVIDIA (304.64 on GTX 260) fails all of the 1.10, 1.20, and 1.30 tests because they fail to recognize the layout keyword at all. Paul has suggested that adding #extension GL_ARB_fragment_coord_conventions: require may work around this issue in some cases. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: Wen Su w...@nvidia.com Cc: Paul Berry stereotype...@gmail.com --- Paul, Are there other geometry shader tests that I should add? This patch is: Reviewed-by: Paul Berry stereotype...@gmail.com I don't see any need to add more geometry shader tests at the moment. .../compiler/1.10/layout-location.frag | 14 ++ .../compiler/1.10/layout-location.vert | 15 +++ .../compiler/1.20/layout-location.frag | 14 ++ .../compiler/1.20/layout-location.vert | 15 +++ .../compiler/1.30/layout-location.frag | 14 ++ .../compiler/1.30/layout-location.vert | 15 +++ .../compiler/1.40/layout-location.frag | 15 +++ .../compiler/1.40/layout-location.vert | 16 .../compiler/1.50/layout-location.frag | 15 +++ .../compiler/1.50/layout-location.geom | 22 ++ .../compiler/1.50/layout-location.vert | 16 11 files changed, 171 insertions(+) create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.frag create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.vert create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.frag create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.vert create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.30/layout-location.frag create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.30/layout-location.vert create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.40/layout-location.frag create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.40/layout-location.vert create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.50/layout-location.frag create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.50/layout-location.geom create mode 100644 tests/spec/arb_separate_shader_objects/compiler/1.50/layout-location.vert diff --git a/tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.frag b/tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.frag new file mode 100644 index 000..b91faa1 --- /dev/null +++ b/tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.frag @@ -0,0 +1,14 @@ +// [config] +// expect_result: pass +// glsl_version: 1.10 +// require_extensions: GL_ARB_separate_shader_objects +// [end config] +#version 110 +#extension GL_ARB_separate_shader_objects: require + +layout(location = 0) in vec4 a; + +void main() +{ +gl_FragColor = a; +} diff --git a/tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.vert b/tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.vert new file mode 100644 index 000..ecc8e78 --- /dev/null +++ b/tests/spec/arb_separate_shader_objects/compiler/1.10/layout-location.vert @@ -0,0 +1,15 @@ +// [config] +// expect_result: pass +// glsl_version: 1.10 +// require_extensions: GL_ARB_separate_shader_objects +// [end config] +#version 110 +#extension GL_ARB_separate_shader_objects: require + +layout(location = 0) out vec4 a; + +void main() +{ +gl_Position = gl_Vertex; +a = vec4(0); +} diff --git a/tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.frag b/tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.frag new file mode 100644 index 000..0090a9f --- /dev/null +++ b/tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.frag @@ -0,0 +1,14 @@ +// [config] +// expect_result: pass +// glsl_version: 1.20 +// require_extensions: GL_ARB_separate_shader_objects +// [end config] +#version 120 +#extension GL_ARB_separate_shader_objects: require + +layout(location = 0) in vec4 a; + +void main() +{ +gl_FragColor = a; +} diff --git a/tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.vert b/tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.vert new file mode 100644 index 000..d432b81 --- /dev/null +++ b/tests/spec/arb_separate_shader_objects/compiler/1.20/layout-location.vert @@ -0,0 +1,15 @@ +// [config] +// expect_result: pass +// glsl_version: 1.20 +// require_extensions: GL_ARB_separate_shader_objects +// [end config] +#version 120
Re: [Piglit] [PATCH] built-in-constants: don't try to create GS with version 150.
On 14 October 2013 12:44, Ian Romanick i...@freedesktop.org wrote: On 10/12/2013 10:11 AM, Paul Berry wrote: Previously, built-in-constants looked at required_glsl_version to determine what to include in the #version directive, but it looked at glsl_version (the maximum version supported by the implementation) to decide whether to test geometry shaders. As a result, it when testing a built-in constant whose required_glsl_version was less than 150, it would try to create a geometry shader using a #version directive less than 150, leading to GL errors. This patch prevents the problem by only testing geometry shaders when required_glsl_version = 150. It's actually even more broken than that. :( Sorry about that. If required_glsl_version or glsl_version is 300 (for OpenGL ES 3.0), it will also try to create a geometry shader. How about if (required_glsl_version = 150 required_glsl_version != 300) instead? Oops, good call. With that fixed, do I have your r-b? --- tests/shaders/built-in-constants.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/shaders/built-in-constants.c b/tests/shaders/built-in-constants.c index 06850b5..3a2a784 100644 --- a/tests/shaders/built-in-constants.c +++ b/tests/shaders/built-in-constants.c @@ -350,7 +350,7 @@ piglit_init(int argc, char **argv) test_vs = glCreateShader(GL_VERTEX_SHADER); test_fs = glCreateShader(GL_FRAGMENT_SHADER); - if (glsl_version = 150) + if (required_glsl_version = 150) test_gs = glCreateShader(GL_GEOMETRY_SHADER); for (i = 0; i num_tests; i++) { ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [RFC PATCH] Test that in/out qualifiers are required when redeclaring gl_ClipDistance.
Although it is not explicitly stated in the GLSL spec, all examples of redeclaring built-in in/out variables (such as gl_ClipDistance) include the in or out qualifier, so it seems like failure to do so should cause a compile error. At present: - Mesa (as of commit a50c5f8) does not generate an error. - The NVIDIA proprietary driver for Linux (version 313.18) does not generate an error; however, if gl_ClipDistance is redeclared in the fragment shader without specifying the in keyword, it fails to work properly. --- .../clip-distance-redeclare-without-inout.frag | 21 + .../clip-distance-redeclare-without-inout.vert | 21 + 2 files changed, 42 insertions(+) create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag new file mode 100644 index 000..60f0650 --- /dev/null +++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.30 + * check_link: true + * [end config] + * + * Although it is not explicitly stated in the GLSL spec, in all + * examples, redeclarations of built-in variables (such as + * gl_ClipDistance) preserve the in/out qualifiers. + * + * This test verifies that a shader is rejected if it tries to + * redeclare gl_ClipDistance without an in/out qualifier. + */ +#version 130 + +float gl_ClipDistance[3]; + +void main() +{ + gl_FragColor = vec4(0.0); +} diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert new file mode 100644 index 000..d385cc7 --- /dev/null +++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert @@ -0,0 +1,21 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.30 + * check_link: true + * [end config] + * + * Although it is not explicitly stated in the GLSL spec, in all + * examples, redeclarations of built-in variables (such as + * gl_ClipDistance) preserve the in/out qualifiers. + * + * This test verifies that a shader is rejected if it tries to + * redeclare gl_ClipDistance without an in/out qualifier. + */ +#version 130 + +float gl_ClipDistance[3]; + +void main() +{ + gl_Position = vec4(0.0); +} -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2] gs: Don't try to use gl_PerVertex when redeclaring fragment shader inputs.
In commit 5b1dff3 (Geometry shaders: Test gl_ClipDistance input (GLSL 1.50)) I accidentally used this syntax to redeclare the gl_ClipDistance fragment shader input: in gl_PerVertex { float gl_ClipDistance[8]; }; This is incorrect--gl_PerVertex is only meaningful in vertex and geometry shaders. In fragment shaders gl_ClipDistance isn't in any interface block. v2: don't forget the in keyword. --- .../glsl-1.50/execution/geometry/clip-distance-bulk-copy.shader_test | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/spec/glsl-1.50/execution/geometry/clip-distance-bulk-copy.shader_test b/tests/spec/glsl-1.50/execution/geometry/clip-distance-bulk-copy.shader_test index ef21260..1086a07 100644 --- a/tests/spec/glsl-1.50/execution/geometry/clip-distance-bulk-copy.shader_test +++ b/tests/spec/glsl-1.50/execution/geometry/clip-distance-bulk-copy.shader_test @@ -56,9 +56,7 @@ void main() [fragment shader] #version 150 -in gl_PerVertex { - float gl_ClipDistance[8]; -}; +in float gl_ClipDistance[8]; in float offset_to_fs; void main() -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared.
On 8 October 2013 11:40, Jordan Justen jljus...@gmail.com wrote: On Wed, Oct 2, 2013 at 4:45 PM, Paul Berry stereotype...@gmail.com wrote: --- .../redeclare-pervertex-out-subset-gs.shader_test | 77 ++ ...redeclare-pervertex-subset-vs-to-gs.shader_test | 113 + .../redeclare-pervertex-subset-vs.shader_test | 73 + 3 files changed, 263 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test create mode 100644 tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test create mode 100644 tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test diff --git a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test new file mode 100644 index 000..baaa0f1 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test @@ -0,0 +1,77 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# The gl_PerVertex block can be redeclared in a shader to explicitly +# indicate what subset of the fixed pipeline interface will be +# used. This is necessary to establish the interface between multiple +# programs. For example: +# +# out gl_PerVertex { +# vec4 gl_Position;// will use gl_Position +# float gl_PointSize; // will use gl_PointSize +# vec4 t; // error, only gl_PerVertex members allowed Not a big deal, but the bad example of 't' here seems to be left over from patch 3's comment. I see it below again. Since the example text is a literal quote from the spec, I think I'll leave it as is, but I've added notes below it to clarify that in these particular tests, we're not exercising the bad vec4 t case because we're testing that gl_PerVertex functions properly when it's correctly redeclared. So far 1-6 Reviewed-by: Jordan Justen jordan.l.jus...@intel.com Thanks! -Jordan +# }; // no other members of gl_PerVertex will be used +# +# This establishes the output interface the shader will use with the +# subsequent pipeline stage. It must be a subset of the built-in members +# of gl_PerVertex. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# This test verifies that the geometry shader can redeclare gl_PerVertex +# specifying a subset of the built-in values (gl_Position and +# gl_PointSize), and the subset works. +# +# This test draws a small point in the left half of the window and a +# large point in the right half. Then it probes the region around +# each point to ensure that the point on the right is larger. +# +# NOTE: since gl_PointSize is expressed in pixels, but gl_Position is +# expressed relative to the window size, this test is dependent upon +# the window size. It assumes a window size of 250x250, which is the +# shader_runner default. + +[require] +GLSL = 1.50 + +[vertex shader] +void main() +{ +} + +[geometry shader] +layout(points) in; +layout(points, max_vertices = 2) out; + +out gl_PerVertex { +vec4 gl_Position; +float gl_PointSize; +}; + +void main() +{ + gl_Position = vec4(-0.5, 0.0, 0.0, 1.0); + gl_PointSize = 1.0; + EmitVertex(); + gl_Position = vec4(0.5, 0.0, 0.0, 1.0); + gl_PointSize = 13.0; + EmitVertex(); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +enable GL_PROGRAM_POINT_SIZE +draw arrays GL_POINTS 0 1 +relative probe rgba (0.24, 0.5) (0.0, 0.0, 0.0, 0.0) +relative probe rgba (0.26, 0.5) (0.0, 0.0, 0.0, 0.0) +relative probe rgba (0.74, 0.5) (1.0, 1.0, 1.0, 1.0) +relative probe rgba (0.76, 0.5) (1.0, 1.0, 1.0, 1.0) diff --git a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test new file mode 100644 index 000..7472762 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test @@ -0,0 +1,113 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# The gl_PerVertex block can be redeclared in a shader to explicitly +# indicate what subset of the fixed pipeline interface will be +# used. This is necessary to establish the interface between multiple +# programs. For example: +# +# out gl_PerVertex { +# vec4 gl_Position;// will use gl_Position +# float gl_PointSize; // will use gl_PointSize +# vec4 t; // error, only gl_PerVertex members allowed +# }; // no other members
Re: [Piglit] [PATCH] geometry-end-primitive-optional-with-points-out: Require GLSL 1.50.
On 8 October 2013 11:56, Vinson Lee v...@freedesktop.org wrote: Signed-off-by: Vinson Lee v...@freedesktop.org --- .../geometry/geometry-end-primitive-optional-with-points-out.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c index d6c4b44..13fb7eb 100644 --- a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c +++ b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c @@ -93,6 +93,8 @@ piglit_init(int argc, char **argv) GLuint vs = 0, gs = 0, fs = 0; GLuint vertIndex; + piglit_require_GLSL_version(150); + prog = glCreateProgram(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gstext); -- 1.8.1.2 The test already specifies config.supports_gl_compat_version = 32; config.supports_gl_core_version = 32; and GL 3.2 requires GLSL 1.50, so it seems to me that this shouldn't be necessary. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 14/14] Test that gl_in may be redeclared with an array size.
On 8 October 2013 12:17, Jordan Justen jljus...@gmail.com wrote: Series Reviewed-by: Jordan Justen jordan.l.jus...@intel.com I thought I might see a positive .geom with *both* per-vertex in out. Too trivial? That's a good idea. I'll do that as a follow-up. On Wed, Oct 2, 2013 at 4:45 PM, Paul Berry stereotype...@gmail.com wrote: --- ...gs-redeclares-pervertex-in-with-array-size.geom | 45 ++ 1 file changed, 45 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-array-size.geom diff --git a/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-array-size.geom b/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-array-size.geom new file mode 100644 index 000..f408c62 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-array-size.geom @@ -0,0 +1,45 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// check_link: false +// [end config] +// +// From section 7.1.1 (Compatibility Profile Built-In Language +// Variables) of the GLSL 4.10 spec: +// +// However, when a built-in interface block with an instance name +// is redeclared (e.g., gl_in), the instance name must be included +// in the redeclaration. It is an error to not include the +// built-in instance name or to change its name. For example, +// +// in gl_PerVertex { +// vec4 gl_ClipVertex; +// vec4 gl_FrontColor; +// } gl_in[]; // must be present and must be gl_in[] +// +// Although the example mentions gl_in[], it seems reasonable to +// assume that specifying an array size (e.g. gl_in[3]) is also +// allowed (this is confirmed by tests of the NVIDIA proprietary +// driver for Linux, version 313.18). +// +// Note: although this text appears in a section referring to +// compatibility profile variables, it's clear from context that it's +// meant to apply to any redeclaration of gl_in, whether it is done in +// a compatibility or a core profile. +// +// This appears to be a clarification to the behaviour established for +// gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +// 1.50. + +#version 150 + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; +} gl_in[3]; + +void main() +{ +} -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] gs: Test that a single shader can redeclare both gl_PerVertex input and output.
--- ...gs-redeclares-both-pervertex-blocks.shader_test | 67 ++ 1 file changed, 67 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test diff --git a/tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test b/tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test new file mode 100644 index 000..7b8aafb --- /dev/null +++ b/tests/spec/glsl-1.50/execution/gs-redeclares-both-pervertex-blocks.shader_test @@ -0,0 +1,67 @@ +# This test verifies that a single geometry shader can redeclare both +# the gl_PerVertex input and gl_PerVertex output interface blocks +# without error, and that data is properly exchanged with the vertex +# and fragment shaders. + +[require] +GLSL = 1.50 + +[vertex shader] +out gl_PerVertex { +float gl_PointSize; +}; + +void main() +{ + gl_PointSize = float(gl_VertexID); +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 4) out; + +in gl_PerVertex { + float gl_PointSize; +} gl_in[]; + +out gl_PerVertex { + vec4 gl_Position; +}; + +out vec4 color; + +void main() +{ + const vec4 vertices[4] = vec4[4]( +vec4(-1.0, -1.0, 0.0, 1.0), +vec4(-1.0, 1.0, 0.0, 1.0), +vec4( 1.0, -1.0, 0.0, 1.0), +vec4( 1.0, 1.0, 0.0, 1.0) + ); + + bool pass = true; + for (int i = 0; i 3; i++) { +if (gl_in[i].gl_PointSize != float(i)) + pass = false; + } + + for (int i = 0; i 4; i++) { +color = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); +gl_Position = vertices[i]; +EmitVertex(); + } +} + +[fragment shader] +in vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +draw arrays GL_TRIANGLES 0 3 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] geometry-end-primitive-optional-with-points-out: Require GLSL 1.50.
On 8 October 2013 13:55, Vinson Lee v...@freedesktop.org wrote: On Tue, Oct 8, 2013 at 12:47 PM, Paul Berry stereotype...@gmail.com wrote: On 8 October 2013 11:56, Vinson Lee v...@freedesktop.org wrote: Signed-off-by: Vinson Lee v...@freedesktop.org --- .../geometry/geometry-end-primitive-optional-with-points-out.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c index d6c4b44..13fb7eb 100644 --- a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c +++ b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c @@ -93,6 +93,8 @@ piglit_init(int argc, char **argv) GLuint vs = 0, gs = 0, fs = 0; GLuint vertIndex; + piglit_require_GLSL_version(150); + prog = glCreateProgram(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gstext); -- 1.8.1.2 The test already specifies config.supports_gl_compat_version = 32; config.supports_gl_core_version = 32; and GL 3.2 requires GLSL 1.50, so it seems to me that this shouldn't be necessary. I'm seeing this test fail on swrast instead of reporting a skip. That's strange. When I run this test with LIBGL_ALWAYS_SOFTWARE=1 I get: piglit: info: Failed to create GL 3.2 core context piglit: info: Falling back to GL 3.2 compatibility context piglit: info: Requested a GL 3.2 compatibility context, but actual context version is 2.1 piglit: info: Failed to create GL 3.2 compatibility context piglit: info: Failed to create any GL context PIGLIT: {'result': 'skip' } ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] geometry-end-primitive-optional-with-points-out: Require GLSL 1.50.
On 8 October 2013 15:22, Vinson Lee v...@freedesktop.org wrote: On Tue, Oct 8, 2013 at 2:05 PM, Paul Berry stereotype...@gmail.com wrote: On 8 October 2013 13:55, Vinson Lee v...@freedesktop.org wrote: On Tue, Oct 8, 2013 at 12:47 PM, Paul Berry stereotype...@gmail.com wrote: On 8 October 2013 11:56, Vinson Lee v...@freedesktop.org wrote: Signed-off-by: Vinson Lee v...@freedesktop.org --- .../geometry/geometry-end-primitive-optional-with-points-out.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c index d6c4b44..13fb7eb 100644 --- a/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c +++ b/tests/spec/glsl-1.50/execution/geometry/geometry-end-primitive-optional-with-points-out.c @@ -93,6 +93,8 @@ piglit_init(int argc, char **argv) GLuint vs = 0, gs = 0, fs = 0; GLuint vertIndex; + piglit_require_GLSL_version(150); + prog = glCreateProgram(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gstext); -- 1.8.1.2 The test already specifies config.supports_gl_compat_version = 32; config.supports_gl_core_version = 32; and GL 3.2 requires GLSL 1.50, so it seems to me that this shouldn't be necessary. I'm seeing this test fail on swrast instead of reporting a skip. That's strange. When I run this test with LIBGL_ALWAYS_SOFTWARE=1 I get: piglit: info: Failed to create GL 3.2 core context piglit: info: Falling back to GL 3.2 compatibility context piglit: info: Requested a GL 3.2 compatibility context, but actual context version is 2.1 piglit: info: Failed to create GL 3.2 compatibility context piglit: info: Failed to create any GL context PIGLIT: {'result': 'skip' } I'm using piglit without waffle. Ok. It looks like there's a bug in piglit's glut framework--it's not paying attention to the value of config.supports_gl_compat_version. I'll submit a patch shortly to fix this. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] glut framework: skip if implementation doesn't support required GL version.
In effect, we are already doing this when Waffle is in use, since Waffle uses a context creation mechanism that ensures that the context won't be created if the implementation doesn't support the GL version needed by the test. But for GLUT we need to do the check manually, since GLUT always just creates the highest GL version context it can. --- .../piglit-framework-gl/piglit_glut_framework.c| 28 ++ 1 file changed, 28 insertions(+) diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c index a28a177..716f314 100644 --- a/tests/util/piglit-framework-gl/piglit_glut_framework.c +++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c @@ -169,6 +169,31 @@ set_reshape_func(struct piglit_gl_framework *gl_fw, glutReshapeFunc(func); } +/** + * Check that the context's actual version is no less than the + * requested version. + */ +static bool +check_gl_version(const struct piglit_gl_test_config *test_config) +{ + int actual_version = piglit_get_gl_version(); + + /* GLUT only supports GL compatibility contexts, so we only +* have to check supports_gl_compat_version. +*/ + if (actual_version test_config-supports_gl_compat_version) { + printf(Test requires GL version %d.%d, but actual version is + %d.%d\n, + test_config-supports_gl_compat_version / 10, + test_config-supports_gl_compat_version % 10, + actual_version / 10, + actual_version % 10); + return false; + } + + return true; +} + struct piglit_gl_framework* piglit_glut_framework_create(const struct piglit_gl_test_config *test_config) { @@ -191,6 +216,9 @@ piglit_glut_framework_create(const struct piglit_gl_test_config *test_config) init_glut(); + if (!check_gl_version(test_config)) + piglit_report_result(PIGLIT_SKIP); + glut_fw.gl_fw.swap_buffers = swap_buffers; glut_fw.gl_fw.run_test = run_test; glut_fw.gl_fw.post_redisplay = post_redisplay; -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] GLSL: Test that input layout qualifiers cannot be used on variable declarations
On 20 September 2013 12:31, Nicholas Mack nichm...@gmail.com wrote: --- ...-layout-qualifiers-with-variable-declarations.geom | 19 +++ ...-layout-qualifiers-with-variable-declarations.geom | 19 +++ 2 files changed, 38 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom create mode 100644 tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom diff --git a/tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom b/tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom new file mode 100644 index 000..f26b60d --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/incorrect-in-layout-qualifiers-with-variable-declarations.geom @@ -0,0 +1,19 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true This needs to be check_link: false. Otherwise the test will erroneously pass due to lacking the necessary input/output layout qualifiers. A similar change needs to be made to incorrect-out-layout-qualifiers-with-variable-declarations.geom. With that change, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com +// [end config] +// +// Tests that input layout qualifiers cannot be used on a variable declaration. +// +// GLSLangSpec 1.50, section 4.3.8.2 (Output Layout Qualifiers): +// Geometry shaders allow input layout qualifiers only on the interface +// qualifier in, not on an input block,block member, or variable. + +#version 150 + +layout(points) in float c[]; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom b/tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom new file mode 100644 index 000..161de1c --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/incorrect-out-layout-qualifiers-with-variable-declarations.geom @@ -0,0 +1,19 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// Tests that output layout qualifiers cannot be used on a variable declaration. +// +// GLSLangSpec 1.50, section 4.3.8.2 (Output Layout Qualifiers): +// Geometry shaders can have output layout qualifiers only on the interface +// qualifier out, not on an output block or variable declaration. + +#version 150 + +layout(points) out float c; + +void main() +{ +} -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] textureSize: Initialize sample_count to 1.
On 23 September 2013 20:46, Kenneth Graunke kenn...@whitecape.org wrote: The multisampling tests initialize the number of miplevels to the number of samples. Since this is zero, we allocate an array of zero miplevels, and then try to write to the first element. Fixes the following Valgrind error: Invalid write of size 8 at 0x403123: compute_miplevel_info (common.c:163) by 0x402B9B: piglit_init (textureSize.c:455) by 0x4EA6B89: run_test (piglit_fbo_framework.c:50) by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141) by 0x401FC7: main (textureSize.c:68) Address 0xa04d040 is 0 bytes after a block of size 0 alloc'd at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x40310A: compute_miplevel_info (common.c:161) by 0x402B9B: piglit_init (textureSize.c:455) by 0x4EA6B89: run_test (piglit_fbo_framework.c:50) by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141) by 0x401FC7: main (textureSize.c:68) Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: Chris Forbes chr...@ijw.co.nz --- tests/texturing/shaders/textureSize.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/texturing/shaders/textureSize.c b/tests/texturing/shaders/textureSize.c index f010d9c..85a11d3 100644 --- a/tests/texturing/shaders/textureSize.c +++ b/tests/texturing/shaders/textureSize.c @@ -432,6 +432,8 @@ piglit_init(int argc, char **argv) int prog; int tex_location; + sample_count = 1; + require_GL_features(test_stage); if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY) It looks like the textureSize test creates its textures using common.c's upload_miplevel_data(), which always passes a sample count of 4 to glTexImage{2,3}DMultisample(). Would it be better to set sample_count to 4 to match this? In addition, maybe we should change upload_miplevel_data() so that it passes sample_count to glTexImage{2,3}DMultisample() rather than hardcoding a sample count of 4. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 1/2] GLSL 1.50: Test that version 140 and version 150 shaders can be linked together
On 27 September 2013 11:55, Nicholas Mack nichm...@gmail.com wrote: --- .../glsl-1.50/linker/versions-mingled.shader_test | 29 ++ 1 file changed, 29 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/versions-mingled.shader_test diff --git a/tests/spec/glsl-1.50/linker/versions-mingled.shader_test b/tests/spec/glsl-1.50/linker/versions-mingled.shader_test new file mode 100644 index 000..543a778 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/versions-mingled.shader_test @@ -0,0 +1,29 @@ +# Tests that GLSL 1.40 and GLSL 1.50 shaders may be linked together +# +# GLSL 1.50 Spec, 3.3 (): Were you meaning to put something between the parentheses? (The section name, Preprocessor, perhaps?) The same comment applies to patch 2. With that fixed, the series is: Reviewed-by: Paul Berry stereotype...@gmail.com +# Shaders declaring version 1.40 of the shading language can be linked with +# shaders declaring version 1.50 in the same program. +[require] +GLSL = 1.50 + +[vertex shader] +#version 140 + +in vec4 a; + +void main() +{ + gl_Position = a; +} + +[fragment shader] +#version 150 + +void main() +{ + gl_FragColor = vec4(1.); +} + +[test] + + -- 1.8.3.1 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 01/11] arb_transform_feedback2: Require that xfb object names come from Gen
On 21 August 2013 09:07, Ian Romanick i...@freedesktop.org wrote: From: Ian Romanick ian.d.roman...@intel.com NVIDIA (304.64 on GTX 260) passes this test. AMD has not been tested. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: Kenneth Graunke kenn...@whitecape.org --- tests/all.tests| 1 + .../spec/arb_transform_feedback2/CMakeLists.gl.txt | 1 + .../spec/arb_transform_feedback2/gen-names-only.c | 74 ++ 3 files changed, 76 insertions(+) create mode 100644 tests/spec/arb_transform_feedback2/gen-names-only.c diff --git a/tests/all.tests b/tests/all.tests index 2777d17..0e942c5 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -2179,6 +2179,7 @@ arb_transform_feedback2 = Group() spec['ARB_transform_feedback2'] = arb_transform_feedback2 arb_transform_feedback2['draw-auto'] = PlainExecTest(['arb_transform_feedback2-draw-auto', '-auto']) arb_transform_feedback2['istranformfeedback'] = PlainExecTest(['arb_transform_feedback2-istransformfeedback', '-auto']) +arb_transform_feedback2['glGenTransformFeedbacks names only'] = concurrent_test('arb_transform_feedback2-gen-names-only') arb_transform_feedback_instanced = Group() spec['ARB_transform_feedback_instanced'] = arb_transform_feedback_instanced diff --git a/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt b/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt index c31b912..e230e1a 100644 --- a/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt +++ b/tests/spec/arb_transform_feedback2/CMakeLists.gl.txt @@ -10,6 +10,7 @@ link_libraries ( ) piglit_add_executable (arb_transform_feedback2-draw-auto draw-auto.c) +piglit_add_executable (arb_transform_feedback2-gen-names-only gen-names-only.c) piglit_add_executable (arb_transform_feedback2-istransformfeedback istransformfeedback.c) # vim: ft=cmake: diff --git a/tests/spec/arb_transform_feedback2/gen-names-only.c b/tests/spec/arb_transform_feedback2/gen-names-only.c new file mode 100644 index 000..e3d84ad --- /dev/null +++ b/tests/spec/arb_transform_feedback2/gen-names-only.c @@ -0,0 +1,74 @@ +/* + * Copyright © 2012 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. + */ + +/** + * \file gen-names-only.c + * + * The ARB_transform_feedback2 spec says: + * + * BindTransformFeedback fails and an INVALID_OPERATION error is + * generated if id is not zero or a name returned from a previous + * call to GenTransformFeedbacks, or if such a name has since been + * deleted with DeleteTransformFeedbacks. + */ + +#include piglit-util-gl-common.h + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.window_visual = PIGLIT_GL_VISUAL_RGB; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} + +void piglit_init(int argc, char **argv) +{ + GLuint id; + bool pass = true; + + piglit_require_transform_feedback(); + piglit_require_extension(GL_ARB_transform_feedback2); + + glGenTransformFeedbacks(1, id); + + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0); + pass = piglit_check_gl_error(0) pass; + + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 47); + pass = piglit_check_gl_error(GL_INVALID_OPERATION) pass; Nit pick: if glGenTransformFeedbacks happened to generate an id of 47, this test will fail. How about instead doing this: glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id + 1); (since id + 1 is guaranteed to be an invalid name). Either way, the patch is: Reviewed-by: Paul Berry stereotype...@gmail.com + + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id); + pass = piglit_check_gl_error(0) pass; + + glDeleteTransformFeedbacks(1, id
Re: [Piglit] [PATCH 08/11] arb_get_program_binary: Verify glGet* doesn't over-run the buffer for binary format queries
, + GL_PROGRAM_BINARY_FORMATS); + } + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} -- 1.8.1.4 With those changes, the patch is: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 11/11] Test some interactions with multiple inout parameters
On 21 August 2013 09:08, Ian Romanick i...@freedesktop.org wrote: From: Ian Romanick ian.d.roman...@intel.com There are several variations of void foo(inout int i, inout float f); ... foo(i, f[i]); that Mesa's GLSL compiler gets wrong. NVIDIA (304.64 on GTX 260) fails vs-inout-index-inout-mat2-col.shader_test and vs-inout-index-inout-mat2-row.shader_test, but passes the others. v2: Use 'proble all rgb' and make vs-inout-index-inout-mat2-col use u=1 s/proble/probe/ like the other tests. Both items were suggested by Eric Anholt. I use 'probe all rgb' because the tests actually write 0 for alpha, but shader_runner doesn't always get an RGBA visual (so alpha will be 0 or 1). Also, add two simpler tests vs-out-vec4 and vs-inout-vec4. This currently pass, but a patch series I have in progress had broken them. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: James Jones jajo...@nvidia.com --- .../vs-inout-index-inout-float-array.shader_test | 35 ++ .../vs-inout-index-inout-mat2-col.shader_test | 34 + .../vs-inout-index-inout-mat2-row.shader_test | 34 + ...nout-index-inout-vec4-array-element.shader_test | 35 ++ .../vs-inout-index-inout-vec4-array.shader_test| 35 ++ .../vs-inout-index-inout-vec4.shader_test | 35 ++ .../vs-inout-vec4.shader_test | 33 .../out-parameter-indexing/vs-out-vec4.shader_test | 33 8 files changed, 274 insertions(+) create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-vec4.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-out-vec4.shader_test diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test new file mode 100644 index 000..95fee24 --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL = 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + float fa[] = float[](0., 0., 0., 0.); + int i = u; + + func(i, fa[i]); + color = vec4(fa[0], fa[1], fa[2], fa[3]); + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test new file mode 100644 index 000..853d1bc --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL = 1.20 + +[vertex shader] +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + mat2 m = mat2(0.); + int i = u; + + func(i, m[i][1]); + color = vec4(m[1].x, m[1].y, m[0].x, m[0].y); + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. I think you mean: probe all rgb 0. 1. 0. With that fixed, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test new file mode 100644 index 000..1c1c39c --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL = 1.20 + +[vertex shader] +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + mat2 m = mat2(0.); + int i = u; + + func(i, m[0][i]); + color = vec4(m[0].x, m[0].y, m[1].x, m[1].y); + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test
Re: [Piglit] [PATCH 00/11] Misc old piglit tests
On 21 August 2013 09:07, Ian Romanick i...@freedesktop.org wrote: A few months ago my piglit tree got really broken, and I had to re-clone it. When that happened, I left a bunch of in-progress tests in the old tree. Since Ken was looking for some GL_ARB_transform_feedback2 tests, I had to revive some of them. I decided to revive them all. :) I've sent comments on patches 1, 2, 3, 8, 9, and 11. The remainder are: Reviewed-by: Paul Berry stereotype...@gmail.com ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] egl-1.4: Add test egl-terminate-then-unbind-context
On 20 September 2013 12:38, Chad Versace chad.vers...@linux.intel.comwrote: This test makes current a context, terminates the context's display, then unbinds the context. According to the EGL 1.4 spec (2011.04.06), Section 3.2 Initialization, no errors should occur. Exposes a use-after-free crash on mesa-9.2 with i965. This is the underlying reason that `./$gles1_test -fbo` crashes on Intel for each GLES1 test. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69622 CC: Ian Romanick i...@freedesktop.org CC: Paul Berry stereotype...@gmail.com Signed-off-by: Chad Versace chad.vers...@linux.intel.com --- tests/all.tests| 1 + tests/egl/spec/CMakeLists.txt | 1 + tests/egl/spec/egl-1.4/CMakeLists.gles2.txt| 8 ++ tests/egl/spec/egl-1.4/CMakeLists.txt | 1 + .../egl-1.4/egl-terminate-then-unbind-context.c| 108 + 5 files changed, 119 insertions(+) create mode 100644 tests/egl/spec/egl-1.4/CMakeLists.gles2.txt create mode 100644 tests/egl/spec/egl-1.4/CMakeLists.txt create mode 100644 tests/egl/spec/egl-1.4/egl-terminate-then-unbind-context.c diff --git a/tests/all.tests b/tests/all.tests index a7bf00c..6a89287 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -3020,6 +3020,7 @@ egl14['eglQuerySurface EGL_BAD_ATTRIBUTE'] = plain_test('egl-query-surface --bad egl14['eglQuerySurface EGL_BAD_SURFACE'] = plain_test('egl-query-surface --bad-surface') egl14['eglQuerySurface EGL_HEIGHT'] = plain_test('egl-query-surface --attr=EGL_HEIGHT') egl14['eglQuerySurface EGL_WIDTH'] = plain_test('egl-query-surface --attr=EGL_WIDTH') +egl14['eglTerminate then unbind context'] = plain_test('egl-terminate-then-unbind-context') egl_nok_swap_region = Group() spec['EGL_NOK_swap_region'] = egl_nok_swap_region diff --git a/tests/egl/spec/CMakeLists.txt b/tests/egl/spec/CMakeLists.txt index de4de3f..12bb419 100644 --- a/tests/egl/spec/CMakeLists.txt +++ b/tests/egl/spec/CMakeLists.txt @@ -1 +1,2 @@ +add_subdirectory (egl-1.4) add_subdirectory (egl_khr_create_context) diff --git a/tests/egl/spec/egl-1.4/CMakeLists.gles2.txt b/tests/egl/spec/egl-1.4/CMakeLists.gles2.txt new file mode 100644 index 000..b6bb1e8 --- /dev/null +++ b/tests/egl/spec/egl-1.4/CMakeLists.gles2.txt @@ -0,0 +1,8 @@ +link_libraries( + piglitutil_${piglit_target_api} +${OPENGL_egl_LIBRARY} +) + +piglit_add_executable(egl-terminate-then-unbind-context egl-terminate-then-unbind-context.c) + +# vim: ft=cmake: diff --git a/tests/egl/spec/egl-1.4/CMakeLists.txt b/tests/egl/spec/egl-1.4/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/egl/spec/egl-1.4/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/egl/spec/egl-1.4/egl-terminate-then-unbind-context.c b/tests/egl/spec/egl-1.4/egl-terminate-then-unbind-context.c new file mode 100644 index 000..acf3dcb --- /dev/null +++ b/tests/egl/spec/egl-1.4/egl-terminate-then-unbind-context.c @@ -0,0 +1,108 @@ +/* Copyright © 2013 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. + */ + +/** + * \file + * + * This test makes current a context, terminates the context's display, then + * unbinds the context. According to the EGL 1.4 spec (2011.04.06), Section + * 3.2 Initialization, no error should occur. + * + * EGLBoolean eglTerminate(EGLDisplay dpy); + * + * Termination marks all EGL-specific resources, such as contexts and + * surfaces, associated with the specified display for deletion. Handles + * to all such resources are invalid as soon as eglTerminate returns, but + * the dpy handle itself remains valid. [...] Applications should not try + * to perform useful work with such resources
Re: [Piglit] [PATCH] egl-1.4: Add test egl-terminate-then-unbind-context
On 4 October 2013 13:49, Chad Versace chad.vers...@linux.intel.com wrote: On 10/04/2013 01:42 PM, Paul Berry wrote: On 20 September 2013 12:38, Chad Versace chad.vers...@linux.intel.com** wrote: It's not obvious clear why EGL_KHR_surfaceless_context is necessary for this test. Can we remove this check, or add a comment explaining why it's necessary? With that addressed, this patch is: Reviewed-by: Paul Berry stereotype...@gmail.com Does this comment suffice? /* This test tries to be window-system independent, and so avoids * creating any EGLSurface. To call eglMakeCurrent() without a surface * requires EGL_KHR_surfaceless_context. */ if (!piglit_is_egl_extension_**supported(dpy, EGL_KHR_surfaceless_context)**) piglit_report_result(PIGLIT_**SKIP); Ah, ok. That explains it. Thanks. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 01/14] Test that struct names may not begin with gl_ prefix.
--- .../struct/struct-name-uses-gl-prefix.vert | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 tests/spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert diff --git a/tests/spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert b/tests/spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert new file mode 100644 index 000..9cc9d55 --- /dev/null +++ b/tests/spec/glsl-1.10/compiler/struct/struct-name-uses-gl-prefix.vert @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 3.7 (Identifiers) of the GLSL 1.10 spec: +// +// Identifiers starting with gl_ are reserved for use by OpenGL +// and may not be declared in a shader as either a variable or a +// function. +// +// Consequently, a struct's name may not start with gl_. + +struct gl_ProsciuttoHoagie { +vec4 a; +}; + +void main() +{ + gl_Position = vec4(0.0); +} -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 00/14] Tests related to interface block redeclaration.
I'm putting the finishing touches on a patch series for Mesa that allows for redeclaration of the gl_PerVertex interface block. This series contains the tests I used to validate my Mesa work. The GLSL 1.50 spec doesn't directly address how to redeclare elements of the gl_PerVertex interface block, but the GLSL 4.10 spec does. It seems pretty clear that the rules in the GLSL 4.10 spec were intended as a clarification, rather than a behavioural change, so I've based my tests on the GLSL 4.10 spec, but applied them to GLSL 1.50. A few patches don't relate directly to redeclaration of gl_PerVertex, but rather cover Mesa bugs I discovered while working on interface block redeclaration. Patches 1 and 2 test some previously untested uses of identifiers to make sure that they can't begin with the gl_ prefix. Patches 4 and 5 test some things that should be prohibited in general for interface blocks, such as redeclaring an existing interface block, or declaring an interface block that conflicts with a global variable. The remaining patches are specific to redeclaration of gl_PerVertex. [PATCH 01/14] Test that struct names may not begin with gl_ prefix. [PATCH 02/14] Test illegal usages of gl_ prefix in interface blocks. [PATCH 03/14] Test that redeclaration of gl_PerVertex must be for a subset. [PATCH 04/14] Test that interface blocks cannot declare conflicting names. [PATCH 05/14] Test that in general, interface blocks cannot be redeclared. [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared. [PATCH 07/14] Test that gl_PerVertex can't be redeclared after it's been used. [PATCH 08/14] Test that gl_PerVertex can't be redeclared multiple times in one shader. [PATCH 09/14] Test that after redeclaration, absent members of gl_PerVertex can't be used. [PATCH 10/14] Test that builtins can't be redeclared both inside and outside gl_PerVertex. [PATCH 11/14] Test inter- and intra-stage gl_PerVertex matching rules. [PATCH 12/14] Verify array-ness and instance name of gl_PerVertex redeclarations. [PATCH 13/14] Verify that gl_PerVertex can't be redeclared in certain shader types. [PATCH 14/14] Test that gl_in may be redeclared with an array size. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared.
--- .../redeclare-pervertex-out-subset-gs.shader_test | 77 ++ ...redeclare-pervertex-subset-vs-to-gs.shader_test | 113 + .../redeclare-pervertex-subset-vs.shader_test | 73 + 3 files changed, 263 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test create mode 100644 tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test create mode 100644 tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs.shader_test diff --git a/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test new file mode 100644 index 000..baaa0f1 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/redeclare-pervertex-out-subset-gs.shader_test @@ -0,0 +1,77 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# The gl_PerVertex block can be redeclared in a shader to explicitly +# indicate what subset of the fixed pipeline interface will be +# used. This is necessary to establish the interface between multiple +# programs. For example: +# +# out gl_PerVertex { +# vec4 gl_Position;// will use gl_Position +# float gl_PointSize; // will use gl_PointSize +# vec4 t; // error, only gl_PerVertex members allowed +# }; // no other members of gl_PerVertex will be used +# +# This establishes the output interface the shader will use with the +# subsequent pipeline stage. It must be a subset of the built-in members +# of gl_PerVertex. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# This test verifies that the geometry shader can redeclare gl_PerVertex +# specifying a subset of the built-in values (gl_Position and +# gl_PointSize), and the subset works. +# +# This test draws a small point in the left half of the window and a +# large point in the right half. Then it probes the region around +# each point to ensure that the point on the right is larger. +# +# NOTE: since gl_PointSize is expressed in pixels, but gl_Position is +# expressed relative to the window size, this test is dependent upon +# the window size. It assumes a window size of 250x250, which is the +# shader_runner default. + +[require] +GLSL = 1.50 + +[vertex shader] +void main() +{ +} + +[geometry shader] +layout(points) in; +layout(points, max_vertices = 2) out; + +out gl_PerVertex { +vec4 gl_Position; +float gl_PointSize; +}; + +void main() +{ + gl_Position = vec4(-0.5, 0.0, 0.0, 1.0); + gl_PointSize = 1.0; + EmitVertex(); + gl_Position = vec4(0.5, 0.0, 0.0, 1.0); + gl_PointSize = 13.0; + EmitVertex(); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +clear color 0.0 0.0 0.0 0.0 +clear +enable GL_PROGRAM_POINT_SIZE +draw arrays GL_POINTS 0 1 +relative probe rgba (0.24, 0.5) (0.0, 0.0, 0.0, 0.0) +relative probe rgba (0.26, 0.5) (0.0, 0.0, 0.0, 0.0) +relative probe rgba (0.74, 0.5) (1.0, 1.0, 1.0, 1.0) +relative probe rgba (0.76, 0.5) (1.0, 1.0, 1.0, 1.0) diff --git a/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test new file mode 100644 index 000..7472762 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/redeclare-pervertex-subset-vs-to-gs.shader_test @@ -0,0 +1,113 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# The gl_PerVertex block can be redeclared in a shader to explicitly +# indicate what subset of the fixed pipeline interface will be +# used. This is necessary to establish the interface between multiple +# programs. For example: +# +# out gl_PerVertex { +# vec4 gl_Position;// will use gl_Position +# float gl_PointSize; // will use gl_PointSize +# vec4 t; // error, only gl_PerVertex members allowed +# }; // no other members of gl_PerVertex will be used +# +# This establishes the output interface the shader will use with the +# subsequent pipeline stage. It must be a subset of the built-in members +# of gl_PerVertex. +# +# Furthermore, section 7.1.1 (Compatibility Profile Built-In Language +# Variables) says: +# +# In the tessellation control, evaluation, and geometry shaders, the +# outputs of the previous stage described above are also available +# in the input gl_PerVertex block in these languages. +# +# ... +# +# These can be redeclared to establish an explicit pipeline +# interface, the same way as described above for the output block +# gl_PerVertex, and the input redeclaration must match the output +# redeclaration of the previous stage. However, when a built-in +# interface block with an instance name is redeclared (e.g., gl_in), +# the instance name must
[Piglit] [PATCH 05/14] Test that in general, interface blocks cannot be redeclared.
--- ...face-block-redeclared-different-block-name.vert | 36 ++ ...interface-block-redeclared-same-block-name.vert | 36 ++ 2 files changed, 72 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-different-block-name.vert create mode 100644 tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-same-block-name.vert diff --git a/tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-different-block-name.vert b/tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-different-block-name.vert new file mode 100644 index 000..13cc019 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-different-block-name.vert @@ -0,0 +1,36 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: false +// [end config] +// +// From section 4.1.9 (Arrays) of the GLSL 4.40 spec (as of revision 7): +// +// However, unless noted otherwise, blocks cannot be redeclared; +// an unsized array in a user-declared block cannot be sized +// through redeclaration. +// +// The only place where the spec notes that interface blocks can be +// redeclared is to allow for redeclaration of built-in interface +// blocks such as gl_PerVertex. Therefore, user-defined interface +// blocks can never be redeclared. This is a clarification of +// previous intent (see Khronos bug 10659: +// https://cvs.khronos.org/bugzilla/show_bug.cgi?id=10659), so we test +// it for GLSL version 1.50. +// +// In this test, the named interface block is redeclared using a +// different block name from the name that it had previously. + +#version 150 + +out block1 { +vec4 a; +} inst; + +out block2 { +vec4 a; +} inst; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-same-block-name.vert b/tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-same-block-name.vert new file mode 100644 index 000..676d4cc --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/named-interface-block-redeclared-same-block-name.vert @@ -0,0 +1,36 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: false +// [end config] +// +// From section 4.1.9 (Arrays) of the GLSL 4.40 spec (as of revision 7): +// +// However, unless noted otherwise, blocks cannot be redeclared; +// an unsized array in a user-declared block cannot be sized +// through redeclaration. +// +// The only place where the spec notes that interface blocks can be +// redeclared is to allow for redeclaration of built-in interface +// blocks such as gl_PerVertex. Therefore, user-defined interface +// blocks can never be redeclared. This is a clarification of +// previous intent (see Khronos bug 10659: +// https://cvs.khronos.org/bugzilla/show_bug.cgi?id=10659), so we test +// it for GLSL version 1.50. +// +// In this test, the named interface block is redeclared using the +// same block name that it had previously. + +#version 150 + +out block { +vec4 a; +} inst; + +out block { +vec4 a; +} inst; + +void main() +{ +} -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 04/14] Test that interface blocks cannot declare conflicting names.
--- ...nterface-block-conflicts-with-ordinary-var.vert | 21 +++ ...-block-elem-conflicts-with-prev-block-elem.vert | 30 ++ ...face-block-elem-conflicts-with-prev-global.vert | 28 3 files changed, 79 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert create mode 100644 tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert create mode 100644 tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert diff --git a/tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert b/tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert new file mode 100644 index 000..08096df --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/named-interface-block-conflicts-with-ordinary-var.vert @@ -0,0 +1,21 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: false +// [end config] +// +// This test checks that once a variable has been declared, the name +// of that variable can't be re-used as an instance name for a named +// interface block. + +#version 150 + +out vec4 foo; + +out block { +vec4 a; +} foo; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert new file mode 100644 index 000..c26c82d --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-block-elem.vert @@ -0,0 +1,30 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec: +// +// If an instance name (instance-name) is not used, the names +// declared inside the block are scoped at the global level and +// accessed as if they were declared outside the block. +// +// Consequently, inside an interface block lacking an instance-name, +// it is illegal to use a name that was previously declared inside a +// different interface block lacking an instance-name (just as it +// would be illegal to redeclare the name outside an interface block). + +#version 150 + +out block1 { +vec4 a; +}; + +out block2 { +vec4 a; +}; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert new file mode 100644 index 000..968eeeb --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-conflicts-with-prev-global.vert @@ -0,0 +1,28 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec: +// +// If an instance name (instance-name) is not used, the names +// declared inside the block are scoped at the global level and +// accessed as if they were declared outside the block. +// +// Consequently, inside an interface block lacking an instance-name, +// it is illegal to use a name that was previously declared outside +// any interface block (just as it would be illegal to redeclare the +// name outside an interface block). + +#version 150 + +vec4 a; + +out block { +vec4 a; +}; + +void main() +{ +} -- 1.8.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 02/14] Test illegal usages of gl_ prefix in interface blocks.
--- .../interface-block-array-elem-uses-gl-prefix.vert | 24 ++ ...terface-block-instance-name-uses-gl-prefix.vert | 23 + .../interface-block-name-uses-gl-prefix.vert | 23 + .../named-interface-block-elem-uses-gl-prefix.vert | 24 ++ ...nnamed-interface-block-elem-uses-gl-prefix.vert | 24 ++ 5 files changed, 118 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.vert create mode 100644 tests/spec/glsl-1.50/compiler/interface-block-instance-name-uses-gl-prefix.vert create mode 100644 tests/spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert create mode 100644 tests/spec/glsl-1.50/compiler/named-interface-block-elem-uses-gl-prefix.vert create mode 100644 tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert diff --git a/tests/spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.vert b/tests/spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.vert new file mode 100644 index 000..20d5a06 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/interface-block-array-elem-uses-gl-prefix.vert @@ -0,0 +1,24 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 3.7 (Identifiers) of the GLSL 1.50 spec: +// +// Identifiers starting with gl_ are reserved for use by OpenGL +// and may not be declared in a shader as either a variable or a +// function. +// +// Consequently, an interface block array may not contain a name +// starting with gl_. + +#version 150 + +out block { +vec4 gl_ProsciuttoHoagie; +} inst[2]; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/interface-block-instance-name-uses-gl-prefix.vert b/tests/spec/glsl-1.50/compiler/interface-block-instance-name-uses-gl-prefix.vert new file mode 100644 index 000..830ca05 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/interface-block-instance-name-uses-gl-prefix.vert @@ -0,0 +1,23 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 3.7 (Identifiers) of the GLSL 1.50 spec: +// +// Identifiers starting with gl_ are reserved for use by OpenGL +// and may not be declared in a shader as either a variable or a +// function. +// +// Consequently, an interface block's instance name may not start with gl_. + +#version 150 + +out block { +vec4 a; +} gl_ProsciuttoHoagie; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert b/tests/spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert new file mode 100644 index 000..ed811c0 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/interface-block-name-uses-gl-prefix.vert @@ -0,0 +1,23 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 3.7 (Identifiers) of the GLSL 1.50 spec: +// +// Identifiers starting with gl_ are reserved for use by OpenGL +// and may not be declared in a shader as either a variable or a +// function. +// +// Consequently, an interface block's block name may not start with gl_. + +#version 150 + +out gl_ProsciuttoHoagie { +vec4 a; +} inst; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/named-interface-block-elem-uses-gl-prefix.vert b/tests/spec/glsl-1.50/compiler/named-interface-block-elem-uses-gl-prefix.vert new file mode 100644 index 000..94e85ff --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/named-interface-block-elem-uses-gl-prefix.vert @@ -0,0 +1,24 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 3.7 (Identifiers) of the GLSL 1.50 spec: +// +// Identifiers starting with gl_ are reserved for use by OpenGL +// and may not be declared in a shader as either a variable or a +// function. +// +// Consequently, a named interface block may not contain a name +// starting with gl_. + +#version 150 + +out block { +vec4 gl_ProsciuttoHoagie; +} inst; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert new file mode 100644 index 000..31e90ac --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/unnamed-interface-block-elem-uses-gl-prefix.vert @@ -0,0 +1,24 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 3.7 (Identifiers) of the GLSL 1.50 spec: +// +// Identifiers starting with gl_ are reserved for use by OpenGL +// and may not be declared in a shader as either a variable or a +// function. +// +// Consequently, an unnamed interface block may not contain a name +// starting with gl_. + +#version
[Piglit] [PATCH 03/14] Test that redeclaration of gl_PerVertex must be for a subset.
--- ...edeclares-pervertex-in-with-illegal-member.geom | 41 ++ ...declares-pervertex-out-with-illegal-member.geom | 41 ++ ...s-redeclares-pervertex-with-illegal-member.vert | 38 3 files changed, 120 insertions(+) create mode 100644 tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-illegal-member.geom create mode 100644 tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-with-illegal-member.geom create mode 100644 tests/spec/glsl-1.50/compiler/vs-redeclares-pervertex-with-illegal-member.vert diff --git a/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-illegal-member.geom b/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-illegal-member.geom new file mode 100644 index 000..bd85a06 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-in-with-illegal-member.geom @@ -0,0 +1,41 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +// spec: +// +// The gl_PerVertex block can be redeclared in a shader to explicitly +// indicate what subset of the fixed pipeline interface will be +// used. This is necessary to establish the interface between multiple +// programs. For example: +// +// out gl_PerVertex { +// vec4 gl_Position;// will use gl_Position +// float gl_PointSize; // will use gl_PointSize +// vec4 t; // error, only gl_PerVertex members allowed +// }; // no other members of gl_PerVertex will be used +// +// This establishes the output interface the shader will use with the +// subsequent pipeline stage. It must be a subset of the built-in members +// of gl_PerVertex. +// +// This test verifies that a non-member of the geometry shader +// gl_PerVertex input may not be included in the redeclaration. + +#version 150 + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { +vec4 gl_Position; +float gl_PointSize; +vec4 t; +} gl_in[]; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-with-illegal-member.geom b/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-with-illegal-member.geom new file mode 100644 index 000..3983672 --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/gs-redeclares-pervertex-out-with-illegal-member.geom @@ -0,0 +1,41 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +// spec: +// +// The gl_PerVertex block can be redeclared in a shader to explicitly +// indicate what subset of the fixed pipeline interface will be +// used. This is necessary to establish the interface between multiple +// programs. For example: +// +// out gl_PerVertex { +// vec4 gl_Position;// will use gl_Position +// float gl_PointSize; // will use gl_PointSize +// vec4 t; // error, only gl_PerVertex members allowed +// }; // no other members of gl_PerVertex will be used +// +// This establishes the output interface the shader will use with the +// subsequent pipeline stage. It must be a subset of the built-in members +// of gl_PerVertex. +// +// This test verifies that a non-member of the geometry shader +// gl_PerVertex output may not be included in the redeclaration. + +#version 150 + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +out gl_PerVertex { +vec4 gl_Position; +float gl_PointSize; +vec4 t; +}; + +void main() +{ +} diff --git a/tests/spec/glsl-1.50/compiler/vs-redeclares-pervertex-with-illegal-member.vert b/tests/spec/glsl-1.50/compiler/vs-redeclares-pervertex-with-illegal-member.vert new file mode 100644 index 000..369574f --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/vs-redeclares-pervertex-with-illegal-member.vert @@ -0,0 +1,38 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// check_link: true +// [end config] +// +// From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +// spec: +// +// The gl_PerVertex block can be redeclared in a shader to explicitly +// indicate what subset of the fixed pipeline interface will be +// used. This is necessary to establish the interface between multiple +// programs. For example: +// +// out gl_PerVertex { +// vec4 gl_Position;// will use gl_Position +// float gl_PointSize; // will use gl_PointSize +// vec4 t; // error, only gl_PerVertex members allowed +// }; // no other members of gl_PerVertex will be used +// +// This establishes the output interface the shader will use with the +// subsequent pipeline stage. It must be a subset of the built-in members +// of gl_PerVertex. +// +// This test verifies that a non-member of gl_PerVertex may not be +//
Re: [Piglit] [PATCH 00/14] Tests related to interface block redeclaration.
On 2 October 2013 16:45, Paul Berry stereotype...@gmail.com wrote: I'm putting the finishing touches on a patch series for Mesa that allows for redeclaration of the gl_PerVertex interface block. This series contains the tests I used to validate my Mesa work. The GLSL 1.50 spec doesn't directly address how to redeclare elements of the gl_PerVertex interface block, but the GLSL 4.10 spec does. It seems pretty clear that the rules in the GLSL 4.10 spec were intended as a clarification, rather than a behavioural change, so I've based my tests on the GLSL 4.10 spec, but applied them to GLSL 1.50. A few patches don't relate directly to redeclaration of gl_PerVertex, but rather cover Mesa bugs I discovered while working on interface block redeclaration. Patches 1 and 2 test some previously untested uses of identifiers to make sure that they can't begin with the gl_ prefix. Patches 4 and 5 test some things that should be prohibited in general for interface blocks, such as redeclaring an existing interface block, or declaring an interface block that conflicts with a global variable. The remaining patches are specific to redeclaration of gl_PerVertex. [PATCH 01/14] Test that struct names may not begin with gl_ prefix. [PATCH 02/14] Test illegal usages of gl_ prefix in interface blocks. [PATCH 03/14] Test that redeclaration of gl_PerVertex must be for a subset. [PATCH 04/14] Test that interface blocks cannot declare conflicting names. [PATCH 05/14] Test that in general, interface blocks cannot be redeclared. [PATCH 06/14] Test that the built-in gl_PerVertex interface block can be redeclared. [PATCH 07/14] Test that gl_PerVertex can't be redeclared after it's been used. [PATCH 08/14] Test that gl_PerVertex can't be redeclared multiple times in one shader. [PATCH 09/14] Test that after redeclaration, absent members of gl_PerVertex can't be used. [PATCH 10/14] Test that builtins can't be redeclared both inside and outside gl_PerVertex. [PATCH 11/14] Test inter- and intra-stage gl_PerVertex matching rules. [PATCH 12/14] Verify array-ness and instance name of gl_PerVertex redeclarations. [PATCH 13/14] Verify that gl_PerVertex can't be redeclared in certain shader types. [PATCH 14/14] Test that gl_in may be redeclared with an array size. I almost forgot to mention: this series is available at branch interface-block-redeclaration of https://github.com/stereotype441/piglit.git. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 11/14] Test inter- and intra-stage gl_PerVertex matching rules.
These tests verify the following linkage rules, from GLSL 4.10: 1. If multiple shaders using members of a built-in block belonging to the same interface are linked together in the same program, they must all redeclare the built-in block in the same way, as described in section 4.3.7 Interface Blocks for interface block matching, or a link error will result. 2. It will also be a link error if some shaders in a program redeclare a specific built-in interface block while another shader in that program does not redeclare that interface block yet still uses a member of that interface block. --- ...ge-pervertex-redeclaration-mismatch.shader_test | 65 ++ ...tage-pervertex-redeclaration-needed.shader_test | 64 ++ ...ge-pervertex-redeclaration-unneeded.shader_test | 63 + ...pervertex-in-redeclaration-mismatch.shader_test | 71 ...e-pervertex-in-redeclaration-needed.shader_test | 78 ++ ...pervertex-in-redeclaration-unneeded.shader_test | 75 + ...ervertex-out-redeclaration-mismatch.shader_test | 62 + ...-pervertex-out-redeclaration-needed.shader_test | 61 + ...ervertex-out-redeclaration-unneeded.shader_test | 60 + 9 files changed, 599 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-unneeded.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-needed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-in-redeclaration-unneeded.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-mismatch.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-needed.shader_test create mode 100644 tests/spec/glsl-1.50/linker/intrastage-pervertex-out-redeclaration-unneeded.shader_test diff --git a/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test new file mode 100644 index 000..ab5e3c4 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-mismatch.shader_test @@ -0,0 +1,65 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 Interface Blocks for interface +# block matching, or a link error will result. +# +# This appears to be a clarification to the behaviour established for +# gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version +# 1.50. +# +# The definition of interface in section 4.3.7 that applies here is +# as follows: +# +# The boundary between adjacent programmable pipeline stages: This +# spans all the outputs in all compilation units of the first +# stage and all the inputs in all compilation units of the second +# stage. +# +# Therefore this rule applies to both inter- and intra-stage linking. +# +# In this test we exercise interstage linking of the gl_PerVertex +# interface block using the vertex and geometry shader stages, and we +# use shaders that refer to an overlapping set of built-in variables. + +[require] +GLSL = 1.50 + +[vertex shader] +out gl_PerVertex { + vec4 gl_Position; +}; +in vec4 pos; + +void main() +{ + gl_Position = pos; +} + +[geometry shader] +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex { + vec4 gl_Position; + float gl_PointSize; +} gl_in[]; +out vec4 v; + +void main() +{ + v = vec4(gl_in[0].gl_Position.xyz, gl_in[0].gl_PointSize); + EmitVertex(); +} + +[fragment shader] +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link error diff --git a/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test new file mode 100644 index 000..0b58b92 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interstage-pervertex-redeclaration-needed.shader_test @@ -0,0 +1,64 @@ +# From section 7.1 (Built-In Language Variables) of the GLSL 4.10 +# spec: +# +# If multiple shaders using members of a built-in block belonging +# to the same interface are linked together in the same program, +# they must all redeclare the built-in block in the same way, as +# described in section 4.3.7 Interface