mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
glsl: add workaround for MDK2 HD
Allows a shader to compile that uses an embedded struct declaration
which are not allowed in glsl 1.20+
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14986
(cherry picked from commit f109bfc3f1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
parent
1d66a995ce
commit
a66a9280fb
11 changed files with 25 additions and 1 deletions
|
|
@ -2704,7 +2704,7 @@
|
|||
"description": "glsl: add workaround for MDK2 HD",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -7667,6 +7667,7 @@ ast_process_struct_or_iface_block_members(ir_exec_list *instructions,
|
|||
* embedded structures in 1.10 only.
|
||||
*/
|
||||
if (state->language_version != 110 &&
|
||||
!state->allow_glsl_embedded_structure_declarations &&
|
||||
decl_list->type->specifier->structure != NULL)
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"embedded structure declarations are not allowed");
|
||||
|
|
|
|||
|
|
@ -329,6 +329,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
|
|||
ctx->Const.AllowVertexTextureBias;
|
||||
this->allow_glsl_120_subset_in_110 =
|
||||
ctx->Const.AllowGLSL120SubsetIn110;
|
||||
this->allow_glsl_embedded_structure_declarations =
|
||||
ctx->Const.AllowGLSLEmbeddedStructureDeclarations;
|
||||
this->allow_builtin_variable_redeclaration =
|
||||
ctx->Const.AllowGLSLBuiltinVariableRedeclaration;
|
||||
this->ignore_write_to_readonly_var =
|
||||
|
|
|
|||
|
|
@ -1023,6 +1023,7 @@ struct _mesa_glsl_parse_state {
|
|||
char *alias_shader_extension;
|
||||
bool allow_vertex_texture_bias;
|
||||
bool allow_glsl_120_subset_in_110;
|
||||
bool allow_glsl_embedded_structure_declarations;
|
||||
bool allow_builtin_variable_redeclaration;
|
||||
bool ignore_write_to_readonly_var;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ DRI_CONF_SECTION_DEBUG
|
|||
DRI_CONF_ALLOW_EXTRA_PP_TOKENS(false)
|
||||
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(false)
|
||||
DRI_CONF_ALLOW_GLSL_120_SUBSET_IN_110(false)
|
||||
DRI_CONF_ALLOW_GLSL_EMBEDDED_STRUCTURE_DECLARATIONS(false)
|
||||
DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION(false)
|
||||
DRI_CONF_ALLOW_GLSL_RELAXED_ES(false)
|
||||
DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION(false)
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ u_driconf_fill_st_options(struct st_config_options *options,
|
|||
query_bool_option(allow_extra_pp_tokens);
|
||||
query_bool_option(allow_glsl_extension_directive_midshader);
|
||||
query_bool_option(allow_glsl_120_subset_in_110);
|
||||
query_bool_option(allow_glsl_embedded_structure_declarations);
|
||||
query_bool_option(allow_glsl_builtin_const_expression);
|
||||
query_bool_option(allow_glsl_relaxed_es);
|
||||
query_bool_option(allow_glsl_builtin_variable_redeclaration);
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ struct st_config_options
|
|||
bool allow_extra_pp_tokens;
|
||||
bool allow_glsl_extension_directive_midshader;
|
||||
bool allow_glsl_120_subset_in_110;
|
||||
bool allow_glsl_embedded_structure_declarations;
|
||||
bool allow_glsl_builtin_const_expression;
|
||||
bool allow_glsl_relaxed_es;
|
||||
bool allow_glsl_builtin_variable_redeclaration;
|
||||
|
|
|
|||
|
|
@ -541,6 +541,12 @@ struct gl_constants
|
|||
*/
|
||||
GLboolean AllowGLSL120SubsetIn110;
|
||||
|
||||
/**
|
||||
* Allow a embedded structure declarations which were allowed in GLSL 1.10
|
||||
* but are no longer allowed in GLSL 1.20+
|
||||
*/
|
||||
GLboolean AllowGLSLEmbeddedStructureDeclarations;
|
||||
|
||||
/**
|
||||
* Allow builtins as part of constant expressions. This was not allowed
|
||||
* until GLSL 1.20 this allows it everywhere.
|
||||
|
|
|
|||
|
|
@ -1551,6 +1551,9 @@ void st_init_extensions(struct pipe_screen *screen,
|
|||
if (options->allow_glsl_120_subset_in_110)
|
||||
consts->AllowGLSL120SubsetIn110 = GL_TRUE;
|
||||
|
||||
if (options->allow_glsl_embedded_structure_declarations)
|
||||
consts->AllowGLSLEmbeddedStructureDeclarations = GL_TRUE;
|
||||
|
||||
if (options->allow_glsl_builtin_const_expression)
|
||||
consts->AllowGLSLBuiltinConstantExpression = GL_TRUE;
|
||||
|
||||
|
|
|
|||
|
|
@ -286,6 +286,10 @@ TODO: document the other workarounds.
|
|||
<option name="glsl_ignore_write_to_readonly_var" value="true"/>
|
||||
</application>
|
||||
|
||||
<application name="MDK2 HD" executable="mdk2hd.exe">
|
||||
<option name="allow_glsl_embedded_structure_declarations" value="true"/>
|
||||
</application>
|
||||
|
||||
<application name="Rocket League" executable="RocketLeague">
|
||||
<option name="glsl_correct_derivatives_after_discard" value="true"/>
|
||||
</application>
|
||||
|
|
|
|||
|
|
@ -207,6 +207,10 @@
|
|||
DRI_CONF_OPT_B(allow_glsl_120_subset_in_110, def, \
|
||||
"Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13")
|
||||
|
||||
#define DRI_CONF_ALLOW_GLSL_EMBEDDED_STRUCTURE_DECLARATIONS(def) \
|
||||
DRI_CONF_OPT_B(allow_glsl_embedded_structure_declarations, def, \
|
||||
"Allow embedded structure declarations again in GLSL 1.20+")
|
||||
|
||||
#define DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION(def) \
|
||||
DRI_CONF_OPT_B(allow_glsl_builtin_const_expression, def, \
|
||||
"Allow builtins as part of constant expressions")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue