[Piglit] [PATCH 1/3] shader_runner: Add 'atomic counters' command
Jordan Justen
jordan.l.justen at intel.com
Sat Jun 7 11:58:58 PDT 2014
This command initializes the specified number of atomic counters all
containing an initial value of 0.
For example, 'atomic counters 2' creates an zeroed 8 byte buffer
for 2 atomic counters.
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/shaders/shader_runner.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 85a0b98..4babd36 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -113,6 +113,7 @@ GLuint *uniform_block_bos;
GLenum geometry_layout_input_type = GL_TRIANGLES;
GLenum geometry_layout_output_type = GL_TRIANGLE_STRIP;
GLint geometry_layout_vertices_out = 0;
+GLuint atomics_bo = 0;
char *shader_string;
GLint shader_string_size;
@@ -2005,7 +2006,15 @@ piglit_display(void)
line = eat_whitespace(line);
- if (string_match("clear color", line)) {
+ if (sscanf(line, "atomic counters %d", &x) == 1) {
+ GLuint *atomics_buf = calloc(x, sizeof(GLuint));
+ glGenBuffers(1, &atomics_bo);
+ glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
+ glBufferData(GL_ATOMIC_COUNTER_BUFFER,
+ sizeof(GLuint) * x,
+ atomics_buf, GL_STATIC_DRAW);
+ free(atomics_buf);
+ } else if (string_match("clear color", line)) {
get_floats(line + 11, c, 4);
glClearColor(c[0], c[1], c[2], c[3]);
clear_bits |= GL_COLOR_BUFFER_BIT;
--
2.0.0.rc4
More information about the Piglit
mailing list