On 08/28/2013 11:45 AM, Ian Romanick wrote:
On 08/23/2013 11:46 AM, Kenneth Graunke wrote:
This is copy and pasted from glsl-1.50/compiler/version-macro.frag with
the version changed.

Since this is the first test for GLSL 3.30, this patch also hooks up the
directory so all.tests scans it for parsertests and shader runner tests.
---
  tests/all.tests                                  | 8 ++++++++
  tests/spec/glsl-3.30/compiler/version-macro.frag | 7 +++++++
  2 files changed, 15 insertions(+)
  create mode 100644 tests/spec/glsl-3.30/compiler/version-macro.frag

diff --git a/tests/all.tests b/tests/all.tests
index 0c67beb..af2f684 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -938,6 +938,14 @@ for draw in ['', 'indexed']:
                              ('arb_geometry_shader4-ignore-adjacent-vertices '
                               'core {0} {1}').format(draw, prim))

+spec['glsl-3.30'] = Group()
+import_glsl_parser_tests(spec['glsl-3.30'],
+                        os.path.join(testsDir, 'spec', 'glsl-3.30'),
+                        ['compiler'])
+add_shader_test_dir(spec['glsl-3.30'],
+                   os.path.join(testsDir, 'spec', 'glsl-3.30'),
+                   recursive=True)
+
  # Group spec/glsl-es-3.00
  spec['glsl-es-3.00'] = Group()
  import_glsl_parser_tests(spec['glsl-es-3.00'],
diff --git a/tests/spec/glsl-3.30/compiler/version-macro.frag 
b/tests/spec/glsl-3.30/compiler/version-macro.frag
new file mode 100644
index 0000000..d4107ce
--- /dev/null
+++ b/tests/spec/glsl-3.30/compiler/version-macro.frag
@@ -0,0 +1,7 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// [end config]
+
+#version 330
+int x[int(__VERSION__ == 330)];


Since the spec says __VERSION__ is a define, I feel like we should test
these like:

#if !defined __VERSION__
#error __VERSION__ not defined.
#endif
#if __VERSION__ != 330
#error __VERSION__ is not 330
#endif

void main() { ... }

Including main or some function is important because Apple's compiler is
dumb.

I suppose that also ensures that __VERSION__ is a #define, rather than say, a built-in const int variable.

I'll make some patches.

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to