[Piglit] [PATCH] glsl-1.10: test that loop unrolling doesnt create an infinite loop
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105670 --- ...vs-loop-complex-unroll-nested-break.shader_test | 48 ++ 1 file changed, 48 insertions(+) create mode 100644 tests/spec/glsl-1.10/execution/vs-loop-complex-unroll-nested-break.shader_test diff --git a/tests/spec/glsl-1.10/execution/vs-loop-complex-unroll-nested-break.shader_test b/tests/spec/glsl-1.10/execution/vs-loop-complex-unroll-nested-break.shader_test new file mode 100644 index 0..42721ca79 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/vs-loop-complex-unroll-nested-break.shader_test @@ -0,0 +1,48 @@ +# This tests for a bug in loop unrolling where we were detecting 2 breaks in +# the loop but only found a single terminator (exit condition). The result was +# we were attempting to do a complex unroll but failing half way through the +# unroll process. As a result we ended up creating an infinite loop. +[require] +GLSL >= 1.10 + +[vertex shader] +uniform int loop_break; + +void main() +{ + gl_Position = gl_Vertex; + + vec4 colour; + int j = 0; + for (int i = 0; i < 4; i++) { + + colour = vec4(0.0, 1.0, 0.0, 1.0); + + if (i >= 2) { +j++; // we use this so the if doesn't get reduced to a series of bcsel +if (loop_break == 1 || j == loop_break) { + colour = vec4(1.0, 0.0, 0.0, 1.0); + break; +} + } + } + + gl_FrontColor = colour; +} + +[fragment shader] +void main() +{ + gl_FragColor = gl_Color; +} + +[test] +clear color 0.5 0.5 0.5 0.5 + +uniform int loop_break 0 +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 + +uniform int loop_break 1 +draw rect -1 -1 2 2 +probe all rgba 1.0 0.0 0.0 1.0 -- 2.14.3 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 3/3] arb_get_texture_sub_image: update cube map tests to complete the cube map
From: Anthony PeschUpdate cube map tests to complete the cube map before performing the final query. This final query is expected to succeed, however, querying a cube map which is not cube complete should set INVALID_OPERATION as per the OpenGL 4.6 Core spec: "An INVALID_OPERATION error is generated if the effective target is TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and the texture object is not cube complete or cube array complete, respectively." --- tests/spec/arb_get_texture_sub_image/errors.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/spec/arb_get_texture_sub_image/errors.c b/tests/spec/arb_get_texture_sub_image/errors.c index 1e7b17115..4b99d1cc2 100644 --- a/tests/spec/arb_get_texture_sub_image/errors.c +++ b/tests/spec/arb_get_texture_sub_image/errors.c @@ -253,16 +253,20 @@ test_cubemap_faces(void) 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL); } -/* try to get all six cube faces, should fail */ +/* try to query incomplete cube map, should fail */ glGetTextureSubImage(tex, 0, 0, 0, 0, - 8, 8, 6, + 8, 8, 5, GL_RGBA, GL_UNSIGNED_BYTE, sizeof(results), results); if (!piglit_check_gl_error(GL_INVALID_OPERATION)) pass = false; -/* try to get five cube faces, should pass */ + /* upload final face */ + glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + 5, +0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL); + +/* try to query complete cube map, should now pass */ glGetTextureSubImage(tex, 0, 0, 0, 0, 8, 8, 5, -- 2.13.6 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/3] arb_get_texture_sub_image: fix depth parameter when performing zero-sized texture queries
From: Anthony PeschChange zero-sized texture queries to pass a valid depth parameter, otherwise they should error as per the OpenGL 4.6 Core spec: "An INVALID_VALUE error is generated if the effective target is TEXTURE_1D, TEXTURE_1D_ARRAY, TEXTURE_2D or TEXTURE_RECTANGLE, and either zoffset is not zero, or depth is not one." --- tests/spec/arb_get_texture_sub_image/errors.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/spec/arb_get_texture_sub_image/errors.c b/tests/spec/arb_get_texture_sub_image/errors.c index 57875fa6a..1e7b17115 100644 --- a/tests/spec/arb_get_texture_sub_image/errors.c +++ b/tests/spec/arb_get_texture_sub_image/errors.c @@ -293,7 +293,7 @@ test_zero_size_image(void) /* getting 0x0 image from 8x8 source should work */ glGetTextureSubImage(tex, 0, 0, 0, 0, -0, 0, 0, +0, 0, 1, GL_RGBA, GL_UNSIGNED_BYTE, sizeof(image), image); if (!piglit_check_gl_error(GL_NO_ERROR)) @@ -306,7 +306,7 @@ test_zero_size_image(void) /* getting 0x0 image from 0x0 source should work */ glGetTextureSubImage(tex, 0, 0, 0, 0, -0, 0, 0, +0, 0, 1, GL_RGBA, GL_UNSIGNED_BYTE, sizeof(image), image); if (!piglit_check_gl_error(GL_NO_ERROR)) @@ -315,7 +315,7 @@ test_zero_size_image(void) /* getting 0x0 image at an offset from 0x0 source should error */ glGetTextureSubImage(tex, 0, 1, 2, 0, /* offset */ -0, 0, 0, +0, 0, 1, GL_RGBA, GL_UNSIGNED_BYTE, sizeof(image), image); if (!piglit_check_gl_error(GL_INVALID_VALUE)) -- 2.13.6 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error when querying a level which hasn't been explicitly defined
From: Anthony PeschChange expected error from INVALID_OPERATION to INVALID_VALUE when querying a level which hasn't been explicitly defined. This is a valid operation, the error set should be due to the requested width and height being greater than the default width and height of zero. --- tests/spec/arb_get_texture_sub_image/errors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spec/arb_get_texture_sub_image/errors.c b/tests/spec/arb_get_texture_sub_image/errors.c index 34fec4a95..57875fa6a 100644 --- a/tests/spec/arb_get_texture_sub_image/errors.c +++ b/tests/spec/arb_get_texture_sub_image/errors.c @@ -200,7 +200,7 @@ test_invalid_values(void) 8, 8, 1, /* size */ GL_RGBA, GL_FLOAT, /* bad enum */ sizeof(buffer), buffer); - if (!piglit_check_gl_error(GL_INVALID_OPERATION)) + if (!piglit_check_gl_error(GL_INVALID_VALUE)) pass = false; /* Test getting invalid offset */ -- 2.13.6 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 03/15] gl-3.2/adj-prims: fix expected vertex order for triangle strips with adjacency
For 3&4, Reviewed-by: Brian PaulTested-by: Brian Paul (on NVIDIA) On 03/26/2018 05:32 PM, Marek Olšák wrote: From: Nicolai Hähnle The first two vertices are swapped for triangle strips with adjacency; see Table 10.1 of the OpenGL 4.5 (Compatibility Profile) spec. --- tests/spec/gl-3.2/adj-prims.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/spec/gl-3.2/adj-prims.c b/tests/spec/gl-3.2/adj-prims.c index 794ab3dc9..f4479c708 100644 --- a/tests/spec/gl-3.2/adj-prims.c +++ b/tests/spec/gl-3.2/adj-prims.c @@ -167,23 +167,26 @@ provoking_vertex_index(GLenum prim_mode, GLenum pv_mode, unsigned prim_index) if (pv_mode == GL_FIRST_VERTEX_CONVENTION) return prim_index + 1; else return prim_index + 2; case GL_TRIANGLES_ADJACENCY: if (pv_mode == GL_FIRST_VERTEX_CONVENTION) return prim_index * 6 + 0; else return prim_index * 6 + 4; case GL_TRIANGLE_STRIP_ADJACENCY: - if (pv_mode == GL_FIRST_VERTEX_CONVENTION) - return prim_index * 2; - else + if (pv_mode == GL_FIRST_VERTEX_CONVENTION) { + if (prim_index & 1) + return prim_index * 2 + 2; + else + return prim_index * 2; + } else return prim_index * 2 + 4; default: assert(!"Unexpected prim_mode"); return 0; } } /** * Given a primitive type and a primitive (line/triangle) index, return @@ -206,22 +209,27 @@ compute_probe_location(GLenum prim_mode, unsigned prim_index, i0 = prim_index + 1; i1 = prim_index + 2; break; case GL_TRIANGLES_ADJACENCY: i0 = prim_index * 6 + 0; i1 = prim_index * 6 + 2; if (polygon_mode != GL_LINE) i2 = prim_index * 6 + 4; break; case GL_TRIANGLE_STRIP_ADJACENCY: - i0 = prim_index * 2; - i1 = prim_index * 2 + 2; + if (prim_index & 1) { + i0 = prim_index * 2; + i1 = prim_index * 2 + 2; + } else { + i0 = prim_index * 2 + 2; + i1 = prim_index * 2; + } if (polygon_mode != GL_LINE) i2 = prim_index * 2 + 4; break; default: assert(!"Unexpected prim_mode"); *x = *y = 0; return; } /* average of 2 or 3 points */ ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] Fix piglit_probe_pixel_rgb on GLES2
The pixels_b buffer is indeed to small. I don't think the GL_UNSIGNED_BYTE glReadPixels is called on non-ES. There is an early exit above (on line 1029) for non-ES situations. On Mon, Mar 26, 2018 at 3:42 PM, Brian Paulwrote: > On 03/25/2018 01:49 PM, Rhys Perry wrote: >> >> GLES2 requires GL_RGBA to be used with GL_UNSIGNED_BYTE in glReadPixels >> --- >> tests/util/piglit-util-gl.c | 6 ++ >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c >> index df39c1c87..be060aae5 100644 >> --- a/tests/util/piglit-util-gl.c >> +++ b/tests/util/piglit-util-gl.c >> @@ -1017,7 +1017,7 @@ static GLfloat * >> read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei height, >> GLenum format, GLfloat *pixels) >> { >> - GLubyte *pixels_b; >> + uint8_t pixels_b[4]; >> unsigned i, ncomponents; >> ncomponents = width * height * piglit_num_components(format); >> @@ -1029,11 +1029,9 @@ read_pixels_float(GLint x, GLint y, GLsizei width, >> GLsizei height, >> return pixels; >> } >> - pixels_b = malloc(ncomponents * sizeof(GLubyte)); >> - glReadPixels(x, y, width, height, format, GL_UNSIGNED_BYTE, >> pixels_b); >> + glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, >> pixels_b); >> for (i = 0; i < ncomponents; i++) >> pixels[i] = pixels_b[i] / 255.0; >> - free(pixels_b); >> return pixels; >> } >> > > > This doesn't look right. The pixels_b buffer must be large enough to hold > 'ncomponents' values, not 4. > > Also, I'd prefer to keep read GL_RGB on non-ES. Reading GL_RGB vs. GL_RGBA > probably hits different code paths in the driver, which is a good thing. > > -Brian > ___ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit