[Piglit] [PATCH] shader_runner: Only call glMemoryBarrier when supported
Jordan Justen
jordan.l.justen at intel.com
Thu Jun 19 10:52:30 PDT 2014
Make sure ARB_shader_image_load_store is supported before calling
glMemoryBarrier.
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/shaders/shader_runner.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 5fd76f2..e12a742 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -129,6 +129,7 @@ GLchar *prog_err_info = NULL;
GLuint vao = 0;
GLuint fbo = 0;
GLint render_width, render_height;
+bool ARB_shader_image_load_store_supported = false;
enum states {
none = 0,
@@ -2044,6 +2045,17 @@ probe_atomic_counter(GLint counter_num, const char *op, uint32_t value)
return true;
}
+static void
+dispatch_compute(int x, int y, int z)
+{
+ program_must_be_in_use();
+ if (ARB_shader_image_load_store_supported)
+ glMemoryBarrier(GL_ALL_BARRIER_BITS);
+ glDispatchCompute(x, y, z);
+ if (ARB_shader_image_load_store_supported)
+ glMemoryBarrier(GL_ALL_BARRIER_BITS);
+}
+
enum piglit_result
piglit_display(void)
{
@@ -2089,10 +2101,7 @@ piglit_display(void)
} else if (sscanf(line,
"compute %d %d %d",
&x, &y, &z) == 3) {
- program_must_be_in_use();
- glMemoryBarrier(GL_ALL_BARRIER_BITS);
- glDispatchCompute(x, y, z);
- glMemoryBarrier(GL_ALL_BARRIER_BITS);
+ dispatch_compute(x, y, z);
} else if (string_match("draw rect tex", line)) {
program_must_be_in_use();
get_floats(line + 13, c, 8);
@@ -2409,6 +2418,10 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS,
&gl_max_vertex_uniform_components);
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max_clip_planes);
+
+ ARB_shader_image_load_store_supported =
+ gl_version.num >= 42 ||
+ piglit_is_extension_supported("GL_ARB_shader_image_load_store");
#else
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS,
&gl_max_fragment_uniform_components);
--
2.0.0
More information about the Piglit
mailing list