[Mesa-dev] [PATCH 1/2] mesa: disallow creation of GL 3.1 compatibility contexts

Ian Romanick idr at freedesktop.org
Sat Dec 8 15:16:07 PST 2012


On 12/08/2012 02:02 PM, Marek Olšák wrote:
> Death to driver-specific hacks!

This looks good to me, but Dave Airlie may have a different opinion. :)

Drivers could enable GLSL 1.40 without 3.1 if they can support the full 
ARB_texbo.  We didn't enable texbos on compatibility profiles because L, 
LA, A, and I format texbos would require extra instructions in the 
shader and NOS recompiles.  Other hardware may not have this limitation.

If someone were to enable that, we should have some piglit test for 
those cases.

The series is:

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/mesa/drivers/dri/intel/intel_extensions.c |    6 +-----
>   src/mesa/main/version.c                       |    6 ++++++
>   src/mesa/state_tracker/st_extensions.c        |    5 +----
>   3 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
> index 96288ab..df886a5 100755
> --- a/src/mesa/drivers/dri/intel/intel_extensions.c
> +++ b/src/mesa/drivers/dri/intel/intel_extensions.c
> @@ -89,11 +89,7 @@ intelInitExtensions(struct gl_context *ctx)
>      ctx->Extensions.ARB_texture_rgb10_a2ui = true;
>
>      if (intel->gen >= 6)
> -      if (ctx->API == API_OPENGL_CORE) {
> -         ctx->Const.GLSLVersion = 140;
> -      } else {
> -         ctx->Const.GLSLVersion = 130;
> -      }
> +      ctx->Const.GLSLVersion = 140;
>      else
>         ctx->Const.GLSLVersion = 120;
>      _mesa_override_glsl_version(ctx);
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index eef8f43..4373d7b 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -345,6 +345,12 @@ _mesa_compute_version(struct gl_context *ctx)
>
>      switch (ctx->API) {
>      case API_OPENGL_COMPAT:
> +      /* Disable GLSL 1.40 and later for legacy contexts.
> +       * This disallows creation of the GL 3.1 compatibility context. */
> +      if (ctx->Const.GLSLVersion > 130) {
> +         ctx->Const.GLSLVersion = 130;
> +      }
> +      /* fall through */
>      case API_OPENGL_CORE:
>         compute_version(ctx);
>         break;
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 93ef7a9..726d868 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -570,10 +570,7 @@ void st_init_extensions(struct st_context *st)
>      glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
>
>      if (glsl_feature_level >= 140) {
> -      if (ctx->API == API_OPENGL_CORE)
> -         ctx->Const.GLSLVersion = 140;
> -      else
> -         ctx->Const.GLSLVersion = 130;
> +      ctx->Const.GLSLVersion = 140;
>      } else if (glsl_feature_level >= 130) {
>         ctx->Const.GLSLVersion = 130;
>      } else {
>



More information about the mesa-dev mailing list