On 11/26/2012 02:30 PM, Matt Turner wrote:
This is at least better than failing to compile the shader.

I think this is a pretty clear indication that app developers think
these macros are about as useful as the rest of us.

I think the rest of us are pretty useful. :)

Since we maintain line and "file" information for generating error messages, how hard would it be to just fix this?

Works around es3conform's silly preprocess2_frag and preprocess16_frag
tests.
---
  src/glsl/glcpp/README        |    4 ++--
  src/glsl/glcpp/glcpp-parse.y |    3 +++
  2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/glsl/glcpp/README b/src/glsl/glcpp/README
index 0b5ef50..592d073 100644
--- a/src/glsl/glcpp/README
+++ b/src/glsl/glcpp/README
@@ -25,8 +25,8 @@ and will not appear in the output.

  Known limitations
  -----------------
-The __LINE__ and __FILE__ macros are not yet supported.
+The __LINE__ and __FILE__ macros always evaluate to zero.

  A file that ends with a function-like macro name as the last
  non-whitespace token will result in a parse error, (where it should be
-passed through as is).
\ No newline at end of file
+passed through as is).
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index f62cbe4..e09de94 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1186,6 +1186,9 @@ glcpp_parser_create (const struct gl_extensions 
*extensions, int api)

        language_version = 110;
        add_builtin_define(parser, "__VERSION__", language_version);
+       /* FINISHME */
+       add_builtin_define(parser, "__FILE__", 0);
+       add_builtin_define(parser, "__LINE__", 0);

        return parser;
  }


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to