layers: mem_tracker: Change to new WSI query functions.
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index 40af60c..510af12 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -2951,8 +2951,8 @@
if (pInfo->images.size() > 0) {
for (auto it = pInfo->images.begin(); it != pInfo->images.end(); it++) {
- clear_object_binding(device, it->image.handle, VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
- auto image_item = imageMap.find(it->image.handle);
+ clear_object_binding(device, it->handle, VK_OBJECT_TYPE_SWAP_CHAIN_WSI);
+ auto image_item = imageMap.find(it->handle);
if (image_item != imageMap.end())
imageMap.erase(image_item);
}
@@ -2964,35 +2964,34 @@
return get_dispatch_table(mem_tracker_device_table_map, device)->DestroySwapChainWSI(device, swapChain);
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
+VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainImagesWSI(
VkDevice device,
VkSwapChainWSI swapChain,
- VkSwapChainInfoTypeWSI infoType,
- size_t *pDataSize,
- void *pData)
+ uint32_t* pCount,
+ VkImage* pSwapChainImages)
{
- VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->GetSwapChainInfoWSI(device, swapChain, infoType, pDataSize, pData);
+ VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->GetSwapChainImagesWSI(device, swapChain, pCount, pSwapChainImages);
- if (infoType == VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI && result == VK_SUCCESS && pData != NULL) {
- const size_t count = *pDataSize / sizeof(VkSwapChainImagePropertiesWSI);
+ if (result == VK_SUCCESS && pSwapChainImages != NULL) {
+ const size_t count = *pCount;
MT_SWAP_CHAIN_INFO *pInfo = swapChainMap[swapChain.handle];
if (pInfo->images.empty()) {
pInfo->images.resize(count);
- memcpy(&pInfo->images[0], pData, sizeof(pInfo->images[0]) * count);
+ memcpy(&pInfo->images[0], pSwapChainImages, sizeof(pInfo->images[0]) * count);
if (pInfo->images.size() > 0) {
- for (std::vector<VkSwapChainImagePropertiesWSI>::const_iterator it = pInfo->images.begin();
+ for (std::vector<VkImage>::const_iterator it = pInfo->images.begin();
it != pInfo->images.end(); it++) {
// Add image object binding, then insert the new Mem Object and then bind it to created image
- add_object_create_info(it->image.handle, VK_OBJECT_TYPE_SWAP_CHAIN_WSI, &pInfo->createInfo);
+ add_object_create_info(it->handle, VK_OBJECT_TYPE_SWAP_CHAIN_WSI, &pInfo->createInfo);
}
}
} else {
- const size_t count = *pDataSize / sizeof(VkSwapChainImagePropertiesWSI);
+ const size_t count = *pCount;
MT_SWAP_CHAIN_INFO *pInfo = swapChainMap[swapChain.handle];
const bool mismatch = (pInfo->images.size() != count ||
- memcmp(&pInfo->images[0], pData, sizeof(pInfo->images[0]) * count));
+ memcmp(&pInfo->images[0], pSwapChainImages, sizeof(pInfo->images[0]) * count));
if (mismatch) {
// TODO : Want swapChain to be srcObj here
@@ -3191,14 +3190,12 @@
layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(dev), layer_data_map);
if (my_device_data->wsi_enabled)
{
-// if (!strcmp(funcName, "vkGetSurfaceInfoWSI"))
-// return (PFN_vkVoidFunction) vkGetSurfaceInfoWSI;
if (!strcmp(funcName, "vkCreateSwapChainWSI"))
return (PFN_vkVoidFunction) vkCreateSwapChainWSI;
if (!strcmp(funcName, "vkDestroySwapChainWSI"))
return (PFN_vkVoidFunction) vkDestroySwapChainWSI;
- if (!strcmp(funcName, "vkGetSwapChainInfoWSI"))
- return (PFN_vkVoidFunction) vkGetSwapChainInfoWSI;
+ if (!strcmp(funcName, "vkGetSwapChainImagesWSI"))
+ return (PFN_vkVoidFunction) vkGetSwapChainImagesWSI;
// if (!strcmp(funcName, "vkAcquireNextImageWSI"))
// return (PFN_vkVoidFunction) vkAcquireNextImageWSI;
// if (!strcmp(funcName, "vkQueuePresentWSI"))
diff --git a/layers/mem_tracker.h b/layers/mem_tracker.h
index 9d29dcf..31e728a 100644
--- a/layers/mem_tracker.h
+++ b/layers/mem_tracker.h
@@ -140,7 +140,7 @@
struct MT_SWAP_CHAIN_INFO {
VkSwapChainCreateInfoWSI createInfo;
- std::vector<VkSwapChainImagePropertiesWSI> images;
+ std::vector<VkImage> images;
};
#ifdef __cplusplus
diff --git a/layers/screenshot.cpp b/layers/screenshot.cpp
index 7f8ce4a..a9313bb 100644
--- a/layers/screenshot.cpp
+++ b/layers/screenshot.cpp
@@ -426,14 +426,13 @@
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(
+VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainImagesWSI(
VkDevice device,
VkSwapChainWSI swapChain,
- VkSwapChainInfoTypeWSI infoType,
- size_t *pDataSize,
- void *pData)
+ uint32_t* pCount,
+ VkImage* pSwapChainImages)
{
- VkResult result = get_dispatch_table(screenshot_device_table_map, device)->GetSwapChainInfoWSI(device, swapChain, infoType, pDataSize, pData);
+ VkResult result = get_dispatch_table(screenshot_device_table_map, device)->GetSwapChainImagesWSI(device, swapChain, pCount, pSwapChainImages);
loader_platform_thread_lock_mutex(&globalLock);
if (screenshotEnvQueried && screenshotFrames.empty()) {
@@ -443,20 +442,19 @@
}
if (result == VK_SUCCESS &&
- pData &&
+ pSwapChainImages &&
!swapchainMap.empty() && swapchainMap.find(swapChain.handle) != swapchainMap.end())
- {
- VkSwapChainImagePropertiesWSI *swapChainImageInfo = (VkSwapChainImagePropertiesWSI *)pData;
+ {
int i;
- for (i=0; i<*pDataSize/sizeof(VkSwapChainImagePropertiesWSI); i++,swapChainImageInfo++)
+ for (i=0; i<*pCount; i++)
{
// Create a mapping for an image to a device, image extent, and format
ImageMapStruct *imageMapElem = new ImageMapStruct;
imageMapElem->device = swapchainMap[swapChain.handle]->device;
imageMapElem->imageExtent = swapchainMap[swapChain.handle]->imageExtent;
imageMapElem->format = swapchainMap[swapChain.handle]->format;
- imageMap.insert(make_pair(swapChainImageInfo->image.handle, imageMapElem));
+ imageMap.insert(make_pair(pSwapChainImages[i].handle, imageMapElem));
}
// Add list of images to swapchain to image map
@@ -465,10 +463,9 @@
{
VkImage *imageList = new VkImage[i];
swapchainMapElem->imageList = imageList;
- VkSwapChainImagePropertiesWSI *swapChainImageInfo = (VkSwapChainImagePropertiesWSI *)pData;
- for (int j=0; j<i; j++,swapChainImageInfo++)
+ for (int j=0; j<i; j++)
{
- swapchainMapElem->imageList[j] = swapChainImageInfo->image.handle;
+ swapchainMapElem->imageList[j] = pSwapChainImages[j].handle;
}
}
@@ -590,8 +587,8 @@
{
if (!strcmp(funcName, "vkCreateSwapChainWSI"))
return (PFN_vkVoidFunction) vkCreateSwapChainWSI;
- if (!strcmp(funcName, "vkGetSwapChainInfoWSI"))
- return (PFN_vkVoidFunction) vkGetSwapChainInfoWSI;
+ if (!strcmp(funcName, "vkGetSwapChainImagesWSI"))
+ return (PFN_vkVoidFunction) vkGetSwapChainImagesWSI;
if (!strcmp(funcName, "vkQueuePresentWSI"))
return (PFN_vkVoidFunction) vkQueuePresentWSI;
}
diff --git a/vk-layer-generate.py b/vk-layer-generate.py
index 93377ee..5466aaa 100755
--- a/vk-layer-generate.py
+++ b/vk-layer-generate.py
@@ -648,7 +648,7 @@
self.layer_name = "Generic"
extensions=[('wsi_enabled',
['vkCreateSwapChainWSI', 'vkDestroySwapChainWSI',
- 'vkGetSwapChainInfoWSI', 'vkQueuePresentWSI'])]
+ 'vkGetSwapChainImagesWSI', 'vkQueuePresentWSI'])]
body = [self._generate_layer_initialization(True),
self._generate_dispatch_entrypoints("VK_LAYER_EXPORT"),
self._gen_create_msg_callback(),
@@ -1047,7 +1047,7 @@
self.layer_name = "APIDump"
extensions=[('wsi_enabled',
['vkCreateSwapChainWSI', 'vkDestroySwapChainWSI',
- 'vkGetSwapChainInfoWSI', 'vkQueuePresentWSI'])]
+ 'vkGetSwapChainImagesWSI', 'vkQueuePresentWSI'])]
body = [self.generate_init(),
self._generate_dispatch_entrypoints("VK_LAYER_EXPORT"),
self._generate_layer_gpa_function(extensions)]
@@ -1511,7 +1511,7 @@
self.layer_name = "ObjectTracker"
extensions=[('wsi_enabled',
['vkCreateSwapChainWSI', 'vkDestroySwapChainWSI',
- 'vkGetSwapChainInfoWSI', 'vkQueuePresentWSI'])]
+ 'vkGetSwapChainImagesWSI', 'vkQueuePresentWSI'])]
body = [self.generate_maps(),
self.generate_procs(),
self.generate_destroy_instance(),
diff --git a/vk_helper.py b/vk_helper.py
index cc28cd0..6ffa482 100755
--- a/vk_helper.py
+++ b/vk_helper.py
@@ -993,6 +993,24 @@
sh_funcs.append(" return final_str;")
sh_funcs.append("}")
sh_funcs.append('%s' % lineinfo.get())
+ #### TODO: Get the following function moved to be in "vk_enum_string_helper.h"
+ # Add function to return a string value for input VkSurfaceFormatWSI*
+ sh_funcs.append("static inline const char* string_VkColorSpaceWSI(VkColorSpaceWSI input_value)\n{")
+ sh_funcs.append(" switch ((VkColorSpaceWSI)input_value)")
+ sh_funcs.append(" {")
+ sh_funcs.append(" case VK_COLORSPACE_SRGB_NONLINEAR_WSI:")
+ sh_funcs.append(" return \"VK_COLORSPACE_SRGB_NONLINEAR_WSI\";")
+ sh_funcs.append(" default:")
+ sh_funcs.append(" return \"Unhandled VkColorSpaceWSI\";")
+ sh_funcs.append(" }")
+ sh_funcs.append("}")
+ sh_funcs.append('%s' % lineinfo.get())
+ # Add function to return a string value for input VkSurfaceFormatWSI*
+ sh_funcs.append("string string_convert_helper(VkSurfaceFormatWSI toString, const string prefix)\n{")
+ sh_funcs.append(' string final_str = prefix + "format = " + string_VkFormat(toString.format) + "format = " + string_VkColorSpaceWSI(toString.colorSpace);')
+ sh_funcs.append(" return final_str;")
+ sh_funcs.append("}")
+ sh_funcs.append('%s' % lineinfo.get())
# Add function to dynamically print out unknown struct
sh_funcs.append("string dynamic_display(const void* pStruct, const string prefix)\n{")
sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct")