[Piglit] [PATCH] arb_program_interface_query: add support for querying subroutine index

Tapani Pälli tapani.palli at intel.com
Thu Nov 19 22:59:15 PST 2015


BTW I bisected that this test has failed since AoA was enabled in Mesa 
by commit 5b75dbd, would be nice to have it passing before adding new 
subtests ... but I'm ok with that as long as same tests pass/fail before 
and after.

The additions for 'vss2' , 'vss_idx' and 'vss2_idx' look good to me;

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 11/05/2015 12:34 PM, Timothy Arceri wrote:
> This also adds support for validating an expected or explicit index.
>
> In this case we check the explicit index of subroutine set via the
> layout qualifier.
> ---
>   tests/spec/arb_program_interface_query/common.h    | 15 +++++
>   .../getprogramresourceindex.c                      | 65 ++++++++++++----------
>   2 files changed, 52 insertions(+), 28 deletions(-)
>
> diff --git a/tests/spec/arb_program_interface_query/common.h b/tests/spec/arb_program_interface_query/common.h
> index dd293bd..698fb92 100755
> --- a/tests/spec/arb_program_interface_query/common.h
> +++ b/tests/spec/arb_program_interface_query/common.h
> @@ -221,6 +221,21 @@ static const char vs_sub[] =
>           "       vs_output1 = vs_input0;\n"
>   	"}";
>
> +static const char vs_subidx[] =
> +	"#version 150\n"
> +	"#extension GL_ARB_shader_subroutine : require\n"
> +	"#extension GL_ARB_explicit_uniform_location : require\n"
> +	"in vec4 vs_input0;\n"
> +	"out vec4 vs_output1;\n"
> +	"subroutine vec4 vs_offset();\n"
> +	"subroutine uniform vs_offset VERTEX;\n"
> +	"layout(index=5) subroutine (vs_offset) vec4 vss_idx() { return vec4(1, 0, 0, 0); }\n"
> +	"subroutine (vs_offset) vec4 vss2_idx() { return vec4(1, 0, 0, 0); }\n"
> +	"void main() {\n"
> +	"	gl_Position = vs_input0 + VERTEX();\n"
> +        "       vs_output1 = vs_input0;\n"
> +	"}";
> +
>   static const char gs_sub[] =
>   	"#version 150\n"
>   	"#extension GL_ARB_shader_subroutine : require\n"
> diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
> index c408b71..07d9a06 100755
> --- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c
> +++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
> @@ -144,43 +144,47 @@ struct subtest_index_t {
>
>   	GLenum programInterface;
>   	const char *name;
> -	GLint expect_value; /* 0 == any number >= 0, -1 == INVALID_INDEX */
> +	bool valid_index;
> +	GLint expect_value; /* -1, means don't check for an epected value */

x missing from 'epected'

>   	GLenum expected_error;
>
>   	const char *programInterface_str;
>   	const char *error_str;
>   };
>
> -#define ST(vs_text, programInterface, name, value, error) { \
> -	(vs_text), (programInterface), (name), (value), (error), \
> +#define ST(vs_text, programInterface, name, valid, value, error) { \
> +	(vs_text), (programInterface), (name), (valid), (value), (error), \
>   	#programInterface, #error \
>   }
>
>   /* Test for arrays of arrays */
>   static const struct subtest_index_t index_subtests[] = {
> - ST(vs_empty,      GL_ATOMIC_COUNTER_BUFFER,              "dummy", -1, GL_INVALID_ENUM),
> - ST(vs_empty,                    GL_UNIFORM,                 NULL, -1, GL_NO_ERROR),
> - ST(vs_empty,                    GL_UNIFORM,              "dummy", -1, GL_NO_ERROR),
> - ST(vs_empty,                       GL_TRUE,           "vs_input",  0, GL_INVALID_ENUM),
> - ST(vs_array,              GL_PROGRAM_INPUT,           "vs_input",  0, GL_NO_ERROR),
> - ST(vs_array,              GL_PROGRAM_INPUT,        "vs_input[0]",  0, GL_NO_ERROR),
> - ST(vs_array,              GL_PROGRAM_INPUT,        "vs_input[1]", -1, GL_NO_ERROR),
> - ST(vs_array,                    GL_UNIFORM,              "hello", -1, GL_NO_ERROR),
> - ST(vs_array,                    GL_UNIFORM,        "sa[0].hello",  0, GL_NO_ERROR),
> - ST(vs_array,                    GL_UNIFORM,        "sa[0].world",  0, GL_NO_ERROR),
> - ST(vs_array,                    GL_UNIFORM,     "sa[0].world[0]",  0, GL_NO_ERROR),
> - ST(vs_array,                    GL_UNIFORM,        "sa[1].hello", -1, GL_NO_ERROR),
> - ST( vs_aofa,              GL_PROGRAM_INPUT,          "vs_input2", -1, GL_NO_ERROR),
> - ST( vs_aofa,              GL_PROGRAM_INPUT,       "vs_input2[0]",  0, GL_NO_ERROR),
> - ST( vs_aofa,              GL_PROGRAM_INPUT,    "vs_input2[0][0]",  0, GL_NO_ERROR),
> - ST( vs_aofa,              GL_PROGRAM_INPUT,    "vs_input2[1][0]", -1, GL_NO_ERROR),
> - ST( vs_aofa,              GL_PROGRAM_INPUT,    "vs_input2[0][1]", -1, GL_NO_ERROR),
> - ST(  vs_sub,          GL_VERTEX_SUBROUTINE,                "vss",  0, GL_NO_ERROR),
> - ST(vs_empty, GL_TRANSFORM_FEEDBACK_VARYING,      "gl_NextBuffer", -1, GL_NO_ERROR),
> - ST(vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents1", -1, GL_NO_ERROR),
> - ST(vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents2", -1, GL_NO_ERROR),
> - ST(vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents3", -1, GL_NO_ERROR),
> - ST(vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents4", -1, GL_NO_ERROR),
> + ST( vs_empty,      GL_ATOMIC_COUNTER_BUFFER,              "dummy", false, -1, GL_INVALID_ENUM),
> + ST( vs_empty,                    GL_UNIFORM,                 NULL, false, -1, GL_NO_ERROR),
> + ST( vs_empty,                    GL_UNIFORM,              "dummy", false, -1, GL_NO_ERROR),
> + ST( vs_empty,                       GL_TRUE,           "vs_input",  true, -1, GL_INVALID_ENUM),
> + ST( vs_array,              GL_PROGRAM_INPUT,           "vs_input",  true, -1, GL_NO_ERROR),
> + ST( vs_array,              GL_PROGRAM_INPUT,        "vs_input[0]",  true, -1, GL_NO_ERROR),
> + ST( vs_array,              GL_PROGRAM_INPUT,        "vs_input[1]", false, -1, GL_NO_ERROR),
> + ST( vs_array,                    GL_UNIFORM,              "hello", false, -1, GL_NO_ERROR),
> + ST( vs_array,                    GL_UNIFORM,        "sa[0].hello",  true, -1, GL_NO_ERROR),
> + ST( vs_array,                    GL_UNIFORM,        "sa[0].world",  true, -1, GL_NO_ERROR),
> + ST( vs_array,                    GL_UNIFORM,     "sa[0].world[0]",  true, -1, GL_NO_ERROR),
> + ST( vs_array,                    GL_UNIFORM,        "sa[1].hello", false, -1, GL_NO_ERROR),
> + ST(  vs_aofa,              GL_PROGRAM_INPUT,          "vs_input2", false, -1, GL_NO_ERROR),
> + ST(  vs_aofa,              GL_PROGRAM_INPUT,       "vs_input2[0]",  true, -1, GL_NO_ERROR),
> + ST(  vs_aofa,              GL_PROGRAM_INPUT,    "vs_input2[0][0]",  true, -1, GL_NO_ERROR),
> + ST(  vs_aofa,              GL_PROGRAM_INPUT,    "vs_input2[1][0]", false, -1, GL_NO_ERROR),
> + ST(  vs_aofa,              GL_PROGRAM_INPUT,    "vs_input2[0][1]", false, -1, GL_NO_ERROR),
> + ST(   vs_sub,          GL_VERTEX_SUBROUTINE,                "vss",  true, -1, GL_NO_ERROR),
> + ST(   vs_sub,          GL_VERTEX_SUBROUTINE,               "vss2",  true, -1, GL_NO_ERROR),
> + ST(vs_subidx,          GL_VERTEX_SUBROUTINE,            "vss_idx",  true,  5, GL_NO_ERROR),
> + ST(vs_subidx,          GL_VERTEX_SUBROUTINE,           "vss2_idx",  true, -1, GL_NO_ERROR),
> + ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING,      "gl_NextBuffer", false, -1, GL_NO_ERROR),
> + ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents1", false, -1, GL_NO_ERROR),
> + ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents2", false, -1, GL_NO_ERROR),
> + ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents3", false, -1, GL_NO_ERROR),
> + ST( vs_empty, GL_TRANSFORM_FEEDBACK_VARYING, "gl_SkipComponents4", false, -1, GL_NO_ERROR),
>   };
>
>   static bool
> @@ -278,11 +282,16 @@ run_index_subtest(const struct subtest_index_t st, bool *pass)
>   		       index);
>   		local_pass = false;
>   	} else if (st.expected_error == GL_NO_ERROR) {
> -		if (index >=0 && st.expect_value != 0) {
> +                if (index >=0 && !st.valid_index) {
>   			printf("Invalid index for '%s': expected INVALID_INDEX "
>   			       "but got %i\n", st.name, index);
>   			local_pass = false;
> -		} else if (index == GL_INVALID_INDEX && st.expect_value != -1) {
> +                } else if (index >=0 && st.expect_value != -1 &&
> +                           st.expect_value != index) {
> +			printf("For index of '%s': expected %d "
> +			       "but got %i\n", st.name, st.expect_value, index);
> +			local_pass = false;
> +		} else if (index == GL_INVALID_INDEX && st.valid_index) {
>   			printf("Invalid index for '%s': expected a valid index "
>   			       "but got INVALID_INDEX\n", st.name);
>   			local_pass = false;
>


More information about the Piglit mailing list