#include "vk_safe_struct.h"
#include "vk_layer_utils.h"
+// All increments must be guarded by global_lock
+static uint64_t global_unique_id = 1;
+
struct layer_data {
bool wsi_enabled;
- uint64_t unique_id; // All increments are guarded by global_lock
std::unordered_map<uint64_t, uint64_t> unique_id_mapping; // Map uniqueID to actual object handle
VkPhysicalDevice gpu;
- layer_data() : wsi_enabled(false), unique_id(1), gpu(VK_NULL_HANDLE){};
+ layer_data() : wsi_enabled(false), gpu(VK_NULL_HANDLE){};
};
struct instExts {
uint64_t unique_id = 0;
std::lock_guard<std::mutex> lock(global_lock);
for (uint32_t i = 0; i < createInfoCount; ++i) {
- unique_id = my_device_data->unique_id++;
+ unique_id = global_unique_id++;
my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
}
uint64_t unique_id = 0;
std::lock_guard<std::mutex> lock(global_lock);
for (uint32_t i = 0; i < createInfoCount; ++i) {
- unique_id = my_device_data->unique_id++;
+ unique_id = global_unique_id++;
my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
}
delete local_pCreateInfo;
if (VK_SUCCESS == result) {
std::lock_guard<std::mutex> lock(global_lock);
- uint64_t unique_id = my_map_data->unique_id++;
+ uint64_t unique_id =global_unique_id++;
my_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(*pSwapchain);
*pSwapchain = reinterpret_cast<VkSwapchainKHR &>(unique_id);
}
uint64_t unique_id = 0;
std::lock_guard<std::mutex> lock(global_lock);
for (uint32_t i = 0; i < *pSwapchainImageCount; ++i) {
- unique_id = my_device_data->unique_id++;
+ unique_id = global_unique_id++;
my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pSwapchainImages[i]);
pSwapchainImages[i] = reinterpret_cast<VkImage &>(unique_id);
}
local_name = '%ss' % (local_name) # add 's' to end for vector of many
post_call_txt += '%sfor (uint32_t i=0; i<%s; ++i) {\n' % (indent, custom_create_dict[obj_name])
indent += ' '
- post_call_txt += '%suint64_t unique_id = my_map_data->unique_id++;\n' % (indent)
+ post_call_txt += '%suint64_t unique_id = global_unique_id++;\n' % (indent)
post_call_txt += '%smy_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(%s[i]);\n' % (indent, obj_name)
post_call_txt += '%s%s[i] = reinterpret_cast<%s&>(unique_id);\n' % (indent, obj_name, obj_type)
indent = indent[4:]
post_call_txt += '%s}\n' % (indent)
else:
post_call_txt += '%s\n' % (self.lineinfo.get())
- post_call_txt += '%suint64_t unique_id = my_map_data->unique_id++;\n' % (indent)
+ post_call_txt += '%suint64_t unique_id = global_unique_id++;\n' % (indent)
post_call_txt += '%smy_map_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(*%s);\n' % (indent, obj_name)
post_call_txt += '%s*%s = reinterpret_cast<%s&>(unique_id);\n' % (indent, obj_name, obj_type)
indent = indent[4:]