Jordan Justen <[email protected]> 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 when the optional
> parameter is not given.
>
> 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
>
> v2:
>  * Drop 'base type' parameter
>
> Signed-off-by: Jordan Justen <[email protected]>
> ---
>  tests/shaders/shader_runner.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 41024cd..74cc9d9 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -2572,11 +2572,23 @@ 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;
> +                     num_scanned = sscanf(line, "texture rgbw %d ( %d , %d ) 
> %31s",
> +                                          &tex, &w, &h, s);

You could probably initialize this variable at the point you declare it.

> +                     if (num_scanned < 3) {
> +                             printf("invalid texture rgbw command!\n");

Any reason to send this to stdout instead of stderr?

With these nit-picks fixed:
Reviewed-by: Francisco Jerez <[email protected]>

> +                             piglit_report_result(PIGLIT_FAIL);
> +                     }
> +
> +                     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,
> +                                         GL_UNSIGNED_NORMALIZED);
>                       if (!piglit_is_core_profile)
>                               glEnable(GL_TEXTURE_2D);
>               } else if (sscanf(line, "texture miptree %d", &tex) == 1) {
> -- 
> 2.1.4
>
> _______________________________________________
> Piglit mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/piglit

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to