loader: refactor layer activation function to handle more general inputs
Renamed structure types as well.
TODO: verify vk-layer-generate.py
v2: fix LoaderEntrypointsSubcommand (olv)
diff --git a/layers/basic.cpp b/layers/basic.cpp
index 9501c13..3854577 100644
--- a/layers/basic.cpp
+++ b/layers/basic.cpp
@@ -32,17 +32,17 @@
// being used:
#include "loader_platform.h"
-static std::unordered_map<void *, VK_LAYER_DISPATCH_TABLE *> tableMap;
+static std::unordered_map<void *, VkLayerDispatchTable *> tableMap;
-static VK_LAYER_DISPATCH_TABLE * initLayerTable(const VK_BASE_LAYER_OBJECT *gpuw)
+static VkLayerDispatchTable * initLayerTable(const VkBaseLayerObject *gpuw)
{
- VK_LAYER_DISPATCH_TABLE *pTable;
+ VkLayerDispatchTable *pTable;
assert(gpuw);
- std::unordered_map<void *, VK_LAYER_DISPATCH_TABLE *>::const_iterator it = tableMap.find((void *) gpuw);
+ std::unordered_map<void *, VkLayerDispatchTable *>::const_iterator it = tableMap.find((void *) gpuw);
if (it == tableMap.end())
{
- pTable = new VK_LAYER_DISPATCH_TABLE;
+ pTable = new VkLayerDispatchTable;
tableMap[(void *) gpuw] = pTable;
} else
{
@@ -64,7 +64,7 @@
VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
{
VkResult result;
- VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu;
+ VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
/* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
if (!strncmp(pExtName, "vkLayerExtension1", strlen("vkLayerExtension1")))
@@ -76,7 +76,7 @@
} else if (!tableMap.empty() && (tableMap.find(gpuw) != tableMap.end()))
{
printf("At start of wrapped vkGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
- VK_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw];
+ VkLayerDispatchTable* pTable = tableMap[gpuw];
result = pTable->GetExtensionSupport((VkPhysicalGpu)gpuw->nextObject, pExtName);
printf("Completed wrapped vkGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
} else
@@ -88,8 +88,8 @@
VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
{
- VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu;
- VK_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw];
+ VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
+ VkLayerDispatchTable* pTable = tableMap[gpuw];
printf("At start of wrapped vkCreateDevice() call w/ gpu: %p\n", (void*)gpu);
VkResult result = pTable->CreateDevice((VkPhysicalGpu)gpuw->nextObject, pCreateInfo, pDevice);
@@ -100,7 +100,7 @@
}
VK_LAYER_EXPORT VkResult VKAPI vkGetFormatInfo(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData)
{
- VK_LAYER_DISPATCH_TABLE* pTable = tableMap[device];
+ VkLayerDispatchTable* pTable = tableMap[device];
printf("At start of wrapped vkGetFormatInfo() call w/ device: %p\n", (void*)device);
VkResult result = pTable->GetFormatInfo(device, format, infoType, pDataSize, pData);
@@ -112,8 +112,8 @@
{
if (gpu != NULL)
{
- VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu;
- VK_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw);
+ VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
+ VkLayerDispatchTable* pTable = initLayerTable(gpuw);
printf("At start of wrapped vkEnumerateLayers() call w/ gpu: %p\n", gpu);
VkResult result = pTable->EnumerateLayers((VkPhysicalGpu)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayerCount, pOutLayers, pReserved);
@@ -124,7 +124,7 @@
return VK_ERROR_INVALID_POINTER;
// Example of a layer that is only compatible with Intel's GPUs
- VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT*) pReserved;
+ VkBaseLayerObject* gpuw = (VkBaseLayerObject*) pReserved;
PFN_vkGetGpuInfo fpGetGpuInfo;
VkPhysicalGpuProperties gpuProps;
size_t dataSize = sizeof(VkPhysicalGpuProperties);
@@ -147,7 +147,7 @@
if (gpu == NULL)
return NULL;
- initLayerTable((const VK_BASE_LAYER_OBJECT *) gpu);
+ initLayerTable((const VkBaseLayerObject *) gpu);
if (!strncmp("vkGetProcAddr", pName, sizeof("vkGetProcAddr")))
return (void *) vkGetProcAddr;
@@ -162,7 +162,7 @@
else if (!strncmp("vkLayerExtension1", pName, sizeof("vkLayerExtension1")))
return (void *) vkLayerExtension1;
else {
- VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu;
+ VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
if (gpuw->pGPA == NULL)
return NULL;
return gpuw->pGPA((VkPhysicalGpu) gpuw->nextObject, pName);