mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine
See documentation in mtypes.h. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -239,9 +239,10 @@ struct st_visual
|
|||||||
*/
|
*/
|
||||||
struct st_config_options
|
struct st_config_options
|
||||||
{
|
{
|
||||||
boolean force_glsl_extensions_warn;
|
|
||||||
boolean disable_glsl_line_continuations;
|
|
||||||
boolean disable_blend_func_extended;
|
boolean disable_blend_func_extended;
|
||||||
|
boolean disable_glsl_line_continuations;
|
||||||
|
boolean force_glsl_extensions_warn;
|
||||||
|
unsigned force_glsl_version;
|
||||||
boolean force_s3tc_enable;
|
boolean force_s3tc_enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -42,12 +42,14 @@
|
|||||||
static void dri_fill_st_options(struct st_config_options *options,
|
static void dri_fill_st_options(struct st_config_options *options,
|
||||||
const struct driOptionCache * optionCache)
|
const struct driOptionCache * optionCache)
|
||||||
{
|
{
|
||||||
options->force_glsl_extensions_warn =
|
|
||||||
driQueryOptionb(optionCache, "force_glsl_extensions_warn");
|
|
||||||
options->disable_glsl_line_continuations =
|
|
||||||
driQueryOptionb(optionCache, "disable_glsl_line_continuations");
|
|
||||||
options->disable_blend_func_extended =
|
options->disable_blend_func_extended =
|
||||||
driQueryOptionb(optionCache, "disable_blend_func_extended");
|
driQueryOptionb(optionCache, "disable_blend_func_extended");
|
||||||
|
options->disable_glsl_line_continuations =
|
||||||
|
driQueryOptionb(optionCache, "disable_glsl_line_continuations");
|
||||||
|
options->force_glsl_extensions_warn =
|
||||||
|
driQueryOptionb(optionCache, "force_glsl_extensions_warn");
|
||||||
|
options->force_glsl_version =
|
||||||
|
driQueryOptioni(optionCache, "force_glsl_version");
|
||||||
options->force_s3tc_enable =
|
options->force_s3tc_enable =
|
||||||
driQueryOptionb(optionCache, "force_s3tc_enable");
|
driQueryOptionb(optionCache, "force_s3tc_enable");
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,7 @@ PUBLIC const char __driConfigOptions[] =
|
|||||||
DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
|
DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
|
||||||
DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
|
DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
|
||||||
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
|
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
|
||||||
|
DRI_CONF_FORCE_GLSL_VERSION(0)
|
||||||
DRI_CONF_SECTION_END
|
DRI_CONF_SECTION_END
|
||||||
|
|
||||||
DRI_CONF_SECTION_MISCELLANEOUS
|
DRI_CONF_SECTION_MISCELLANEOUS
|
||||||
@@ -72,7 +73,7 @@ PUBLIC const char __driConfigOptions[] =
|
|||||||
|
|
||||||
#define false 0
|
#define false 0
|
||||||
|
|
||||||
static const uint __driNConfigOptions = 11;
|
static const uint __driNConfigOptions = 12;
|
||||||
|
|
||||||
static const __DRIconfig **
|
static const __DRIconfig **
|
||||||
dri_fill_in_modes(struct dri_screen *screen)
|
dri_fill_in_modes(struct dri_screen *screen)
|
||||||
|
@@ -546,6 +546,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, GLint stencilBits,
|
|||||||
attribs.options.disable_blend_func_extended = FALSE;
|
attribs.options.disable_blend_func_extended = FALSE;
|
||||||
attribs.options.disable_glsl_line_continuations = FALSE;
|
attribs.options.disable_glsl_line_continuations = FALSE;
|
||||||
attribs.options.force_s3tc_enable = FALSE;
|
attribs.options.force_s3tc_enable = FALSE;
|
||||||
|
attribs.options.force_glsl_version = 0;
|
||||||
|
|
||||||
osmesa_init_st_visual(&attribs.visual,
|
osmesa_init_st_visual(&attribs.visual,
|
||||||
PIPE_FORMAT_R8G8B8A8_UNORM,
|
PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||||
|
@@ -74,7 +74,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
|
|||||||
this->num_builtins_to_link = 0;
|
this->num_builtins_to_link = 0;
|
||||||
|
|
||||||
/* Set default language version and extensions */
|
/* Set default language version and extensions */
|
||||||
this->language_version = 110;
|
this->language_version = ctx->Const.ForceGLSLVersion ?
|
||||||
|
ctx->Const.ForceGLSLVersion : 110;
|
||||||
this->es_shader = false;
|
this->es_shader = false;
|
||||||
this->ARB_texture_rectangle_enable = true;
|
this->ARB_texture_rectangle_enable = true;
|
||||||
|
|
||||||
|
@@ -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>
|
<driconf>
|
||||||
<!-- Please always enable app-specific workarounds for all drivers and
|
<!-- Please always enable app-specific workarounds for all drivers and
|
||||||
screens. -->
|
screens. -->
|
||||||
@@ -6,30 +30,40 @@
|
|||||||
<option name="force_glsl_extensions_warn" value="true" />
|
<option name="force_glsl_extensions_warn" value="true" />
|
||||||
<option name="disable_blend_func_extended" value="true" />
|
<option name="disable_blend_func_extended" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Unigine Tropics" executable="Tropics">
|
<application name="Unigine Tropics" executable="Tropics">
|
||||||
<option name="force_glsl_extensions_warn" value="true" />
|
<option name="force_glsl_extensions_warn" value="true" />
|
||||||
<option name="disable_blend_func_extended" value="true" />
|
<option name="disable_blend_func_extended" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Unigine Heaven (32-bit)" executable="heaven_x86">
|
<application name="Unigine Heaven (32-bit)" executable="heaven_x86">
|
||||||
<option name="force_glsl_extensions_warn" value="true" />
|
<option name="force_glsl_extensions_warn" value="true" />
|
||||||
<option name="disable_blend_func_extended" value="true" />
|
<option name="disable_blend_func_extended" value="true" />
|
||||||
|
<option name="force_glsl_version" value="130" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Unigine Heaven (64-bit)" executable="heaven_x64">
|
<application name="Unigine Heaven (64-bit)" executable="heaven_x64">
|
||||||
<option name="force_glsl_extensions_warn" value="true" />
|
<option name="force_glsl_extensions_warn" value="true" />
|
||||||
<option name="disable_blend_func_extended" value="true" />
|
<option name="disable_blend_func_extended" value="true" />
|
||||||
|
<option name="force_glsl_version" value="130" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Unigine OilRush (32-bit)" executable="OilRush_x86">
|
<application name="Unigine OilRush (32-bit)" executable="OilRush_x86">
|
||||||
<option name="disable_blend_func_extended" value="true" />
|
<option name="disable_blend_func_extended" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Unigine OilRush (64-bit)" executable="OilRush_x64">
|
<application name="Unigine OilRush (64-bit)" executable="OilRush_x64">
|
||||||
<option name="disable_blend_func_extended" value="true" />
|
<option name="disable_blend_func_extended" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Savage 2" executable="savage2.bin">
|
<application name="Savage 2" executable="savage2.bin">
|
||||||
<option name="disable_glsl_line_continuations" value="true" />
|
<option name="disable_glsl_line_continuations" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Topogun (32-bit)" executable="topogun32">
|
<application name="Topogun (32-bit)" executable="topogun32">
|
||||||
<option name="always_have_depth_buffer" value="true" />
|
<option name="always_have_depth_buffer" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<application name="Topogun (64-bit)" executable="topogun64">
|
<application name="Topogun (64-bit)" executable="topogun64">
|
||||||
<option name="always_have_depth_buffer" value="true" />
|
<option name="always_have_depth_buffer" value="true" />
|
||||||
</application>
|
</application>
|
||||||
|
@@ -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_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \
|
||||||
DRI_CONF_OPT_END
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2873,6 +2873,12 @@ struct gl_constants
|
|||||||
*/
|
*/
|
||||||
GLboolean ForceGLSLExtensionsWarn;
|
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
|
* Does the driver support real 32-bit integers? (Otherwise, integers are
|
||||||
* simulated via floats.)
|
* simulated via floats.)
|
||||||
|
@@ -598,6 +598,11 @@ void st_init_extensions(struct st_context *st)
|
|||||||
|
|
||||||
_mesa_override_glsl_version(st->ctx);
|
_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) {
|
if (ctx->Const.GLSLVersion >= 130) {
|
||||||
ctx->Const.NativeIntegers = GL_TRUE;
|
ctx->Const.NativeIntegers = GL_TRUE;
|
||||||
ctx->Const.MaxClipPlanes = 8;
|
ctx->Const.MaxClipPlanes = 8;
|
||||||
|
Reference in New Issue
Block a user