[Piglit] [PATCH v5 5/6] program_interface_query: move some shaders to common.h

Tapani Pälli tapani.palli at intel.com
Thu Apr 2 03:36:09 PDT 2015


Yes, makes sense!

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

On 04/01/2015 01:56 PM, Martin Peres wrote:
> This will be needed for the next test.
>
> Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
> ---
>   tests/spec/arb_program_interface_query/common.h    | 22 +++++++++++++++
>   .../resource-location.c                            | 32 ++++------------------
>   2 files changed, 27 insertions(+), 27 deletions(-)
>   mode change 100644 => 100755 tests/spec/arb_program_interface_query/resource-location.c
>
> diff --git a/tests/spec/arb_program_interface_query/common.h b/tests/spec/arb_program_interface_query/common.h
> index 8c6965c..55f0358 100755
> --- a/tests/spec/arb_program_interface_query/common.h
> +++ b/tests/spec/arb_program_interface_query/common.h
> @@ -169,6 +169,28 @@ static const char fs_atom[] =
>   	"	atomicCounterIncrement(fs_counter);\n"
>   	"}";
>
> +static const char vs_loc[] =
> +	"#version 150\n"
> +	"#extension GL_ARB_explicit_attrib_location : require\n"
> +	"layout (location = 3) in vec4 input0;\n"
> +	"layout (location = 6) in vec4 input1;\n"
> +	"void main() {\n"
> +		"gl_Position = input0 * input1;\n"
> +	"}";
> +
> +static const char fs_loc[] =
> +	"#version 150\n"
> +	"#extension GL_ARB_explicit_attrib_location  : require\n"
> +	"#extension GL_ARB_explicit_uniform_location : require\n"
> +	"layout (location = 9) uniform vec4 color;\n"
> +	"layout (location = 1) uniform float array[4];\n"
> +	"layout (location = 1) out vec4 output0;\n"
> +	"layout (location = 0) out vec4 output1;\n"
> +	"void main() {\n"
> +		"output0 = color * array[2];\n"
> +		"output1 = color * array[3];\n"
> +	"}";
> +
>   static const char vs_tfv[] =
>   	"#version 150\n"
>   	"in vec4 vs_input0;\n"
> diff --git a/tests/spec/arb_program_interface_query/resource-location.c b/tests/spec/arb_program_interface_query/resource-location.c
> old mode 100644
> new mode 100755
> index cdae2ee..4085f02
> --- a/tests/spec/arb_program_interface_query/resource-location.c
> +++ b/tests/spec/arb_program_interface_query/resource-location.c
> @@ -57,6 +57,7 @@
>    */
>
>   #include "piglit-util-gl.h"
> +#include "common.h"
>
>   PIGLIT_GL_TEST_CONFIG_BEGIN
>
> @@ -86,29 +87,6 @@ static const GLenum valid_enums_sub_com[] = {
>   	GL_COMPUTE_SUBROUTINE_UNIFORM
>   };
>
> -
> -static const char vs_text[] =
> -	"#version 150\n"
> -	"#extension GL_ARB_explicit_attrib_location : require\n"
> -	"layout (location = 3) in vec4 input0;\n"
> -	"layout (location = 6) in vec4 input1;\n"
> -	"void main() {\n"
> -		"gl_Position = input0 * input1;\n"
> -	"}";
> -
> -static const char fs_text[] =
> -	"#version 150\n"
> -	"#extension GL_ARB_explicit_attrib_location  : require\n"
> -	"#extension GL_ARB_explicit_uniform_location : require\n"
> -	"layout (location = 9) uniform vec4 color;\n"
> -	"layout (location = 1) uniform float array[4];\n"
> -	"layout (location = 1) out vec4 output0;\n"
> -	"layout (location = 0) out vec4 output1;\n"
> -	"void main() {\n"
> -		"output0 = color * array[2];\n"
> -		"output1 = color * array[3];\n"
> -	"}";
> -
>   static const char vs_subroutine_text[] =
>   	"#version 150\n"
>   	"#extension GL_ARB_explicit_attrib_location : require\n"
> @@ -264,10 +242,10 @@ test_subroutine_stages_tcs_tes()
>   	}
>
>           prog = piglit_build_simple_program_multiple_shaders(
> -                     GL_VERTEX_SHADER, vs_text,
> +                     GL_VERTEX_SHADER, vs_loc,
>                        GL_TESS_CONTROL_SHADER, tcs_subroutine_text,
>                        GL_TESS_EVALUATION_SHADER, tes_subroutine_text,
> -                     GL_FRAGMENT_SHADER, fs_text,
> +                     GL_FRAGMENT_SHADER, fs_loc,
>                        0);
>
>   	glUseProgram(prog);
> @@ -374,14 +352,14 @@ piglit_init(int argc, char **argv)
>   	}
>
>   	/* Test passing a shader, not program. */
> -	shader = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text);
> +	shader = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_loc);
>   	glGetProgramResourceLocation(shader, GL_UNIFORM, "name");
>   	if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
>   		piglit_report_subtest_result(PIGLIT_FAIL, "invalid program test 2");
>   		pass = false;
>   	}
>
> -	prog = piglit_build_simple_program_unlinked(vs_text, fs_text);
> +	prog = piglit_build_simple_program_unlinked(vs_loc, fs_loc);
>
>   	if (!piglit_check_gl_error(GL_NO_ERROR))
>   		piglit_report_result(PIGLIT_FAIL);
>


More information about the Piglit mailing list