glsl: Add gl_MaxViewports to available builtin constants
authorMaxence Le Doré <maxence.ledore@gmail.com>
Wed, 10 Dec 2014 07:09:24 +0000 (08:09 +0100)
committerMatt Turner <mattst88@gmail.com>
Mon, 15 Dec 2014 20:20:00 +0000 (12:20 -0800)
It seems to have been forgotten during viewports array implementation time.

Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/builtin_variables.cpp
src/glsl/glsl_parser_extras.cpp
src/glsl/glsl_parser_extras.h

index c36d19831f8a4816a7cdaa95c715b1d764482fcc..65e32ad73976398e4956f4172d7709a45154e48c 100644 (file)
@@ -724,6 +724,10 @@ builtin_variable_generator::generate_constants()
       add_const("gl_MaxCombinedImageUniforms",
                 state->Const.MaxCombinedImageUniforms);
    }
+
+   if (state->is_version(410, 0) ||
+       state->ARB_viewport_array_enable)
+      add_const("gl_MaxViewports", state->Const.MaxViewports);
 }
 
 
index 6893c7b82cca1db1e94a5f2712b9f03db925e5e8..dd02a808e0db648fda1b45d850e425f324552a13 100644 (file)
@@ -135,6 +135,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
    this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
    this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms;
 
+   /* ARB_viewport_array */
+   this->Const.MaxViewports = ctx->Const.MaxViewports;
+
    this->current_function = NULL;
    this->toplevel_ir = NULL;
    this->found_return = false;
index e9eb237b0b3a0ff65e1fb7d9c97a3d4b95f74514..e04f7ced565bf719b67e452e664a7c76318f81aa 100644 (file)
@@ -343,6 +343,9 @@ struct _mesa_glsl_parse_state {
       unsigned MaxGeometryImageUniforms;
       unsigned MaxFragmentImageUniforms;
       unsigned MaxCombinedImageUniforms;
+
+      /* ARB_viewport_array */
+      unsigned MaxViewports;
    } Const;
 
    /**