[Piglit] [PATCH 9/9] sso: Test all of the ProgramUniform entry points
Ian Romanick
idr at freedesktop.org
Sun Sep 8 19:42:33 PDT 2013
On 09/07/2013 09:32 PM, Paul Berry wrote:
> On 4 September 2013 12:57, Ian Romanick <idr at freedesktop.org
> <mailto:idr at freedesktop.org>> wrote:
>
> From: Ian Romanick <ian.d.romanick at intel.com
> <mailto:ian.d.romanick at intel.com>>
>
> This is a nearly exhaustive test of all the glProgramUniform functions
> added by GL_ARB_separate_shader_objects.
>
> For every entrypoint, a shader using a uniform of the correct type is
> created using glCreateShaderProgramv. The uniform is then set and
> queried (using glGetUniform). The test passes if the correct data is
> returned and no GL errors are generated.
>
> The following aspects of these interfaces are not tested by this test:
>
> - Uniform arrays set by glProgramUniform*v or by
> glProgramUniformMatrix*v with count > 1.
>
> - Transpose matrices set by glProgramUniformMatrix*v with transpose
> set to GL_TRUE.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com
> <mailto:ian.d.romanick at intel.com>>
> ---
> tests/all.tests | 1 +
> .../arb_separate_shader_objects/CMakeLists.gl.txt | 1 +
> .../ProgramUniform-coverage.c | 1211
> ++++++++++++++++++++
> 3 files changed, 1213 insertions(+)
> create mode 100644
> tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c
>
> diff --git a/tests/all.tests b/tests/all.tests
> index a8e389c..9baaa89 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1241,6 +1241,7 @@
> arb_separate_shader_objects['GetProgramPipelineiv'] =
> concurrent_test('arb_separ
> arb_separate_shader_objects['IsProgramPipeline'] =
> concurrent_test('arb_separate_shader_object-IsProgramPipeline')
> 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')
>
> diff --git
> a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> index 66176f1..32a28ba 100644
> --- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> +++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
> @@ -12,6 +12,7 @@ link_libraries (
> 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)
> +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/ProgramUniform-coverage.c
> b/tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c
> new file mode 100644
> index 0000000..c1faf60
> --- /dev/null
> +++ b/tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c
> @@ -0,0 +1,1211 @@
> +/*
> + * 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.
> + */
> +
> +/**
> + * \name ProgramUniform-coverage.c
> + * Nearly exhaustive test of all the glProgramUniform functions
> added by
> + * GL_ARB_separate_shader_objects.
> + *
> + * For every entrypoint, a shader using a uniform of the correct
> type is
> + * created using \c glCreateShaderProgramv. The uniform is then
> set and
> + * queried (using \c glGetUniform). The test passes if the correct
> data is
> + * returned and no GL errors are generated.
> + *
> + * \note
> + * The following aspects of these interfaces are not tested by this
> test:
> + *
> + * - Uniform arrays set by \c glProgramUniform*v or by
> + * \c glProgramUniformMatrix*v with \c count > 1.
> + *
> + * - Transpose matrices set by \c glProgramUniformMatrix*v with
> \c transpose
> + * set to \c GL_TRUE.
> + */
> +#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_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char common_body[] =
> + "\n"
> + "void main()\n"
> + "{\n"
> + " gl_Position = vec4(v4) + vec4(v3, v1) + vec4(v2, 0, 0);\n"
> + "}\n"
> + ;
> +
> +static const char float_code[] =
> + "uniform float v1;\n"
> + "uniform vec2 v2;\n"
> + "uniform vec3 v3;\n"
> + "uniform vec4 v4;\n"
> + ;
> +
> +static const char int_code[] =
> + "uniform int v1;\n"
> + "uniform ivec2 v2;\n"
> + "uniform ivec3 v3;\n"
> + "uniform ivec4 v4;\n"
> + ;
> +
> +static const char uint_code[] =
> + "uniform uint v1;\n"
> + "uniform uvec2 v2;\n"
> + "uniform uvec3 v3;\n"
> + "uniform uvec4 v4;\n"
> + ;
> +
> +static const char double_code[] =
> + "uniform uint v1;\n"
> + "uniform uvec2 v2;\n"
> + "uniform uvec3 v3;\n"
> + "uniform uvec4 v4;\n"
> + ;
>
>
> I think you mean:
>
> uniform double v1;
> uniform dvec2 v2;
> uniform dvec3 v3;
> uniform dvec4 v4;
>
> Copy and paste error?
Yes... of course, the one thing that I didn't have the hardware to test
was broken... I can already hear keithp saying it...
> I didn't have the energy to read through the whole test, so with the
> above fixed, consider this patch:
>
> Acked-by: Paul Berry <stereotype441 at gmail.com
> <mailto:stereotype441 at gmail.com>>
>
> I've sent comments on everything but patch 4. Patch 4 is:
>
> Reviewed-by: Paul Berry <stereotype441 at gmail.com
> <mailto:stereotype441 at gmail.com>>
>
>
>
> You also asked yesterday if I could send out a list of additional
> ARB_sso tests that I think we need. Here's what I was able to come up with:
>
> - For i965, it would be nice to have some validation that rendezvous by
> location works properly for VS-FS when there are more than 16 slots used
> by the FS, and the set of locations output by the VS does not match the
> set of locations input by the FS. (This is the one case I wasn't able
> to verify when testing my "i965/gen6+: Support 128 varying components"
> series, because ARB_sso is really needed in order to test it effectively).
>
> - Test that varying structs and arrays are *not* packed when there is an
> explicit location. For example, this:
>
> struct Foo {
> vec2 a;
> vec2 b;
> vec2 c[2];
> };
> layout(location = 5) out Foo f;
>
> should cause f.a to be assigned location 5, f.b to be assigned location
> 6, f.c[0] to be assigned to location 7, and f.c[1] to be assigned to
> location 8. (Currently Mesa packs varying structs unconditionally, so
> this test would fail unless we do additional work).
>
> - Test that varying arrays that are assigned an explicit location still
> work properly with transform feedback, both when capturing a single
> element of the array and when capturing the entire array all at once.
> (Currently Mesa's transform feedback code assumes that varying arrays
> are always packed).
>
> - Verify that if you create a separable program with GS but no VS, and
> then you try to use it using UseProgram(): (a) ValidateProgram() says
> it's invalid, and (b) trying to draw with it results in
> INVALID_OPERATION. (This is the "loophole" that I erroneously thought I
> discovered in the spec yesterday. It would be good to make sure the
> implementation doesn't have such a loophole).
>
> - I didn't see any tests to verify that glActiveShaderProgram() has the
> proper effect (only to verify that it generates the proper error
> messages). I could be mistaken about that though.
>
> - Verify that the state set by glActiveShaderProgram() is per-pipeline
> state, not global state.
>
> - Test that INVALID_OPERATION is generated by ResumeTransformFeedback if
> the program pipeline object being used by the current transform feedback
> object is not bound, any of its shader stage bindings has changed, or a
> single program object is active and overriding it (see the text "Add to
> list of INVALID_OPERATION errors on page 172" from the ARB_sso spec).
>
> - Patch 8/9 was called "sso: Verify that rendezvous by location also
> works", but I don't see any tests of rendezvous by name yet. Am I
> missing something?
>
> - Some tests that mix rendezvous-by-name with rendezvous-by-location are
> probably in order, especially given that the rendezvous-by-name
> variables have to get allocated to unassigned locations.
More information about the Piglit
mailing list