Re: [Piglit] [PATCH] ARB_shading_language_packing: Generate tests for builtin packing functions
On 24 January 2013 19:50, Matt Turner matts...@gmail.com wrote: This uses the existing pack/unpack testing infrasturcture for GLSL ES 3.0 and adds support for testing pack/unpack 4x8 operations. Generate the following test files: {const,vs,fs}-{pack,unpack}{Snorm,Unorm}{2x16,4x8}.shader_test {const,vs,fs}-{pack,unpack}Half2x16.shader_test --- generated_tests/gen_builtin_packing_tests.py | 298 ++ 1 files changed, 258 insertions(+), 40 deletions(-) diff --git a/generated_tests/gen_builtin_packing_tests.py b/generated_tests/gen_builtin_packing_tests.py index 30190d6..653e6fb 100644 --- a/generated_tests/gen_builtin_packing_tests.py +++ b/generated_tests/gen_builtin_packing_tests.py @@ -12,7 +12,7 @@ import sys from collections import namedtuple from mako.template import Template from math import copysign, fabs, fmod, frexp, isinf, isnan, modf -from numpy import int16, int32, uint16, uint32, float32 +from numpy import int8, int16, int32, uint8, uint16, uint32, float32 from textwrap import dedent # @@ -37,10 +37,13 @@ from textwrap import dedent # Test evaluation of constant pack2x16 expressions. const_pack_2x16_template = Template(dedent(\ Can we rename this template to just const_pack_template, to reflect the fact that it no longer just does 2x16 packing? (A similar comment applies to the other templates) [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); @@ -55,7 +58,12 @@ const_pack_2x16_template = Template(dedent(\ vert_color = green; % for io in func.inout_seq: -actual = ${func.name}(vec2(${io.input[0]}, ${io.input[1]})); +actual = ${func.name}(vec${func.vector_size}( +% for index in range(func.vector_size - 1): +${io.input[index]}, +% endfor +${io.input[func.vector_size - 1]} +)); This could be expressed more simply using the join() function: actual = ${func.name}(vec${func.vector_size}(${', '.join(io.input)})); if (true % for u in sorted(set(io.valid_outputs)): @@ -92,10 +100,13 @@ const_pack_2x16_template = Template(dedent(\ # Test evaluation of constant unpack2x16 expressions. const_unpack_2x16_template = Template(dedent(\ [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); @@ -104,7 +115,7 @@ const_unpack_2x16_template = Template(dedent(\ void main() { -${func.result_precision} vec2 actual; +${func.result_precision} vec${func.vector_size} actual; gl_Position = vertex; vert_color = green; @@ -114,7 +125,11 @@ const_unpack_2x16_template = Template(dedent(\ if (true % for v in io.valid_outputs: - actual != vec2(${v[0]}, ${v[1]}) + actual != vec${func.vector_size}( +% for index in range(func.vector_size - 1): +${v[index]}, +% endfor +${v[func.vector_size - 1]}) join() could be used here too. % endfor ) { vert_color = red; @@ -147,14 +162,17 @@ const_unpack_2x16_template = Template(dedent(\ # Test execution of pack2x16 functions in the vertex shader. vs_pack_2x16_template = Template(dedent(\ [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); -uniform vec2 func_input; +uniform vec${func.vector_size} func_input; % for j in range(func.num_valid_outputs): uniform ${func.result_precision} uint expect${j}; (snip) @@ -688,7 +793,7 @@ def unpack_half_1x16(u16): # # This table maps GLSL pack/unpack function names to a sequence of inputs to -# the respective component-wise function. It contains two types of mappings: +# the respective component-wise function. It contains four types of mappings: #- name of a pack2x16 function to a sequence of float32 #- name of a unpack2x16 function to a sequence of uint16 Did you forget to add bullet points here to describe the two new types of mappings? full_input_table = dict() @@ -720,6 +825,8 @@ def make_inputs_for_pack_snorm_2x16():
Re: [Piglit] [PATCH] Clarify comment about glIsBuffer behavior
Matt Turner matts...@gmail.com writes: The spec's not vague, it's just stupid. glIsBuffer should return false between the time a buffer name is generated and first bound. --- tests/general/isbufferobj.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/general/isbufferobj.c b/tests/general/isbufferobj.c index 3938d18..d805818 100644 --- a/tests/general/isbufferobj.c +++ b/tests/general/isbufferobj.c @@ -78,10 +78,8 @@ test(void) } /* -* The GL spec is vague here. But the GL man pages say glIsBuffer should -* return false in this case. Mesa and NVIDIA's driver return true. -* Generate a warning, not an error, if the driver doesn't follow the -* GL docs here. +* Generate a warning, not an error, if the driver doesn't return +* GL_FALSE from glIsBuffers if the buffer has never been bound. */ if (glIsBuffer(buffers[1])) { printf(%s: glIsBuffer(%u) returned true instead of false.\n, Why should we generate a warning, not an error, if the spec is clear? pgp7mMRwg2Bud.pgp Description: PGP signature ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] Clarify comment about glIsBuffer behavior
On Fri, Jan 25, 2013 at 9:35 AM, Eric Anholt e...@anholt.net wrote: Matt Turner matts...@gmail.com writes: The spec's not vague, it's just stupid. glIsBuffer should return false between the time a buffer name is generated and first bound. --- tests/general/isbufferobj.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/general/isbufferobj.c b/tests/general/isbufferobj.c index 3938d18..d805818 100644 --- a/tests/general/isbufferobj.c +++ b/tests/general/isbufferobj.c @@ -78,10 +78,8 @@ test(void) } /* -* The GL spec is vague here. But the GL man pages say glIsBuffer should -* return false in this case. Mesa and NVIDIA's driver return true. -* Generate a warning, not an error, if the driver doesn't follow the -* GL docs here. +* Generate a warning, not an error, if the driver doesn't return +* GL_FALSE from glIsBuffers if the buffer has never been bound. */ if (glIsBuffer(buffers[1])) { printf(%s: glIsBuffer(%u) returned true instead of false.\n, Why should we generate a warning, not an error, if the spec is clear? I suppose because the spec is stupid. Although I've added tests for this behavior to piglit elsewhere (glIsTransformFeedback, glIsVertexArray) and PBOTest::testSanity looks like it fails if glIsBufferARB returns true before being bound. I'll send new patch that changes this from a warning to a failure. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] ARB_shading_language_packing: Generate tests for builtin packing functions
This uses the existing pack/unpack testing infrasturcture for GLSL ES 3.0 and adds support for testing pack/unpack 4x8 operations. Generate the following test files: {const,vs,fs}-{pack,unpack}{Snorm,Unorm}{2x16,4x8}.shader_test {const,vs,fs}-{pack,unpack}Half2x16.shader_test --- generated_tests/gen_builtin_packing_tests.py | 339 ++ 1 files changed, 286 insertions(+), 53 deletions(-) diff --git a/generated_tests/gen_builtin_packing_tests.py b/generated_tests/gen_builtin_packing_tests.py index 30190d6..7c1074e 100644 --- a/generated_tests/gen_builtin_packing_tests.py +++ b/generated_tests/gen_builtin_packing_tests.py @@ -12,7 +12,7 @@ import sys from collections import namedtuple from mako.template import Template from math import copysign, fabs, fmod, frexp, isinf, isnan, modf -from numpy import int16, int32, uint16, uint32, float32 +from numpy import int8, int16, int32, uint8, uint16, uint32, float32 from textwrap import dedent # @@ -35,12 +35,15 @@ from textwrap import dedent # # Test evaluation of constant pack2x16 expressions. -const_pack_2x16_template = Template(dedent(\ +const_pack_template = Template(dedent(\ [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); @@ -55,7 +58,7 @@ const_pack_2x16_template = Template(dedent(\ vert_color = green; % for io in func.inout_seq: -actual = ${func.name}(vec2(${io.input[0]}, ${io.input[1]})); +actual = ${func.name}(${func.vector_type}(${', '.join(io.input)})); if (true % for u in sorted(set(io.valid_outputs)): @@ -90,12 +93,15 @@ const_pack_2x16_template = Template(dedent(\ )) # Test evaluation of constant unpack2x16 expressions. -const_unpack_2x16_template = Template(dedent(\ +const_unpack_template = Template(dedent(\ [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); @@ -104,7 +110,7 @@ const_unpack_2x16_template = Template(dedent(\ void main() { -${func.result_precision} vec2 actual; +${func.result_precision} ${func.vector_type} actual; gl_Position = vertex; vert_color = green; @@ -114,8 +120,8 @@ const_unpack_2x16_template = Template(dedent(\ if (true % for v in io.valid_outputs: - actual != vec2(${v[0]}, ${v[1]}) -% endfor + actual != ${func.vector_type}(${', '.join(v)}) + % endfor ) { vert_color = red; } @@ -145,16 +151,19 @@ const_unpack_2x16_template = Template(dedent(\ )) # Test execution of pack2x16 functions in the vertex shader. -vs_pack_2x16_template = Template(dedent(\ +vs_pack_template = Template(dedent(\ [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); -uniform vec2 func_input; +uniform ${func.vector_type} func_input; % for j in range(func.num_valid_outputs): uniform ${func.result_precision} uint expect${j}; @@ -197,7 +206,7 @@ vs_pack_2x16_template = Template(dedent(\ [test] % for io in func.inout_seq: -uniform vec2 func_input ${io.input[0]} ${io.input[1]} +uniform ${func.vector_type} func_input ${ .join(io.input)} % for j in range(func.num_valid_outputs): uniform uint expect${j} ${io.valid_outputs[j]} % endfor @@ -208,19 +217,22 @@ vs_pack_2x16_template = Template(dedent(\ )) # Test execution of unpack2x16 functions in the vertex shader. -vs_unpack_2x16_template = Template(dedent(\ +vs_unpack_template = Template(dedent(\ [require] -GL ES = 3.0 -GLSL ES = 3.00 +${func.requirements} [vertex shader] +#ifndef GL_ES +#extension GL_ARB_shading_language_packing : require +#endif + const vec4 red = vec4(1, 0, 0, 1); const vec4 green = vec4(0, 1, 0, 1); uniform highp uint func_input; % for j in range(func.num_valid_outputs): -uniform ${func.result_precision} vec2 expect${j}; +uniform ${func.result_precision} ${func.vector_type} expect${j}; % endfor in vec4 vertex; @@ -230,7 +242,7 @@ vs_unpack_2x16_template = Template(dedent(\ { gl_Position = vertex; -${func.result_precision} vec2 actual =