Commit 461e76e8 authored by Andres Gomez's avatar Andres Gomez

arb_separate_shader_objects: add location overlapping tests

New tests for location overlap with scalars, doubles and for
duplicated inputs which match the same output variable in the previous
stage.

From the ARB_separate_shader_objects spec v.25:

  "   * An output variable is considered to match an input variable in
        the subequent shader if:

        * the two variables match in name, type, and qualification; or

        * the two variables are declared with the same location layout
          qualifier and match in type and qualification."

...

  " A program will fail to link if any two non-vertex shader input
    variables are assigned to the same location."

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Andres Gomez's avatarAndres Gomez <agomez@igalia.com>
Reviewed-by: Timothy Arceri's avatarTimothy Arceri <tarceri@itsqueeze.com>
parent cd992375
// From the ARB_separate_shader_objects spec v.25:
//
// " * An output variable is considered to match an input variable
// in the subequent shader if:
//
// * the two variables match in name, type, and qualification;
// or
//
// * the two variables are declared with the same location
// layout qualifier and match in type and qualification."
//
// ...
//
// " A program will fail to link if any two non-vertex shader input
// variables are assigned to the same location."
[require]
GLSL >= 1.50
GL_ARB_separate_shader_objects
GL_ARB_gpu_shader_fp64
[vertex shader]
#version 150
#extension GL_ARB_separate_shader_objects : require
#extension GL_ARB_gpu_shader_fp64 : require
in vec4 piglit_vertex;
layout(location = 0) flat out dvec4 out1;
void main()
{
gl_Position = piglit_vertex;
out1 = dvec4(1.0, 0.0, 0.0, 1.0);
}
[fragment shader]
#version 150
#extension GL_ARB_separate_shader_objects : require
#extension GL_ARB_gpu_shader_fp64 : require
uniform int i;
layout(location = 0) flat in dvec4 in1;
layout(location = 0) flat in dvec4 in2;
out vec4 color;
void main()
{
if (i == 0)
color = vec4(in1);
else
color = vec4(in2);
}
[test]
link error
// From the ARB_separate_shader_objects spec v.25:
//
// " * An output variable is considered to match an input variable
// in the subequent shader if:
//
// * the two variables match in name, type, and qualification;
// or
//
// * the two variables are declared with the same location
// layout qualifier and match in type and qualification."
//
// ...
//
// " A program will fail to link if any two non-vertex shader input
// variables are assigned to the same location."
[require]
GLSL >= 1.40
GL_ARB_separate_shader_objects
[vertex shader]
#version 140
#extension GL_ARB_separate_shader_objects : require
in vec4 piglit_vertex;
layout(location = 0) out vec4 out1;
void main()
{
gl_Position = piglit_vertex;
out1 = vec4(1.0, 0.0, 0.0, 1.0);
}
[fragment shader]
#version 140
#extension GL_ARB_separate_shader_objects : require
uniform int i;
layout(location = 0) in vec4 in1;
layout(location = 0) in vec4 in2;
out vec4 color;
void main()
{
if (i == 0)
color = in1;
else
color = in2;
}
[test]
link error
// From the ARB_separate_shader_objects spec v.25:
//
// " A program will fail to link if any two non-vertex shader input
// variables are assigned to the same location."
[require]
GLSL >= 1.50
GL_ARB_separate_shader_objects
GL_ARB_gpu_shader_fp64
[vertex shader]
#version 150
#extension GL_ARB_separate_shader_objects : require
#extension GL_ARB_gpu_shader_fp64 : require
in vec4 piglit_vertex;
layout(location = 0) flat out dvec4 out1;
layout(location = 1) flat out dvec2 out2;
void main()
{
gl_Position = piglit_vertex;
out1 = dvec4(1.0, 0.0, 0.0, 1.0);
out2 = dvec2(0.0);
}
[fragment shader]
#version 150
#extension GL_ARB_separate_shader_objects : require
#extension GL_ARB_gpu_shader_fp64 : require
uniform int i;
layout(location = 0) flat in dvec4 in1;
layout(location = 1) flat in dvec2 in2;
out vec4 color;
void main()
{
if (i == 0)
color = vec4(in1);
else
color = vec4(in2, in2);
}
[test]
link error
// From the ARB_separate_shader_objects spec v.25:
//
// " A program will fail to link if any two non-vertex shader input
// variables are assigned to the same location."
[require]
GLSL >= 1.40
GL_ARB_separate_shader_objects
[vertex shader]
#version 140
#extension GL_ARB_separate_shader_objects : require
in vec4 piglit_vertex;
layout(location = 0) out mat2x4 out1;
layout(location = 1) out vec4 out2;
void main()
{
gl_Position = piglit_vertex;
out1[0] = vec4(1.0, 0.0, 0.0, 1.0);
out1[1] = vec4(1.0, 1.0, 0.0, 1.0);
out2 = vec4(0.0);
}
[fragment shader]
#version 140
#extension GL_ARB_separate_shader_objects : require
uniform int i;
layout(location = 0) in mat2x4 in1;
layout(location = 1) in vec4 in2;
out vec4 color;
void main()
{
if (i == 0)
color = in1[0];
else if (i == 1)
color = in1[1];
else
color = in2;
}
[test]
link error
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment