diff --git a/.pick_status.json b/.pick_status.json index f9c49bdf2d9..1422106d527 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6367,7 +6367,7 @@ "description": "glsl: add extra pp tokens workaround and enable for CoR", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "43047384c331a9240339563704fe5d97ebe599d7" }, diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index 173e1a1586b..2359967e89e 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -781,7 +781,10 @@ replacement_list: junk: /* empty */ | pp_tokens { - glcpp_error(&@1, parser, "extra tokens at end of directive"); + if (parser->gl_ctx->Const.AllowExtraPPTokens) + glcpp_warning(&@1, parser, "extra tokens at end of directive"); + else + glcpp_error(&@1, parser, "extra tokens at end of directive"); } ; diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 25ade275d64..cec47de1b02 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -22,6 +22,7 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false") DRI_CONF_DISABLE_ARB_GPU_SHADER5("false") DRI_CONF_FORCE_GLSL_VERSION(0) + 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_BUILTIN_CONST_EXPRESSION("false") diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index e3bda001c60..953dee0d611 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -73,6 +73,8 @@ dri_fill_st_options(struct dri_screen *screen) driQueryOptionb(optionCache, "force_glsl_extensions_warn"); options->force_glsl_version = driQueryOptioni(optionCache, "force_glsl_version"); + options->allow_extra_pp_tokens = + driQueryOptionb(optionCache, "allow_extra_pp_tokens"); options->allow_glsl_extension_directive_midshader = driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader"); options->allow_glsl_120_subset_in_110 = diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index effc2cd72b4..05adf567ab8 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -220,6 +220,7 @@ struct st_config_options bool disable_arb_gpu_shader5; bool force_glsl_extensions_warn; unsigned force_glsl_version; + bool allow_extra_pp_tokens; bool allow_glsl_extension_directive_midshader; bool allow_glsl_120_subset_in_110; bool allow_glsl_builtin_const_expression; diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index cd69195c186..c1fb3db77e7 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -84,6 +84,7 @@ DRI_CONF_BEGIN DRI_CONF_FORCE_GLSL_VERSION(0) DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false") DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false") + DRI_CONF_ALLOW_EXTRA_PP_TOKENS("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") diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 52e890c1a3b..80e57891582 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3875,6 +3875,14 @@ struct gl_constants */ GLboolean AllowLayoutQualifiersOnFunctionParameters; + /** + * Allow extra tokens at end of preprocessor directives. The CTS now tests + * to make sure these are not allowed. However, previously drivers would + * allow them to exist and just issue a warning so some old applications + * depend on this. + */ + GLboolean AllowExtraPPTokens; + /** * Force computing the absolute value for sqrt() and inversesqrt() to follow * D3D9 when apps rely on this behaviour. diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index af454dca069..0af35876c4c 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1124,6 +1124,8 @@ void st_init_extensions(struct pipe_screen *screen, consts->ForceGLSLVersion = options->force_glsl_version; } + consts->AllowExtraPPTokens = options->allow_extra_pp_tokens; + consts->AllowHigherCompatVersion = options->allow_higher_compat_version; consts->ForceGLSLAbsSqrt = options->force_glsl_abs_sqrt; diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index 00888a154e9..da795eb50c5 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -246,6 +246,10 @@ TODO: document the other workarounds.