Commit 7fd22146 authored by Timothy Arceri's avatar Timothy Arceri

gl-3.2-compat: test gl_TexCoord[] built-in with geometry shaders

This tests both setting gl_TexCoord[] in the geometry shader and
using the gs to passthrough the gl_TexCoord[] values from the
vertex shader.
Reviewed-by: 's avatarMarek Olšák <marek.olsak@amd.com>
parent a4cedb84
[require]
GL COMPAT >= 3.2
GLSL >= 1.50
[vertex shader]
#version 150 compatibility
void main()
{
gl_Position = gl_Vertex;
}
[geometry shader]
#version 150 compatibility
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
out vec4 gl_TexCoord[5];
void main()
{
for (int i = 0; i < 3; i++) {
gl_Position = gl_in[i].gl_Position;
/* 0.05, 0.05, 0.10, 0.15, 0.20 */
for (int j = 0; j < 5; j++) {
gl_TexCoord[j] = vec4(float(j) * 0.05);
}
EmitVertex();
}
}
[fragment shader]
#version 110
varying vec4 gl_TexCoord[5];
void main()
{
vec4 result = vec4(0.0);
for (int i = 0; i < 4; i++)
result += gl_TexCoord[i];
/* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
gl_FragColor = result;
}
[test]
draw rect -1 -1 2 2
probe rgba 1 1 0.3 0.3 0.3 0.3
[require]
GL COMPAT >= 3.2
GLSL >= 1.50
[vertex shader]
#version 150 compatibility
void main()
{
gl_Position = gl_Vertex;
}
[geometry shader]
#version 150 compatibility
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
uniform int n;
out vec4 gl_TexCoord[5];
void main()
{
for (int i = 0; i < 3; i++) {
gl_Position = gl_in[i].gl_Position;
for (int j = 0; j < n; j++) {
gl_TexCoord[j] = vec4(0.5, 0.5, 0.5, 0.5) * float(j);
}
EmitVertex();
}
}
[fragment shader]
#version 150 compatibility
uniform int index;
in vec4 gl_TexCoord[5];
void main()
{
gl_FragColor = gl_TexCoord[index];
}
[test]
uniform int index 1
uniform int n 4
draw rect -1 -1 2 2
probe rgba 1 1 0.5 0.5 0.5 0.5
[require]
GL COMPAT >= 3.2
GLSL >= 1.50
[vertex shader]
#version 150 compatibility
out gl_PerVertex {
vec4 gl_Position;
vec4 gl_TexCoord[5];
};
void main()
{
/* 0.05, 0.05, 0.10, 0.15, 0.20 */
for (int i = 0; i < 5; i++)
gl_TexCoord[i] = vec4(float(i) * 0.05);
gl_Position = gl_Vertex;
}
[geometry shader]
#version 150 compatibility
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
in gl_PerVertex {
vec4 gl_Position;
vec4 gl_TexCoord[5];
} gl_in[];
out vec4 gl_TexCoord[5];
void main()
{
for (int i = 0; i < 3; i++) {
gl_Position = gl_in[i].gl_Position;
for (int j = 0; j < 5; j++) {
gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
}
EmitVertex();
}
}
[fragment shader]
#version 110
varying vec4 gl_TexCoord[5];
void main()
{
vec4 result = vec4(0.0);
for (int i = 0; i < 4; i++)
result += gl_TexCoord[i];
/* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
gl_FragColor = result;
}
[test]
draw rect -1 -1 2 2
probe rgba 1 1 0.3 0.3 0.3 0.3
[require]
GL COMPAT >= 3.2
GLSL >= 1.50
[vertex shader]
#version 150 compatibility
uniform int n;
out gl_PerVertex {
vec4 gl_Position;
vec4 gl_TexCoord[5];
};
void main()
{
for (int i = 0; i < n; i++) {
gl_TexCoord[i] = vec4(0.5, 0.5, 0.5, 0.5) * float(i);
}
gl_Position = gl_Vertex;
}
[geometry shader]
#version 150 compatibility
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
uniform int n;
in gl_PerVertex {
vec4 gl_Position;
vec4 gl_TexCoord[5];
} gl_in[];
out vec4 gl_TexCoord[5];
void main()
{
for (int i = 0; i < 3; i++) {
gl_Position = gl_in[i].gl_Position;
for (int j = 0; j < n; j++) {
gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
}
EmitVertex();
}
}
[fragment shader]
#version 150 compatibility
uniform int index;
in vec4 gl_TexCoord[5];
void main()
{
gl_FragColor = gl_TexCoord[index];
}
[test]
uniform int index 1
uniform int n 4
draw rect -1 -1 2 2
probe rgba 1 1 0.5 0.5 0.5 0.5
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