From 04841b40d5283677d92c2415cf6e14151cf9af38 Mon Sep 17 00:00:00 2001
From: Mark Lobodzinski <mark@lunarg.com>
Date: Tue, 28 Mar 2017 16:22:56 -0600
Subject: [PATCH] layers: Fix push_desc_with_template in unique_objs

Added unwrapping of vulkan objects embedded in this APIs data buffer.

Change-Id: Ibbee614148d10efe9a954cd793f0e92881300c71
---
 layers/unique_objects.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/layers/unique_objects.cpp b/layers/unique_objects.cpp
index 4d7722bad..64acf43d6 100644
--- a/layers/unique_objects.cpp
+++ b/layers/unique_objects.cpp
@@ -802,14 +802,16 @@ VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer c
                                                                VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate,
                                                                VkPipelineLayout layout, uint32_t set, const void *pData) {
     layer_data *dev_data = GetLayerDataPtr(get_dispatch_key(commandBuffer), layer_data_map);
+    uint64_t template_handle = reinterpret_cast<uint64_t &>(descriptorUpdateTemplate);
     {
         std::lock_guard<std::mutex> lock(global_lock);
-        descriptorUpdateTemplate =
-            (VkDescriptorUpdateTemplateKHR)dev_data->unique_id_mapping[reinterpret_cast<uint64_t &>(descriptorUpdateTemplate)];
+        descriptorUpdateTemplate = (VkDescriptorUpdateTemplateKHR)dev_data->unique_id_mapping[template_handle];
         layout = (VkPipelineLayout)dev_data->unique_id_mapping[reinterpret_cast<uint64_t &>(layout)];
     }
+    void *unwrapped_buffer = BuildUnwrappedUpdateTemplateBuffer(dev_data, template_handle, pData);
     dev_data->device_dispatch_table->CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set,
-                                                                         pData);
+                                                                         unwrapped_buffer);
+    free(unwrapped_buffer);
 }
 
 #ifndef __ANDROID__
-- 
GitLab