Mesa (master): driconf: Add a new option: disable_glsl_line_continuations

Carl Worth cworth at kemper.freedesktop.org
Fri Jan 11 22:31:40 UTC 2013


Module: Mesa
Branch: master
Commit: c0c9c9966f54b2e4a4eb2ffa2abe343c1b82b823
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0c9c9966f54b2e4a4eb2ffa2abe343c1b82b823

Author: Carl Worth <cworth at cworth.org>
Date:   Tue Dec  4 16:29:00 2012 -0800

driconf: Add a new option: disable_glsl_line_continuations

This is to enable a quirk for Savage2 which includes a shader with a stray '\'
at the end of a comment line. Interpreting that backslash as a line
continuation will break the compilation of the shader, so we need a way to
disable this.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/common/xmlpool/t_options.h |    5 +++++
 src/mesa/drivers/dri/i965/brw_context.c         |    2 ++
 src/mesa/drivers/dri/intel/intel_screen.c       |    3 ++-
 src/mesa/main/mtypes.h                          |    6 ++++++
 4 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 78f1765..683a473 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -282,3 +282,8 @@ DRI_CONF_OPT_END
 DRI_CONF_OPT_BEGIN(disable_blend_func_extended,bool,def) \
         DRI_CONF_DESC(en,gettext("Disable dual source blending")) \
 DRI_CONF_OPT_END
+
+#define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \
+DRI_CONF_OPT_BEGIN(disable_glsl_line_continuations,bool,def) \
+        DRI_CONF_DESC(en,gettext("Disable backslash-based line continuations in GLSL source")) \
+DRI_CONF_OPT_END
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index df0f8d6..cf4cedd 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -377,6 +377,8 @@ brwCreateContext(int api,
 
    ctx->Const.ForceGLSLExtensionsWarn = driQueryOptionb(&intel->optionCache, "force_glsl_extensions_warn");
 
+   ctx->Const.DisableGLSLLineContinuations = driQueryOptionb(&intel->optionCache, "disable_glsl_line_continuations");
+
    ctx->Const.ContextFlags = 0;
    if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
       ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index e0fe8c1..557f1af 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -80,6 +80,7 @@ PUBLIC const char __driConfigOptions[] =
      DRI_CONF_ALWAYS_FLUSH_BATCH(false)
      DRI_CONF_ALWAYS_FLUSH_CACHE(false)
      DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
+     DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
      DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
 
       DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false)
@@ -92,7 +93,7 @@ PUBLIC const char __driConfigOptions[] =
    DRI_CONF_SECTION_END
 DRI_CONF_END;
 
-const GLuint __driNConfigOptions = 15;
+const GLuint __driNConfigOptions = 16;
 
 #include "intel_batchbuffer.h"
 #include "intel_buffers.h"
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f44ec49..f7b90cf 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2984,6 +2984,12 @@ struct gl_constants
     * \sa _mesa_init_constants
     */
    GLuint64 MaxElementIndex;
+
+   /**
+    * Disable interpretation of line continuations (lines ending with a
+    * backslash character ('\') in GLSL source.
+    */
+   GLboolean DisableGLSLLineContinuations;
 };
 
 




More information about the mesa-commit mailing list