[Piglit] [PATCH 1/2] Modify shader attachment order in piglit_link_simple_program()

Ian Romanick idr at freedesktop.org
Wed Nov 2 14:54:38 PDT 2011


On 11/01/2011 02:27 PM, Paul Berry wrote:
> Some tests (in particular, glsl-link-initializer-03.c) assume that
> piglit_link_simple_program() attaches shaders in the same order that
> they appear in the parameter list.  There's no good reason for
> piglit_link_simple_program() to attach them in the opposite order.
> ---
>   tests/util/piglit-shader.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
> index c5c8c2d..3e0f935 100644
> --- a/tests/util/piglit-shader.c
> +++ b/tests/util/piglit-shader.c
> @@ -240,10 +240,10 @@ GLint piglit_link_simple_program(GLint vs, GLint fs)
>   	piglit_require_GLSL();
>
>   	prog = piglit_CreateProgram();
> -	if (fs)
> -		piglit_AttachShader(prog, fs);
>   	if (vs)
>   		piglit_AttachShader(prog, vs);
> +	if (fs)
> +		piglit_AttachShader(prog, fs);
>   	piglit_LinkProgram(prog);
>
>   	if (!piglit_link_check_status(prog)) {

Since there is an ordering dependency, would it maybe better to just 
have the test try linking the shaders in "all" the different orders? 
This would mean making more programs, but that should't be a problem.

     prog_a = piglit_link_simple_program(vert[0], vert[1]);
     prog_b = piglit_link_simple_program(vert[1], vert[0]);
     prog_c = piglit_link_simple_program(vert[0], vert[2]);
     prog_d = piglit_link_simple_program(vert[2], vert[0]);


More information about the Piglit mailing list