* If the function call is a constant expression, don't generate any
* instructions; just generate an ir_constant.
*/
- if (state->is_version(120, 100)) {
+ if (state->is_version(120, 100) ||
+ state->ctx->Const.AllowGLSLBuiltinConstantExpression) {
ir_constant *value = sig->constant_expression_value(ctx,
actual_parameters,
NULL);
DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
DRI_CONF_FORCE_GLSL_VERSION(0)
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
+ DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION("false")
DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
DRI_CONF_ALLOW_GLSL_CROSS_STAGE_INTERPOLATION_MISMATCH("false")
DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
boolean force_glsl_extensions_warn;
unsigned force_glsl_version;
boolean allow_glsl_extension_directive_midshader;
+ boolean allow_glsl_builtin_const_expression;
boolean allow_glsl_builtin_variable_redeclaration;
boolean allow_higher_compat_version;
boolean glsl_zero_init;
driQueryOptioni(optionCache, "force_glsl_version");
options->allow_glsl_extension_directive_midshader =
driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
+ options->allow_glsl_builtin_const_expression =
+ driQueryOptionb(optionCache, "allow_glsl_builtin_const_expression");
options->allow_glsl_builtin_variable_redeclaration =
driQueryOptionb(optionCache, "allow_glsl_builtin_variable_redeclaration");
options->allow_higher_compat_version =
*/
GLboolean AllowGLSLExtensionDirectiveMidShader;
+ /**
+ * Allow builtins as part of constant expressions. This was not allowed
+ * until GLSL 1.20 this allows it everywhere.
+ */
+ GLboolean AllowGLSLBuiltinConstantExpression;
+
/**
* Allow GLSL built-in variables to be redeclared verbatim
*/
if (options->allow_glsl_extension_directive_midshader)
consts->AllowGLSLExtensionDirectiveMidShader = GL_TRUE;
+ if (options->allow_glsl_builtin_const_expression)
+ consts->AllowGLSLBuiltinConstantExpression = GL_TRUE;
+
consts->MinMapBufferAlignment =
screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives in the middle of shaders")) \
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(en,gettext("Allow builtins as part of constant expressions")) \
+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")) \