[Mesa-dev] [PATCH] glsl: Add gl_MaxViewports to available builtin constants

Matt Turner mattst88 at gmail.com
Fri Dec 12 09:19:00 PST 2014


On Tue, Dec 9, 2014 at 11:09 PM, Maxence Le Doré
<maxence.ledore at gmail.com> wrote:
> It seems to have been forgotten during viewports array implementation time.
> ---
>  src/glsl/builtin_variables.cpp  | 4 ++++
>  src/glsl/glsl_parser_extras.cpp | 3 +++
>  src/glsl/glsl_parser_extras.h   | 3 +++
>  3 files changed, 10 insertions(+)
>
> diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> index c36d198..65e32ad 100644
> --- a/src/glsl/builtin_variables.cpp
> +++ b/src/glsl/builtin_variables.cpp
> @@ -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);
>  }

Nice find. The only thing that's holding back my review is that the
specification says

    Add to the list of built in constants available to geometry shaders in
    Section 7.4:

        const int gl_MaxViewports = 16;

and I don't see how we're preventing gl_MaxViewports from being
enabled in other shader stages.

Maybe idr can confirm.


More information about the mesa-dev mailing list