Add tests for all geometry shader primitive types.

This commit is contained in:
Hans-Kristian Arntzen 2016-09-28 08:23:21 +02:00
parent f3220833e8
commit 25c4467a10
10 changed files with 263 additions and 0 deletions

View File

@ -0,0 +1,26 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(lines_adjacency) in;
layout(max_vertices = 3, line_strip) out;
out vec3 vNormal;
in VertexData
{
vec3 normal;
} vin[4];
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = vin[2].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,23 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(lines) in;
layout(max_vertices = 2, line_strip) out;
out vec3 vNormal;
in VertexData
{
vec3 normal;
} vin[2];
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,26 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(points) in;
layout(max_vertices = 3, points) out;
out vec3 vNormal;
in VertexData
{
vec3 normal;
} vin[1];
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,26 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(triangles_adjacency) in;
layout(max_vertices = 3, triangle_strip) out;
out vec3 vNormal;
in VertexData
{
vec3 normal;
} vin[6];
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = vin[2].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,26 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(triangles) in;
layout(max_vertices = 3, triangle_strip) out;
out vec3 vNormal;
in VertexData
{
vec3 normal;
} vin[3];
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = vin[2].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,28 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(lines_adjacency) in;
layout(line_strip, max_vertices = 3) out;
in VertexData {
vec3 normal;
} vin[];
out vec3 vNormal;
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = vin[2].normal;
EmitVertex();
EndPrimitive();
}

24
shaders/geom/lines.geom Normal file
View File

@ -0,0 +1,24 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(lines) in;
layout(line_strip, max_vertices = 2) out;
in VertexData {
vec3 normal;
} vin[];
out vec3 vNormal;
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
EndPrimitive();
}

28
shaders/geom/points.geom Normal file
View File

@ -0,0 +1,28 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(points) in;
layout(points, max_vertices = 3) out;
in VertexData {
vec3 normal;
} vin[];
out vec3 vNormal;
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,28 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(triangles_adjacency) in;
layout(triangle_strip, max_vertices = 3) out;
in VertexData {
vec3 normal;
} vin[];
out vec3 vNormal;
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = vin[2].normal;
EmitVertex();
EndPrimitive();
}

View File

@ -0,0 +1,28 @@
#version 310 es
#extension GL_EXT_geometry_shader : require
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
in VertexData {
vec3 normal;
} vin[];
out vec3 vNormal;
void main()
{
gl_Position = gl_in[0].gl_Position;
vNormal = vin[0].normal;
EmitVertex();
gl_Position = gl_in[1].gl_Position;
vNormal = vin[1].normal;
EmitVertex();
gl_Position = gl_in[2].gl_Position;
vNormal = vin[2].normal;
EmitVertex();
EndPrimitive();
}