[Mesa-dev] [PATCH 06/16] driconf: start sharing ForceGLSLVersion
Martin Peres
martin.peres at linux.intel.com
Fri Jun 5 06:04:00 PDT 2015
This has the side effect of enabling this option for the intel classic
drivers, nouveau_vieux, classic swrast, and the classic radeon drivers.
Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
---
src/gallium/include/state_tracker/st_api.h | 1 -
src/gallium/state_trackers/dri/dri_screen.c | 3 ---
src/gallium/state_trackers/osmesa/osmesa.c | 1 -
src/glsl/glsl_parser_extras.cpp | 4 +++-
src/mesa/drivers/dri/common/xmlpool.h | 3 ++-
src/mesa/main/mtypes.h | 6 ------
src/mesa/main/shared_options.c | 3 +++
src/mesa/main/shared_options.h | 7 +++++++
src/mesa/state_tracker/st_extensions.c | 6 +-----
9 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index b8cd330..5ccd54a 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -247,7 +247,6 @@ struct st_config_options
boolean disable_blend_func_extended;
boolean disable_glsl_line_continuations;
boolean disable_shader_bit_encoding;
- unsigned force_glsl_version;
boolean force_s3tc_enable;
boolean allow_glsl_extension_directive_midshader;
};
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 6fb7155..2c691e0 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -73,7 +73,6 @@ const __DRIconfigOptionsExtension gallium_config_options = {
DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
- DRI_CONF_FORCE_GLSL_VERSION(0)
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
DRI_CONF_SECTION_END
@@ -98,8 +97,6 @@ dri_fill_st_options(struct st_config_options *options,
driQueryOptionb(optionCache, "disable_glsl_line_continuations");
options->disable_shader_bit_encoding =
driQueryOptionb(optionCache, "disable_shader_bit_encoding");
- options->force_glsl_version =
- driQueryOptioni(optionCache, "force_glsl_version");
options->force_s3tc_enable =
driQueryOptionb(optionCache, "force_s3tc_enable");
options->allow_glsl_extension_directive_midshader =
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c
index 2c32fa2..cebc4ec 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -589,7 +589,6 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, GLint stencilBits,
attribs.options.disable_glsl_line_continuations = FALSE;
attribs.options.disable_shader_bit_encoding = FALSE;
attribs.options.force_s3tc_enable = FALSE;
- attribs.options.force_glsl_version = 0;
_mesa_shared_options_fill_defaults(&attribs.options.shared_options);
osmesa_init_st_visual(&attribs.visual,
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 49b715c..d18f3c6 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -74,9 +74,11 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
/* Set default language version and extensions */
this->language_version = 110;
- this->forced_language_version = ctx->Const.ForceGLSLVersion;
this->es_shader = false;
this->ARB_texture_rectangle_enable = true;
+ if (ctx->Const.options.ForceGLSLVersion <= ctx->Const.GLSLVersion) {
+ this->forced_language_version = ctx->Const.options.ForceGLSLVersion;
+ }
/* OpenGL ES 2.0 has different defaults from desktop GL. */
if (ctx->API == API_OPENGLES2) {
diff --git a/src/mesa/drivers/dri/common/xmlpool.h b/src/mesa/drivers/dri/common/xmlpool.h
index 91f810f..82968f6 100644
--- a/src/mesa/drivers/dri/common/xmlpool.h
+++ b/src/mesa/drivers/dri/common/xmlpool.h
@@ -109,7 +109,8 @@
"<!-- No shared quality options yet -->\n"
#define DRI_CONF_SECTION_DEBUG_SHARED \
- DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
+ DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false") \
+ DRI_CONF_FORCE_GLSL_VERSION(0)
#define DRI_CONF_SECTION_MISC_SHARED \
"<!-- No shared msic options yet -->\n"
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 619788b..d35a3a0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3381,12 +3381,6 @@ struct gl_constants
struct shared_options options;
/**
- * If non-zero, forces GLSL shaders to behave as if they began
- * with "#version ForceGLSLVersion".
- */
- GLuint ForceGLSLVersion;
-
- /**
* Allow GLSL #extension directives in the middle of shaders.
*/
GLboolean AllowGLSLExtensionDirectiveMidShader;
diff --git a/src/mesa/main/shared_options.c b/src/mesa/main/shared_options.c
index 8457b18..5288e0c 100644
--- a/src/mesa/main/shared_options.c
+++ b/src/mesa/main/shared_options.c
@@ -31,4 +31,7 @@ _mesa_shared_options_fill(struct driOptionCache *optionCache,
{
sharedOptions->ForceGLSLExtensionsWarn =
driQueryOptionb(optionCache, "force_glsl_extensions_warn");
+
+ sharedOptions->ForceGLSLVersion =
+ driQueryOptioni(optionCache, "force_glsl_version");
}
diff --git a/src/mesa/main/shared_options.h b/src/mesa/main/shared_options.h
index 7cee737..3c66906 100644
--- a/src/mesa/main/shared_options.h
+++ b/src/mesa/main/shared_options.h
@@ -54,6 +54,12 @@ struct shared_options
*/
GLboolean ForceGLSLExtensionsWarn;
+ /**
+ * If non-zero, forces GLSL shaders to behave as if they began
+ * with "#version ForceGLSLVersion".
+ */
+ GLuint ForceGLSLVersion;
+
/* misc */
};
@@ -67,6 +73,7 @@ static inline void
_mesa_shared_options_fill_defaults(struct shared_options *sharedOptions)
{
sharedOptions->ForceGLSLExtensionsWarn = GL_FALSE;
+ sharedOptions->ForceGLSLVersion = 0;
}
#ifdef __cplusplus
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index b68ff6e..d0eea25 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -660,13 +660,9 @@ void st_init_extensions(struct pipe_screen *screen,
if (glsl_feature_level >= 410)
consts->GLSLVersion = 410;
+ /* FIXME: This should be handled by DRIconf only! */
_mesa_override_glsl_version(consts);
- if (options->force_glsl_version > 0 &&
- options->force_glsl_version <= consts->GLSLVersion) {
- consts->ForceGLSLVersion = options->force_glsl_version;
- }
-
if (glsl_feature_level >= 400)
extensions->ARB_gpu_shader5 = GL_TRUE;
if (glsl_feature_level >= 410)
--
2.4.2
More information about the mesa-dev
mailing list