Mesa (10.1): glsl: Use switch to allow adding more shader types

Carl Worth cworth at kemper.freedesktop.org
Fri May 2 00:06:09 UTC 2014


Module: Mesa
Branch: 10.1
Commit: 6c4601ac46abc6803d93175c76a678141dacb905
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c4601ac46abc6803d93175c76a678141dacb905

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Thu May  1 15:37:48 2014 -0700

glsl: Use switch to allow adding more shader types

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Cc: <mesa-stable at lists.freedesktop.org>

---

 src/glsl/glsl_parser_extras.cpp |   33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 87784ed..6b7760f 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -1335,20 +1335,27 @@ set_shader_inout_layout(struct gl_shader *shader,
       return;
    }
 
-   shader->Geom.VerticesOut = 0;
-   if (state->out_qualifier->flags.q.max_vertices)
-      shader->Geom.VerticesOut = state->out_qualifier->max_vertices;
-
-   if (state->gs_input_prim_type_specified) {
-      shader->Geom.InputType = state->gs_input_prim_type;
-   } else {
-      shader->Geom.InputType = PRIM_UNKNOWN;
-   }
+   switch(shader->Stage) {
+   case MESA_SHADER_GEOMETRY:
+      shader->Geom.VerticesOut = 0;
+      if (state->out_qualifier->flags.q.max_vertices)
+         shader->Geom.VerticesOut = state->out_qualifier->max_vertices;
+
+      if (state->gs_input_prim_type_specified) {
+         shader->Geom.InputType = state->gs_input_prim_type;
+      } else {
+         shader->Geom.InputType = PRIM_UNKNOWN;
+      }
 
-   if (state->out_qualifier->flags.q.prim_type) {
-      shader->Geom.OutputType = state->out_qualifier->prim_type;
-   } else {
-      shader->Geom.OutputType = PRIM_UNKNOWN;
+      if (state->out_qualifier->flags.q.prim_type) {
+         shader->Geom.OutputType = state->out_qualifier->prim_type;
+      } else {
+         shader->Geom.OutputType = PRIM_UNKNOWN;
+      }
+      break;
+    default:
+      /* Nothing to do. */
+      break;
    }
 }
 




More information about the mesa-commit mailing list