diff options
author | Craig Stout <[email protected]> | 2017-03-29 12:14:30 -0700 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-04-12 11:05:41 +0100 |
commit | 5094311078e23a3a9f62b143f2451d3b91691134 (patch) | |
tree | 72aefa26ec001efea50e33bd7422d8e436ece370 | |
parent | a5afb7e1ee03e1cdba48bbaedeac718d2ef72e69 (diff) |
anv/cmd_buffer: fix host memory leak
push_constants must be free'd.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100452
Reviewed-by: Jason Ekstrand <[email protected]>
Cc: "17.0 13.0" <[email protected]>
(cherry picked from commit 1da7a11de8113932871487efaeb2674a3d1c644a)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <[email protected]>
Conflicts:
src/intel/vulkan/anv_cmd_buffer.c
-rw-r--r-- | src/intel/vulkan/anv_cmd_buffer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 660e41e2db6..2539b1025b5 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -118,7 +118,12 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer) struct anv_cmd_state *state = &cmd_buffer->state; memset(&state->descriptors, 0, sizeof(state->descriptors)); - memset(&state->push_constants, 0, sizeof(state->push_constants)); + for (uint32_t i = 0; i < MESA_SHADER_STAGES; i++) { + if (state->push_constants[i] != NULL) { + vk_free(&cmd_buffer->pool->alloc, state->push_constants[i]); + state->push_constants[i] = NULL; + } + } memset(state->binding_tables, 0, sizeof(state->binding_tables)); memset(state->samplers, 0, sizeof(state->samplers)); @@ -180,6 +185,9 @@ static VkResult anv_create_cmd_buffer( if (cmd_buffer == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + for (uint32_t i = 0; i < MESA_SHADER_STAGES; i++) { + cmd_buffer->state.push_constants[i] = NULL; + } cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC; cmd_buffer->device = device; cmd_buffer->pool = pool; |