[Piglit] [PATCH 4/4] arb_sample_shading: don't use gl_FragColor/Data in fragment shaders
NVIDIA's driver fails to compile the fragment shaders with "Failed to compile fragment shader: 0(4) : error C7533: global variable gl_FragData is deprecated after version 120". Use 'out fragdata' or 'out fragcolor' instead. Tested with Mesa too. --- .../execution/ignore-centroid-qualifier.cpp | 9 ++--- .../execution/interpolate-at-sample-position.cpp| 13 - 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp b/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp index c286c5c..105f837 100644 --- a/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp +++ b/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp @@ -147,8 +147,9 @@ piglit_init(int argc, char**argv) "#version 130\n" "#extension GL_ARB_sample_shading: require\n" "centroid in vec2 test;\n" + "out vec4 fragcolor;\n" "void main() {\n" - " gl_FragColor = vec4(abs(test), 0, 1);\n" + " fragcolor = vec4(abs(test), 0, 1);\n" "}\n"); draw_prog_right = piglit_build_simple_program( @@ -169,8 +170,9 @@ piglit_init(int argc, char**argv) "#version 130\n" "in vec2 ref;\n" + "out vec4 fragcolor;\n" "void main() {\n" - " gl_FragColor = vec4(abs(ref), 0, 1);\n" + " fragcolor = vec4(abs(ref), 0, 1);\n" "}\n"); sample_pos_loc = glGetUniformLocation(draw_prog_right, "sample_pos"); @@ -185,8 +187,9 @@ piglit_init(int argc, char**argv) "#extension GL_ARB_texture_multisample: require\n" "uniform int sample_id;\n" "uniform sampler2DMS tex;\n" + "out vec4 fragcolor;\n" "void main() {\n" - " gl_FragColor = texelFetch(tex, ivec2(gl_FragCoord.xy),\n" + " fragcolor = texelFetch(tex, ivec2(gl_FragCoord.xy),\n" " sample_id);\n" "}\n"); diff --git a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp index 6d0123b..36ede0d 100644 --- a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp +++ b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp @@ -162,9 +162,10 @@ piglit_init(int argc, char**argv) "#extension GL_ARB_sample_shading: require\n" "in vec2 test_center;\n" "centroid in vec2 test_centroid;\n" + "out vec4 fragdata[2];\n" "void main() {\n" - " gl_FragData[0] = vec4(abs(test_center), 0, 1);\n" - " gl_FragData[1] = vec4(abs(test_centroid), 0, 1);\n" + " fragdata[0] = vec4(abs(test_center), 0, 1);\n" + " fragdata[1] = vec4(abs(test_centroid), 0, 1);\n" "}\n"); draw_prog_right = piglit_build_simple_program( @@ -185,9 +186,10 @@ piglit_init(int argc, char**argv) "#version 130\n" "in vec2 ref;\n" + "out vec4 fragdata[2];\n" "void main() {\n" - " gl_FragData[0] = vec4(abs(ref), 0, 1);\n" - " gl_FragData[1] = vec4(abs(ref), 0, 1);\n" + " fragdata[0] = vec4(abs(ref), 0, 1);\n" + " fragdata[1] = vec4(abs(ref), 0, 1);\n" "}\n"); sample_pos_loc = glGetUniformLocation(draw_prog_right, "sample_pos"); @@ -203,9 +205,10 @@ piglit_init(int argc, char**argv) "uniform int sample_id;\n" "uniform sampler2DMS tex_center;\n" "uniform sampler2DMS tex_centroid;\n" + "out vec4 fragcolor;\n" "void main() {\n" " ivec2 coord = ivec2(gl_FragCoord.xy);\n" - " gl_FragColor = coord.y < 128 ? \n" + " fragcolor = coord.y < 128 ? \n" " texelFetch(tex_center, coord, sample_id) :\n" " texelFetch(tex_centroid, coord - ivec2(0, 128), sample_id);\n" "}\n"); -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/4] util: const-qualify data parameter to piglit_multisample_texture()
--- tests/util/piglit-util-gl.c | 2 +- tests/util/piglit-util-gl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index 041427d..43b38e5 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -2967,7 +2967,7 @@ GLuint piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat, unsigned width, unsigned height, unsigned depth, unsigned samples, - GLenum format, GLenum type, void *data) + GLenum format, GLenum type, const void *data) { static GLuint prog = 0; static GLint tex_loc, tex_depth_loc, z_loc; diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h index 00b5a35..e8728d0 100644 --- a/tests/util/piglit-util-gl.h +++ b/tests/util/piglit-util-gl.h @@ -308,7 +308,7 @@ GLuint piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat, unsigned width, unsigned height, unsigned depth, unsigned samples, - GLenum format, GLenum type, void *data); + GLenum format, GLenum type, const void *data); extern float piglit_tolerance[4]; void piglit_set_tolerance_for_bits(int rbits, int gbits, int bbits, int abits); extern void piglit_require_transform_feedback(void); -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/4] arb_indirect_parameters: add cast to silence compiler warnings
--- tests/spec/arb_indirect_parameters/tf-count-arrays.c | 2 +- tests/spec/arb_indirect_parameters/tf-count-elements.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/spec/arb_indirect_parameters/tf-count-arrays.c b/tests/spec/arb_indirect_parameters/tf-count-arrays.c index f70209c..7f64d8f 100644 --- a/tests/spec/arb_indirect_parameters/tf-count-arrays.c +++ b/tests/spec/arb_indirect_parameters/tf-count-arrays.c @@ -194,7 +194,7 @@ piglit_display(void) /* Overdraw with the red quad, except count = 0 */ glMultiDrawArraysIndirectCountARB( GL_TRIANGLE_FAN, - (2 * 4 * 4), 4, 1, 0); + (const void *) (2 * 4 * 4), 4, 1, 0); pass &= piglit_probe_rect_rgba(0, 0, piglit_width / 2, piglit_height, g); diff --git a/tests/spec/arb_indirect_parameters/tf-count-elements.c b/tests/spec/arb_indirect_parameters/tf-count-elements.c index b8ea084..8cd7944 100644 --- a/tests/spec/arb_indirect_parameters/tf-count-elements.c +++ b/tests/spec/arb_indirect_parameters/tf-count-elements.c @@ -203,7 +203,7 @@ piglit_display(void) /* Overdraw with the red quad, except count = 0 */ glMultiDrawElementsIndirectCountARB( GL_TRIANGLES, GL_UNSIGNED_INT, - (2 * 5 * 4), 4, 1, 0); + (const void *) (2 * 5 * 4), 4, 1, 0); pass &= piglit_probe_rect_rgba(0, 0, piglit_width / 2, piglit_height, g); -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/4] util: fix piglit_multisample_texture() parameter type
Texture IDs are GLuint, not GLenum. --- tests/util/piglit-util-gl.c | 3 ++- tests/util/piglit-util-gl.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index d8b8f85..041427d 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -2949,6 +2949,7 @@ static const char multisample_texture_fs_source[] = * * \param target either GL_TEXTURE_2D_MULTISAMPLE or * GL_TEXTURE2D_MULTISAMPLE_ARRAY + * \param textexture ID for existing texture, or zero * \param internalformat a renderable color format accepted by * glTexImage2DMultisample * \param width texture width @@ -2963,7 +2964,7 @@ static const char multisample_texture_fs_source[] = * \return the new texture object id */ GLuint -piglit_multisample_texture(GLenum target, GLenum tex, GLenum internalFormat, +piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat, unsigned width, unsigned height, unsigned depth, unsigned samples, GLenum format, GLenum type, void *data) diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h index 3bb0ee8..00b5a35 100644 --- a/tests/util/piglit-util-gl.h +++ b/tests/util/piglit-util-gl.h @@ -304,7 +304,7 @@ GLuint piglit_rgbw_texture(GLenum internalFormat, int w, int h, GLboolean mip, GLuint piglit_integer_texture(GLenum internalFormat, int w, int h, int b, int a); GLuint piglit_depth_texture(GLenum target, GLenum format, int w, int h, int d, GLboolean mip); GLuint piglit_array_texture(GLenum target, GLenum format, int w, int h, int d, GLboolean mip); -GLuint piglit_multisample_texture(GLenum target, GLenum tex, +GLuint piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat, unsigned width, unsigned height, unsigned depth, unsigned samples, -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] framework: specify GL_NEAREST filter for FBO textures
Brian Paulwrites: > By setting the min/mag filters, we give a hint to the OpenGL driver > that we probaby don't want mipmapped textures. This results in the > Mesa state tracker allocating single-level textures here instead of > full mipmaps. Reviewed-by: Eric Anholt signature.asc Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] gl-1.0-logicop: allow testing single mode on the command line
>From: Brian Paul>Sent: Thursday, November 9, 2017 12:52 PM >To: piglit@lists.freedesktop.org >Cc: Charmaine Lee; Brian Paul >Subject: [PATCH] gl-1.0-logicop: allow testing single mode on the command line >And require GL 1.1 since that's when color logicops were introduced. >Technically, we should move/rename the test, but it's hardly worth it. >--- > tests/spec/gl-1.0/logicop.c | 90 + > 1 file changed, 58 insertions(+), 32 deletions(-) >diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c >index 9ff80be..d415335 100644 >--- a/tests/spec/gl-1.0/logicop.c >+++ b/tests/spec/gl-1.0/logicop.c >@@ -46,7 +46,7 @@ > PIGLIT_GL_TEST_CONFIG_BEGIN >- config.supports_gl_compat_version = 10; >+ config.supports_gl_compat_version = 11; >config.window_visual = PIGLIT_GL_VISUAL_RGBA | >PIGLIT_GL_VISUAL_DOUBLE; >@@ -54,12 +54,28 @@ PIGLIT_GL_TEST_CONFIG_BEGIN > PIGLIT_GL_TEST_CONFIG_END >-void >-piglit_init(int argc, char **argv) >-{ >- srand(0); >- piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); >-} >+ >+static const GLenum logicop_modes[] = { >+ GL_CLEAR, >+ GL_SET, >+ GL_COPY, >+ GL_COPY_INVERTED, >+ GL_NOOP, >+ GL_INVERT, >+ GL_AND, >+ GL_NAND, >+ GL_OR, >+ GL_NOR, >+ GL_XOR, >+ GL_EQUIV, >+ GL_AND_REVERSE, >+ GL_AND_INVERTED, >+ GL_OR_REVERSE, >+ GL_OR_INVERTED >+}; >+ >+static GLenum test_single = 0; /* 0 = test all logicop modes */ >+ > static GLubyte* > random_image_data(void) >@@ -67,7 +83,7 @@ random_image_data(void) >int i; >GLubyte *img = malloc(4 * img_width * img_height * sizeof(GLubyte)); >for (i = 0; i < 4 * img_width * img_height; ++i) { >- img[i] = rand() % 256; >+ img[i] = /*rand()*/ (100+i) % 256; Is this change intentional or just a left over from debugging? Other than that, Reviewed-by: Charmaine Lee ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] framework: specify GL_NEAREST filter for FBO textures
Reviewed-by: Charmaine LeeFrom: Brian Paul Sent: Thursday, November 9, 2017 12:52:42 PM To: piglit@lists.freedesktop.org Cc: Charmaine Lee; Brian Paul Subject: [PATCH] framework: specify GL_NEAREST filter for FBO textures By setting the min/mag filters, we give a hint to the OpenGL driver that we probaby don't want mipmapped textures. This results in the Mesa state tracker allocating single-level textures here instead of full mipmaps. --- tests/util/piglit-framework-gl/piglit_fbo_framework.c | 4 1 file changed, 4 insertions(+) diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c b/tests/util/piglit-framework-gl/piglit_fbo_framework.c index 77e717b..7064753 100644 --- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c +++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c @@ -77,6 +77,8 @@ init_gl(struct piglit_wfl_framework *wfl_fw) glGenTextures(1, ); glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, piglit_width, piglit_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); @@ -93,6 +95,8 @@ init_gl(struct piglit_wfl_framework *wfl_fw) */ glGenTextures(1, ); glBindTexture(GL_TEXTURE_2D, depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL, piglit_width, piglit_height, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL); -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] gl-1.0-logicop: allow testing single mode on the command line
On 11/10/2017 12:16 PM, Charmaine Lee wrote: From: Brian PaulSent: Thursday, November 9, 2017 12:52 PM To: piglit@lists.freedesktop.org Cc: Charmaine Lee; Brian Paul Subject: [PATCH] gl-1.0-logicop: allow testing single mode on the command line And require GL 1.1 since that's when color logicops were introduced. Technically, we should move/rename the test, but it's hardly worth it. --- tests/spec/gl-1.0/logicop.c | 90 + 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c index 9ff80be..d415335 100644 --- a/tests/spec/gl-1.0/logicop.c +++ b/tests/spec/gl-1.0/logicop.c @@ -46,7 +46,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN - config.supports_gl_compat_version = 10; + config.supports_gl_compat_version = 11; config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; @@ -54,12 +54,28 @@ PIGLIT_GL_TEST_CONFIG_BEGIN PIGLIT_GL_TEST_CONFIG_END -void -piglit_init(int argc, char **argv) -{ - srand(0); - piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); -} + +static const GLenum logicop_modes[] = { + GL_CLEAR, + GL_SET, + GL_COPY, + GL_COPY_INVERTED, + GL_NOOP, + GL_INVERT, + GL_AND, + GL_NAND, + GL_OR, + GL_NOR, + GL_XOR, + GL_EQUIV, + GL_AND_REVERSE, + GL_AND_INVERTED, + GL_OR_REVERSE, + GL_OR_INVERTED +}; + +static GLenum test_single = 0; /* 0 = test all logicop modes */ + static GLubyte* random_image_data(void) @@ -67,7 +83,7 @@ random_image_data(void) int i; GLubyte *img = malloc(4 * img_width * img_height * sizeof(GLubyte)); for (i = 0; i < 4 * img_width * img_height; ++i) { - img[i] = rand() % 256; + img[i] = /*rand()*/ (100+i) % 256; Is this change intentional or just a left over from debugging? Oops, left-over from debugging. Thanks for catching that. -Brian Other than that, Reviewed-by: Charmaine Lee ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] framework: decrement argc in delete_arg()
Reviewed-by: Charmaine LeeFrom: Brian Paul Sent: Thursday, November 9, 2017 8:18:31 PM To: piglit@lists.freedesktop.org Cc: Charmaine Lee; Brian Paul Subject: [PATCH] framework: decrement argc in delete_arg() So it doesn't have to be done after every call to delete_arg(). --- tests/util/piglit-framework-gl.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 22aadc5..1b2078d 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -87,13 +87,14 @@ piglit_gl_test_config_init(struct piglit_gl_test_config *config) } static void -delete_arg(char *argv[], int argc, int arg) +delete_arg(char *argv[], int *argc, int arg) { int i; - for (i = arg + 1; i < argc; i++) { + for (i = arg + 1; i < *argc; i++) { argv[i - 1] = argv[i]; } + (*argc)--; } /** @@ -117,16 +118,13 @@ process_args(int *argc, char *argv[], unsigned *force_samples, for (j = 1; j < *argc; j++) { if (!strcmp(argv[j], "-auto")) { piglit_automatic = 1; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-fbo")) { piglit_use_fbo = true; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-png")) { piglit_dump_png = true; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-rlimit")) { char *ptr; unsigned long lim; @@ -158,12 +156,10 @@ process_args(int *argc, char *argv[], unsigned *force_samples, j -= 2; } else if (!strncmp(argv[j], "-samples=", 9)) { *force_samples = atoi(argv[j]+9); - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-khr_no_error")) { piglit_khr_no_error = true; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); if (config->khr_no_error_support == PIGLIT_UNKNOWN_ERROR_STATUS) { fprintf(stderr, @@ -186,8 +182,7 @@ process_args(int *argc, char *argv[], unsigned *force_samples, config->supports_gl_compat_version = 10; config->supports_gl_core_version = 0; puts("The compatibility profile forced."); - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } } } -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2] shader_draw_parameters: Also test using an indirect draw
The test can now take an extra argument ‘indirect’ which will cause it to emit the draw calls via an indirect buffer. This is useful to test at least on i965 because emitting the gl_BaseVertex takes a different path in that case. --- tests/all.py | 10 +- tests/spec/arb_shader_draw_parameters/basevertex.c | 122 + 2 files changed, 104 insertions(+), 28 deletions(-) diff --git a/tests/all.py b/tests/all.py index ae4a995..e9d5583 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4903,15 +4903,17 @@ with profile.test_list.group_manager( grouptools.join('spec', 'ARB_shader_draw_parameters')) as g: g(['arb_shader_draw_parameters-drawid', 'drawid'], 'drawid') g(['arb_shader_draw_parameters-drawid', 'vertexid'], 'drawid-vertexid') -g(['arb_shader_draw_parameters-basevertex', 'basevertex'], 'basevertex') -g(['arb_shader_draw_parameters-basevertex', 'baseinstance'], 'baseinstance') -g(['arb_shader_draw_parameters-basevertex', 'basevertex-baseinstance'], 'basevertex-baseinstance') -g(['arb_shader_draw_parameters-basevertex', 'vertexid-zerobased'], 'vertexid-zerobased') g(['arb_shader_draw_parameters-drawid-indirect', 'drawid'], 'drawid-indirect') g(['arb_shader_draw_parameters-drawid-indirect', 'basevertex'], 'drawid-indirect-basevertex') g(['arb_shader_draw_parameters-drawid-indirect', 'baseinstance'], 'drawid-indirect-baseinstance') g(['arb_shader_draw_parameters-drawid-indirect', 'vertexid'], 'drawid-indirect-vertexid') +variables = ('basevertex', 'baseinstance', 'basevertex-baseinstance', 'vertexid-zerobased') +for v in variables: +g(['arb_shader_draw_parameters-basevertex', v], v) +for v in variables: +g(['arb_shader_draw_parameters-basevertex', v, 'indirect'], v + '-indirect') + # Group ARB_indirect_parameters with profile.test_list.group_manager( PiglitGLTest, diff --git a/tests/spec/arb_shader_draw_parameters/basevertex.c b/tests/spec/arb_shader_draw_parameters/basevertex.c index 333d4e2..4db6cd1 100644 --- a/tests/spec/arb_shader_draw_parameters/basevertex.c +++ b/tests/spec/arb_shader_draw_parameters/basevertex.c @@ -1,5 +1,5 @@ /* - * Copyright © 2015 Intel Corporation + * Copyright © 2015, 2017 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -82,6 +82,8 @@ static const char fs_text[] = " gl_FragColor = color;\n" "}\n"; +static bool opt_draw_indirect = false; + void piglit_init(int argc, char **argv) { @@ -105,16 +107,102 @@ piglit_init(int argc, char **argv) piglit_report_result(PIGLIT_FAIL); } + if (argc > 2) { + if (strcmp(argv[2], "indirect") == 0) { + opt_draw_indirect = true; + } else { + printf("Unknown second argument: %s\n", argv[2]); + piglit_report_result(PIGLIT_FAIL); + } + } + piglit_require_GLSL_version(330); piglit_require_extension("GL_ARB_shader_draw_parameters"); piglit_require_extension("GL_ARB_base_instance"); + if (opt_draw_indirect) + piglit_require_extension("GL_ARB_draw_indirect"); prog = piglit_build_simple_program(vs_text, fs_text); glUseProgram(prog); } +static void +draw_direct(void) +{ + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, NULL); + + /* We use this monster to draw the right half of the +* window. Base vertex so that we can reuse the indices to +* draw with vertices and colors 4-7, base instance so that we +* can verify that the value presented in the shader is +* correct. We only draw one instance so the only effect of +* instancing is that gl_BaseInstanceARB is 7. +*/ + glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, 6, + GL_UNSIGNED_INT, + NULL, 1, + 4, /* basevertex */ + 7 /* baseinstance */); + + /* Test using glDrawArrays with a non-zero ‘first’ parameter. +* This value should be included in gl_VertexID but not in +* gl_BaseVertex. +*/ + glDrawArrays(GL_TRIANGLE_STRIP, +8, /* first */ +4 /* count */); +} + +static void +draw_indirect(void) +{ + GLuint params_bo; + + static const GLuint draw_params[] = { + 6, /* count */ + 1, /* prim count */ + 0, /* firstIndex */ + 0, /* baseVertex */ + 0, /* baseInstance */ + + 6, /* count */ + 1, /* prim count */ + 0,
[Piglit] [PATCH 1/2] shader_draw_parameters: Also test using glDrawArrays with first > 0
The ‘first’ parameter should not affect the value of gl_BaseVertex put it should be added to gl_VertexID. This patch adds an extra rectangle to the drawn area to test a non-zero ‘first’ parameter. This is worth testing because Mesa is currently getting this wrong. --- tests/spec/arb_shader_draw_parameters/basevertex.c | 52 ++ 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/tests/spec/arb_shader_draw_parameters/basevertex.c b/tests/spec/arb_shader_draw_parameters/basevertex.c index 2279e0f..333d4e2 100644 --- a/tests/spec/arb_shader_draw_parameters/basevertex.c +++ b/tests/spec/arb_shader_draw_parameters/basevertex.c @@ -24,10 +24,26 @@ /** * \file basevertex.c * - * Test that gl_BaseVertexARB has the correct values. Draw left side - * of window with a non-base-vertex draw call to verify - * gl_BaseVertexARB is 0 in that case, then draw other half with base - * vertex 4 and verifies that that works. + * Test that gl_BaseVertexARB has the correct values. + * + * The framebuffer is filled with three quads like this: + * + * # + * # # # + * # # B # + * # A # + * # # C # + * # # # + * # + * + * Quad A is rendered using a non-base-vertex draw call to verify that + * gl_BaseVertexARB is zero in that case. + * + * Quad B is rendered with baseVertex as 4. + * + * Quad C is rendered using a non-indexed draw call with a non-zero + * ‘first’ parameter. This shouldn’t affect gl_BaseVertex but it + * should affect gl_VertexID. */ #include "piglit-util-gl.h" @@ -104,19 +120,27 @@ piglit_display() { bool pass; - static const float vertex_array[16] = { + static const float vertex_array[24] = { + /* Left half of the screen */ -1, -1, 0, -1, 0, 1, -1, 1, - 0, -1, - 1, -1, + /* Top-right quarter of the screen */ + 0, 0, + 1, 0, 1, 1, 0, 1, + + /* Bottom-right quarter of the screen */ + 0, -1, + 1, -1, + 0, 0, + 1, 0, }; - static const int reference_array[32] = { + static const int reference_array[48] = { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, @@ -125,6 +149,10 @@ piglit_display() 4, 7, 1, 0, 4, 7, 2, 0, 4, 7, 3, 0, + 0, 0, 8, 0, + 0, 0, 9, 0, + 0, 0, 10, 0, + 0, 0, 11, 0, }; const int indices[6] = { @@ -167,6 +195,14 @@ piglit_display() 4, /* basevertex */ 7 /* baseinstance */); + /* Test using glDrawArrays with a non-zero ‘first’ parameter. +* This value should be included in gl_VertexID but not in +* gl_BaseVertex. +*/ + glDrawArrays(GL_TRIANGLE_STRIP, +8, /* first */ +4 /* count */); + pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green); -- 2.9.5 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] all.py: filter directories traversed to find shader tests
Thanks! Reviewed-by: Dylan BakerQuoting Brian Paul (2017-11-09 20:18:10) > The script searches all files under tests/ and generated_tests/ for > files ending in ".shader_test". For each match, a ShaderTest() object > is created and added to the test list. > > For GL extensions or versions not supported by the driver, this is > wasted effort. > > This patch looks for directories under spec/ and tries to determine if > the extension/feature is actually supported by the current driver. If > not, it's skipped. > > This, with other recent optimizations, reduces Piglit startup time for a > Windows VM from nearly 5 minutes to 45 seconds. > > v2: > - replace os.path.walk() with my own walk_dir_tree() which avoids > decending into subdirs when the parent directory/feature is not supported. > - Use env var to enable/disable shader directory filtering > - Also, fix naming conventions and minor formatting issues. > v3: > - minor Piglit style changes, per Dylan > - handle ES cases in is_feature_directory_supported() > --- > tests/all.py | 81 > +++- > 1 file changed, 80 insertions(+), 1 deletion(-) > > diff --git a/tests/all.py b/tests/all.py > index ae4a995..6c89d7a 100644 > --- a/tests/all.py > +++ b/tests/all.py > @@ -13,7 +13,9 @@ import six > from six.moves import range > > from framework import grouptools > +from framework.test import opengl > from framework import options > +from framework import wflinfo > from framework.profile import TestProfile > from framework.driver_classifier import DriverClassifier > from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest, > @@ -210,9 +212,86 @@ profile = TestProfile() # pylint: disable=invalid-name > > shader_tests = collections.defaultdict(list) > > +wfl_info = wflinfo.WflInfo() > + > + > +def gl_extension_supported(ext_name): > +"""Is the named OpenGL extension supported?""" > +return ext_name in wfl_info.gl_extensions > + > + > +def is_feature_directory_supported(dir_name): > +"""Determine if dir_name specifies an OpenGL feature (extension or GL > +version) which is supported by the host. If we return False, it means > +the extension/version is definitely not supported. If we return True, > +it means the extension/version is possibly suppported. We're a little > +fuzzy because we don't yet parse all the directory name possibilities > +(like ES tests). > +""" > +if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}: > +# The directory is a GL extension name, but of the format > "arb_foo_bar" > +# instead of "GL_ARB_foo_bar". We convert the former into the later > +# and check if the extension is supported. > +ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:] > +return gl_extension_supported(ext_name) > +elif dir_name[:5] == "gles-": > +# OpenGL ES test > +version = dir_name[5:] > +return float(version) <= float(wfl_info.gles_version) > +elif dir_name[:8] == "glsl-es-": > +# OpenGL ES shader test > +version = dir_name[8:] > +return float(version) <= float(wfl_info.glsl_es_version) > +elif dir_name[:3] == "gl-": > +# The directory is a GL version > +version = dir_name[3:] > +return float(version) <= float(wfl_info.gl_version) > +elif dir_name[:5] == "glsl-": > +# The directory is a GLSL version > +version = dir_name[5:] > +return float(version) <= float(wfl_info.glsl_version) > +else: > +# The directory is something else. Don't skip it. > +return True > + > + > +def walk_filter_dir_tree(root): > +"""Recursively walk the directory tree rooted at 'root'. > +If we find a directory path of the form ".../spec/foo/" we'll check if > +'foo' is a supported extension/feature/version. If not, we do not > +traverse foo/. Otherwise, we add continue traversing. > +The return value is a list of (dirpath, filename) tuples. > +""" > +curdir = os.path.split(root)[1] > +files = [] > +retval = [] > + > +for entry in os.listdir(root): > +full_path = os.path.join(root, entry) > +if os.path.isdir(full_path): > +# Check if we're in a "spec/" direcotry > +if curdir == "spec" and not > is_feature_directory_supported(entry): > +# The directory's tests aren't supported by the driver. > +print("Skipping spec/{}".format(entry)) > +else: > +# recursively walk the subdirectory > +retval += walk_filter_dir_tree(full_path) > +elif os.path.isfile(full_path): > +# Add the file to the files list > +files += [entry] > + > +retval += [(root, [], files)] > + > +return retval > + > + > # Find and add all shader tests. > for basedir in [TESTS_DIR,