summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJohn Brooks <[email protected]>2017-05-15 01:47:37 -0400
committerSamuel Pitoiset <[email protected]>2017-05-20 17:29:55 +0200
commitbf4d7671f423f5d4e451fba81bb9d9ae57f5fe5b (patch)
tree40eca7487016e44dc4831a07fa60addb3d1e97f7 /src/mesa
parent61d8f3387d1f2b724c833418968ba407fc294032 (diff)
driconf: Add allow_glsl_builtin_variable_redeclaration option
This option will allow GLSL builtins to be redeclared verbatim (e.g. redeclaring "in int gl_VertexID" in a vertex shader). This is not strictly valid and would normally fail to compile, but some applications (such as newer Techland ports) do it and need more leniency. v2 (Samuel Pitoiset): - Rename allow_glsl_builtin_redeclaration -> allow_glsl_builtin_variable_redeclaration Signed-off-by: John Brooks <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/t_options.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c3
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c1
-rw-r--r--src/mesa/main/mtypes.h5
-rw-r--r--src/mesa/state_tracker/st_extensions.c2
5 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index cd4f0252b92..ec0f3f7eaca 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -115,6 +115,11 @@ DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader, def) \
DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives in the middle of shaders")) \
DRI_CONF_OPT_END
+#define DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION(def) \
+DRI_CONF_OPT_BEGIN_B(allow_glsl_builtin_variable_redeclaration, def) \
+ DRI_CONF_DESC(en,gettext("Allow GLSL built-in variables to be redeclared verbatim")) \
+DRI_CONF_OPT_END
+
#define DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION(def) \
DRI_CONF_OPT_BEGIN_B(allow_higher_compat_version, def) \
DRI_CONF_DESC(en,gettext("Allow a higher compat profile (version 3.1+) for apps that request it")) \
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 5055dd76a84..d3ed871618c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -934,6 +934,9 @@ brw_process_driconf_options(struct brw_context *brw)
ctx->Const.AllowGLSLExtensionDirectiveMidShader =
driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
+ ctx->Const.AllowGLSLBuiltinVariableRedeclaration =
+ driQueryOptionb(options, "allow_glsl_builtin_variable_redeclaration");
+
ctx->Const.AllowHigherCompatVersion =
driQueryOptionb(options, "allow_higher_compat_version");
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 91ed128f832..9842de67423 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -89,6 +89,7 @@ DRI_CONF_BEGIN
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION("false")
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
+ DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d47c428936c..7ac0ee36778 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3638,6 +3638,11 @@ struct gl_constants
GLboolean AllowGLSLExtensionDirectiveMidShader;
/**
+ * Allow GLSL built-in variables to be redeclared verbatim
+ */
+ GLboolean AllowGLSLBuiltinVariableRedeclaration;
+
+ /**
* Allow creating a higher compat profile (version 3.1+) for apps that
* request it. Be careful when adding that driconf option because some
* features are unimplemented and might not work correctly.
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 2fa7ba7797e..a8cd2b4e174 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -892,6 +892,8 @@ void st_init_extensions(struct pipe_screen *screen,
consts->ForceGLSLAbsSqrt = options->force_glsl_abs_sqrt;
+ consts->AllowGLSLBuiltinVariableRedeclaration = options->allow_glsl_builtin_variable_redeclaration;
+
consts->dri_config_options_sha1 = options->config_options_sha1;
if (consts->GLSLVersion >= 400)