glsl,driconf: add allow_glsl_120_subset_in_110 for SPECviewperf13
authorMarek Olšák <marek.olsak@amd.com>
Sat, 13 Jun 2020 21:18:34 +0000 (17:18 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 23 Jun 2020 09:25:24 +0000 (09:25 +0000)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5459>

src/compiler/glsl/ast_function.cpp
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h
src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
src/gallium/frontends/dri/dri_screen.c
src/gallium/include/frontend/api.h
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_extensions.c
src/util/driconf.h

index b6b81bf1e142c3152d03f6c2f0d31f86143343db..74985db51cacc4fa58a57b2955297399f9fcbf7b 100644 (file)
@@ -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);
          }
 
index f050313ce7385334fbef60a50e4b234c4a12cce4..101269bcb56858d665fec262527b32c8927b4cfe 100644 (file)
@@ -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:
           *
index 647402eee3e6c4f24532a9ab1bcc4cd6a697bb18..e9130d16d254eb4686729de1cf358b8439c10612 100644 (file)
@@ -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 =
index e6b9b196dad69ebc804e2cdeca708759f86e945c..bd1392f7ce1a3eabc42c725899b950e9c2af57bf 100644 (file)
@@ -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;
 
index 1be9abd87fe82eaebc82632dd9d37c6e165e0c06..25ade275d647ac488216c5a56b34be39c7add3d1 100644 (file)
@@ -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")
index a6ba68eaec323b6a74eb7bdf774461482572ab6e..e3bda001c60b0900405bfaa7eda90ced372f1826 100644 (file)
@@ -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 =
index a7e602c874fb34f9f74e5ce8ac61d29bd0c43e32..effc2cd72b40ec79fd757f7f81ba0c7536930894 100644 (file)
@@ -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;
index b74f81ee06da5748dc35c20b7df8a9585c66f94f..836961b077f9b3586182f97566b63704754f16a0 100644 (file)
@@ -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.
index 0efd16bfd4a64d89b4319e082a2f3345f61877b3..1ba60a94a385de493ad1c611f99e28e2c8535be4 100644 (file)
@@ -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;
 
index 7f9312241d437132822b03bf60d2e481ab6acffc..b807e669ce2902cb003764a2904c9c13a94694b9 100644 (file)
@@ -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") \