[Piglit] [PATCH v2] program_interface_query: add new subtest for getprogramresourceiv

Martin Peres martin.peres at linux.intel.com
Wed May 20 05:15:40 PDT 2015


On 20/05/15 15:10, Samuel Iglesias Gonsalvez wrote:
> Test that uniforms inside arrays of uniform blocks with instance name are
> queried properly.
>
> Tested on NVIDIA's proprietary driver version 340.65
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90397
>
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
>
> V2:
>
>    * Change instance name for the array of uniform blocks
>    * Delete modification of an unrelated test.
>
>   tests/spec/arb_program_interface_query/common.h       | 12 +++++++++---
>   .../getprogramresourceiv.c                            | 19 +++++++++++++++++++
>   .../spec/arb_program_interface_query/resource-query.c | 16 ++++++++++++----
>   3 files changed, 40 insertions(+), 7 deletions(-)
>
> diff --git a/tests/spec/arb_program_interface_query/common.h b/tests/spec/arb_program_interface_query/common.h
> index 55f0358..e083a6e 100755
> --- a/tests/spec/arb_program_interface_query/common.h
> +++ b/tests/spec/arb_program_interface_query/common.h
> @@ -102,13 +102,19 @@ static const char fs_std[] =
>   	"uniform fs_uniform_block {"
>   	"	vec4 fs_color;\n"
>   	"	float fs_array[4];\n"
> -	"};"
> +	"};\n"
> +	"uniform fs_array_uniform_block {\n"
> +	"	vec4 fs_color;\n"
> +	"	float fs_array[4];\n"
> +	"} faub[4];\n"
>   	"in vec4 fs_input1;\n"
>   	"out vec4 fs_output0;\n"
>   	"out vec4 fs_output1;\n"
>   	"void main() {\n"
> -		"fs_output0 = fs_color * fs_input1 * fs_array[2];\n"
> -		"fs_output1 = fs_color * fs_input1 * fs_array[3];\n"
> +		"fs_output0 = fs_color * fs_input1 * fs_array[2] * \n"
> +		"	      faub[0].fs_array[2] * faub[2].fs_array[2];\n"
> +		"fs_output1 = fs_color * fs_input1 * fs_array[3] * \n"
> +		"             faub[1].fs_array[3] * faub[3].fs_array[3];\n"
>   	"}";
>   
>   static const char vs_stor[] =
> diff --git a/tests/spec/arb_program_interface_query/getprogramresourceiv.c b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
> index da9751a..03f2fc6 100755
> --- a/tests/spec/arb_program_interface_query/getprogramresourceiv.c
> +++ b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
> @@ -454,6 +454,25 @@ static const struct subtest_t subtests[] = {
>   	{ GL_REFERENCED_BY_COMPUTE_SHADER, 1, { 0 } },
>   	{ 0, 0, { 0 } }}
>    },
> + { &prog_std, GL_UNIFORM, "fs_array_uniform_block.fs_array", "fs_array_uniform_block[0]", {
> +	{ GL_NAME_LENGTH, 1, { 35 } },
> +	{ GL_TYPE, 1, { GL_FLOAT } },
> +	{ GL_ARRAY_SIZE, 1, { 4 } },
> +	{ GL_OFFSET, 1, { 0 } }, /* valid index == anything but -1 */
> +	{ GL_BLOCK_INDEX, 1, { 2 } }, /* compared to fs_array_uniform_block[0]'s idx */
> +	{ GL_ARRAY_STRIDE, 1, { 0 } }, /* valid index == anything but -1 */
> +	{ GL_MATRIX_STRIDE, 1, { 0 } },
> +	{ GL_IS_ROW_MAJOR, 1, { 0 } },
> +	{ GL_ATOMIC_COUNTER_BUFFER_INDEX, 1, { -1 } }, /* valid index == anything but -1 */
> +	{ GL_REFERENCED_BY_VERTEX_SHADER, 1, { 0 } },
> +	{ GL_REFERENCED_BY_TESS_CONTROL_SHADER, 1, { 0 } },
> +	{ GL_REFERENCED_BY_TESS_EVALUATION_SHADER, 1, { 0 } },
> +	{ GL_REFERENCED_BY_GEOMETRY_SHADER, 1, { 0 } },
> +	{ GL_REFERENCED_BY_FRAGMENT_SHADER, 1, { 1 } },
> +	{ GL_REFERENCED_BY_COMPUTE_SHADER, 1, { 0 } },
> +	{ GL_LOCATION, 1, { -1 } }, /* valid index == anything but -1 */
> +	{ 0, 0, { 0 } }}
> + },
>    { &prog_stor, GL_BUFFER_VARIABLE, "gs_buf_var", "gs_buffer_block", {
>   	{ GL_NAME_LENGTH, 1, { 11 } },
>   	{ GL_TYPE, 1, { GL_FLOAT_VEC4 } },
> diff --git a/tests/spec/arb_program_interface_query/resource-query.c b/tests/spec/arb_program_interface_query/resource-query.c
> index 92b8cd8..1db5585 100755
> --- a/tests/spec/arb_program_interface_query/resource-query.c
> +++ b/tests/spec/arb_program_interface_query/resource-query.c
> @@ -189,13 +189,21 @@ PIGLIT_GL_TEST_CONFIG_END
>    * white space anywhere in the string.
>    */
>   static const char *st_r_uniform[] = {"vs_test", "gs_test", "fs_color",
> -				     "fs_array[0]", "sa[0].a[0]", "sa[1].a[0]",
> +				     "fs_array[0]",
> +				     "fs_array_uniform_block.fs_color",
> +				     "fs_array_uniform_block.fs_array[0]",
> +				     "sa[0].a[0]", "sa[1].a[0]",
>   				     NULL};
>   static const char *st_r_tess_uniform[] = {"tcs_test", "tes_test", NULL};
>   static const char *st_r_cs_uniform[] = {"cs_test", "tex", NULL};
>   static const char *st_r_uniform_block[] = {"vs_uniform_block",
>   					   "gs_uniform_block",
> -					   "fs_uniform_block", NULL};
> +					   "fs_uniform_block",
> +					   "fs_array_uniform_block[0]",
> +					   "fs_array_uniform_block[1]",
> +					   "fs_array_uniform_block[2]",
> +					   "fs_array_uniform_block[3]",
> +					   NULL};
>   static const char *st_r_tess_uniform_block[] = {"tcs_uniform_block",
>   						"tes_uniform_block", NULL};
>   static const char *st_r_cs_uniform_block[] = {"cs_uniform_block", NULL};
> @@ -346,10 +354,10 @@ struct subtest_t {
>   }
>   
>   static const struct subtest_t subtests[] = {
> - ST( 6, 12, -1, -1,  vs_std,    NULL,    NULL,  gs_std,  fs_std,   NULL, GL_UNIFORM, "(vs,gs,fs)", st_r_uniform),
> + ST( 8, 35, -1, -1,  vs_std,    NULL,    NULL,  gs_std,  fs_std,   NULL, GL_UNIFORM, "(vs,gs,fs)", st_r_uniform),
>    ST( 2,  9, -1, -1,    NULL, tcs_sub, tes_sub,    NULL,    NULL,   NULL, GL_UNIFORM, "(tes,tcs)", st_r_tess_uniform),
>    ST( 2,  8, -1, -1,    NULL,    NULL,    NULL,    NULL,    NULL, cs_sub, GL_UNIFORM, "(cs)", st_r_cs_uniform),
> - ST( 3, 17,  2, -1,  vs_std,    NULL,    NULL,  gs_std,  fs_std,   NULL, GL_UNIFORM_BLOCK, "(vs,gs,fs)", st_r_uniform_block),
> + ST( 7, 26,  2, -1,  vs_std,    NULL,    NULL,  gs_std,  fs_std,   NULL, GL_UNIFORM_BLOCK, "(vs,gs,fs)", st_r_uniform_block),
>    ST( 2, 18, -1, -1,    NULL, tcs_sub, tes_sub,    NULL,    NULL,   NULL, GL_UNIFORM_BLOCK, "(tcs,tes)", st_r_tess_uniform_block),
>    ST( 1, 17, -1, -1,    NULL,    NULL,    NULL,    NULL,    NULL, cs_sub, GL_UNIFORM_BLOCK, "(cs)", st_r_cs_uniform_block),
>    ST( 2, 10, -1, -1,  vs_std,    NULL,    NULL,    NULL,    NULL,   NULL, GL_PROGRAM_INPUT, "(vs)", st_r_in_vs),

Looks good to me! Thanks!

Reviewed-by: Martin Peres <martin.peres at linux.intel.com>


More information about the Piglit mailing list