From ca719c6e303966e8acf8a5d7d094e0075e36f6a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 13 Jun 2020 17:18:34 -0400 Subject: [PATCH] glsl,driconf: add allow_glsl_120_subset_in_110 for SPECviewperf13 Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/compiler/glsl/ast_function.cpp | 4 ++-- src/compiler/glsl/ast_to_hir.cpp | 3 ++- src/compiler/glsl/glsl_parser_extras.cpp | 2 ++ src/compiler/glsl/glsl_parser_extras.h | 4 +++- src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 + src/gallium/frontends/dri/dri_screen.c | 2 ++ src/gallium/include/frontend/api.h | 1 + src/mesa/main/mtypes.h | 5 +++++ src/mesa/state_tracker/st_extensions.c | 3 +++ src/util/driconf.h | 5 +++++ 10 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index b6b81bf1e14..74985db51ca 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -2110,8 +2110,8 @@ ast_function_expression::hir(exec_list *instructions, } if (constructor_type->is_array()) { - if (!state->check_version(120, 300, &loc, - "array constructors forbidden")) { + if (!state->check_version(state->allow_glsl_120_subset_in_110 ? 110 : 120, + 300, &loc, "array constructors forbidden")) { return ir_rvalue::error_value(ctx); } diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index f050313ce73..101269bcb56 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -962,7 +962,8 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, lhs_var->name); error_emitted = true; } else if (lhs->type->is_array() && - !state->check_version(120, 300, &lhs_loc, + !state->check_version(state->allow_glsl_120_subset_in_110 ? 110 : 120, + 300, &lhs_loc, "whole array assignment forbidden")) { /* From page 32 (page 38 of the PDF) of the GLSL 1.10 spec: * diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 647402eee3e..e9130d16d25 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -317,6 +317,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, sizeof(this->atomic_counter_offsets)); this->allow_extension_directive_midshader = ctx->Const.AllowGLSLExtensionDirectiveMidShader; + this->allow_glsl_120_subset_in_110 = + ctx->Const.AllowGLSL120SubsetIn110; this->allow_builtin_variable_redeclaration = ctx->Const.AllowGLSLBuiltinVariableRedeclaration; this->allow_layout_qualifier_on_function_parameter = diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index e6b9b196dad..bd1392f7ce1 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -356,7 +356,8 @@ struct _mesa_glsl_parse_state { bool has_implicit_conversions() const { - return EXT_shader_implicit_conversions_enable || is_version(120, 0); + return EXT_shader_implicit_conversions_enable || + is_version(allow_glsl_120_subset_in_110 ? 110 : 120, 0); } bool has_implicit_int_to_uint_conversion() const @@ -938,6 +939,7 @@ struct _mesa_glsl_parse_state { bool layer_viewport_relative; bool allow_extension_directive_midshader; + bool allow_glsl_120_subset_in_110; bool allow_builtin_variable_redeclaration; bool allow_layout_qualifier_on_function_parameter; diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 1be9abd87fe..25ade275d64 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -23,6 +23,7 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_DISABLE_ARB_GPU_SHADER5("false") DRI_CONF_FORCE_GLSL_VERSION(0) DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false") + DRI_CONF_ALLOW_GLSL_120_SUBSET_IN_110("false") DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION("false") DRI_CONF_ALLOW_GLSL_RELAXED_ES("false") DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false") diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index a6ba68eaec3..e3bda001c60 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -75,6 +75,8 @@ dri_fill_st_options(struct dri_screen *screen) driQueryOptioni(optionCache, "force_glsl_version"); options->allow_glsl_extension_directive_midshader = driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader"); + options->allow_glsl_120_subset_in_110 = + driQueryOptionb(optionCache, "allow_glsl_120_subset_in_110"); options->allow_glsl_builtin_const_expression = driQueryOptionb(optionCache, "allow_glsl_builtin_const_expression"); options->allow_glsl_relaxed_es = diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index a7e602c874f..effc2cd72b4 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -221,6 +221,7 @@ struct st_config_options bool force_glsl_extensions_warn; unsigned force_glsl_version; bool allow_glsl_extension_directive_midshader; + bool allow_glsl_120_subset_in_110; bool allow_glsl_builtin_const_expression; bool allow_glsl_relaxed_es; bool allow_glsl_builtin_variable_redeclaration; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b74f81ee06d..836961b077f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3829,6 +3829,11 @@ struct gl_constants */ GLboolean AllowGLSLExtensionDirectiveMidShader; + /** + * Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13. + */ + GLboolean AllowGLSL120SubsetIn110; + /** * Allow builtins as part of constant expressions. This was not allowed * until GLSL 1.20 this allows it everywhere. diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 0efd16bfd4a..1ba60a94a38 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1402,6 +1402,9 @@ void st_init_extensions(struct pipe_screen *screen, if (options->allow_glsl_extension_directive_midshader) consts->AllowGLSLExtensionDirectiveMidShader = GL_TRUE; + if (options->allow_glsl_120_subset_in_110) + consts->AllowGLSL120SubsetIn110 = GL_TRUE; + if (options->allow_glsl_builtin_const_expression) consts->AllowGLSLBuiltinConstantExpression = GL_TRUE; diff --git a/src/util/driconf.h b/src/util/driconf.h index 7f9312241d4..b807e669ce2 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -162,6 +162,11 @@ DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader, def) \ DRI_CONF_DESC("Allow GLSL #extension directives in the middle of shaders") \ DRI_CONF_OPT_END +#define DRI_CONF_ALLOW_GLSL_120_SUBSET_IN_110(def) \ +DRI_CONF_OPT_BEGIN_B(allow_glsl_120_subset_in_110, def) \ + DRI_CONF_DESC("Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13") \ +DRI_CONF_OPT_END + #define DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION(def) \ DRI_CONF_OPT_BEGIN_B(allow_glsl_builtin_const_expression, def) \ DRI_CONF_DESC("Allow builtins as part of constant expressions") \ -- 2.30.2