Re: [Piglit] [Patch V3] Simplify piglit threading

2014-01-09 Thread Kenneth Graunke
On 01/09/2014 02:20 PM, Dylan Baker wrote:
> This patch simplifies threading in piglit by removing the hand-rolled
> threadpool, and instead using the Pool class from multiprocessing.dummy.
> This provides a map interface, allowing for very clear succinct code.
> 
> The previous implementation ran all tests out of thread pools, a serial
> pool and a multi-threaded pool. This patch does the same thing for a
> couple of reasons. First, the obvious solution is to use the map()
> builtin for serial tests. However, map in python3 returns an iterator
> instead of a list so calling map(f, x) will not actually run f(x) until
> something tries to use those values. This would require considerable
> restructuring to work around. Second, that could easily be split out
> into another patch, and limits the number of changes in this patch.
> 
> Multiproccessing.dummy is a wrapper around the Threading module,
> providing the multiproccessing API, but with threads instead of
> processes.
> 
> V2: - Renamed run() helper to test()
> - use multiprocessing.dummy.Pool() default thread count value, which
>   is equal to multiproccessing.cpu_count(), instead of cpu_count()
>   explicitly
> V3: - use Pool.imap() instead of Pool.map(), it is slightly faster.
> 
> Signed-off-by: Dylan Baker 
> ---
>  framework/core.py   | 54 +--
>  framework/threadpool.py | 67 
> -
>  2 files changed, 30 insertions(+), 91 deletions(-)
>  delete mode 100644 framework/threadpool.py
> 
> diff --git a/framework/core.py b/framework/core.py
> index 8bcda5b..4080c91 100644
> --- a/framework/core.py
> +++ b/framework/core.py
> @@ -36,14 +36,13 @@ from log import log
>  from cStringIO import StringIO
>  from textwrap import dedent
>  from threads import synchronized_self
> -import threading
>  import multiprocessing
> +import multiprocessing.dummy
>  try:
>  import simplejson as json
>  except ImportError:
>  import json
>  
> -from threadpool import ThreadPool
>  import status
>  
>  __all__ = ['Environment',
> @@ -566,31 +565,38 @@ class TestProfile:
>  
>  self.prepare_test_list(env)
>  
> -# If concurrency is set to 'all' run all tests out of a concurrent
> -# threadpool, if it's none, then run evey test serially. otherwise 
> mix
> -# and match them
> +def test(pair):
> +""" Function to call test.execute from .map
> +
> +adds env and json_writer which are needed by Test.execute()
> +
> +"""
> +name, test = pair
> +test.execute(env, name, json_writer)
> +
> +# Multiprocessing.dummy is a wrapper around Threading that provides a
> +# multiprocessing compatible API
> +#
> +# The default value of pool is the number of virtual processor cores
> +single = multiprocessing.dummy.Pool(1)
> +multi = multiprocessing.dummy.Pool()
> +chunksize = 50
> +
>  if env.concurrent == "all":
> -pool = ThreadPool(multiprocessing.cpu_count())
> -for (path, test) in self.test_list.items():
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> +multi.imap(test, self.test_list.iteritems(), chunksize)
>  elif env.concurrent == "none":
> -pool = ThreadPool(1)
> -for (path, test) in self.test_list.items():
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> +single.imap(test, self.test_list.iteritems(), chunksize)
>  else:
> -pool = ThreadPool(multiprocessing.cpu_count())
> -for (path, test) in self.test_list.items():
> -if test.runConcurrent:
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> -
> -pool = ThreadPool(1)
> -for (path, test) in self.test_list.items():
> -if not test.runConcurrent:
> -pool.add(test.execute, (env, path, json_writer))
> -pool.join()
> +# Filter and return only thread safe tests to the threaded pool
> +multi.imap(test, (x for x in self.test_list.iteritems() if
> +  x[1].runConcurrent), chunksize)
> +# Filter and return the non thread safe tests to the single pool
> +single.imap(test, (x for x in self.test_list.iteritems() if not
> +   x[1].runConcurrent), chunksize)
> +
> +# Close and join the pools
> +map(lambda x: x.close(), [multi, single])
> +map(lambda x: x.join(), [multi, single])

I think this would be clearer as:

for pool in [multi, single]:
pool.close()
pool.join()

or:
multi.close()
single.close()
multi.join()
single.join()

With that change, v4 would be:
Reviewed-by: Kenneth Graunke 

>  
>  def remove_test(se

Re: [Piglit] [Patch V2] Simplify piglit threading

2014-01-09 Thread Kenneth Graunke
On 01/08/2014 03:49 PM, Dylan Baker wrote:
> This patch simplifies threading in piglit by removing the hand-rolled
> threadpool, and instead using the Pool class from multiprocessing.dummy.
> This provides a map interface, allowing for very clear succinct code.
> 
> The previous implementation ran all tests out of thread pools, a serial
> pool and a multi-threaded pool. This patch does the same thing for a
> couple of reasons. First, the obvious solution is to use the map()
> builtin for serial tests. However, map in python3 returns an iterator
> instead of a list so calling map(f, x) will not actually run f(x) until
> something tries to use those values. This would require considerable
> restructuring to work around. Second, that could easily be split out
> into another patch, and limits the number of changes in this patch.
> 
> Multiproccessing.dummy is a wrapper around the Threading module,
> providing the multiproccessing API, but with threads instead of
> processes.
> 
> V2: - Renamed run() helper to test()
> - use multiprocessing.dummy.Pool() default thread count value, which
>   is equal to multiproccessing.cpu_count(), instead of cpu_count()
>   explicitly

Reviewed-by: Kenneth Graunke 

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Add test to verify interpolation at sample position

2014-01-09 Thread Anuj Phogat
ARB_sample_shading extension says:
 "When the sample shading fraction is 1.0, a separate set of colors
  and other associated data are evaluated for each sample, each set
  of values are evaluated at the sample location."

Test passes on intel hardware with mesa patch: 'i965: Use sample
barycentric coordinates with per sample shading'.

Signed-off-by: Anuj Phogat 
Cc: Chris Forbes 
---
Thanks Chris for pointing to a reference test which I used to create
this test.

 tests/all.tests|   5 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt |   1 +
 .../execution/interpolate-at-sample-position.cpp   | 192 +
 3 files changed, 198 insertions(+)
 create mode 100644 
tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp

diff --git a/tests/all.tests b/tests/all.tests
index 29d012b..d7a2393 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1440,6 +1440,11 @@ for num_samples in TEST_SAMPLE_COUNTS:
 executable = 'arb_sample_shading-{0} -auto'.format(test_name)
 arb_sample_shading[test_name] = PlainExecTest(executable)
 
+for num_samples in MSAA_SAMPLE_COUNTS:
+test_name = 'interpolate-at-sample-position {0}'.format(num_samples)
+executable = 'arb_sample_shading-{0} -auto'.format(test_name)
+arb_sample_shading[test_name] = PlainExecTest(executable)
+
 import_glsl_parser_tests(spec['ARB_sample_shading'],
  os.path.join(testsDir, 'spec', 'arb_sample_shading'),
  ['compiler'])
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
index a832189..9a72439 100644
--- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -15,4 +15,5 @@ piglit_add_executable 
(arb_sample_shading-builtin-gl-num-samples builtin-gl-num-
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-id 
builtin-gl-sample-id.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask 
builtin-gl-sample-mask.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-position 
builtin-gl-sample-position.cpp)
+piglit_add_executable (arb_sample_shading-interpolate-at-sample-position 
interpolate-at-sample-position.cpp)
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp 
b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
new file mode 100644
index 000..253aa08
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * @file interpolate-at-sample-position.cpp
+ *
+ * Tests that 'in' variables in fragment shader are interpolated at sample
+ * positions when using per sample shading.
+ *
+ */
+#include "piglit-util-gl-common.h"
+#include "piglit-fbo.h"
+
+using namespace piglit_util_fbo;
+const int pattern_width = 128; const int pattern_height = 128;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 21;
+   config.supports_gl_core_version = 31;
+config.window_width = 2 * pattern_width;
+config.window_height = pattern_height;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static piglit_fbo multisampled_fbo;
+static int sample_pos_loc, sample_id_loc, num_samples;
+static int draw_prog_left, draw_prog_right, test_prog;
+
+enum piglit_result
+piglit_display(void)
+{
+   float pos[2];
+   bool result = true, pass = true;
+
+   glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisampled_fbo.handle);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   /* Draw test image in to left half of multisample fbo*/
+   glUseProgram(draw_prog_

[Piglit] [Patch V3] Simplify piglit threading

2014-01-09 Thread Dylan Baker
This patch simplifies threading in piglit by removing the hand-rolled
threadpool, and instead using the Pool class from multiprocessing.dummy.
This provides a map interface, allowing for very clear succinct code.

The previous implementation ran all tests out of thread pools, a serial
pool and a multi-threaded pool. This patch does the same thing for a
couple of reasons. First, the obvious solution is to use the map()
builtin for serial tests. However, map in python3 returns an iterator
instead of a list so calling map(f, x) will not actually run f(x) until
something tries to use those values. This would require considerable
restructuring to work around. Second, that could easily be split out
into another patch, and limits the number of changes in this patch.

Multiproccessing.dummy is a wrapper around the Threading module,
providing the multiproccessing API, but with threads instead of
processes.

V2: - Renamed run() helper to test()
- use multiprocessing.dummy.Pool() default thread count value, which
  is equal to multiproccessing.cpu_count(), instead of cpu_count()
  explicitly
V3: - use Pool.imap() instead of Pool.map(), it is slightly faster.

Signed-off-by: Dylan Baker 
---
 framework/core.py   | 54 +--
 framework/threadpool.py | 67 -
 2 files changed, 30 insertions(+), 91 deletions(-)
 delete mode 100644 framework/threadpool.py

diff --git a/framework/core.py b/framework/core.py
index 8bcda5b..4080c91 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -36,14 +36,13 @@ from log import log
 from cStringIO import StringIO
 from textwrap import dedent
 from threads import synchronized_self
-import threading
 import multiprocessing
+import multiprocessing.dummy
 try:
 import simplejson as json
 except ImportError:
 import json
 
-from threadpool import ThreadPool
 import status
 
 __all__ = ['Environment',
@@ -566,31 +565,38 @@ class TestProfile:
 
 self.prepare_test_list(env)
 
-# If concurrency is set to 'all' run all tests out of a concurrent
-# threadpool, if it's none, then run evey test serially. otherwise mix
-# and match them
+def test(pair):
+""" Function to call test.execute from .map
+
+adds env and json_writer which are needed by Test.execute()
+
+"""
+name, test = pair
+test.execute(env, name, json_writer)
+
+# Multiprocessing.dummy is a wrapper around Threading that provides a
+# multiprocessing compatible API
+#
+# The default value of pool is the number of virtual processor cores
+single = multiprocessing.dummy.Pool(1)
+multi = multiprocessing.dummy.Pool()
+chunksize = 50
+
 if env.concurrent == "all":
-pool = ThreadPool(multiprocessing.cpu_count())
-for (path, test) in self.test_list.items():
-pool.add(test.execute, (env, path, json_writer))
-pool.join()
+multi.imap(test, self.test_list.iteritems(), chunksize)
 elif env.concurrent == "none":
-pool = ThreadPool(1)
-for (path, test) in self.test_list.items():
-pool.add(test.execute, (env, path, json_writer))
-pool.join()
+single.imap(test, self.test_list.iteritems(), chunksize)
 else:
-pool = ThreadPool(multiprocessing.cpu_count())
-for (path, test) in self.test_list.items():
-if test.runConcurrent:
-pool.add(test.execute, (env, path, json_writer))
-pool.join()
-
-pool = ThreadPool(1)
-for (path, test) in self.test_list.items():
-if not test.runConcurrent:
-pool.add(test.execute, (env, path, json_writer))
-pool.join()
+# Filter and return only thread safe tests to the threaded pool
+multi.imap(test, (x for x in self.test_list.iteritems() if
+  x[1].runConcurrent), chunksize)
+# Filter and return the non thread safe tests to the single pool
+single.imap(test, (x for x in self.test_list.iteritems() if not
+   x[1].runConcurrent), chunksize)
+
+# Close and join the pools
+map(lambda x: x.close(), [multi, single])
+map(lambda x: x.join(), [multi, single])
 
 def remove_test(self, test_path):
 """Remove a fully qualified test from the profile.
diff --git a/framework/threadpool.py b/framework/threadpool.py
deleted file mode 100644
index 5d1fc56..000
--- a/framework/threadpool.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright (c) 2013 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction,

[Piglit] [PATCH] log: Replace console output with a simpler output

2014-01-09 Thread Dylan Baker
This replaces the console spewer with a simpler console reporting
mechanism inspired by the output of ninja. This reduces code, remove all
singleton instances and speeds up piglit runs. There is a drawback, the
output is much more terse than the previous implementation, giving only
the following output:
[/] Running Test(s): 
[16008/16011] Running Test(s): 16007 16008 16009 16010

This means that one can't look at the output to readily see that all
tests are skipping or failing. However, since these problems are usually
related to environment setup, and not to piglit doing something wrong,
these should be moved to some kind of prerun check instead of relying on
user attentiveness. Since the test numbers update only when they are
completed and hung test can be spotted.

Performance examples:
Master:
./piglit-run.py -c tets/quick.tests foo 1065.64s user 373.48s system
295% cpu 8:06.35 total

With this patch:
./piglit-run.py -c tests/quick.tests foo  1045.33s user 353.20s system
315% cpu 7:23.56 total

Signed-off-by: Dylan Baker 
---
 framework/core.py | 23 +++--
 framework/log.py  | 78 +---
 framework/patterns.py | 90 ---
 3 files changed, 63 insertions(+), 128 deletions(-)
 delete mode 100644 framework/patterns.py

diff --git a/framework/core.py b/framework/core.py
index 8bcda5b..aa89584 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -32,7 +32,7 @@ import string
 import sys
 import time
 import traceback
-from log import log
+from log import Log
 from cStringIO import StringIO
 from textwrap import dedent
 from threads import synchronized_self
@@ -464,7 +464,7 @@ class Test:
 def run(self):
 raise NotImplementedError
 
-def execute(self, env, path, json_writer):
+def execute(self, env, path, log, json_writer):
 '''
 Run the test.
 
@@ -472,13 +472,12 @@ class Test:
 Fully qualified test name as a string.  For example,
 ``spec/glsl-1.30/preprocessor/compiler/keywords/void.frag``.
 '''
-def status(msg):
-log(msg=msg, channel=path)
 
+log_current = log.get_current()
 # Run the test
 if env.execute:
 try:
-status("running")
+log.log()
 time_start = time.time()
 result = self.run(env)
 time_end = time.time()
@@ -499,8 +498,6 @@ class Test:
 result['traceback'] = \
 "".join(traceback.format_tb(sys.exc_info()[2]))
 
-status(result['result'])
-
 if 'subtest' in result and len(result['subtest'].keys()) > 1:
 for test in result['subtest'].keys():
 result['result'] = result['subtest'][test]
@@ -508,7 +505,8 @@ class Test:
 else:
 json_writer.write_dict_item(path, result)
 else:
-status("dry-run")
+log.log()
+log.mark_complete(log_current)
 
 
 class Group(dict):
@@ -565,6 +563,7 @@ class TestProfile:
 '''
 
 self.prepare_test_list(env)
+log = Log(len(self.test_list))
 
 # If concurrency is set to 'all' run all tests out of a concurrent
 # threadpool, if it's none, then run evey test serially. otherwise mix
@@ -572,24 +571,24 @@ class TestProfile:
 if env.concurrent == "all":
 pool = ThreadPool(multiprocessing.cpu_count())
 for (path, test) in self.test_list.items():
-pool.add(test.execute, (env, path, json_writer))
+pool.add(test.execute, (env, path, log, json_writer))
 pool.join()
 elif env.concurrent == "none":
 pool = ThreadPool(1)
 for (path, test) in self.test_list.items():
-pool.add(test.execute, (env, path, json_writer))
+pool.add(test.execute, (env, path, log, json_writer))
 pool.join()
 else:
 pool = ThreadPool(multiprocessing.cpu_count())
 for (path, test) in self.test_list.items():
 if test.runConcurrent:
-pool.add(test.execute, (env, path, json_writer))
+pool.add(test.execute, (env, path, log, json_writer))
 pool.join()
 
 pool = ThreadPool(1)
 for (path, test) in self.test_list.items():
 if not test.runConcurrent:
-pool.add(test.execute, (env, path, json_writer))
+pool.add(test.execute, (env, path, log, json_writer))
 pool.join()
 
 def remove_test(self, test_path):
diff --git a/framework/log.py b/framework/log.py
index 310c552..167e4ea 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -1,5 +1,4 @@
-#
-# Copyright (c) 2010 Intel Corporation
+# Copyright (c) 2013 Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person o

[Piglit] [PATCH 04/12] Test compilation rules related to compute shader layout qualifiers.

2014-01-09 Thread Paul Berry
---
 .../compiler/default_local_size.comp   | 39 ++
 .../compiler/mismatched_local_size.comp| 21 
 .../compiler/negative_local_size.comp  | 26 +++
 .../compiler/zero_local_size.comp  | 26 +++
 4 files changed, 112 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/compiler/default_local_size.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/negative_local_size.comp
 create mode 100644 tests/spec/arb_compute_shader/compiler/zero_local_size.comp

diff --git a/tests/spec/arb_compute_shader/compiler/default_local_size.comp 
b/tests/spec/arb_compute_shader/compiler/default_local_size.comp
new file mode 100644
index 000..81fb6e3
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/default_local_size.comp
@@ -0,0 +1,39 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+// Layout qualifier identifiers for compute shader inputs are the 
work-group 
+// size qualifiers:
+//
+// layout-qualifier-id
+// local_size_x = integer-constant
+// local_size_y = integer-constant
+// local_size_z = integer-constant
+//
+// , , and  are used to define 
the
+// local size of the kernel defined by the compute shader in the first,
+// second, and third dimension, respectively. The default size in each
+// dimension is 1. If a shader does not specify a size for one of the
+// dimensions, that dimension will have a size of 1.
+//
+// This test verifies that unspecified local_size dimensions default
+// to 1, by taking advantage of the fact that conflicting layouts will
+// cause a compiler error.
+
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+// All 3 of the following layouts should be equivalent, since
+// unspecified sizes default to 1.
+layout(local_size_x = 1) in;
+layout(local_size_y = 1) in;
+layout(local_size_z = 1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp 
b/tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp
new file mode 100644
index 000..6f83a32
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/mismatched_local_size.comp
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+// [If an input layout qualifier] is declared more than once in
+// the same shader, all those declarations must indicate the same
+// local work-group size; otherwise a compile-time error results.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 2) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/negative_local_size.comp 
b/tests/spec/arb_compute_shader/compiler/negative_local_size.comp
new file mode 100644
index 000..0a84019
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/negative_local_size.comp
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+// , , and  are used to
+// define the local size of the kernel defined by the compute
+// shader in the first, second, and third dimension,
+// respectively. The default size in each dimension is 1. If a
+// shader does not specify a size for one of the dimensions, that
+// dimension will have a size of 1.
+//
+// Although it's not explicitly stated, it seems reasonable to assume
+// that a local size less than 0 is prohibited.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_y = -1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/zero_local_size.comp 
b/tests/spec/arb_compute_shader/compiler/zero_local_size.comp
new file mode 100644
index 000..fbadf3e
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/zero_local_size.comp
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+// , , and  are used to
+// define the local size of the kernel defined by the compute
+// shader in the first, second, and third dimension,
+// respectively. The default size in each dimension is 1. If a
+// shader does not specify a size for one of the dimensions, that
+// dimension will have a size of 1.
+//
+// Although it's not explicitly stated, it seems reasonable to assume
+// that a local size of 0 is proh

[Piglit] [PATCH 00/12] Initial batch of compute shader tests.

2014-01-09 Thread Paul Berry
These tests exercise some very basic pieces of compute shader
functionality, such as minimum maximums, compute shader layout
qualifiers, a few built-in GLSL constants, and the fact that in/out
variables are not allowed in compute shaders.

None of the tests actually runs a compute shader; I plan to do that in
future patch series.

[PATCH 01/12] glapi: Rename ARB_compute_shader "LOCAL" -> "WORK_GROUP".
[PATCH 02/12] util: Add ARB_compute_shader support to piglit_get_gl_enum_name().
[PATCH 03/12] Add minmax test for ARB_compute_shader.
[PATCH 04/12] Test compilation rules related to compute shader layout 
qualifiers.
[PATCH 05/12] Test that compute shader work group sizes are properly bounds 
checked.
[PATCH 06/12] Test ARB_compute_shader built-in constant gl_WorkGroupSize.
[PATCH 07/12] Test ARB_compute_shader built-in constant 
gl_MaxComputeWorkGroupCount.
[PATCH 08/12] Test ARB_compute_shader built-in constant 
gl_MaxComputeWorkGroupSize.
[PATCH 09/12] Test that compute shaders may not have user-defined ins/outs.
[PATCH 10/12] shader_runner: Add support for compute shaders.
[PATCH 11/12] Linker tests for compute shaders: local work sizes.
[PATCH 12/12] Test API errors for compute shaders related to 
COMPUTE_WORK_GROUP_SIZE query.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 02/12] util: Add ARB_compute_shader support to piglit_get_gl_enum_name().

2014-01-09 Thread Paul Berry
---
 tests/util/piglit-util-gl-enum.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/tests/util/piglit-util-gl-enum.c b/tests/util/piglit-util-gl-enum.c
index 8769f4d..8deb58f 100644
--- a/tests/util/piglit-util-gl-enum.c
+++ b/tests/util/piglit-util-gl-enum.c
@@ -997,6 +997,12 @@ piglit_get_gl_enum_name(GLenum param)
CASE(GL_VIEWPORT_INDEX_PROVOKING_VERTEX)// 0x825F
CASE(GL_UNDEFINED_VERTEX)   // 0x8260
CASE(GL_NO_RESET_NOTIFICATION_ARB)  // 0x8261
+   CASE(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE) // 0x8262
+   CASE(GL_MAX_COMPUTE_UNIFORM_COMPONENTS) // 0x8263
+   CASE(GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS) // 0x8264
+   CASE(GL_MAX_COMPUTE_ATOMIC_COUNTERS)// 0x8265
+   CASE(GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS)// 0x8266
+   CASE(GL_COMPUTE_WORK_GROUP_SIZE)// 0x8267
//CASE(GL_DEPTH_PASS_INSTRUMENT_SGIX)   // 0x8310
//CASE(GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX)  // 0x8311
//CASE(GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX)   // 0x8312
@@ -2875,6 +2881,11 @@ piglit_get_gl_enum_name(GLenum param)
CASE(GL_MAX_FRAGMENT_IMAGE_UNIFORMS)// 0x90CE
CASE(GL_MAX_COMBINED_IMAGE_UNIFORMS)// 0x90CF
CASE(GL_SYNC_X11_FENCE_EXT) // 0x90E1
+   CASE(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS) // 0x90EB
+   CASE(GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER) // 0x90EC
+   CASE(GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER) // 
0x90ED
+   CASE(GL_DISPATCH_INDIRECT_BUFFER)   // 0x90EE
+   CASE(GL_DISPATCH_INDIRECT_BUFFER_BINDING)   // 0x90EF
CASE(GL_TEXTURE_2D_MULTISAMPLE) // 0x9100
CASE(GL_PROXY_TEXTURE_2D_MULTISAMPLE)   // 0x9101
CASE(GL_TEXTURE_2D_MULTISAMPLE_ARRAY)   // 0x9102
@@ -2946,6 +2957,12 @@ piglit_get_gl_enum_name(GLenum param)
CASE(GL_QUERY_OBJECT_AMD)   // 0x9153
CASE(GL_VERTEX_ARRAY_OBJECT_AMD)// 0x9154
CASE(GL_SAMPLER_OBJECT_AMD) // 0x9155
+   CASE(GL_COMPUTE_SHADER) // 0x91B9
+   CASE(GL_MAX_COMPUTE_UNIFORM_BLOCKS) // 0x91BB
+   CASE(GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS)// 0x91BC
+   CASE(GL_MAX_COMPUTE_IMAGE_UNIFORMS) // 0x91BD
+   CASE(GL_MAX_COMPUTE_WORK_GROUP_COUNT)   // 0x91BE
+   CASE(GL_MAX_COMPUTE_WORK_GROUP_SIZE)// 0x91BF
//CASE(GL_SHADER_BINARY_DMP)# 0x9250
CASE(GL_ATOMIC_COUNTER_BUFFER)  // 0x92C0
CASE(GL_ATOMIC_COUNTER_BUFFER_BINDING)  // 0x92C1
-- 
1.8.5.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 12/12] Test API errors for compute shaders related to COMPUTE_WORK_GROUP_SIZE query.

2014-01-09 Thread Paul Berry
This test can be expanded in the future to check for other compute
shader API errors.
---
 tests/all.tests |   1 +
 tests/spec/arb_compute_shader/CMakeLists.gl.txt |   1 +
 tests/spec/arb_compute_shader/api_errors.c  | 211 
 3 files changed, 213 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/api_errors.c

diff --git a/tests/all.tests b/tests/all.tests
index 5bb0ed5..8999643 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2783,6 +2783,7 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'],
 
 arb_compute_shader = Group()
 spec['ARB_compute_shader'] = arb_compute_shader
+arb_compute_shader['api_errors'] = 
concurrent_test('arb_compute_shader-api_errors')
 arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax')
 arb_compute_shader['compiler/work_group_size_too_large'] = \
 concurrent_test('arb_compute_shader-work_group_size_too_large')
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index b79cbf9..9202761 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
${OPENGL_glu_LIBRARY}
 )
 
+add_executable (arb_compute_shader-api_errors api_errors.c)
 add_executable (arb_compute_shader-minmax minmax.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/api_errors.c 
b/tests/spec/arb_compute_shader/api_errors.c
new file mode 100644
index 000..e069750
--- /dev/null
+++ b/tests/spec/arb_compute_shader/api_errors.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** \file
+ *
+ * Test cases in which the ARB_compute_shader API is expected to
+ * generate an error.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "piglit-shader.h"
+
+
+static struct piglit_gl_test_config *piglit_config;
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   piglit_config = &config;
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const char *trivial_correct_shader =
+   "#version 330\n"
+   "#extension GL_ARB_compute_shader: enable\n"
+   "\n"
+   "layout(local_size_x = 1) in;\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "}\n";
+
+
+static const char *trivial_link_fail_shader =
+   "#version 330\n"
+   "#extension GL_ARB_compute_shader: enable\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "}\n";
+
+
+static const char *trivial_vertex_shader =
+   "#version 330\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "  gl_Position = vec4(0.0);\n"
+   "}\n";
+
+
+static enum piglit_result
+query_work_group_size_expect_error(GLint prog)
+{
+   const GLint orig_query_result[3] = { 1234, 2345, 3456 };
+   GLint query_result[3];
+   int i;
+
+   for (i = 0; i < 3; i++)
+   query_result[i] = orig_query_result[i];
+
+   glGetProgramiv(prog, GL_COMPUTE_WORK_GROUP_SIZE, query_result);
+
+   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+   return PIGLIT_FAIL;
+   for (i = 0; i < 3; i++) {
+   if (query_result[i] != orig_query_result[i]) {
+   printf("Error was generated, but query returned a "
+  "result anyway.");
+   return PIGLIT_FAIL;
+   }
+   }
+   return PIGLIT_PASS;
+}
+
+
+static enum piglit_result
+query_work_group_size_unlinked(void *data)
+{
+   /* From the ARB_compute_shader spec, in the description of the
+* COMPUTE_WORK_GROUP_SIZE query:
+*
+* If  is the name of a program that has not been
+* successfully linked, or is the name of a linked program
+* object that co

[Piglit] [PATCH 11/12] Linker tests for compute shaders: local work sizes.

2014-01-09 Thread Paul Berry
These tests verify the linker rules for local work sizes (they must be
specified in at least one shader, and they must not conflict).
---
 tests/all.tests|  3 ++
 .../linker/matched_local_work_sizes.shader_test| 42 +
 .../linker/mismatched_local_work_sizes.shader_test | 43 ++
 .../linker/mix_compute_and_non_compute.shader_test | 32 
 .../linker/no_local_work_size.shader_test  | 28 ++
 .../linker/one_local_work_size.shader_test | 41 +
 6 files changed, 189 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test
 create mode 100644 
tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test
 create mode 100644 
tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
 create mode 100644 
tests/spec/arb_compute_shader/linker/no_local_work_size.shader_test
 create mode 100644 
tests/spec/arb_compute_shader/linker/one_local_work_size.shader_test

diff --git a/tests/all.tests b/tests/all.tests
index eb2faf0..5bb0ed5 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2786,6 +2786,9 @@ spec['ARB_compute_shader'] = arb_compute_shader
 arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax')
 arb_compute_shader['compiler/work_group_size_too_large'] = \
 concurrent_test('arb_compute_shader-work_group_size_too_large')
+add_shader_test_dir(spec['ARB_compute_shader'],
+os.path.join(testsDir, 'spec', 'arb_compute_shader'),
+recursive=True)
 import_glsl_parser_tests(spec['ARB_compute_shader'],
  os.path.join(testsDir, 'spec', 'arb_compute_shader'),
  ['compiler'])
diff --git 
a/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test 
b/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test
new file mode 100644
index 000..67e850c
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/matched_local_work_sizes.shader_test
@@ -0,0 +1,42 @@
+# From the ARB_compute_shader spec, in the section describing local
+# size declarations:
+#
+# If multiple compute shaders attached to a single program object
+# declare local work-group size, the declarations must be
+# identical; otherwise a link-time error results. Furthermore, if
+# a program object contains any compute shaders, at least one must
+# contain an input layout qualifier specifying the local work
+# sizes of the program, or a link-time error will occur.
+#
+# In this test, we link two shaders that have the same local work size.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo();
+
+void main()
+{
+   foo();
+}
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo()
+{
+}
+
+[test]
+link success
diff --git 
a/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test 
b/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test
new file mode 100644
index 000..e4872e1
--- /dev/null
+++ 
b/tests/spec/arb_compute_shader/linker/mismatched_local_work_sizes.shader_test
@@ -0,0 +1,43 @@
+# From the ARB_compute_shader spec, in the section describing local
+# size declarations:
+#
+# If multiple compute shaders attached to a single program object
+# declare local work-group size, the declarations must be
+# identical; otherwise a link-time error results. Furthermore, if
+# a program object contains any compute shaders, at least one must
+# contain an input layout qualifier specifying the local work
+# sizes of the program, or a link-time error will occur.
+#
+# In this test, we try to link two shaders that have different local
+# work sizes.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 2) in;
+
+void foo();
+
+void main()
+{
+   foo();
+}
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_y = 2) in;
+
+void foo()
+{
+}
+
+[test]
+link error
diff --git 
a/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test 
b/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
new file mode 100644
index 000..603cbe7
--- /dev/null
+++ 
b/tests/spec/arb_compute_shader/linker/mix_compute_and_non_compute.shader_test
@@ -0,0 +1,32 @@
+# From the ARB_compute_shader spec:
+#
+# In section 2.11.3, "Program Objects", add to the reasons that LinkProgram
+# may fail, p. 61:
+#
+# * The program object contains objects to form a compute shader (see
+#   section 5.5) and objects to form any other type of

[Piglit] [PATCH 08/12] Test ARB_compute_shader built-in constant gl_MaxComputeWorkGroupSize.

2014-01-09 Thread Paul Berry
---
 .../compiler/gl_MaxComputeWorkGroupSize.comp | 20 
 1 file changed, 20 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp

diff --git 
a/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp 
b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp
new file mode 100644
index 000..8291dd8
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupSize.comp
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// Test the minimum values for gl_MaxComputeWorkGroupSize specified in
+// ARB_compute_shader.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+  int x[gl_MaxComputeWorkGroupSize.x >= 1024 ? 1 : -1];
+  int y[gl_MaxComputeWorkGroupSize.y >= 1024 ? 1 : -1];
+  int z[gl_MaxComputeWorkGroupSize.z >= 64 ? 1 : -1];
+}
-- 
1.8.5.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 06/12] Test ARB_compute_shader built-in constant gl_WorkGroupSize.

2014-01-09 Thread Paul Berry
---
 .../compiler/gl_WorkGroupSize_before_layout.comp   | 22 
 .../compiler/gl_WorkGroupSize_matches_layout.comp  | 29 ++
 .../compiler/gl_WorkGroupSize_without_layout.comp  | 18 ++
 3 files changed, 69 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp

diff --git 
a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp 
b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp
new file mode 100644
index 000..23324e3
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_before_layout.comp
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables):
+//
+// It is a compile-time error to use gl_WorkGroupSize in a shader
+// that does not declare a fixed local group size, or before that
+// shader has declared a fixed local group size, using
+// local_size_x, local_size_y, and local_size_z.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+void main()
+{
+  ivec3 size = gl_WorkGroupSize;
+}
+
+layout(local_size_x = 3, local_size_y = 5, local_size_z = 7) in;
diff --git 
a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp 
b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp
new file mode 100644
index 000..094bcd9
--- /dev/null
+++ 
b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_matches_layout.comp
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables):
+//
+// The built-in constant gl_WorkGroupSize is a compute-shader
+// constant containing the local work-group size of the
+// shader. The size of the work group in the X, Y, and Z
+// dimensions is stored in the x, y, and z components. The
+// constants values in gl_WorkGroupSize will match those specified
+// in the required local_size_x, local_size_y, and local_size_z
+// layout qualifiers for the current shader. This is a constant so
+// that it can be used to size arrays of memory that can be shared
+// within the local work group.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 3, local_size_y = 5, local_size_z = 7) in;
+
+void main()
+{
+  int x[gl_WorkGroupSize.x == 3 ? 1 : -1];
+  int y[gl_WorkGroupSize.y == 5 ? 1 : -1];
+  int z[gl_WorkGroupSize.z == 7 ? 1 : -1];
+}
diff --git 
a/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp 
b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp
new file mode 100644
index 000..cec8c45
--- /dev/null
+++ 
b/tests/spec/arb_compute_shader/compiler/gl_WorkGroupSize_without_layout.comp
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the GLSL 4.4 spec, section 7.1 (Built-in Language Variables):
+//
+// It is a compile-time error to use gl_WorkGroupSize in a shader
+// that does not declare a fixed local group size ...
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+void main()
+{
+  ivec3 size = gl_WorkGroupSize;
+}
-- 
1.8.5.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 09/12] Test that compute shaders may not have user-defined ins/outs.

2014-01-09 Thread Paul Berry
---
 .../compiler/no_user_defined_in.comp   | 21 +
 .../compiler/no_user_defined_out.comp  | 22 ++
 2 files changed, 43 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp

diff --git a/tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp 
b/tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp
new file mode 100644
index 000..1d1d160
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/no_user_defined_in.comp
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+// Compute shaders do not permit user-defined input variables and
+// do not form a formal interface with any other shader stage.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+in int i;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp 
b/tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp
new file mode 100644
index 000..5b01be0
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/no_user_defined_out.comp
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// From the ARB_compute_shader spec:
+//
+// Compute shaders have no built-in output variables, do not
+// support user-defined output variables and do not form a formal
+// interface with any other shader stage.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+out int i;
+
+void main()
+{
+}
-- 
1.8.5.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 07/12] Test ARB_compute_shader built-in constant gl_MaxComputeWorkGroupCount.

2014-01-09 Thread Paul Berry
---
 .../compiler/gl_MaxComputeWorkGroupCount.comp| 20 
 1 file changed, 20 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp

diff --git 
a/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp 
b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp
new file mode 100644
index 000..f8da3e2
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/gl_MaxComputeWorkGroupCount.comp
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+//
+// Test the minimum values for gl_MaxComputeWorkGroupCount specified
+// in ARB_compute_shader.
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+  int x[gl_MaxComputeWorkGroupCount.x >= 65535 ? 1 : -1];
+  int y[gl_MaxComputeWorkGroupCount.y >= 65535 ? 1 : -1];
+  int z[gl_MaxComputeWorkGroupCount.z >= 65535 ? 1 : -1];
+}
-- 
1.8.5.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 05/12] Test that compute shader work group sizes are properly bounds checked.

2014-01-09 Thread Paul Berry
---
 tests/all.tests|   2 +
 tests/spec/arb_compute_shader/CMakeLists.txt   |   1 +
 .../arb_compute_shader/compiler/CMakeLists.gl.txt  |  15 ++
 .../arb_compute_shader/compiler/CMakeLists.txt |   1 +
 .../compiler/work_group_size_too_large.c   | 180 +
 5 files changed, 199 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_compute_shader/compiler/CMakeLists.txt
 create mode 100644 
tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c

diff --git a/tests/all.tests b/tests/all.tests
index 91a9450..eb2faf0 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2784,6 +2784,8 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'],
 arb_compute_shader = Group()
 spec['ARB_compute_shader'] = arb_compute_shader
 arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax')
+arb_compute_shader['compiler/work_group_size_too_large'] = \
+concurrent_test('arb_compute_shader-work_group_size_too_large')
 import_glsl_parser_tests(spec['ARB_compute_shader'],
  os.path.join(testsDir, 'spec', 'arb_compute_shader'),
  ['compiler'])
diff --git a/tests/spec/arb_compute_shader/CMakeLists.txt 
b/tests/spec/arb_compute_shader/CMakeLists.txt
index 144a306..16df30d 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.txt
@@ -1 +1,2 @@
+add_subdirectory (compiler)
 piglit_include_target_api()
diff --git a/tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt
new file mode 100644
index 000..f96a656
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/CMakeLists.gl.txt
@@ -0,0 +1,15 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+add_executable (arb_compute_shader-work_group_size_too_large 
work_group_size_too_large.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/compiler/CMakeLists.txt 
b/tests/spec/arb_compute_shader/compiler/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c 
b/tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c
new file mode 100644
index 000..44052b6
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/work_group_size_too_large.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** \file
+ *
+ * Test that exceeding the implementation's size work group size
+ * limits results in a compile error.
+ *
+ * From the ARB_compute_shader specification:
+ *
+ * If the local size of the shader in any dimension is greater
+ * than the maximum size supported by the implementation for that
+ * dimension, a compile-time error results.
+ *
+ * It is not clear from the spec how the error should be reported if
+ * the total size of the work group exceeds
+ * MAX_COMPUTE_WORK_GROUP_INVOCATIONS, but it seems reasonable to
+ * assume that this is reported at compile time as well.
+ */
+
+#include "piglit-util-gl-common.h"
+#include 
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+
+enum piglit_result
+piglit_display(void)
+{
+   /* UNREACHED */
+   return PIGLIT_FAIL;
+}
+
+
+static const char *cs_template =
+   "#version 330\n"
+   "#extension GL_ARB_compute_shader:

[Piglit] [PATCH 03/12] Add minmax test for ARB_compute_shader.

2014-01-09 Thread Paul Berry
---
 tests/all.tests |  1 +
 tests/spec/CMakeLists.txt   |  1 +
 tests/spec/arb_compute_shader/CMakeLists.gl.txt | 15 ++
 tests/spec/arb_compute_shader/CMakeLists.txt|  1 +
 tests/spec/arb_compute_shader/minmax.c  | 71 +
 tests/util/minmax-test.c| 24 +
 tests/util/minmax-test.h|  2 +
 7 files changed, 115 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_compute_shader/CMakeLists.txt
 create mode 100644 tests/spec/arb_compute_shader/minmax.c

diff --git a/tests/all.tests b/tests/all.tests
index 29d012b..91a9450 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2783,6 +2783,7 @@ import_glsl_parser_tests(spec['ARB_geometry_shader4'],
 
 arb_compute_shader = Group()
 spec['ARB_compute_shader'] = arb_compute_shader
+arb_compute_shader['minmax'] = concurrent_test('arb_compute_shader-minmax')
 import_glsl_parser_tests(spec['ARB_compute_shader'],
  os.path.join(testsDir, 'spec', 'arb_compute_shader'),
  ['compiler'])
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 7f6bf47..d49872a 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_subdirectory (amd_performance_monitor)
 add_subdirectory (arb_base_instance)
 add_subdirectory (arb_color_buffer_float)
+add_subdirectory (arb_compute_shader)
 add_subdirectory (arb_debug_output)
 add_subdirectory (khr_debug)
 add_subdirectory (arb_depth_clamp)
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
new file mode 100644
index 000..b79cbf9
--- /dev/null
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -0,0 +1,15 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+add_executable (arb_compute_shader-minmax minmax.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/CMakeLists.txt 
b/tests/spec/arb_compute_shader/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_compute_shader/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_compute_shader/minmax.c 
b/tests/spec/arb_compute_shader/minmax.c
new file mode 100644
index 000..9df6d9b
--- /dev/null
+++ b/tests/spec/arb_compute_shader/minmax.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** \file
+ *
+ * Test for the minimum maximum values specified in the
+ * ARB_compute_shader extension.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "minmax-test.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.supports_gl_core_version = 31;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   /* UNREACHED */
+   return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_ARB_compute_shader");
+   piglit_print_minmax_header();
+
+   piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, 65535);
+   piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, 65535);
+   piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, 65535);
+   piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, 1024);
+   piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, 1024);
+   piglit_test_min_int_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, 64);
+   piglit_test_min_int(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, 1024);
+   piglit_test_min_int(GL_MAX_COMPUTE_UNIFORM_BLOCKS, 1

[Piglit] [PATCH 01/12] glapi: Rename ARB_compute_shader "LOCAL" -> "WORK_GROUP".

2014-01-09 Thread Paul Berry
The piglit glapi files, which are derived from files published on
www.opengl.org, contained nonstandard names for two enums:
COMPUTE_LOCAL_WORK_SIZE and MAX_COMPUTE_LOCAL_INVOCATIONS.

The ARB_compute_shader spec, the OpenGL specs, and the OpenGL wiki all
agree that these should be called COMPUTE_WORK_GROUP_SIZE and
MAX_COMPUTE_WORK_GROUP_INVOCATIONS.  So rename them in piglit to be
consistent.
---
 glapi/enum.spec| 4 ++--
 glapi/enumext.spec | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/glapi/enum.spec b/glapi/enum.spec
index abe64de..c854b91 100644
--- a/glapi/enum.spec
+++ b/glapi/enum.spec
@@ -3592,7 +3592,7 @@ ARB_compute_shader enum:
MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS  = 0x8264
MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265
MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266
-   COMPUTE_LOCAL_WORK_SIZE = 0x8267
+   COMPUTE_WORK_GROUP_SIZE = 0x8267
 
 # Also VERSION_4_3
 KHR_debug enum: (additional; see above)
@@ -8681,7 +8681,7 @@ ARB_stencil_texturing enum:
 
 # Also VERSION_4_3
 ARB_compute_shader enum:
-   MAX_COMPUTE_LOCAL_INVOCATIONS   = 0x90EB
+   MAX_COMPUTE_WORK_GROUP_INVOCATIONS  = 0x90EB
UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER  = 0x90EC
ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED
DISPATCH_INDIRECT_BUFFER= 0x90EE
diff --git a/glapi/enumext.spec b/glapi/enumext.spec
index 044ee6a..c08024f 100644
--- a/glapi/enumext.spec
+++ b/glapi/enumext.spec
@@ -1825,10 +1825,10 @@ passthru: /* Reuse tokens from ARB_compute_shader */
use ARB_compute_shader  
MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS
use ARB_compute_shader  MAX_COMPUTE_ATOMIC_COUNTERS
use ARB_compute_shader  
MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS
-   use ARB_compute_shader  
MAX_COMPUTE_LOCAL_INVOCATIONS
+   use ARB_compute_shader  
MAX_COMPUTE_WORK_GROUP_INVOCATIONS
use ARB_compute_shader  MAX_COMPUTE_WORK_GROUP_COUNT
use ARB_compute_shader  MAX_COMPUTE_WORK_GROUP_SIZE
-   use ARB_compute_shader  COMPUTE_LOCAL_WORK_SIZE
+   use ARB_compute_shader  COMPUTE_WORK_GROUP_SIZE
use ARB_compute_shader  
UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER
use ARB_compute_shader  
ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER
use ARB_compute_shader  DISPATCH_INDIRECT_BUFFER
@@ -3773,10 +3773,10 @@ ARB_compute_shader enum:
MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS  = 0x8264
MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265
MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266
-   MAX_COMPUTE_LOCAL_INVOCATIONS   = 0x90EB
+   MAX_COMPUTE_WORK_GROUP_INVOCATIONS  = 0x90EB
MAX_COMPUTE_WORK_GROUP_COUNT= 0x91BE
MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF
-   COMPUTE_LOCAL_WORK_SIZE = 0x8267
+   COMPUTE_WORK_GROUP_SIZE = 0x8267
UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER  = 0x90EC
ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED
DISPATCH_INDIRECT_BUFFER= 0x90EE
-- 
1.8.5.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 10/12] shader_runner: Add support for compute shaders.

2014-01-09 Thread Paul Berry
Currently there is no way for shader_runner to accept output from
compute shaders; however this should still be useful for linker tests.
---
 tests/shaders/shader_runner.c | 44 +--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index d78514b..ce6171d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -101,6 +101,8 @@ GLuint geometry_shaders[256];
 unsigned num_geometry_shaders = 0;
 GLuint fragment_shaders[256];
 unsigned num_fragment_shaders = 0;
+GLuint compute_shaders[256];
+unsigned num_compute_shaders = 0;
 int num_uniform_blocks;
 GLuint *uniform_block_bos;
 GLenum geometry_layout_input_type = GL_TRIANGLES;
@@ -131,6 +133,8 @@ enum states {
fragment_shader,
fragment_shader_file,
fragment_program,
+   compute_shader,
+   compute_shader_file,
vertex_data,
test,
 };
@@ -234,6 +238,8 @@ target_to_short_name(GLenum target)
return "FS";
case GL_GEOMETRY_SHADER:
return "GS";
+   case GL_COMPUTE_SHADER:
+   return "CS";
default:
return "???";
}
@@ -257,6 +263,10 @@ compile_glsl(GLenum target, bool release_text)
if (gl_version.num < 32)
piglit_require_extension("GL_ARB_geometry_shader4");
break;
+   case GL_COMPUTE_SHADER:
+   if (gl_version.num < 43)
+   piglit_require_extension("GL_ARB_compute_shader");
+   break;
}
 
if (!glsl_req_version.num) {
@@ -328,6 +338,10 @@ compile_glsl(GLenum target, bool release_text)
fragment_shaders[num_fragment_shaders] = shader;
num_fragment_shaders++;
break;
+   case GL_COMPUTE_SHADER:
+   compute_shaders[num_compute_shaders] = shader;
+   num_compute_shaders++;
+   break;
}
 }
 
@@ -720,6 +734,15 @@ leave_state(enum states state, const char *line)
 line - shader_string);
break;
 
+   case compute_shader:
+   shader_string_size = line - shader_string;
+   compile_glsl(GL_COMPUTE_SHADER, false);
+   break;
+
+   case compute_shader_file:
+   compile_glsl(GL_COMPUTE_SHADER, true);
+   break;
+
case vertex_data:
vertex_data_end = line;
break;
@@ -742,7 +765,8 @@ link_and_use_shaders(void)
 
if ((num_vertex_shaders == 0)
&& (num_fragment_shaders == 0)
-   && (num_geometry_shaders == 0))
+   && (num_geometry_shaders == 0)
+   && (num_compute_shaders == 0))
return;
 
prog = glCreateProgram();
@@ -759,6 +783,10 @@ link_and_use_shaders(void)
glAttachShader(prog, fragment_shaders[i]);
}
 
+   for (i = 0; i < num_compute_shaders; i++) {
+   glAttachShader(prog, compute_shaders[i]);
+   }
+
 #ifdef PIGLIT_USE_OPENGL
if (geometry_layout_input_type != GL_TRIANGLES) {
glProgramParameteriARB(prog, GL_GEOMETRY_INPUT_TYPE_ARB,
@@ -795,6 +823,10 @@ link_and_use_shaders(void)
glDeleteShader(fragment_shaders[i]);
}
 
+   for (i = 0; i < num_compute_shaders; i++) {
+   glDeleteShader(compute_shaders[i]);
+   }
+
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
if (ok) {
link_ok = true;
@@ -862,7 +894,7 @@ process_test_script(const char *script_name)
state = geometry_shader;
shader_string = NULL;
} else if (string_match("[geometry shader file]", 
line)) {
-   state = vertex_shader_file;
+   state = geometry_shader_file;
shader_string = NULL;
} else if (string_match("[geometry layout]", line)) {
state = geometry_layout;
@@ -876,6 +908,12 @@ process_test_script(const char *script_name)
} else if (string_match("[fragment shader file]", 
line)) {
state = fragment_shader_file;
shader_string = NULL;
+   } else if (string_match("[compute shader]", line)) {
+   state = compute_shader;
+   shader_string = NULL;
+   } else if (string_match("[compute shader file]", line)) 
{
+   state = compute_shader_file;
+   shader_string = NULL;
} else if (string_match("[vertex data]", line)) {
state = vertex_data;
   

Re: [Piglit] [PATCH 2/9] cmake: If using Waffle, require waffle >= 1.3

2014-01-09 Thread Chad Versace
On Mon, Jan 06, 2014 at 11:41:26AM -0800, Ian Romanick wrote:
> On 12/30/2013 04:08 PM, Chad Versace wrote:
> > Subsequent patches will enable creation of forward-compatible and debug
> > contexts, which arrived in waffle-1.3.
> > 
> > After this patch, you may need to remove CMakeCache.txt and rerun CMake. The
> > problem is that CMake caches the results of pkg-config queries.  
> > Alternatively,
> > you may manually update the value of CMakeCache.txt:WAFFLE_VERSION in any 
> > text
> > editor.
> 
> And this isn't what the previous patch fixes?

No, it doesn't. Welcome to CMake fun times ;)

When pkg_check_modules() finds a package, it sets an internal variable
in the CMake cache. Let's call it '__pkg_found_${pkg_name}' for this
discussion. Future calls to pkg_check_modules() on ${pkg_name}
will not run if '__pkg_found_${pkg_name}' exists in the cache.

The only way I see to work around this is:

  1. Put some hacks in piglit's cmake that mucks around with CMake
 internal variables.

  2. Remove your CMakeCache and rerun CMake.

I don't like this situation, but I think is Piglit's fate for using
CMake. That is, unless someone proposes some clever CMake-foo.


> > Signed-off-by: Chad Versace 
> > ---
> >  CMakeLists.txt | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/CMakeLists.txt b/CMakeLists.txt
> > index 7418ac3..d9bd28e 100644
> > --- a/CMakeLists.txt
> > +++ b/CMakeLists.txt
> > @@ -50,13 +50,14 @@ if(PIGLIT_USE_WAFFLE)
> > # validates the required version at most once for the lifetime of the
> > # source tree.  If someone changes the required version by editing the
> > # CMakeLists, CMake fails to detect the new requirement.
> > -   set(WAFFLE_REQUIRED_VERSION "1.2.2")
> > +   set(WAFFLE_REQUIRED_VERSION "1.3.0")
> > if(WAFFLE_VERSION VERSION_LESS WAFFLE_REQUIRED_VERSION)
> > message(FATAL_ERROR "Found waffle-${WAFFLE_VERSION}, but "
> > "piglit requires waffle-${WAFFLE_REQUIRED_VERSION}")
> >  endif()
> >  
> > add_definitions(-DPIGLIT_USE_WAFFLE)
> > +   add_definitions(-DWAFFLE_API_VERSION=0x0103)
> > add_definitions(-DPIGLIT_HAS_WAYLAND)
> > set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WAFFLE_CFLAGS}")
> > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WAFFLE_CFLAGS}")
> > 
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit