From 4560aad780b851f855a8adc72ea34ca4eb17634a Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 8 May 2018 10:10:39 +1000 Subject: [PATCH] mesa: add GLSLVersionCompat constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This allows drivers to define what version of GLSL they support in compat. This will be needed in order to support compat 3.2 without breaking drivers that wont support it. Reviewed-by: Marek Olšák --- src/mesa/drivers/dri/i915/intel_extensions.c | 1 + src/mesa/drivers/dri/i965/intel_extensions.c | 6 ++++++ src/mesa/main/mtypes.h | 1 + src/mesa/main/version.c | 4 +--- src/mesa/state_tracker/st_extensions.c | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c index c85bd787fe7..c3851530139 100644 --- a/src/mesa/drivers/dri/i915/intel_extensions.c +++ b/src/mesa/drivers/dri/i915/intel_extensions.c @@ -78,6 +78,7 @@ intelInitExtensions(struct gl_context *ctx) ctx->Extensions.OES_draw_texture = true; ctx->Const.GLSLVersion = 120; + ctx->Const.GLSLVersionCompat = 120; _mesa_override_glsl_version(&ctx->Const); if (intel->gen >= 3) { diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index e1e19217bc9..b5860f13cb4 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -148,6 +148,12 @@ intelInitExtensions(struct gl_context *ctx) ctx->Const.GLSLVersion = 330; else ctx->Const.GLSLVersion = 120; + + if (devinfo->gen >= 6) + ctx->Const.GLSLVersionCompat = 130; + else + ctx->Const.GLSLVersionCompat = 120; + _mesa_override_glsl_version(&ctx->Const); ctx->Extensions.EXT_shader_integer_mix = ctx->Const.GLSLVersion >= 130; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2d3eb457f9b..2c87308dd73 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3649,6 +3649,7 @@ struct gl_constants GLuint MaxGeometryTotalOutputComponents; GLuint GLSLVersion; /**< Desktop GLSL version supported (ex: 120 = 1.20) */ + GLuint GLSLVersionCompat; /**< Desktop compat GLSL version supported */ /** * Changes default GLSL extension behavior from "error" to "warn". It's out diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 84babd69e2f..3f3dff0bde3 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -588,9 +588,7 @@ _mesa_get_version(const struct gl_extensions *extensions, /* Disable higher GLSL versions for legacy contexts. * This disallows creation of higher compatibility contexts. */ if (!consts->AllowHigherCompatVersion) { - if (consts->GLSLVersion > 140) { - consts->GLSLVersion = 140; - } + consts->GLSLVersion = consts->GLSLVersionCompat; } /* fall through */ case API_OPENGL_CORE: diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 5479e637aff..19ef736e5b0 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -936,6 +936,7 @@ void st_init_extensions(struct pipe_screen *screen, /* Figure out GLSL support and set GLSLVersion to it. */ consts->GLSLVersion = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL); + consts->GLSLVersionCompat = 140; _mesa_override_glsl_version(consts); -- 2.30.2