glsl: check geometry output vertices limits.
authorDave Airlie <airlied@redhat.com>
Tue, 10 May 2016 01:56:31 +0000 (11:56 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 10 May 2016 04:26:03 +0000 (14:26 +1000)
This fixes:
GL45-CTS.geometry_shader.limits.max_output_vertices

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/glsl_parser_extras.cpp

index fb64350ed39c067bf4c023b8f809e781b87e3331..463cb9730eac3803b52d56ce7a214227f4af073d 100644 (file)
@@ -1683,6 +1683,14 @@ set_shader_inout_layout(struct gl_shader *shader,
          if (state->out_qualifier->max_vertices->
                process_qualifier_constant(state, "max_vertices",
                                           &qual_max_vertices, true)) {
+
+            if (qual_max_vertices > state->Const.MaxGeometryOutputVertices) {
+               YYLTYPE loc = state->out_qualifier->max_vertices->get_location();
+               _mesa_glsl_error(&loc, state,
+                                "maximum output vertices (%d) exceeds "
+                                "GL_MAX_GEOMETRY_OUTPUT_VERTICES",
+                                qual_max_vertices);
+            }
             shader->Geom.VerticesOut = qual_max_vertices;
          }
       }