diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2016-01-13 19:03:46 -0500 |
---|---|---|
committer | Ilia Mirkin <imirkin@alum.mit.edu> | 2016-03-18 13:26:33 -0400 |
commit | e28a6528f0265db43143b16518a14fc9e46063d9 (patch) | |
tree | d9bc3a7c9bd910ea94eca7b487b8a7836111ac16 | |
parent | 76dee126f287d0e0ed2f1296f20384c6bfe12eba (diff) |
shader_runner: add basic ssbo probing support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
-rw-r--r-- | tests/shaders/shader_runner.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 6783b6fd4..8d2a9bd0d 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -2703,6 +2703,41 @@ probe_atomic_counter(GLint counter_num, const char *op, uint32_t value) return true; } +static bool +probe_ssbo_uint(GLint ssbo_offset, const char *op, uint32_t value) +{ + uint32_t *p; + uint32_t observed; + enum comparison cmp; + bool result; + + process_comparison(op, &cmp); + + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo); + p = glMapBufferRange(GL_SHADER_STORAGE_BUFFER, ssbo_offset, + sizeof(uint32_t), GL_MAP_READ_BIT); + + if (!p) { + printf("Couldn't map ssbo to verify expected value.\n"); + return false; + } + + observed = *p; + result = compare_uint(value, observed, cmp); + + if (!result) { + printf("SSBO %d test failed: Reference %s Observed\n", + ssbo_offset, comparison_string(cmp)); + printf(" Reference: %u\n", value); + printf(" Observed: %u\n", observed); + glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); + return false; + } + + glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); + return true; +} + enum piglit_result piglit_display(void) { @@ -2958,6 +2993,14 @@ 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)) + pass = false; + } else if (sscanf(line, "probe ssbo uint %d %s %d", + &x, s, &y) == 3) { + if (!probe_ssbo_uint(x, s, y)) + pass = false; } else if (sscanf(line, "relative probe rgba ( %f , %f ) " "( %f , %f , %f , %f )", |