diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-03-16 17:31:53 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-04-14 16:42:11 -0500 |
commit | 7874cfadafde3b6f57f2cce5b781776ad6bfb526 (patch) | |
tree | 9f5a659abb9c4f630ac5320029b5c0bd4b9bc99a | |
parent | d5d7d3da89a1a2ab2db9dca7d701309d822a5294 (diff) |
shader_runner: allow multiple ssbo bindings and add ssbo subdata command
-rw-r--r-- | tests/shaders/shader_runner.c | 31 | ||||
-rw-r--r-- | tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test | 2 |
2 files changed, 18 insertions, 15 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index bd886f5c6..239735cba 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -112,7 +112,7 @@ static GLenum geometry_layout_input_type = GL_TRIANGLES; static GLenum geometry_layout_output_type = GL_TRIANGLE_STRIP; static GLint geometry_layout_vertices_out = 0; static GLuint atomics_bo = 0; -static GLuint ssbo = 0; +static GLuint ssbo[32]; #define SHADER_TYPES 6 static GLuint *subuniform_locations[SHADER_TYPES]; @@ -2703,7 +2703,7 @@ probe_atomic_counter(GLint counter_num, const char *op, uint32_t value) } static bool -probe_ssbo_uint(GLint ssbo_offset, const char *op, uint32_t value) +probe_ssbo_uint(GLint ssbo_index, GLint ssbo_offset, const char *op, uint32_t value) { uint32_t *p; uint32_t observed; @@ -2712,7 +2712,7 @@ probe_ssbo_uint(GLint ssbo_offset, const char *op, uint32_t value) process_comparison(op, &cmp); - glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo); + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo[ssbo_index]); p = glMapBufferRange(GL_SHADER_STORAGE_BUFFER, ssbo_offset, sizeof(uint32_t), GL_MAP_READ_BIT); @@ -2994,13 +2994,13 @@ piglit_display(void) if (!probe_atomic_counter(x, s, y)) { piglit_report_result(PIGLIT_FAIL); } - } else if (sscanf(line, "probe ssbo uint %d %s 0x%x", - &x, s, &y) == 3) { - if (!probe_ssbo_uint(x, s, y)) + } else if (sscanf(line, "probe ssbo uint %d %d %s 0x%x", + &x, &y, s, &z) == 4) { + if (!probe_ssbo_uint(x, y, s, z)) pass = false; - } else if (sscanf(line, "probe ssbo uint %d %s %d", - &x, s, &y) == 3) { - if (!probe_ssbo_uint(x, s, y)) + } else if (sscanf(line, "probe ssbo uint %d %d %s %d", + &x, &y, s, &z) == 4) { + if (!probe_ssbo_uint(x, y, s, z)) pass = false; } else if (sscanf(line, "relative probe rgba ( %f , %f ) " @@ -3075,13 +3075,16 @@ piglit_display(void) glShadeModel(GL_SMOOTH); } else if (string_match("shade model flat", line)) { glShadeModel(GL_FLAT); - } else if (sscanf(line, "ssbo %d", &x) == 1) { - GLuint *ssbo_init = calloc(x, 1); - glGenBuffers(1, &ssbo); - glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo); - glBufferData(GL_SHADER_STORAGE_BUFFER, x, + } else if (sscanf(line, "ssbo %d %d", &x, &y) == 2) { + GLuint *ssbo_init = calloc(y, 1); + glGenBuffers(1, &ssbo[x]); + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, x, ssbo[x]); + glBufferData(GL_SHADER_STORAGE_BUFFER, y, ssbo_init, GL_DYNAMIC_DRAW); free(ssbo_init); + } else if (sscanf(line, "ssbo %d subdata float %d %f", &x, &y, &c[0]) == 3) { + glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[x]); + glBufferSubData(GL_SHADER_STORAGE_BUFFER, y, 4, &c[0]); } else if (sscanf(line, "texture rgbw %d ( %d", &tex, &w) == 2) { GLenum int_fmt = GL_RGBA; int num_scanned = diff --git a/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test index 4bf7e1c23..f73d84f4c 100644 --- a/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test +++ b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test @@ -47,7 +47,7 @@ void main() [test] atomic counters 1 -ssbo 1024 +ssbo 0 1024 uniform uint mode 0 compute 1 1 1 |