[Mesa-dev] [PATCH] i965: report bound buffer size not underlying buffer size for image size (v2)

Francisco Jerez currojerez at riseup.net
Tue Aug 23 02:15:31 UTC 2016


Dave Airlie <airlied at gmail.com> writes:

> From: Dave Airlie <airlied at redhat.com>
>
> This seems to make sense, the image is bound to a subset of the buffer
> so the image size should be from the bound size not the underlying
> object.
>
> This fixes:
> GL44-CTS.shader_image_size.advanced-nonMS-fs-int
>
> v2: get mininum of the two values, same as we write to the hw.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index b73d5d5..ee0b9c2 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -1227,10 +1227,11 @@ update_buffer_image_param(struct brw_context *brw,
>                            struct brw_image_param *param)
>  {
>     struct gl_buffer_object *obj = u->TexObj->BufferObject;
> -
> +   uint32_t size;

Fold the computation of size below into its declaration so you can mark
the variable const.  With that fixed:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

>     update_default_image_param(brw, u, surface_idx, param);
>  
> -   param->size[0] = obj->Size / _mesa_get_format_bytes(u->_ActualFormat);
> +   size = MIN2((uint32_t)u->TexObj->BufferSize, obj->Size);
> +   param->size[0] = size / _mesa_get_format_bytes(u->_ActualFormat);
>     param->stride[0] = _mesa_get_format_bytes(u->_ActualFormat);
>  }
>  
> -- 
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160822/a4119e63/attachment.sig>


More information about the mesa-dev mailing list