From efb28aa9705699794143b32e11f5c857db60e060 Mon Sep 17 00:00:00 2001 From: Sergii Romantsov Date: Wed, 15 Aug 2018 15:21:47 +0300 Subject: i965: Emitting 3DSTATE_SO_BUFFER of 0-size. Avoided filling of whole structure and bo-allocation if size of surface is 0. Signed-off-by: Sergii Romantsov --- src/mesa/drivers/dri/i965/genX_state_upload.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index ea5ad55be59..c051848985f 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -3787,19 +3787,20 @@ genX(upload_3dstate_so_buffers)(struct brw_context *brw) for (int i = 0; i < 4; i++) { struct intel_buffer_object *bufferobj = intel_buffer_object(xfb_obj->Buffers[i]); + uint32_t start = xfb_obj->Offset[i]; + uint32_t end = ALIGN(start + xfb_obj->Size[i], 4); + uint32_t const size = end - start; - if (!bufferobj) { + if (!bufferobj || !size) { brw_batch_emit(brw, GENX(3DSTATE_SO_BUFFER), sob) { sob.SOBufferIndex = i; } continue; } - uint32_t start = xfb_obj->Offset[i]; assert(start % 4 == 0); - uint32_t end = ALIGN(start + xfb_obj->Size[i], 4); struct brw_bo *bo = - intel_bufferobj_buffer(brw, bufferobj, start, end - start, true); + intel_bufferobj_buffer(brw, bufferobj, start, size, true); assert(end <= bo->size); brw_batch_emit(brw, GENX(3DSTATE_SO_BUFFER), sob) { -- cgit v1.2.3