glsl: Use Geom.VerticesOut == -1 to specify unset
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 23 May 2016 22:53:10 +0000 (15:53 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 1 Jun 2016 18:11:39 +0000 (11:11 -0700)
Because apparently layout(max_vertices=0) is a thing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/linker.cpp
src/mesa/main/shaderobj.c

index 843998dc9fc86d0497aff61fff43c3a6411057df..2e3395ec41633b691a1a1493ccf3dfdc1fb559ec 100644 (file)
@@ -1687,7 +1687,7 @@ set_shader_inout_layout(struct gl_shader *shader,
          shader->TessEval.PointMode = state->in_qualifier->point_mode;
       break;
    case MESA_SHADER_GEOMETRY:
-      shader->Geom.VerticesOut = 0;
+      shader->Geom.VerticesOut = -1;
       if (state->out_qualifier->flags.q.max_vertices) {
          unsigned qual_max_vertices;
          if (state->out_qualifier->max_vertices->
index e712ee3873b65cee3e8bb7fc646c86e17e489a32..9e6559005d7644dca87688d3e441eff156219a42 100644 (file)
@@ -1980,7 +1980,7 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
                                struct gl_shader **shader_list,
                                unsigned num_shaders)
 {
-   linked_shader->Geom.VerticesOut = 0;
+   linked_shader->Geom.VerticesOut = -1;
    linked_shader->Geom.Invocations = 0;
    linked_shader->Geom.InputType = PRIM_UNKNOWN;
    linked_shader->Geom.OutputType = PRIM_UNKNOWN;
@@ -2024,8 +2024,8 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
         linked_shader->Geom.OutputType = shader->Geom.OutputType;
       }
 
-      if (shader->Geom.VerticesOut != 0) {
-        if (linked_shader->Geom.VerticesOut != 0 &&
+      if (shader->Geom.VerticesOut != -1) {
+        if (linked_shader->Geom.VerticesOut != -1 &&
             linked_shader->Geom.VerticesOut != shader->Geom.VerticesOut) {
            linker_error(prog, "geometry shader defined with conflicting "
                         "output vertex count (%d and %d)\n",
@@ -2067,7 +2067,7 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
    }
    prog->Geom.OutputType = linked_shader->Geom.OutputType;
 
-   if (linked_shader->Geom.VerticesOut == 0) {
+   if (linked_shader->Geom.VerticesOut == -1) {
       linker_error(prog,
                   "geometry shader didn't declare max_vertices\n");
       return;
index 274cb129b07d3c9dbb4f6615bf7b1e8713b63835..189317c3a460beba6a0a468c25314cb349ef8ca0 100644 (file)
@@ -232,7 +232,7 @@ init_shader_program(struct gl_shader_program *prog)
    prog->FragDataBindings = string_to_uint_map_ctor();
    prog->FragDataIndexBindings = string_to_uint_map_ctor();
 
-   prog->Geom.VerticesOut = 0;
+   prog->Geom.VerticesOut = -1;
    prog->Geom.InputType = GL_TRIANGLES;
    prog->Geom.OutputType = GL_TRIANGLE_STRIP;
    prog->Geom.UsesEndPrimitive = false;