diff options
author | Jason Ekstrand <[email protected]> | 2020-02-06 21:38:40 -0600 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-28 22:55:25 +0000 |
commit | b07d26be65b05784950e6f3ea5e82eb213058ecc (patch) | |
tree | f938ffd0b8503efbed7278470fa8ba6ed26e9cf2 | |
parent | fd817291c7f87985d9ef9015cc086d1b5fd86825 (diff) |
anv: Handle null vertex buffer bindings
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4767>
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 31 |
1 files 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, |