aboutsummaryrefslogtreecommitdiff
path: root/layers/draw_state.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/draw_state.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/draw_state.cpp')
-rw-r--r--layers/draw_state.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index cb3e6833..1de84b17 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1443,10 +1443,9 @@ static void initDrawState(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, initDrawState);
- VkResult result = nextTable.CreateDevice((VkPhysicalGpu)gpuw->nextObject, pCreateInfo, pDevice);
+ VkResult result = nextTable.CreateDevice(gpu, pCreateInfo, pDevice);
return result;
}
@@ -1469,8 +1468,8 @@ 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, "DrawState") || !strcmp(pExtName, "drawStateDumpDotFile") ||
!strcmp(pExtName, "drawStateDumpCommandBufferDotFile") || !strcmp(pExtName, "drawStateDumpPngFile"))
@@ -1478,9 +1477,8 @@ 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);
- } else
- {
+ result = nextTable.GetExtensionSupport(gpu, pExtName);
+ } else {
result = VK_ERROR_INVALID_EXTENSION;
}
return result;
@@ -1490,13 +1488,11 @@ 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, initDrawState);
- VkResult result = nextTable.EnumerateLayers((VkPhysicalGpu)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayerCount, pOutLayers, pReserved);
+ VkResult result = nextTable.EnumerateLayers(gpu, maxLayerCount, maxStringSize, pOutLayerCount, pOutLayers, pReserved);
return result;
- } else
- {
+ } else {
if (pOutLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL)
return VK_ERROR_INVALID_POINTER;
// This layer compatible with all GPUs