From a804d82ef6062cc16c5c3beb254560bfe448bfe0 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 22 Jan 2016 22:57:02 -0800 Subject: [PATCH] anv/cmd_buffer: Zero out binding tables and samplers in state_reset This fixes a use of an undefined value if the client uses push constants in a stage without ever setting any descriptors on GEN8-9. --- src/vulkan/anv_cmd_buffer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index fe85e3e164e..d2cbf87578a 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -117,6 +117,11 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer) memset(&state->descriptors, 0, sizeof(state->descriptors)); memset(&state->push_constants, 0, sizeof(state->push_constants)); + memset(state->binding_tables, 0, sizeof(state->binding_tables)); + memset(state->samplers, 0, sizeof(state->samplers)); + + /* 0 isn't a valid config. This ensures that we always configure L3$. */ + cmd_buffer->state.current_l3_config = 0; state->dirty = ~0; state->vb_dirty = 0; @@ -237,9 +242,6 @@ static VkResult anv_create_cmd_buffer( cmd_buffer->level = level; cmd_buffer->state.attachments = NULL; - /* 0 isn't a valid config. This ensures that we always configure L3$. */ - cmd_buffer->state.current_l3_config = 0; - result = anv_cmd_buffer_init_batch_bo_chain(cmd_buffer); if (result != VK_SUCCESS) goto fail; -- 2.30.2