summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-07-30 22:29:24 +0200
committerMarek Olšák <[email protected]>2013-07-30 23:31:28 +0200
commit0f6a7cb00c86fbdb415b01450bb1ece8cfe1e31d (patch)
tree33da25bd8026d511d0c4f08f65d4ff57e9a1a4b0 /src/mesa
parentab789393443629027dca16e0aad501d6c1c32cb0 (diff)
mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine
See documentation in mtypes.h. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/drirc34
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/t_options.h5
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/state_tracker/st_extensions.c5
4 files changed, 50 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc
index 7c2d3ba8f0a..b5430eda5db 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -1,3 +1,27 @@
+<!--
+
+============================================
+Application bugs worked around in this file:
+============================================
+
+* Various Unigine products don't use the #version and #extension GLSL
+ directives, meaning they only get GLSL 1.10 and no extensions for their
+ shaders.
+ Enabling all extensions for Unigine fixes most issues, but the GLSL version
+ is still 1.10.
+
+* Unigine Heaven 3.0 with ARB_texture_multisample uses a "ivec4 * vec4"
+ expression, which fails to compile with GLSL 1.10.
+ Adding "#version 130" fixes this.
+
+* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses the uint keyword, which
+ fails to compile with GLSL 1.10.
+ Adding "#version 130" fixes this.
+
+TODO: document the other workarounds.
+
+-->
+
<driconf>
<!-- Please always enable app-specific workarounds for all drivers and
screens. -->
@@ -6,30 +30,40 @@
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Unigine Tropics" executable="Tropics">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Unigine Heaven (32-bit)" executable="heaven_x86">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
+ <option name="force_glsl_version" value="130" />
</application>
+
<application name="Unigine Heaven (64-bit)" executable="heaven_x64">
<option name="force_glsl_extensions_warn" value="true" />
<option name="disable_blend_func_extended" value="true" />
+ <option name="force_glsl_version" value="130" />
</application>
+
<application name="Unigine OilRush (32-bit)" executable="OilRush_x86">
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Unigine OilRush (64-bit)" executable="OilRush_x64">
<option name="disable_blend_func_extended" value="true" />
</application>
+
<application name="Savage 2" executable="savage2.bin">
<option name="disable_glsl_line_continuations" value="true" />
</application>
+
<application name="Topogun (32-bit)" executable="topogun32">
<option name="always_have_depth_buffer" value="true" />
</application>
+
<application name="Topogun (64-bit)" executable="topogun64">
<option name="always_have_depth_buffer" value="true" />
</application>
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 5b0f9611588..a4e7eb1b0f7 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -95,6 +95,11 @@ DRI_CONF_OPT_BEGIN_B(disable_glsl_line_continuations, def) \
DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \
DRI_CONF_OPT_END
+#define DRI_CONF_FORCE_GLSL_VERSION(def) \
+DRI_CONF_OPT_BEGIN_V(force_glsl_version, int, def, "0:999") \
+ DRI_CONF_DESC(en,gettext("Force a default GLSL version for shaders that lack an explicit #version line")) \
+DRI_CONF_OPT_END
+
/**
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 4042e9a7066..5bb6807452d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2874,6 +2874,12 @@ struct gl_constants
GLboolean ForceGLSLExtensionsWarn;
/**
+ * If non-zero, forces GLSL shaders without the #version directive to behave
+ * as if they began with "#version ForceGLSLVersion".
+ */
+ GLuint ForceGLSLVersion;
+
+ /**
* Does the driver support real 32-bit integers? (Otherwise, integers are
* simulated via floats.)
*/
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 6bc1284f826..a1457767890 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -598,6 +598,11 @@ void st_init_extensions(struct st_context *st)
_mesa_override_glsl_version(st->ctx);
+ if (st->options.force_glsl_version > 0 &&
+ st->options.force_glsl_version <= ctx->Const.GLSLVersion) {
+ ctx->Const.ForceGLSLVersion = st->options.force_glsl_version;
+ }
+
if (ctx->Const.GLSLVersion >= 130) {
ctx->Const.NativeIntegers = GL_TRUE;
ctx->Const.MaxClipPlanes = 8;