Martin Peres <martin.pe...@linux.intel.com> writes:

> Signed-off-by: Martin Peres <martin.pe...@linux.intel.com>

Reviewed-by: Francisco Jerez <curroje...@riseup.net>

> ---
>  tests/spec/arb_shader_image_load_store/common.c |  2 +-
>  tests/spec/arb_shader_image_load_store/image.c  | 10 ++++++++--
>  tests/spec/arb_shader_image_load_store/image.h  |  6 ++++++
>  3 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/tests/spec/arb_shader_image_load_store/common.c 
> b/tests/spec/arb_shader_image_load_store/common.c
> index 88b0f75..3e56c22 100644
> --- a/tests/spec/arb_shader_image_load_store/common.c
> +++ b/tests/spec/arb_shader_image_load_store/common.c
> @@ -215,7 +215,7 @@ upload_image_levels(const struct image_info img, unsigned 
> num_levels,
>                  glGenBuffers(1, &buffers[unit]);
>                  glBindBuffer(GL_PIXEL_PACK_BUFFER, buffers[unit]);
>                  glBufferData(GL_PIXEL_PACK_BUFFER,
> -                             m * img.size.x * sizeof(uint32_t),
> +                             img.size.x * image_pixel_size(img.format) / 8,
>                               NULL, GL_STATIC_DRAW);
>  
>                  glGenTextures(1, &packed_tex);
> diff --git a/tests/spec/arb_shader_image_load_store/image.c 
> b/tests/spec/arb_shader_image_load_store/image.c
> index 7a1867f..9bf7f7f 100644
> --- a/tests/spec/arb_shader_image_load_store/image.c
> +++ b/tests/spec/arb_shader_image_load_store/image.c
> @@ -207,11 +207,17 @@ image_type_name(const struct image_format_info *format)
>          return get_image_type(format)->image_type_name;
>  }
>  
> +unsigned int
> +image_pixel_size(const struct image_format_info *format)
> +{
> +        return format->bits[0] + format->bits[1] +
> +               format->bits[2] + format->bits[3];
> +}
> +
>  GLenum
>  image_compat_format(const struct image_format_info *format)
>  {
> -        const unsigned bits = (format->bits[0] + format->bits[1] +
> -                               format->bits[2] + format->bits[3]);
> +        const unsigned bits = image_pixel_size(format);
>  
>          switch (bits) {
>          case 128:
> diff --git a/tests/spec/arb_shader_image_load_store/image.h 
> b/tests/spec/arb_shader_image_load_store/image.h
> index fc43f22..d712f93 100644
> --- a/tests/spec/arb_shader_image_load_store/image.h
> +++ b/tests/spec/arb_shader_image_load_store/image.h
> @@ -156,6 +156,12 @@ const char *
>  image_type_name(const struct image_format_info *format);
>  
>  /**
> + * Get the size in bits of one pixel in the specified format.
> + */
> +unsigned int
> +image_pixel_size(const struct image_format_info *format);
> +
> +/**
>   * Get a compatible unsigned integer format of the same size.
>   */
>  GLenum
> -- 
> 2.5.0
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to