static bool
deprecated_texture_derivatives_only(const _mesa_glsl_parse_state *state)
{
- return deprecated_texture(state) && derivatives_only(state);
+ return (deprecated_texture(state) && derivatives_only(state)) || state->allow_vertex_texture_bias;
}
static bool
sizeof(this->atomic_counter_offsets));
this->allow_extension_directive_midshader =
ctx->Const.AllowGLSLExtensionDirectiveMidShader;
+ this->alias_shader_extension =
+ ctx->Const.AliasShaderExtension;
+ this->allow_vertex_texture_bias =
+ ctx->Const.AllowVertexTextureBias;
this->allow_glsl_120_subset_in_110 =
ctx->Const.AllowGLSL120SubsetIn110;
this->allow_builtin_variable_redeclaration =
}
/**
+ * Check alias_shader_extension for any aliased shader extensions
+ */
+static const char *find_extension_alias(_mesa_glsl_parse_state *state, const char *name)
+{
+ char *exts, *field, *ext_alias = NULL;
+
+ /* Copy alias_shader_extension because strtok() is destructive. */
+ exts = strdup(state->alias_shader_extension);
+ if (exts) {
+ for (field = strtok(exts, ","); field != NULL; field = strtok(NULL, ",")) {
+ if(strncmp(name, field, strlen(name)) == 0) {
+ field = strstr(field, ":");
+ if(field) {
+ ext_alias = strdup(field + 1);
+ }
+ break;
+ }
+ }
+
+ free(exts);
+ }
+ return ext_alias;
+}
+
+/**
* Find an extension by name in _mesa_glsl_supported_extensions. If
* the name is not found, return NULL.
*/
-static const _mesa_glsl_extension *find_extension(const char *name)
+static const _mesa_glsl_extension *find_extension(_mesa_glsl_parse_state *state, const char *name)
{
+ const char *ext_alias = NULL;
+ if (state->alias_shader_extension) {
+ ext_alias = find_extension_alias(state, name);
+ name = ext_alias ? ext_alias : name;
+ }
+
for (unsigned i = 0; i < ARRAY_SIZE(_mesa_glsl_supported_extensions); ++i) {
if (strcmp(name, _mesa_glsl_supported_extensions[i].name) == 0) {
+ free((void *)ext_alias);
return &_mesa_glsl_supported_extensions[i];
}
}
+
+ free((void *)ext_alias);
return NULL;
}
}
}
} else {
- const _mesa_glsl_extension *extension = find_extension(name);
+ const _mesa_glsl_extension *extension = find_extension(state, name);
if (extension &&
(extension->compatible_with_state(state, api, gl_version) ||
(state->consts->AllowGLSLCompatShaders &&
bool layer_viewport_relative;
bool allow_extension_directive_midshader;
+ char *alias_shader_extension;
+ bool allow_vertex_texture_bias;
bool allow_glsl_120_subset_in_110;
bool allow_builtin_variable_redeclaration;
bool ignore_write_to_readonly_var;
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
DRI_CONF_DISABLE_ARB_GPU_SHADER5(false)
DRI_CONF_DISABLE_UNIFORM_ARRAY_RESIZE(false)
+ DRI_CONF_ALIAS_SHADER_EXTENSION()
+ DRI_CONF_ALLOW_VERTEX_TEXTURE_BIAS(false)
DRI_CONF_FORCE_GLSL_VERSION(0)
DRI_CONF_ALLOW_EXTRA_PP_TOKENS(false)
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(false)
query_bool_option(disable_arb_gpu_shader5);
query_bool_option(disable_glsl_line_continuations);
query_bool_option(disable_uniform_array_resize);
+ query_string_option(alias_shader_extension);
+ query_bool_option(allow_vertex_texture_bias);
query_bool_option(force_compat_shaders);
query_bool_option(force_glsl_extensions_warn);
query_int_option(force_glsl_version);
bool disable_glsl_line_continuations;
bool disable_arb_gpu_shader5;
bool disable_uniform_array_resize;
+ char *alias_shader_extension;
+ bool allow_vertex_texture_bias;
bool force_compat_shaders;
bool force_glsl_extensions_warn;
unsigned force_glsl_version;
bool DisableUniformArrayResize;
/**
+ * Alias extension e.g. GL_ATI_shader_texture_lod to GL_ARB_shader_texture_lod.
+ */
+ char *AliasShaderExtension;
+
+ /**
+ * Allow fs-only bias argument in vertex shaders.
+ */
+ GLboolean AllowVertexTextureBias;
+
+ /**
* Align varyings to POT in a slot
*
* Drivers that prefer varyings to be aligned to POT must set this value to GL_TRUE
if (options->disable_uniform_array_resize)
consts->DisableUniformArrayResize = 1;
+ consts->AliasShaderExtension = options->alias_shader_extension;
+
+ if (options->allow_vertex_texture_bias)
+ consts->AllowVertexTextureBias = GL_TRUE;
+
if (options->allow_glsl_extension_directive_midshader)
consts->AllowGLSLExtensionDirectiveMidShader = GL_TRUE;
<option name="disable_uniform_array_resize" value="true" />
</application>
+ <application name="The Chronicles of Riddick: Assault on Dark Athena" executable="DarkAthena.exe">
+ <option name="disable_uniform_array_resize" value="true" />
+ <option name="alias_shader_extension" value="GL_ATI_shader_texture_lod:GL_ARB_shader_texture_lod" />
+ <option name="allow_vertex_texture_bias" value="true" />
+ </application>
+
<application name="Dying Light" executable="DyingLightGame">
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
</application>
DRI_CONF_OPT_B(disable_uniform_array_resize, def, \
"Disable the glsl optimisation that resizes uniform arrays")
+#define DRI_CONF_ALIAS_SHADER_EXTENSION() \
+ DRI_CONF_OPT_S_NODEF(alias_shader_extension, "Allow alias for shader extensions")
+
+#define DRI_CONF_ALLOW_VERTEX_TEXTURE_BIAS(def) \
+ DRI_CONF_OPT_B(allow_vertex_texture_bias, def, \
+ "Allow GL2 vertex shaders to have access to texture2D/textureCube with bias variants")
+
#define DRI_CONF_FORCE_GLSL_VERSION(def) \
DRI_CONF_OPT_I(force_glsl_version, def, 0, 999, \
"Force a default GLSL version for shaders that lack an explicit #version line")