summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2017-04-22 16:50:38 +0200
committerMarek Olšák <marek.olsak@amd.com>2017-05-05 19:38:02 +0200
commitf64d4ce7fa90851eb4ac4c99dea600487a1e8441 (patch)
tree58e8ebd8fe881303e05efd65bc1a61ae5b6a8cfb /tests
parent860830f48e5c03ceed564bf306933e290a5377a1 (diff)
util: support instancing with piglit_draw_rect_custom
Diffstat (limited to 'tests')
-rw-r--r--tests/shaders/shader_runner.c4
-rw-r--r--tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c2
-rw-r--r--tests/spec/arb_texture_multisample/texelfetch.c2
-rw-r--r--tests/spec/arb_texture_view/common.c2
-rw-r--r--tests/spec/ext_shader_samples_identical/simple-fs.c2
-rw-r--r--tests/util/piglit-util-gl.c31
-rw-r--r--tests/util/piglit-util-gl.h4
7 files changed, 29 insertions, 18 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 6ac5f9893..f9c190b5b 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2982,7 +2982,7 @@ piglit_display(void)
piglit_draw_rect_custom(-1.0 + 2.0 * (c[0] / piglit_width),
-1.0 + 2.0 * (c[1] / piglit_height),
2.0 * (c[2] / piglit_width),
- 2.0 * (c[3] / piglit_height), true);
+ 2.0 * (c[3] / piglit_height), true, 1);
} else if (parse_str(line, "draw rect ortho ", &rest)) {
result = program_must_be_in_use();
program_subroutine_uniforms();
@@ -2995,7 +2995,7 @@ piglit_display(void)
} else if (parse_str(line, "draw rect patch ", &rest)) {
result = program_must_be_in_use();
parse_floats(rest, c, 4, NULL);
- piglit_draw_rect_custom(c[0], c[1], c[2], c[3], true);
+ piglit_draw_rect_custom(c[0], c[1], c[2], c[3], true, 1);
} else if (parse_str(line, "draw rect ", &rest)) {
result = program_must_be_in_use();
program_subroutine_uniforms();
diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c
index 26a9c4e37..9d72cb4e6 100644
--- a/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c
@@ -167,7 +167,7 @@ piglit_display(void)
glClear(GL_COLOR_BUFFER_BIT);
glBindProgramPipeline(pipeline);
- piglit_draw_rect_custom(-1, -1, 2, 2, true);
+ piglit_draw_rect_custom(-1, -1, 2, 2, true, 1);
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
expected);
diff --git a/tests/spec/arb_texture_multisample/texelfetch.c b/tests/spec/arb_texture_multisample/texelfetch.c
index 981e3c6fd..1f1a2f939 100644
--- a/tests/spec/arb_texture_multisample/texelfetch.c
+++ b/tests/spec/arb_texture_multisample/texelfetch.c
@@ -127,7 +127,7 @@ piglit_display(void)
piglit_check_gl_error(GL_NO_ERROR);
glUseProgram(draw_prog);
- piglit_draw_rect_from_arrays(quad_verts, NULL, false);
+ piglit_draw_rect_from_arrays(quad_verts, NULL, false, 1);
piglit_check_gl_error(GL_NO_ERROR);
diff --git a/tests/spec/arb_texture_view/common.c b/tests/spec/arb_texture_view/common.c
index 10d37083b..fc18bbcb7 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -113,5 +113,5 @@ draw_3d_depth(float x, float y, float w, float h, int depth)
1.0, 1.0,
0.0, 1.0};
- piglit_draw_rect_from_arrays(vertices, texcoords, false);
+ piglit_draw_rect_from_arrays(vertices, texcoords, false, 1);
}
diff --git a/tests/spec/ext_shader_samples_identical/simple-fs.c b/tests/spec/ext_shader_samples_identical/simple-fs.c
index e7de7b427..e26a2bef6 100644
--- a/tests/spec/ext_shader_samples_identical/simple-fs.c
+++ b/tests/spec/ext_shader_samples_identical/simple-fs.c
@@ -144,7 +144,7 @@ piglit_display(void)
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(draw_prog);
- piglit_draw_rect_from_arrays(quad_verts, NULL, false);
+ piglit_draw_rect_from_arrays(quad_verts, NULL, false, 1);
/* Scan the previous render. Draw green if the samples are all
* (verifiably) the same, blue if there may be differences, and red if
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index d94a40fb2..5ff13fedc 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -663,7 +663,7 @@ required_gl_version_from_glsl_version(unsigned glsl_version)
*/
void
piglit_draw_rect_from_arrays(const void *verts, const void *tex,
- bool use_patches)
+ bool use_patches, unsigned instance_count)
{
bool use_fixed_function_attributes;
@@ -712,7 +712,10 @@ piglit_draw_rect_from_arrays(const void *verts, const void *tex,
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ if (instance_count > 1)
+ glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, instance_count);
+ else
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (verts)
glDisableClientState(GL_VERTEX_ARRAY);
@@ -779,11 +782,18 @@ piglit_draw_rect_from_arrays(const void *verts, const void *tex,
glGetIntegerv(GL_PATCH_VERTICES, &old_patch_vertices);
glPatchParameteri(GL_PATCH_VERTICES, 4);
- glDrawArrays(GL_PATCHES, 0, 4);
+ if (instance_count > 1)
+ glDrawArraysInstanced(GL_PATCHES, 0, 4, instance_count);
+ else
+ glDrawArrays(GL_PATCHES, 0, 4);
glPatchParameteri(GL_PATCH_VERTICES, old_patch_vertices);
}
- else
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ else {
+ if (instance_count > 1)
+ glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, instance_count);
+ else
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ }
if (verts)
glDisableVertexAttribArray(PIGLIT_ATTRIB_POS);
@@ -804,7 +814,8 @@ piglit_draw_rect_from_arrays(const void *verts, const void *tex,
* Convenience function to draw an axis-aligned rectangle.
*/
GLvoid
-piglit_draw_rect_custom(float x, float y, float w, float h, bool use_patches)
+piglit_draw_rect_custom(float x, float y, float w, float h, bool use_patches,
+ unsigned instance_count)
{
float verts[4][4];
@@ -825,7 +836,7 @@ piglit_draw_rect_custom(float x, float y, float w, float h, bool use_patches)
verts[3][2] = 0.0;
verts[3][3] = 1.0;
- piglit_draw_rect_from_arrays(verts, NULL, use_patches);
+ piglit_draw_rect_from_arrays(verts, NULL, use_patches, instance_count);
}
/**
@@ -834,7 +845,7 @@ piglit_draw_rect_custom(float x, float y, float w, float h, bool use_patches)
GLvoid
piglit_draw_rect(float x, float y, float w, float h)
{
- piglit_draw_rect_custom(x, y, w, h, false);
+ piglit_draw_rect_custom(x, y, w, h, false, 1);
}
/**
@@ -862,7 +873,7 @@ piglit_draw_rect_z(float z, float x, float y, float w, float h)
verts[3][2] = z;
verts[3][3] = 1.0;
- piglit_draw_rect_from_arrays(verts, NULL, false);
+ piglit_draw_rect_from_arrays(verts, NULL, false, 1);
}
/**
@@ -901,7 +912,7 @@ piglit_draw_rect_tex(float x, float y, float w, float h,
tex[3][0] = tx + tw;
tex[3][1] = ty + th;
- piglit_draw_rect_from_arrays(verts, tex, false);
+ piglit_draw_rect_from_arrays(verts, tex, false, 1);
}
unsigned
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index 4fc6c5750..3bb0ee85b 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -236,14 +236,14 @@ GLvoid piglit_draw_triangle(float x1, float y1, float x2, float y2,
GLvoid piglit_draw_triangle_z(float z, float x1, float y1, float x2, float y2,
float x3, float y3);
GLvoid piglit_draw_rect_custom(float x, float y, float w, float h,
- bool use_patches);
+ bool use_patches, unsigned instance_count);
GLvoid piglit_draw_rect(float x, float y, float w, float h);
GLvoid piglit_draw_rect_z(float z, float x, float y, float w, float h);
GLvoid piglit_draw_rect_tex(float x, float y, float w, float h,
float tx, float ty, float tw, float th);
GLvoid piglit_draw_rect_back(float x, float y, float w, float h);
void piglit_draw_rect_from_arrays(const void *verts, const void *tex,
- bool use_patches);
+ bool use_patches, unsigned instance_count);
unsigned short piglit_half_from_float(float val);