[Piglit] [PATCH 1/3] shader_runner: Add 'atomic counters' command

Jordan Justen jordan.l.justen at intel.com
Wed Jun 18 10:16:32 PDT 2014


On 2014-06-18 01:47:21, Chris Forbes wrote:
> Not really thrilled with the parens in 2/3, but I need this working
> for the tests I'm writing :)

I'll drop the parens.

> This series is:
> 
> Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

Thanks!

> On Sun, Jun 8, 2014 at 6:58 AM, Jordan Justen <jordan.l.justen at intel.com> wrote:
> > 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
> >
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: signature
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140618/efe68a89/attachment.sig>


More information about the Piglit mailing list