* Authors:
* Courtney Goeltzenleuchter <courtney@lunarg.com>
*/
+#pragma once
-#ifndef GENERIC_H
-#define GENERIC_H
-#include "vkLayer.h"
+#include "vk_layer.h"
/*
* This file contains static functions for the generated layer Generic
}
};
+struct devExts {
+ bool wsi_enabled;
+};
+
+struct instExts {
+ bool wsi_enabled;
+};
+
+static std::unordered_map<void *, struct devExts> deviceExtMap;
+static std::unordered_map<void *, struct instExts> instanceExtMap;
+
+static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)
+{
+ uint32_t i;
+ VkLayerDispatchTable *pDisp = device_dispatch_table(device);
+ PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;
+ pDisp->GetSurfacePropertiesKHR = (PFN_vkGetSurfacePropertiesKHR) gpa(device, "vkGetSurfacePropertiesKHR");
+ pDisp->GetSurfaceFormatsKHR = (PFN_vkGetSurfaceFormatsKHR) gpa(device, "vkGetSurfaceFormatsKHR");
+ pDisp->GetSurfacePresentModesKHR = (PFN_vkGetSurfacePresentModesKHR) gpa(device, "vkGetSurfacePresentModesKHR");
+ pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR");
+ pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(device, "vkDestroySwapchainKHR");
+ pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR");
+ pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR");
+ pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR");
-#endif // GENERIC_H
+ deviceExtMap[pDisp].wsi_enabled = false;
+ for (i = 0; i < pCreateInfo->extensionCount; i++) {
+ if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NAME) == 0)
+ deviceExtMap[pDisp].wsi_enabled = true;
+
+ }
+}
+
+static void createInstanceRegisterExtensions(const VkInstanceCreateInfo* pCreateInfo, VkInstance instance)
+{
+ uint32_t i;
+ VkLayerInstanceDispatchTable *pDisp = instance_dispatch_table(instance);
+ PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;
+ pDisp->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
+ instanceExtMap[pDisp].wsi_enabled = false;
+ for (i = 0; i < pCreateInfo->extensionCount; i++) {
+ if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)
+ instanceExtMap[pDisp].wsi_enabled = true;
+
+ }
+}
}
};
+struct devExts {
+ bool wsi_enabled;
+};
+struct instExts {
+ bool wsi_enabled;
+};
+static std::unordered_map<void *, struct devExts> deviceExtMap;
+static std::unordered_map<void *, struct instExts> instanceExtMap;
+
+static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)
+{
+ uint32_t i;
+ VkLayerDispatchTable *pDisp = device_dispatch_table(device);
+ PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;
+ pDisp->GetSurfacePropertiesKHR = (PFN_vkGetSurfacePropertiesKHR) gpa(device, "vkGetSurfacePropertiesKHR");
+ pDisp->GetSurfaceFormatsKHR = (PFN_vkGetSurfaceFormatsKHR) gpa(device, "vkGetSurfaceFormatsKHR");
+ pDisp->GetSurfacePresentModesKHR = (PFN_vkGetSurfacePresentModesKHR) gpa(device, "vkGetSurfacePresentModesKHR");
+ pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR");
+ pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(device, "vkDestroySwapchainKHR");
+ pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR");
+ pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR");
+ pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR");
+
+ deviceExtMap[pDisp].wsi_enabled = false;
+ for (i = 0; i < pCreateInfo->extensionCount; i++) {
+ if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NAME) == 0)
+ deviceExtMap[pDisp].wsi_enabled = true;
+ }
+}
+
+static void createInstanceRegisterExtensions(const VkInstanceCreateInfo* pCreateInfo, VkInstance instance)
+{
+ uint32_t i;
+ VkLayerInstanceDispatchTable *pDisp = instance_dispatch_table(instance);
+ PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;
+ pDisp->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
+ instanceExtMap[pDisp].wsi_enabled = false;
+ for (i = 0; i < pCreateInfo->extensionCount; i++) {
+ if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)
+ instanceExtMap[pDisp].wsi_enabled = true;
+
+ }
+}
#endif // GENERIC_H
gen_header.append('#define LAYER_EXT_ARRAY_SIZE 1')
gen_header.append('#define LAYER_DEV_EXT_ARRAY_SIZE 1')
gen_header.append('static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(initOnce);')
- gen_header.append('struct devExts {')
- gen_header.append(' bool wsi_enabled;')
- gen_header.append('};')
- gen_header.append('struct instExts {')
- gen_header.append(' bool wsi_enabled;')
- gen_header.append('};')
- gen_header.append('static std::unordered_map<void *, struct devExts> deviceExtMap;')
- gen_header.append('static std::unordered_map<void *, struct instExts> instanceExtMap;')
- gen_header.append('')
- gen_header.append('static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)')
- gen_header.append('{')
- gen_header.append(' uint32_t i;')
- gen_header.append(' VkLayerDispatchTable *pDisp = device_dispatch_table(device);')
- gen_header.append(' PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;')
- gen_header.append(' pDisp->GetSurfacePropertiesKHR = (PFN_vkGetSurfacePropertiesKHR) gpa(device, "vkGetSurfacePropertiesKHR");')
- gen_header.append(' pDisp->GetSurfaceFormatsKHR = (PFN_vkGetSurfaceFormatsKHR) gpa(device, "vkGetSurfaceFormatsKHR");')
- gen_header.append(' pDisp->GetSurfacePresentModesKHR = (PFN_vkGetSurfacePresentModesKHR) gpa(device, "vkGetSurfacePresentModesKHR");')
- gen_header.append(' pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR");')
- gen_header.append(' pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(device, "vkDestroySwapchainKHR");')
- gen_header.append(' pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR");')
- gen_header.append(' pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR");')
- gen_header.append(' pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR");\n')
- gen_header.append(' deviceExtMap[pDisp].wsi_enabled = false;')
- gen_header.append(' for (i = 0; i < pCreateInfo->extensionCount; i++) {')
- gen_header.append(' if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NAME) == 0)')
- gen_header.append(' deviceExtMap[pDisp].wsi_enabled = true;')
- gen_header.append('')
- gen_header.append(' }')
- gen_header.append('}\n')
- gen_header.append('static void createInstanceRegisterExtensions(const VkInstanceCreateInfo* pCreateInfo, VkInstance instance)')
- gen_header.append('{')
- gen_header.append(' uint32_t i;')
- gen_header.append(' VkLayerInstanceDispatchTable *pDisp = instance_dispatch_table(instance);')
- gen_header.append(' PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;')
- gen_header.append(' pDisp->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");')
- gen_header.append(' instanceExtMap[pDisp].wsi_enabled = false;')
- gen_header.append(' for (i = 0; i < pCreateInfo->extensionCount; i++) {')
- gen_header.append(' if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)')
- gen_header.append(' instanceExtMap[pDisp].wsi_enabled = true;')
- gen_header.append('')
- gen_header.append(' }')
- gen_header.append('}')
gen_header.append('')
return "\n".join(gen_header)
header_txt.append('#include "vk_layer_table.h"')
header_txt.append('#include "vk_layer_extension_utils.h"')
header_txt.append('#include <unordered_map>')
+ header_txt.append('#include "apidump.h"')
header_txt.append('')
header_txt.append('static std::ofstream fileStream;')
header_txt.append('static std::string fileName = "vk_apidump.txt";')
header_txt.append(' assert(maxTID < MAX_TID);')
header_txt.append(' return retVal;')
header_txt.append('}')
- header_txt.append('struct devExts {')
- header_txt.append(' bool wsi_enabled;')
- header_txt.append('};')
- header_txt.append('')
- header_txt.append('struct instExts {')
- header_txt.append(' bool wsi_enabled;')
- header_txt.append('};')
- header_txt.append('')
- header_txt.append('static std::unordered_map<void *, struct devExts> deviceExtMap;')
- header_txt.append('static std::unordered_map<void *, struct instExts> instanceExtMap;')
- header_txt.append('')
- header_txt.append('static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)')
- header_txt.append('{')
- header_txt.append(' uint32_t i;')
- header_txt.append(' VkLayerDispatchTable *pDisp = device_dispatch_table(device);')
- header_txt.append(' PFN_vkGetDeviceProcAddr gpa = pDisp->GetDeviceProcAddr;')
- header_txt.append(' pDisp->GetSurfacePropertiesKHR = (PFN_vkGetSurfacePropertiesKHR) gpa(device, "vkGetSurfacePropertiesKHR");')
- header_txt.append(' pDisp->GetSurfaceFormatsKHR = (PFN_vkGetSurfaceFormatsKHR) gpa(device, "vkGetSurfaceFormatsKHR");')
- header_txt.append(' pDisp->GetSurfacePresentModesKHR = (PFN_vkGetSurfacePresentModesKHR) gpa(device, "vkGetSurfacePresentModesKHR");')
- header_txt.append(' pDisp->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) gpa(device, "vkCreateSwapchainKHR");')
- header_txt.append(' pDisp->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) gpa(device, "vkDestroySwapchainKHR");')
- header_txt.append(' pDisp->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) gpa(device, "vkGetSwapchainImagesKHR");')
- header_txt.append(' pDisp->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) gpa(device, "vkAcquireNextImageKHR");')
- header_txt.append(' pDisp->QueuePresentKHR = (PFN_vkQueuePresentKHR) gpa(device, "vkQueuePresentKHR");\n')
- header_txt.append(' deviceExtMap[pDisp].wsi_enabled = false;')
- header_txt.append(' for (i = 0; i < pCreateInfo->extensionCount; i++) {')
- header_txt.append(' if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_DEVICE_SWAPCHAIN_EXTENSION_NAME) == 0)')
- header_txt.append(' deviceExtMap[pDisp].wsi_enabled = true;')
- header_txt.append('')
- header_txt.append(' }')
- header_txt.append('}\n')
- header_txt.append('static void createInstanceRegisterExtensions(const VkInstanceCreateInfo* pCreateInfo, VkInstance instance)')
- header_txt.append('{')
- header_txt.append(' uint32_t i;')
- header_txt.append(' VkLayerInstanceDispatchTable *pDisp = instance_dispatch_table(instance);')
- header_txt.append(' PFN_vkGetInstanceProcAddr gpa = pDisp->GetInstanceProcAddr;')
- header_txt.append(' pDisp->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");')
- header_txt.append(' instanceExtMap[pDisp].wsi_enabled = false;')
- header_txt.append(' for (i = 0; i < pCreateInfo->extensionCount; i++) {')
- header_txt.append(' if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME) == 0)')
- header_txt.append(' instanceExtMap[pDisp].wsi_enabled = true;')
- header_txt.append('')
- header_txt.append(' }')
- header_txt.append('}\n')
header_txt.append('')
header_txt.append('void interpret_memBarriers(const void* const* ppMemBarriers, uint32_t memBarrierCount)')
header_txt.append('{')