i965: report bound buffer size not underlying buffer size for image size (v2)
authorDave Airlie <airlied@redhat.com>
Fri, 27 May 2016 05:00:57 +0000 (15:00 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 23 Aug 2016 03:39:15 +0000 (13:39 +1000)
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.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index 38701d04eeae923361518560b42a9da0ad482369..2bafe9172f9863e18b2dc00922ff0a9c995ddef2 100644 (file)
@@ -1384,10 +1384,10 @@ update_buffer_image_param(struct brw_context *brw,
                           struct brw_image_param *param)
 {
    struct gl_buffer_object *obj = u->TexObj->BufferObject;
-
+   const uint32_t size = MIN2((uint32_t)u->TexObj->BufferSize, obj->Size);
    update_default_image_param(brw, u, surface_idx, param);
 
-   param->size[0] = obj->Size / _mesa_get_format_bytes(u->_ActualFormat);
+   param->size[0] = size / _mesa_get_format_bytes(u->_ActualFormat);
    param->stride[0] = _mesa_get_format_bytes(u->_ActualFormat);
 }