radv: Reinitialise loaderMagic when allocating a cached command buffer
authorAlex Smith <asmith@feralinteractive.com>
Mon, 13 Mar 2017 13:28:19 +0000 (13:28 +0000)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 13 Mar 2017 22:42:36 +0000 (23:42 +0100)
This must be set to ICD_LOADER_MAGIC by vkAllocateCommandBuffers, which
was being done when allocating a new buffer but not when reusing an
existing one in the cache. This would hit an assertion and crash in
debug builds of the Vulkan loader.

Fixes: 682248db451f ("radv: Cache command buffers in command pool.")
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index 10c51427679de28d15227e41e97eb328bedea3a8..17be0a1dd31b0cf6f401ff2d7fd3bfddab083247 100644 (file)
@@ -1662,6 +1662,7 @@ VkResult radv_AllocateCommandBuffers(
                        list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
 
                        radv_reset_cmd_buffer(cmd_buffer);
+                       cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
                        cmd_buffer->level = pAllocateInfo->level;
 
                        pCommandBuffers[i] = radv_cmd_buffer_to_handle(cmd_buffer);