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 <john@fastquake.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:

committed by
Samuel Pitoiset

parent
61d8f3387d
commit
bf4d7671f4
@@ -246,6 +246,7 @@ struct st_config_options
|
|||||||
unsigned force_glsl_version;
|
unsigned force_glsl_version;
|
||||||
boolean force_s3tc_enable;
|
boolean force_s3tc_enable;
|
||||||
boolean allow_glsl_extension_directive_midshader;
|
boolean allow_glsl_extension_directive_midshader;
|
||||||
|
boolean allow_glsl_builtin_variable_redeclaration;
|
||||||
boolean allow_higher_compat_version;
|
boolean allow_higher_compat_version;
|
||||||
boolean glsl_zero_init;
|
boolean glsl_zero_init;
|
||||||
boolean force_glsl_abs_sqrt;
|
boolean force_glsl_abs_sqrt;
|
||||||
|
@@ -75,6 +75,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {
|
|||||||
DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
|
DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
|
||||||
DRI_CONF_FORCE_GLSL_VERSION(0)
|
DRI_CONF_FORCE_GLSL_VERSION(0)
|
||||||
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("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_ALLOW_HIGHER_COMPAT_VERSION("false")
|
||||||
DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
|
DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
|
||||||
DRI_CONF_SECTION_END
|
DRI_CONF_SECTION_END
|
||||||
@@ -108,6 +109,8 @@ dri_fill_st_options(struct dri_screen *screen)
|
|||||||
driQueryOptionb(optionCache, "force_s3tc_enable");
|
driQueryOptionb(optionCache, "force_s3tc_enable");
|
||||||
options->allow_glsl_extension_directive_midshader =
|
options->allow_glsl_extension_directive_midshader =
|
||||||
driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
|
driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
|
||||||
|
options->allow_glsl_builtin_variable_redeclaration =
|
||||||
|
driQueryOptionb(optionCache, "allow_glsl_builtin_variable_redeclaration");
|
||||||
options->allow_higher_compat_version =
|
options->allow_higher_compat_version =
|
||||||
driQueryOptionb(optionCache, "allow_higher_compat_version");
|
driQueryOptionb(optionCache, "allow_higher_compat_version");
|
||||||
options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init");
|
options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init");
|
||||||
|
@@ -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_DESC(en,gettext("Allow GLSL #extension directives in the middle of shaders")) \
|
||||||
DRI_CONF_OPT_END
|
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) \
|
#define DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION(def) \
|
||||||
DRI_CONF_OPT_BEGIN_B(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")) \
|
DRI_CONF_DESC(en,gettext("Allow a higher compat profile (version 3.1+) for apps that request it")) \
|
||||||
|
@@ -934,6 +934,9 @@ brw_process_driconf_options(struct brw_context *brw)
|
|||||||
ctx->Const.AllowGLSLExtensionDirectiveMidShader =
|
ctx->Const.AllowGLSLExtensionDirectiveMidShader =
|
||||||
driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
|
driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
|
||||||
|
|
||||||
|
ctx->Const.AllowGLSLBuiltinVariableRedeclaration =
|
||||||
|
driQueryOptionb(options, "allow_glsl_builtin_variable_redeclaration");
|
||||||
|
|
||||||
ctx->Const.AllowHigherCompatVersion =
|
ctx->Const.AllowHigherCompatVersion =
|
||||||
driQueryOptionb(options, "allow_higher_compat_version");
|
driQueryOptionb(options, "allow_higher_compat_version");
|
||||||
|
|
||||||
|
@@ -89,6 +89,7 @@ DRI_CONF_BEGIN
|
|||||||
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
|
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
|
||||||
DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION("false")
|
DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION("false")
|
||||||
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("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_ALLOW_HIGHER_COMPAT_VERSION("false")
|
||||||
DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
|
DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
|
||||||
|
|
||||||
|
@@ -3637,6 +3637,11 @@ struct gl_constants
|
|||||||
*/
|
*/
|
||||||
GLboolean AllowGLSLExtensionDirectiveMidShader;
|
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
|
* Allow creating a higher compat profile (version 3.1+) for apps that
|
||||||
* request it. Be careful when adding that driconf option because some
|
* request it. Be careful when adding that driconf option because some
|
||||||
|
@@ -892,6 +892,8 @@ void st_init_extensions(struct pipe_screen *screen,
|
|||||||
|
|
||||||
consts->ForceGLSLAbsSqrt = options->force_glsl_abs_sqrt;
|
consts->ForceGLSLAbsSqrt = options->force_glsl_abs_sqrt;
|
||||||
|
|
||||||
|
consts->AllowGLSLBuiltinVariableRedeclaration = options->allow_glsl_builtin_variable_redeclaration;
|
||||||
|
|
||||||
consts->dri_config_options_sha1 = options->config_options_sha1;
|
consts->dri_config_options_sha1 = options->config_options_sha1;
|
||||||
|
|
||||||
if (consts->GLSLVersion >= 400)
|
if (consts->GLSLVersion >= 400)
|
||||||
|
Reference in New Issue
Block a user