aboutsummaryrefslogtreecommitdiff
path: root/layers/mem_tracker.cpp
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-04-08 21:33:34 -0600
committerChia-I Wu <olv@lunarg.com>2015-04-16 17:48:19 +0800
commita65963a5c7edcfd5e44f8d5102e8379ba86916ec (patch)
tree4d931bb5a34a6ec5b6cb77001f7f627d7b2a8227 /layers/mem_tracker.cpp
parent17cef59f95e4ffa518740c575dc18d59a4007fad (diff)
downloadusermoji-a65963a5c7edcfd5e44f8d5102e8379ba86916ec.tar.xz
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.
Diffstat (limited to 'layers/mem_tracker.cpp')
-rw-r--r--layers/mem_tracker.cpp13
1 files changed, 5 insertions, 8 deletions
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