Commit 1c6388d3 authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Jason Ekstrand

Add a test for writing to an indirect component of a vec4 TCS output

Reviewed-by: Timothy Arceri's avatarTimothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
parent 4991384f
[require]
GLSL >= 1.50
GL_ARB_tessellation_shader
[vertex shader]
#version 150
in vec4 piglit_vertex;
void main()
{
gl_Position = piglit_vertex;
}
[tessellation control shader]
#version 150
#extension GL_ARB_tessellation_shader : require
layout(vertices = 4) out;
uniform int index;
patch out ivec4 v;
void main()
{
if (gl_InvocationID == 0)
v = ivec4(-1);
barrier();
v[gl_InvocationID] = int(gl_InvocationID);
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);
gl_TessLevelInner = float[2](1.0, 1.0);
}
[tessellation evaluation shader]
#version 150
#extension GL_ARB_tessellation_shader : require
layout(quads, equal_spacing) in;
uniform int index;
patch in ivec4 v;
out vec4 fscolor;
#define INTERP_QUADj(INj, OUT) do { \
vec4 v[4]; \
for (int j = 0; j < 4; j++) v[j] = INj; \
OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \
gl_TessCoord[1]); \
} while(false)
void main() {
bool pass = true;
for (int i = 0; i < 4; i++)
pass = pass && (v[i] == i);
fscolor = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
INTERP_QUADj(gl_in[j].gl_Position, gl_Position);
}
[fragment shader]
#version 150
in vec4 fscolor;
out vec4 outcolor;
void main()
{
outcolor = fscolor;
}
[test]
clear color 0.5 0.5 0.5 0.5
clear
patch parameter vertices 4
draw rect patch -1 -1 0.09 0.09
#draw arrays GL_PATCHES 0 4
probe rgb 6 6 0.0 1.0 0.0
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