diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-04-25 09:51:53 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-05-10 08:49:51 +0200 |
commit | b3963b2afe3c01cc45c2f9784e492966c45ba81d (patch) | |
tree | fbd487cd3d1668e9d49e38fb5d280d5e815a23ab /tests | |
parent | c12816f7b3154c87c94244db01c5a79bca1d38a9 (diff) |
shader_runner: add "draw arrays instanced" command
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/shaders/shader_runner.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 0e51227aa..26951aeaf 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -2789,6 +2789,32 @@ bind_vao_if_supported() } } +static enum piglit_result +draw_arrays_common(int first, size_t count) +{ + enum piglit_result result = program_must_be_in_use(); + if (first < 0) { + printf("draw arrays 'first' must be >= 0\n"); + piglit_report_result(PIGLIT_FAIL); + } else if (vbo_present && + (size_t) first >= num_vbo_rows) { + printf("draw arrays 'first' must be < %lu\n", + (unsigned long) num_vbo_rows); + piglit_report_result(PIGLIT_FAIL); + } + if (count <= 0) { + printf("draw arrays 'count' must be > 0\n"); + piglit_report_result(PIGLIT_FAIL); + } else if (vbo_present && + count > num_vbo_rows - (size_t) first) { + printf("draw arrays cannot draw beyond %lu\n", + (unsigned long) num_vbo_rows); + piglit_report_result(PIGLIT_FAIL); + } + bind_vao_if_supported(); + return result; +} + static bool probe_atomic_counter(unsigned buffer_num, GLint counter_num, const char *op, uint32_t value) { @@ -3033,30 +3059,18 @@ piglit_display(void) &primcount, c + 0, c + 1, c + 2, c + 3); draw_instanced_rect(primcount, c[0], c[1], c[2], c[3]); + } else if (sscanf(line, "draw arrays instanced %31s %d %d %d", s, &x, &y, &z) == 4) { + GLenum mode = decode_drawing_mode(s); + int first = x; + size_t count = (size_t) y; + size_t primcount = (size_t) z; + draw_arrays_common(first, count); + glDrawArraysInstanced(mode, first, count, primcount); } else if (sscanf(line, "draw arrays %31s %d %d", s, &x, &y) == 3) { GLenum mode = decode_drawing_mode(s); int first = x; size_t count = (size_t) y; - result = program_must_be_in_use(); - if (first < 0) { - printf("draw arrays 'first' must be >= 0\n"); - piglit_report_result(PIGLIT_FAIL); - } else if (vbo_present && - (size_t) first >= num_vbo_rows) { - printf("draw arrays 'first' must be < %lu\n", - (unsigned long) num_vbo_rows); - piglit_report_result(PIGLIT_FAIL); - } - if (count <= 0) { - printf("draw arrays 'count' must be > 0\n"); - piglit_report_result(PIGLIT_FAIL); - } else if (vbo_present && - count > num_vbo_rows - (size_t) first) { - printf("draw arrays cannot draw beyond %lu\n", - (unsigned long) num_vbo_rows); - piglit_report_result(PIGLIT_FAIL); - } - bind_vao_if_supported(); + result = draw_arrays_common(first, count); glDrawArrays(mode, first, count); } else if (parse_str(line, "disable ", &rest)) { do_enable_disable(rest, false); |