Re: [Piglit] [PATCH 1/2] glslparsertest: support compatibility profile tests
Reviewed-by: Timothy Arceri On 23/05/18 11:29, Marek Olšák wrote: From: Marek Olšák --- framework/test/glsl_parser_test.py| 5 + tests/glslparsertest/glslparsertest.c | 18 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/framework/test/glsl_parser_test.py b/framework/test/glsl_parser_test.py index 46344a8ab..8f2904eb1 100644 --- a/framework/test/glsl_parser_test.py +++ b/framework/test/glsl_parser_test.py @@ -58,20 +58,23 @@ def _is_gles_version(version): assert not isinstance(version, six.binary_type), \ '{}({})'.format(version, type(version)) if isinstance(version, six.text_type): # GLES 3+ versions should have "es" appended, even though # glslparsertest doesn't require them. If the version ends in "es" then # it is a GLES test for sure. if version.endswith('es'): return True +if version.endswith('compatibility'): +return False + version = float(version) return version in [1.0, 3.0, 3.1, 3.2] class GLSLParserNoConfigError(exceptions.PiglitInternalError): pass class GLSLParserInternalError(exceptions.PiglitInternalError): @@ -105,20 +108,22 @@ class Parser(object): raise exceptions.PiglitFatalError( 'In file "{}":\n{}'.format(filepath, six.text_type(e))) self.set_skip_conditions() def set_skip_conditions(self): """Set OpenGL and OpenGL ES fast skipping conditions.""" glsl = self.config['glsl_version'] if _is_gles_version(glsl): self.glsl_es_version = float(glsl[:3]) +elif glsl.endswith('compatibility'): +self.glsl_version = float(glsl[:3]) else: self.glsl_version = float(glsl) req = self.config['require_extensions'] self.gl_required = set(r for r in req.split() if not r.startswith('!')) # If GLES is requested, but piglit was not built with a gles version, # then ARB_ES3_compatibility is required. Add it to # self.gl_required if self.glsl_es_version and not _HAS_GLES_BIN: diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c index 3ad0906b1..61ea46ce2 100644 --- a/tests/glslparsertest/glslparsertest.c +++ b/tests/glslparsertest/glslparsertest.c @@ -28,29 +28,33 @@ /** @file glslparsertest.c * * Tests that compiling (but not linking or drawing with) a given * shader either succeeds or fails as expected. */ #include #include "piglit-util-gl.h" +#define COMPAT_FLAG (1u << 31) + static unsigned parse_glsl_version_number(const char *str); static int process_options(int argc, char **argv); PIGLIT_GL_TEST_CONFIG_BEGIN argc = process_options(argc, argv); if (argc > 3) { - const unsigned int int_version + const unsigned int version = parse_glsl_version_number(argv[3]); + const bool compat = !!(version & COMPAT_FLAG); + const unsigned int int_version = version & ~COMPAT_FLAG; switch (int_version) { /* This is a hack to support es * * This works because version 1.00, 3.00, 3.10, 3.20 (even * though 3.x should include "es") are unique to GLES, there is * no desktop OpenGL shader language 1.00, 3.00, 3.10, or 3.20 */ case 100: config.supports_gl_compat_version = 10; config.supports_gl_es_version = 20; @@ -64,21 +68,21 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_es_version = 31; break; case 320: config.supports_gl_compat_version = 10; config.supports_gl_es_version = 32; break; default: { const unsigned int gl_version = required_gl_version_from_glsl_version(int_version); config.supports_gl_compat_version = gl_version; - if (gl_version < 31) + if (gl_version < 31 || compat) config.supports_gl_core_version = 0; else config.supports_gl_core_version = gl_version; } break; } } else { config.supports_gl_compat_version = 10; config.supports_gl_es_version = 20; } @@ -398,51 +402,55 @@ static void usage(char *name) /** * Process any options and remove them from the argv array. Return * the new argc. */ static int process_options(int argc, char **argv) { int i = 1; int new_argc =
Re: [Piglit] [PATCH v2] add GL_ARB_sample_locations
I took a quick look and I'm OK with it. If anyone else wants to review it more closely, please do so soon. Reviewed-by: Brian Paul On 05/24/2018 12:55 PM, Rhys Perry wrote: Ping I guess? On Mon, May 7, 2018 at 5:19 PM, Rhys Perry wrote: Changelog: v2: - Rebase to handle meta profiles. --- tests/opengl.py | 6 + tests/quick_gl.py | 7 + tests/spec/CMakeLists.txt | 1 + tests/spec/arb_sample_locations/CMakeLists.gl.txt | 11 + tests/spec/arb_sample_locations/CMakeLists.txt| 1 + tests/spec/arb_sample_locations/test.c| 290 ++ 6 files changed, 316 insertions(+) create mode 100644 tests/spec/arb_sample_locations/CMakeLists.gl.txt create mode 100644 tests/spec/arb_sample_locations/CMakeLists.txt create mode 100644 tests/spec/arb_sample_locations/test.c diff --git a/tests/opengl.py b/tests/opengl.py index 825e0bf83..46b26b2ac 100644 --- a/tests/opengl.py +++ b/tests/opengl.py @@ -4840,5 +4840,11 @@ with profile.test_list.group_manager( g(['arb_bindless_texture-uint64_attribs'], 'uint64_attribs') g(['arb_bindless_texture-uniform'], 'uniform') +# Group ARB_sample_locations +with profile.test_list.group_manager( + PiglitGLTest, + grouptools.join('spec', 'ARB_sample_locations')) as g: +g(['arb_sample_locations'], 'test') + if platform.system() is 'Windows': profile.filters.append(lambda p, _: not p.startswith('glx')) diff --git a/tests/quick_gl.py b/tests/quick_gl.py index c6501904c..1f5d4d960 100644 --- a/tests/quick_gl.py +++ b/tests/quick_gl.py @@ -60,6 +60,13 @@ with profile.test_list.group_manager( with profile.test_list.allow_reassignment: g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func') +# Set the --quick flag on the GL_ARB_sample_locations test +with profile.test_list.group_manager( +PiglitGLTest, +grouptools.join('spec', 'arb_sample_locations')) as g: +with profile.test_list.allow_reassignment: +g(['arb_sample_locations', '--quick'], 'test') + # Limit texture size to 512x512 for some texture_multisample tests. # The default (max supported size) can be pretty slow. with profile.test_list.group_manager( diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 405d35a53..941e56805 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -45,6 +45,7 @@ add_subdirectory (arb_point_parameters) add_subdirectory (arb_point_sprite) add_subdirectory (arb_provoking_vertex) add_subdirectory (arb_robustness) +add_subdirectory (arb_sample_locations) add_subdirectory (arb_sample_shading) add_subdirectory (arb_sampler_objects) add_subdirectory (arb_seamless_cube_map) diff --git a/tests/spec/arb_sample_locations/CMakeLists.gl.txt b/tests/spec/arb_sample_locations/CMakeLists.gl.txt new file mode 100644 index 0..c4652699f --- /dev/null +++ b/tests/spec/arb_sample_locations/CMakeLists.gl.txt @@ -0,0 +1,11 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} +) + +piglit_add_executable (arb_sample_locations test.c) diff --git a/tests/spec/arb_sample_locations/CMakeLists.txt b/tests/spec/arb_sample_locations/CMakeLists.txt new file mode 100644 index 0..144a306f4 --- /dev/null +++ b/tests/spec/arb_sample_locations/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_sample_locations/test.c b/tests/spec/arb_sample_locations/test.c new file mode 100644 index 0..f83b17894 --- /dev/null +++ b/tests/spec/arb_sample_locations/test.c @@ -0,0 +1,290 @@ +#include "piglit-util-gl.h" + +/** + * @file test.c + * + * This test verifies that GL_ARB_sample_locations is implemented correctly. + * It does so by retrieving the sample positions using gl_SamplePosition, + * interpolateAtSample() and a method described in + * https://urldefense.proofpoint.com/v2/url?u=https-3A__mynameismjp.wordpress.com_2010_07_07_msaa-2Dsample-2Dpattern-2Ddetector_&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=BjLC1YxlRyoT7nYPqsqgLQdA-EJksEam2pQ9fECOtW8&s=HTkf6lGUjxGK2QwYJuUdP4OvnMRNZnJY8Cg7exCfDkc&e= + * which draws a rectangle covering each possible sample location within a pixel. + * Each rectangle writes it's position within the pixel, which is then read + * through a shader. + * + * The retrieved sample locations are then tested against expectations. This is + * done with various MSAA levels and sample locations. + * + * The test can be rather slow by default, but it can be made less exhaustive by + * passing the argument --quick. + * + * Sample locations are typically represented in this test as 0.4 fixed point + * integers where 0 is the top. + */ + +/* new_locations in do_test_set() needs to be expanded when this is */ +#define LOG2_MAX_SAMPL
Re: [Piglit] [PATCH v2] add GL_ARB_sample_locations
Ping I guess? On Mon, May 7, 2018 at 5:19 PM, Rhys Perry wrote: > Changelog: > v2: > - Rebase to handle meta profiles. > > --- > tests/opengl.py | 6 + > tests/quick_gl.py | 7 + > tests/spec/CMakeLists.txt | 1 + > tests/spec/arb_sample_locations/CMakeLists.gl.txt | 11 + > tests/spec/arb_sample_locations/CMakeLists.txt| 1 + > tests/spec/arb_sample_locations/test.c| 290 > ++ > 6 files changed, 316 insertions(+) > create mode 100644 tests/spec/arb_sample_locations/CMakeLists.gl.txt > create mode 100644 tests/spec/arb_sample_locations/CMakeLists.txt > create mode 100644 tests/spec/arb_sample_locations/test.c > > diff --git a/tests/opengl.py b/tests/opengl.py > index 825e0bf83..46b26b2ac 100644 > --- a/tests/opengl.py > +++ b/tests/opengl.py > @@ -4840,5 +4840,11 @@ with profile.test_list.group_manager( > g(['arb_bindless_texture-uint64_attribs'], 'uint64_attribs') > g(['arb_bindless_texture-uniform'], 'uniform') > > +# Group ARB_sample_locations > +with profile.test_list.group_manager( > + PiglitGLTest, > + grouptools.join('spec', 'ARB_sample_locations')) as g: > +g(['arb_sample_locations'], 'test') > + > if platform.system() is 'Windows': > profile.filters.append(lambda p, _: not p.startswith('glx')) > diff --git a/tests/quick_gl.py b/tests/quick_gl.py > index c6501904c..1f5d4d960 100644 > --- a/tests/quick_gl.py > +++ b/tests/quick_gl.py > @@ -60,6 +60,13 @@ with profile.test_list.group_manager( > with profile.test_list.allow_reassignment: > g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func') > > +# Set the --quick flag on the GL_ARB_sample_locations test > +with profile.test_list.group_manager( > +PiglitGLTest, > +grouptools.join('spec', 'arb_sample_locations')) as g: > +with profile.test_list.allow_reassignment: > +g(['arb_sample_locations', '--quick'], 'test') > + > # Limit texture size to 512x512 for some texture_multisample tests. > # The default (max supported size) can be pretty slow. > with profile.test_list.group_manager( > diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt > index 405d35a53..941e56805 100644 > --- a/tests/spec/CMakeLists.txt > +++ b/tests/spec/CMakeLists.txt > @@ -45,6 +45,7 @@ add_subdirectory (arb_point_parameters) > add_subdirectory (arb_point_sprite) > add_subdirectory (arb_provoking_vertex) > add_subdirectory (arb_robustness) > +add_subdirectory (arb_sample_locations) > add_subdirectory (arb_sample_shading) > add_subdirectory (arb_sampler_objects) > add_subdirectory (arb_seamless_cube_map) > diff --git a/tests/spec/arb_sample_locations/CMakeLists.gl.txt > b/tests/spec/arb_sample_locations/CMakeLists.gl.txt > new file mode 100644 > index 0..c4652699f > --- /dev/null > +++ b/tests/spec/arb_sample_locations/CMakeLists.gl.txt > @@ -0,0 +1,11 @@ > +include_directories( > + ${GLEXT_INCLUDE_DIR} > + ${OPENGL_INCLUDE_PATH} > +) > + > +link_libraries ( > + piglitutil_${piglit_target_api} > + ${OPENGL_gl_LIBRARY} > +) > + > +piglit_add_executable (arb_sample_locations test.c) > diff --git a/tests/spec/arb_sample_locations/CMakeLists.txt > b/tests/spec/arb_sample_locations/CMakeLists.txt > new file mode 100644 > index 0..144a306f4 > --- /dev/null > +++ b/tests/spec/arb_sample_locations/CMakeLists.txt > @@ -0,0 +1 @@ > +piglit_include_target_api() > diff --git a/tests/spec/arb_sample_locations/test.c > b/tests/spec/arb_sample_locations/test.c > new file mode 100644 > index 0..f83b17894 > --- /dev/null > +++ b/tests/spec/arb_sample_locations/test.c > @@ -0,0 +1,290 @@ > +#include "piglit-util-gl.h" > + > +/** > + * @file test.c > + * > + * This test verifies that GL_ARB_sample_locations is implemented correctly. > + * It does so by retrieving the sample positions using gl_SamplePosition, > + * interpolateAtSample() and a method described in > + * https://mynameismjp.wordpress.com/2010/07/07/msaa-sample-pattern-detector/ > + * which draws a rectangle covering each possible sample location within a > pixel. > + * Each rectangle writes it's position within the pixel, which is then read > + * through a shader. > + * > + * The retrieved sample locations are then tested against expectations. This > is > + * done with various MSAA levels and sample locations. > + * > + * The test can be rather slow by default, but it can be made less > exhaustive by > + * passing the argument --quick. > + * > + * Sample locations are typically represented in this test as 0.4 fixed point > + * integers where 0 is the top. > + */ > + > +/* new_locations in do_test_set() needs to be expanded when this is */ > +#define LOG2_MAX_SAMPLES 5 > +#define MAX_SAMPLES (1< + > +#define WIDTH 4 > +/* the height is 7 pixels to test pixel grid flipping */ > +#define HEIGHT 7 > + > +PIGLIT_GL_TEST_CONFIG_BEGIN > + > + config
[Piglit] [Bug 106626] [CI][Intel-GFX-CI] large amount of @execution@build-in-functions@ tests crash
https://bugs.freedesktop.org/show_bug.cgi?id=106626 Martin Peres changed: What|Removed |Added Status|RESOLVED|CLOSED --- Comment #2 from Martin Peres --- (In reply to Mark Janes from comment #1) > This piglit patch was reverted a couple of hours after the regression. Thanks, we really need to stay on a fixed version of piglit that goes well with the mesa version we run. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v3] util: provide way to read a texture in ES compatible way
Implementation supports GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY and affects following functions: - piglit_probe_texel_rect_rgba - piglit_probe_texel_volume_rgba v2: use read_texture only on GL ES fix indentation issues v3: more documentation read all layers for GL_TEXTURE_2D_ARRAY Signed-off-by: Tapani Pälli --- tests/util/piglit-util-gl.c | 131 ++-- 1 file changed, 125 insertions(+), 6 deletions(-) diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c index 2443be03e..76ee0d0a0 100644 --- a/tests/util/piglit-util-gl.c +++ b/tests/util/piglit-util-gl.c @@ -1882,6 +1882,109 @@ piglit_probe_image_ubyte(int x, int y, int w, int h, GLenum format, return 1; } +static GLuint +create_fbo_from_texture(GLenum target, GLint texture, GLint level, GLint layer) +{ + GLuint fbo; + + glGenFramebuffers(1, &fbo); + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + + if (layer > 0) { + glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + texture, level, layer); + } else { + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + target, texture, level); + } + + assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == + GL_FRAMEBUFFER_COMPLETE); + return fbo; +} + +static GLenum +binding_from_target(GLenum target) +{ + switch (target) { + case GL_TEXTURE_2D: + return GL_TEXTURE_BINDING_2D; + case GL_TEXTURE_2D_ARRAY: + return GL_TEXTURE_BINDING_2D_ARRAY; + default: + fprintf(stderr, "%s: unsupported target 0x%x\n", + __func__, target); + return 0; + } +} + +/** + * Read texels in OpenGL ES compatible way. + * + * Currently bound texture is attached to a framebuffer object and + * contents are read using glReadPixels. Supported targets are + * GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY. + */ +static GLfloat * +read_texture_via_fbo(int target, int level, int x, int y, int layer, int w, +int h) +{ + GLint width, height, depth; + GLint current_read_fbo, current_draw_fbo, current_texture; + GLenum binding = binding_from_target(target); + unsigned char *buf; + GLfloat *buffer; + unsigned offset; + + assert(binding != 0); + + glGetIntegerv(binding, ¤t_texture); + glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, ¤t_read_fbo); + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_draw_fbo); + + assert(target == GL_TEXTURE_2D || target == GL_TEXTURE_2D_ARRAY); + + glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); + glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); + glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); + + /* Depth equals 1 in case of GL_TEXTURE_2D, in case of +* GL_TEXTURE_2D_ARRAY we allocate space for many layers. +*/ + buffer = malloc(width * height * depth * 4 * sizeof(GLfloat)); + buf = malloc(width * height * depth * 4 * sizeof(unsigned char)); + + /* Read all layers. */ + for (int i = layer; i >= 0; i--) { + GLuint fbo = + create_fbo_from_texture(target, current_texture, level, + i); + assert(fbo != 0); + + /* Offset to the layer we are expected to read. Note, in case +* of GL_TEXTURE_2D, offset will be always 0 as i equals 0. +*/ + offset = i * (width * height * 4); + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, +buf + offset); + + glDeleteFramebuffers(1, &fbo); + } + + /* Convert the result, callers expect floating point. */ + for (unsigned k = 0; k < (layer + 1) * width * height * 4; k++) + buffer[k] = ((float) buf[k]) / 255.0; + + free(buf); + + /* Restore FBO state. */ + glBindFramebuffer(GL_READ_FRAMEBUFFER, current_read_fbo); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current_draw_fbo); + + return buffer; +} + + /** * Read a texel rectangle from the given location and compare its RGB value to * the given expected values. @@ -1957,10 +2060,18 @@ int piglit_probe_texel_rect_rgba(int target, int level, int x, int y, glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); - buffer = malloc(width * height * 4 * sizeof(GLfloat)); - - glGetTexImage(target, level, GL_RGBA, GL_FLOAT, buffer); +#ifndef PIGLIT_USE_OPENGL + if (target == GL_TEXTURE_2D) { + buffer = read_texture_via_fbo(target, level, x, y, 0, w, h); + } else { +#else + buffer