[Mesa-dev] [PATCH] mesa: Set minimum possible GLSL version

Ilia Mirkin imirkin at alum.mit.edu
Fri Jul 5 05:10:20 UTC 2019


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Fri, Jul 5, 2019 at 12:59 AM Ian Romanick <idr at freedesktop.org> wrote:
>
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Set the absolute minimum possible GLSL version.  API_OPENGL_CORE can
> mean an OpenGL 3.0 forward-compatible context, so that implies a minimum
> possible version of 1.30.  Otherwise, the minimum possible version 1.20.
> Since Mesa unconditionally advertises GL_ARB_shading_language_100 and
> GL_ARB_shader_objects, every driver has GLSL 1.20... even if they don't
> advertise any extensions to enable any shader stages (e.g.,
> GL_ARB_vertex_shader).
>
> Converts about 2,500 piglit tests from crash to skip on NV18.
> ---
>  src/mesa/main/context.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index e5a89d9c2fc..516660d55d2 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -616,6 +616,17 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
>     consts->MaxProgramMatrices = MAX_PROGRAM_MATRICES;
>     consts->MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
>
> +   /* Set the absolute minimum possible GLSL version.  API_OPENGL_CORE can
> +    * mean an OpenGL 3.0 forward-compatible context, so that implies a minimum
> +    * possible version of 1.30.  Otherwise, the minimum possible version 1.20.
> +    * Since Mesa unconditionally advertises GL_ARB_shading_language_100 and
> +    * GL_ARB_shader_objects, every driver has GLSL 1.20... even if they don't
> +    * advertise any extensions to enable any shader stages (e.g.,
> +    * GL_ARB_vertex_shader).
> +    */
> +   consts->GLSLVersion = api == API_OPENGL_CORE ? 130 : 120;
> +   consts->GLSLVersionCompat = consts->GLSLVersion;
> +
>     /* Assume that if GLSL 1.30+ (or GLSL ES 3.00+) is supported that
>      * gl_VertexID is implemented using a native hardware register with OpenGL
>      * semantics.
> --
> 2.21.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list