layers: Remove wrapping of GPU objects by loader and layers
Loader only wraps GPU objects for creating a layer chain. After layer activation
layers and loader use unwrapped gpu object returned by the driver.
This is a large simplification.
This fixes a nasty bug where layers intercepting entrypoints with gpu objects
but not all these entrypoints would fail. These would cause non-uniform
unwrapping of gpu objects by the time the driver was called with a gpu object.
Fixes issue in loader_get_icd where it was trying to compare a wrapped GPU
against a non-wrapped GPU.
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index 1a00669..1b32f88 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -823,10 +823,9 @@
VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu;
loader_platform_thread_once(&g_initOnce, initMemTracker);
- VkResult result = nextTable.CreateDevice((VkPhysicalGpu)gpuw->nextObject, pCreateInfo, pDevice);
+ VkResult result = nextTable.CreateDevice(gpu, pCreateInfo, pDevice);
// Save off device in case we need it to create Fences
globalDevice = *pDevice;
return result;
@@ -867,7 +866,6 @@
VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
VkResult result;
/* This entrypoint is NOT going to init its own dispatch table since loader calls here early */
if (!strcmp(pExtName, "MemTracker"))
@@ -875,7 +873,7 @@
result = VK_SUCCESS;
} else if (nextTable.GetExtensionSupport != NULL)
{
- result = nextTable.GetExtensionSupport((VkPhysicalGpu)gpuw->nextObject, pExtName);
+ result = nextTable.GetExtensionSupport(gpu, pExtName);
} else
{
result = VK_ERROR_INVALID_EXTENSION;
@@ -888,10 +886,9 @@
{
if (gpu != NULL)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu;
loader_platform_thread_once(&g_initOnce, initMemTracker);
- VkResult result = nextTable.EnumerateLayers((VkPhysicalGpu)gpuw->nextObject, maxLayerCount,
+ VkResult result = nextTable.EnumerateLayers(gpu, maxLayerCount,
maxStringSize, pOutLayerCount, pOutLayers, pReserved);
return result;
} else