From a65963a5c7edcfd5e44f8d5102e8379ba86916ec Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Wed, 8 Apr 2015 21:33:34 -0600 Subject: 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. --- layers/mem_tracker.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'layers/mem_tracker.cpp') diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index 1a00669c..1b32f886 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -823,10 +823,9 @@ static void initMemTracker(void) 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 vkDestroyDevice(VkDevice device) 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 @@ VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const ch 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 @@ VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxLa { 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 -- cgit v1.2.3