[Mesa-dev] [PATCH v2 2/3] mesa: actually support GLSL version overrides in compat profile

Emil Velikov emil.l.velikov at gmail.com
Wed May 2 16:51:03 UTC 2018


On 2 May 2018 at 11:27, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> ---
>  src/mesa/main/version.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 84babd69e2f..540f5482034 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -591,6 +591,8 @@ _mesa_get_version(const struct gl_extensions *extensions,
>           if (consts->GLSLVersion > 140) {
>              consts->GLSLVersion = 140;
>           }
> +         /* Support GLSL version overrides in compat profile */
> +         _mesa_override_glsl_version(consts);

Why are we allowing this only for compat? As-is this feels very dirty
and skimming through the existing code doesn't help much.

* classic drivers - 965, starting at create_context
_mesa_initialize_context -> _mesa_init_constants -> GLSLVersion (120) + override
intelInitExtensions -> GLSLVersion + override combo
_mesa_compute_version -> _mesa_get_version -> [optional] cap up-to 140
-> override
_mesa_compute_version -> tweak/match GLSL version based on the GL version

Not to mention the initial 120 (effectively) in
_mesa_initialize_context is bonkers for the following:
 - Intel Gen2 (GL 1.3) and Gen3 (GL 1.4 or 2.1)
 - nouveau vieux - GL 1.2 or 1.3
 - radeon (r100/r200) - GL 1.3

* gallium - two paths - create_screen and create_context, latter more
or less identical to i965
For the create_screen part:
st_api_query_versions (for max_gl*_version) -> _mesa_init_constants -> see above
st_api_query_versions (for max_gl*_version) -> st_init_extensions ->
GLSLVersion + override combo
st_api_query_versions (for max_gl*_version) -> _mesa_get_version -> see above

As you can see things are hairy.

A few ideas that come to mind:
 - drop the _mesa_init_constants bits and update any drivers needed
 - each of GLSLVersion, override and tweaks should happen [ideally]
once per ctx.

In theory one ought to be able to reuse the gallium approach for
classic drivers, but that's going on a far too big tangent.

HTH
Emil


More information about the mesa-dev mailing list