From b07d26be65b05784950e6f3ea5e82eb213058ecc Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 6 Feb 2020 21:38:40 -0600 Subject: [PATCH] anv: Handle null vertex buffer bindings Reviewed-by: Caio Marcelo de Oliveira Filho Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 31 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index bc7ca7fd5db..1ba6dc2b987 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -3282,25 +3282,34 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) struct anv_buffer *buffer = cmd_buffer->state.vertex_bindings[vb].buffer; uint32_t offset = cmd_buffer->state.vertex_bindings[vb].offset; - struct GENX(VERTEX_BUFFER_STATE) state = { - .VertexBufferIndex = vb, + struct GENX(VERTEX_BUFFER_STATE) state; + if (buffer) { + state = (struct GENX(VERTEX_BUFFER_STATE)) { + .VertexBufferIndex = vb, - .MOCS = anv_mocs_for_bo(cmd_buffer->device, buffer->address.bo), + .MOCS = anv_mocs_for_bo(cmd_buffer->device, buffer->address.bo), #if GEN_GEN <= 7 - .BufferAccessType = pipeline->vb[vb].instanced ? INSTANCEDATA : VERTEXDATA, - .InstanceDataStepRate = pipeline->vb[vb].instance_divisor, + .BufferAccessType = pipeline->vb[vb].instanced ? INSTANCEDATA : VERTEXDATA, + .InstanceDataStepRate = pipeline->vb[vb].instance_divisor, #endif - .AddressModifyEnable = true, - .BufferPitch = pipeline->vb[vb].stride, - .BufferStartingAddress = anv_address_add(buffer->address, offset), + .AddressModifyEnable = true, + .BufferPitch = pipeline->vb[vb].stride, + .BufferStartingAddress = anv_address_add(buffer->address, offset), + .NullVertexBuffer = offset >= buffer->size, #if GEN_GEN >= 8 - .BufferSize = buffer->size - offset + .BufferSize = buffer->size - offset #else - .EndAddress = anv_address_add(buffer->address, buffer->size - 1), + .EndAddress = anv_address_add(buffer->address, buffer->size - 1), #endif - }; + }; + } else { + state = (struct GENX(VERTEX_BUFFER_STATE)) { + .VertexBufferIndex = vb, + .NullVertexBuffer = true, + }; + } #if GEN_GEN >= 8 && GEN_GEN <= 9 genX(cmd_buffer_set_binding_for_gen8_vb_flush)(cmd_buffer, vb, -- 2.30.2