[Mesa-dev] [PATCH 08/12] glsl/gsraytrace: Use core geometry shaders.

Fabian Bieler fabianbieler at fastmail.fm
Wed Feb 5 13:07:48 PST 2014


Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
 src/glsl/gsraytrace.cpp | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/src/glsl/gsraytrace.cpp b/src/glsl/gsraytrace.cpp
index 23c0f93..adb6c7a 100644
--- a/src/glsl/gsraytrace.cpp
+++ b/src/glsl/gsraytrace.cpp
@@ -255,7 +255,8 @@ static const char* vsSource =
 static const char* gsSource = 
 "#version 150                                                             \n"
 "#line " S__LINE__ S__LINE__ "\n"
-"#extension GL_ARB_geometry_shader4: require                              \n"
+"layout(points) in;                                                       \n"
+"layout(points, max_vertices = 3) out;                                    \n"
 "                                                                         \n"
 "#define SHADOWS                                                          \n"
 "#define RECURSION                                                        \n"
@@ -337,7 +338,7 @@ static const char* gsSource =
 "    return;                                                              \n"
 "                                                                         \n"
 "  // emitPassThrough();                          \n"
-"  gl_Position  = gl_PositionIn[0];               \n"
+"  gl_Position  = gl_in[0].gl_Position;           \n"
 "  orig_t2      = orig_t1[0];                     \n"
 "  dir_idx2     = dir_idx1[0];                    \n"
 "  uv_state2.xyw= uv_state1[0].xyw;               \n"
@@ -362,7 +363,7 @@ static const char* gsSource =
 "  type = 1;                                        \n"
 "                                                   \n"
 "  //emitShadowRay();                               \n"
-"  gl_Position  = gl_PositionIn[0];                 \n"
+"  gl_Position  = gl_in[0].gl_Position;             \n"
 "  orig_t2.xyz  = shadowRay.orig;                   \n"
 "  orig_t2.w    = shadowHit.t;                      \n"
 "  dir_idx2.xyz = shadowRay.dir;                    \n"
@@ -379,7 +380,7 @@ static const char* gsSource =
 "  type  = -1;                                   \n"
 "                                                \n"
 "  //emitReflRay();                              \n"
-"  gl_Position  = gl_PositionIn[0];              \n"
+"  gl_Position  = gl_in[0].gl_Position;          \n"
 "  orig_t2.xyz  = reflRay.orig;                  \n"
 "  orig_t2.w    = reflHit.t;                     \n"
 "  dir_idx2.xyz = reflRay.dir;                   \n"
@@ -838,30 +839,17 @@ Init(void)
 {
    glDisable(GL_DEPTH_TEST);
 
-   if (!ShadersSupported())
+   if (!GLEW_VERSION_3_2)
    {
-      fprintf(stderr, "Shaders are not supported!\n");
-      exit(-1);
-   }
-
-   if (!GLEW_ARB_geometry_shader4)
-   {
-      fprintf(stderr, "GS Shaders are not supported!\n");
-      exit(-1);
-   }
-
-   if (!GLEW_VERSION_3_0)
-   {
-      fprintf(stderr, "OpenGL 3.0 (needed for transform feedback) not "
-              "supported!\n");
+      fprintf(stderr, "OpenGL 3.2 (needed for transform feedback and "
+              "gemoetry shaders) not supported!\n");
       exit(-1);
    }
 
    vertShader = CompileShaderText(GL_VERTEX_SHADER, vsSource);
    geomShader = CompileShaderText(GL_GEOMETRY_SHADER_ARB, gsSource);
    fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fsSource);
-   program = LinkShaders3WithGeometryInfo(vertShader, geomShader, fragShader,
-                                          3, GL_POINTS, GL_POINTS);
+   program = LinkShaders3(vertShader, geomShader, fragShader);
 
    const char *varyings[] = {
       "gl_Position",
-- 
1.8.3.2



More information about the mesa-dev mailing list