driconf: Add a new option: disable_glsl_line_continuations
authorCarl Worth <cworth@cworth.org>
Wed, 5 Dec 2012 00:29:00 +0000 (16:29 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 11 Jan 2013 21:55:41 +0000 (13:55 -0800)
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@whitecape.org>
src/mesa/drivers/dri/common/xmlpool/t_options.h
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/main/mtypes.h

index 78f17650b2cb11fe6ce5c65519b7223aa3535d07..683a473660bc5485c5b769c298df2b6f32d6d3d0 100644 (file)
@@ -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
index df0f8d604917f5354a31ea94a304998abd994887..cf4cedd3df58cc6b15a7243773bf86fc3526f002 100644 (file)
@@ -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;
index e0fe8c186cb6e63a43dd61c3fac0cc2680a5b2c2..557f1af7aa85d5b908e85ccf474f8a6ef0397210 100644 (file)
@@ -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"
index f44ec4947edec52582a395b457180cc001dcfa92..f7b90cfcf17153cdbc101c7967c60451161330c6 100644 (file)
@@ -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;
 };