[Piglit] [PATCH 3/6] shader_runner: Allow "draw arrays" if no [vertex data] section.
Paul Berry
stereotype441 at gmail.com
Mon Aug 12 06:01:08 PDT 2013
For some geometry shader tests, there's no need for any vertex shader
inputs at all--the geometry shader produces all the data itself. To
allow tests like these, we need to be able to issue a "draw arrays"
command with any number of input vertices, even if there is no [vertex
data] section.
This patch disables shader_runner's "draw arrays" overflow checks in
the event that there is no [vertex data] section, so that the "draw
arrays" command can be used. This is safe, since the lack of a
[vertex data] section means that no vertex attrib arrays are enabled,
so the shader won't try to access the vertex input data at all.
---
tests/shaders/shader_runner.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index be1bfef..492db06 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -95,6 +95,7 @@ const char *vertex_data_start = NULL;
const char *vertex_data_end = NULL;
GLuint prog;
size_t num_vbo_rows = 0;
+bool vbo_present = false;
bool link_ok = false;
bool prog_in_use = false;
GLchar *prog_err_info = NULL;
@@ -1710,7 +1711,8 @@ piglit_display(void)
if (first < 0) {
printf("draw arrays 'first' must be >= 0\n");
piglit_report_result(PIGLIT_FAIL);
- } else if ((size_t) first >= num_vbo_rows) {
+ } 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);
@@ -1718,7 +1720,8 @@ piglit_display(void)
if (count <= 0) {
printf("draw arrays 'count' must be > 0\n");
piglit_report_result(PIGLIT_FAIL);
- } else if (count > num_vbo_rows - (size_t) first) {
+ } 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);
@@ -1993,6 +1996,7 @@ piglit_init(int argc, char **argv)
num_vbo_rows = setup_vbo_from_text(prog, vertex_data_start,
vertex_data_end);
+ vbo_present = true;
}
setup_ubos();
}
--
1.8.3.4
More information about the Piglit
mailing list