[Mesa-dev] [PATCH 07/16] driconf: start sharing AllowGLSLExtensionDirectiveMidShader

Martin Peres martin.peres at linux.intel.com
Fri Jun 5 06:04:01 PDT 2015


This has the side effect of enabling this option for the i830, i915,
nouveau_vieux, classic swrast, and the classic radeon drivers.

It also forces the initialisation of
attribs.options.shared_options.AllowGLSLExtensionDirectiveMidShader in
gallium/osmesa.

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/glsl/glsl_parser_extras.cpp             | 2 +-
 src/mesa/drivers/dri/common/xmlpool.h       | 3 ++-
 src/mesa/drivers/dri/i965/brw_context.c     | 3 ---
 src/mesa/drivers/dri/i965/intel_screen.c    | 1 -
 src/mesa/main/mtypes.h                      | 5 -----
 src/mesa/main/shared_options.c              | 3 +++
 src/mesa/main/shared_options.h              | 6 ++++++
 src/mesa/state_tracker/st_extensions.c      | 3 ---
 10 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 5ccd54a..2d19e91 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -248,7 +248,6 @@ struct st_config_options
    boolean disable_glsl_line_continuations;
    boolean disable_shader_bit_encoding;
    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 2c691e0..f5b5a57 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_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
       DRI_CONF_SECTION_END
 
       DRI_CONF_SECTION_MISCELLANEOUS
@@ -99,8 +98,6 @@ dri_fill_st_options(struct st_config_options *options,
       driQueryOptionb(optionCache, "disable_shader_bit_encoding");
    options->force_s3tc_enable =
       driQueryOptionb(optionCache, "force_s3tc_enable");
-   options->allow_glsl_extension_directive_midshader =
-      driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
 }
 
 static const __DRIconfig **
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index d18f3c6..8fafe96 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -233,7 +233,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
    memset(this->atomic_counter_offsets, 0,
           sizeof(this->atomic_counter_offsets));
    this->allow_extension_directive_midshader =
-      ctx->Const.AllowGLSLExtensionDirectiveMidShader;
+      ctx->Const.options.AllowGLSLExtensionDirectiveMidShader;
 }
 
 /**
diff --git a/src/mesa/drivers/dri/common/xmlpool.h b/src/mesa/drivers/dri/common/xmlpool.h
index 82968f6..f6953b4 100644
--- a/src/mesa/drivers/dri/common/xmlpool.h
+++ b/src/mesa/drivers/dri/common/xmlpool.h
@@ -110,7 +110,8 @@
 
 #define DRI_CONF_SECTION_DEBUG_SHARED \
    DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false") \
-   DRI_CONF_FORCE_GLSL_VERSION(0)
+   DRI_CONF_FORCE_GLSL_VERSION(0) \
+   DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
 
 #define DRI_CONF_SECTION_MISC_SHARED \
    "<!-- No shared msic options yet -->\n"
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index ef05efd..a94e21d5 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -686,9 +686,6 @@ brw_process_driconf_options(struct brw_context *brw)
 
    ctx->Const.DisableGLSLLineContinuations =
       driQueryOptionb(options, "disable_glsl_line_continuations");
-
-   ctx->Const.AllowGLSLExtensionDirectiveMidShader =
-      driQueryOptionb(options, "allow_glsl_extension_directive_midshader");
 }
 
 GLboolean
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index d52bdf3..9f0d9d0 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -83,7 +83,6 @@ DRI_CONF_BEGIN
       DRI_CONF_DISABLE_THROTTLING("false")
       DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
       DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
-      DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
 
       DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")
 	 DRI_CONF_DESC(en, "Perform code generation at shader link time.")
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d35a3a0..0839870 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3381,11 +3381,6 @@ struct gl_constants
    struct shared_options options;
 
    /**
-    * Allow GLSL #extension directives in the middle of shaders.
-    */
-   GLboolean AllowGLSLExtensionDirectiveMidShader;
-
-   /**
     * Does the driver support real 32-bit integers?  (Otherwise, integers are
     * simulated via floats.)
     */
diff --git a/src/mesa/main/shared_options.c b/src/mesa/main/shared_options.c
index 5288e0c..a5b5c97 100644
--- a/src/mesa/main/shared_options.c
+++ b/src/mesa/main/shared_options.c
@@ -29,6 +29,9 @@ void
 _mesa_shared_options_fill(struct driOptionCache *optionCache,
                           struct shared_options *sharedOptions)
 {
+   sharedOptions->AllowGLSLExtensionDirectiveMidShader =
+      driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
+
    sharedOptions->ForceGLSLExtensionsWarn =
       driQueryOptionb(optionCache, "force_glsl_extensions_warn");
 
diff --git a/src/mesa/main/shared_options.h b/src/mesa/main/shared_options.h
index 3c66906..d86561f 100644
--- a/src/mesa/main/shared_options.h
+++ b/src/mesa/main/shared_options.h
@@ -49,6 +49,11 @@ struct shared_options
 
    /* debug */
    /**
+    * Allow GLSL #extension directives in the middle of shaders.
+    */
+   GLboolean AllowGLSLExtensionDirectiveMidShader;
+
+   /**
     * Changes default GLSL extension behavior from "error" to "warn".  It's out
     * of spec, but it can make some apps work that otherwise wouldn't.
     */
@@ -72,6 +77,7 @@ _mesa_shared_options_fill(struct driOptionCache *optionCache,
 static inline void
 _mesa_shared_options_fill_defaults(struct shared_options *sharedOptions)
 {
+   sharedOptions->AllowGLSLExtensionDirectiveMidShader = GL_FALSE;
    sharedOptions->ForceGLSLExtensionsWarn = GL_FALSE;
    sharedOptions->ForceGLSLVersion = 0;
 }
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index d0eea25..5ac3e4e 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -811,9 +811,6 @@ void st_init_extensions(struct pipe_screen *screen,
    if (options->disable_glsl_line_continuations)
       consts->DisableGLSLLineContinuations = 1;
 
-   if (options->allow_glsl_extension_directive_midshader)
-      consts->AllowGLSLExtensionDirectiveMidShader = GL_TRUE;
-
    consts->MinMapBufferAlignment =
       screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
 
-- 
2.4.2



More information about the mesa-dev mailing list