summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Bieler <fabianbieler@fastmail.fm>2014-02-05 22:07:51 +0100
committerKenneth Graunke <kenneth@whitecape.org>2014-03-08 02:08:33 -0800
commit47a89ea50bf285e9da4e86da75d53f5634650fbf (patch)
tree92b3aa5cdba72623dc3db08ef631bd0077ba2477
parent890a26b56f7d79d3a741e58aeac8fe866c820a02 (diff)
geom-outlining-150: Use core geometry shaders.
Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/glsl/geom-outlining-150.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/glsl/geom-outlining-150.c b/src/glsl/geom-outlining-150.c
index 0bc20f06..3dffa16c 100644
--- a/src/glsl/geom-outlining-150.c
+++ b/src/glsl/geom-outlining-150.c
@@ -256,7 +256,8 @@ Init(void)
"} \n";
static const char *geomShaderText =
"#version 150 \n"
- "#extension GL_ARB_geometry_shader4: enable \n"
+ "layout(triangles) in; \n"
+ "layout(triangle_strip, max_vertices = 3) out; \n"
"uniform vec2 ViewportSize; \n"
"out vec2 Vert0, Vert1, Vert2; \n"
"\n"
@@ -271,11 +272,11 @@ Init(void)
" Vert0 = vpxform(gl_in[0].gl_Position); \n"
" Vert1 = vpxform(gl_in[1].gl_Position); \n"
" Vert2 = vpxform(gl_in[2].gl_Position); \n"
- " gl_Position = gl_PositionIn[0]; \n"
+ " gl_Position = gl_in[0].gl_Position; \n"
" EmitVertex(); \n"
- " gl_Position = gl_PositionIn[1]; \n"
+ " gl_Position = gl_in[1].gl_Position; \n"
" EmitVertex(); \n"
- " gl_Position = gl_PositionIn[2]; \n"
+ " gl_Position = gl_in[2].gl_Position; \n"
" EmitVertex(); \n"
"} \n";
static const char *fragShaderText =
@@ -309,15 +310,14 @@ Init(void)
if (!ShadersSupported())
exit(1);
- version = glGetString(GL_VERSION);
- if (version[0] * 10 + version[2] < 32) {
+ if (!GLEW_VERSION_3_2) {
fprintf(stderr, "Sorry, OpenGL 3.2 or later required.\n");
exit(1);
}
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
- GeomShader = CompileShaderText(GL_GEOMETRY_SHADER_ARB, geomShaderText);
+ GeomShader = CompileShaderText(GL_GEOMETRY_SHADER, geomShaderText);
Program = LinkShaders3(VertShader, GeomShader, FragShader);
assert(Program);
@@ -326,18 +326,8 @@ Init(void)
glBindAttribLocation(Program, 0, "Vertex");
glBindFragDataLocation(Program, 0, "FragColor");
- /*
- * The geometry shader will receive and emit triangles.
- */
- glProgramParameteriARB(Program, GL_GEOMETRY_INPUT_TYPE_ARB,
- GL_TRIANGLES);
- glProgramParameteriARB(Program, GL_GEOMETRY_OUTPUT_TYPE_ARB,
- GL_TRIANGLE_STRIP);
- glProgramParameteriARB(Program,GL_GEOMETRY_VERTICES_OUT_ARB, 3);
- CheckError(__LINE__);
-
/* relink */
- glLinkProgramARB(Program);
+ glLinkProgram(Program);
assert(glIsProgram(Program));
assert(glIsShader(FragShader));