[Piglit] [PATCH 2/3] shader_runner: Support optional format paramters for 'texture rgbw'

Jordan Justen jordan.l.justen at intel.com
Tue May 26 11:36:43 PDT 2015


On 2015-05-26 05:12:08, Francisco Jerez wrote:
> Jordan Justen <jordan.l.justen at intel.com> writes:
> 
> > The motivation for this is that (as noted by curro)
> > ARB_shader_image_load_store doesn't support images with an internal
> > format of GL_RGBA.
> >
> > See 'Table X.2' in
> > https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt
> >
> > Therefore, in order to use image load/store in shader runner tests, we
> > must override the default internal format when creating the image.
> >
> > We retain the default internal format of GL_RGBA and base type of
> > GL_UNSIGNED_NORMALIZED for the image creation.
> >
> > Now an internal format can optionally be added as a new parameter when
> > creating the image. For example:
> >
> >   texture rgbw 0 (16, 16) GL_RGBA8
> >
> > Additionally, an optional fifth paramter can be added. This will
> > specify the base type for the image. For example:
> >
> >   texture rgbw 0 (16, 16) GL_RGBA8 GL_UNSIGNED_NORMALIZED
> >
> What exactly does the fifth parameter do?  Does it make sense to change
> the base type independently of the internal format or couldn't
> shader_runner infer one from the other?

It is the other configurable 'format' parameter to
piglit_rgbw_texture. I added it because it was easy, but I don't think
we really need it. I'll update the patch to only add the internal
format param.

-Jordan

> > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> > Cc: Francisco Jerez <currojerez at riseup.net>
> > ---
> >  tests/shaders/shader_runner.c | 26 +++++++++++++++++++++-----
> >  1 file changed, 21 insertions(+), 5 deletions(-)
> >
> > diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> > index 2df9e78..fe59b1d 100644
> > --- a/tests/shaders/shader_runner.c
> > +++ b/tests/shaders/shader_runner.c
> > @@ -2308,7 +2308,7 @@ piglit_display(void)
> >               float c[32];
> >               double d[4];
> >               int x, y, z, w, h, l, tex, level;
> > -             char s[32];
> > +             char s[32], s2[32];
> >  
> >  
> >               line = eat_whitespace(next_line);
> > @@ -2570,11 +2570,27 @@ piglit_display(void)
> >                       glShadeModel(GL_SMOOTH);
> >               } else if (string_match("shade model flat", line)) {
> >                       glShadeModel(GL_FLAT);
> > -             } else if (sscanf(line,
> > -                               "texture rgbw %d ( %d , %d )",
> > -                               &tex, &w, &h) == 3) {
> > +             } else if (string_match("texture rgbw ", line)) {
> > +                     int num_scanned;
> > +                     GLenum int_fmt = GL_RGBA, base_type = GL_UNSIGNED_NORMALIZED;
> > +                     num_scanned = sscanf(line, "texture rgbw %d ( %d , %d ) %31s %31s",
> > +                                          &tex, &w, &h, s, s2);
> > +                     if (num_scanned < 3) {
> > +                             printf("invalid texture rgbw command!\n");
> > +                             piglit_report_result(PIGLIT_FAIL);
> > +                     }
> > +
> > +                     if (num_scanned >= 5) {
> > +                             base_type = piglit_get_gl_enum_from_name(s2);
> > +                     }
> > +
> > +                     if (num_scanned >= 4) {
> > +                             int_fmt = piglit_get_gl_enum_from_name(s);
> > +                     }
> > +
> >                       glActiveTexture(GL_TEXTURE0 + tex);
> > -                     piglit_rgbw_texture(GL_RGBA, w, h, GL_FALSE, GL_FALSE, GL_UNSIGNED_NORMALIZED);
> > +                     piglit_rgbw_texture(int_fmt, w, h, GL_FALSE, GL_FALSE,
> > +                                         base_type);
> >                       if (!piglit_is_core_profile)
> >                               glEnable(GL_TEXTURE_2D);
> >               } else if (sscanf(line, "texture miptree %d", &tex) == 1) {
> > -- 
> > 2.1.4


More information about the Piglit mailing list