aboutsummaryrefslogtreecommitdiff
path: root/layers/param_checker.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/param_checker.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/param_checker.cpp')
-rw-r--r--layers/param_checker.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 1ce946ae..4c2b4402 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -148,15 +148,14 @@ VK_LAYER_EXPORT VkResult VKAPI vkEnumerateGpus(VkInstance instance, uint32_t max
VK_LAYER_EXPORT VkResult VKAPI vkGetGpuInfo(VkPhysicalGpu gpu, VkPhysicalGpuInfoType infoType, size_t* pDataSize, void* pData)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu;
loader_platform_thread_once(&tabOnce, initParamChecker);
char str[1024];
if (!validate_VkPhysicalGpuInfoType(infoType)) {
sprintf(str, "Parameter infoType to function GetGpuInfo has invalid value of %i.", (int)infoType);
layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
}
- VkResult result = nextTable.GetGpuInfo((VkPhysicalGpu)gpuw->nextObject, infoType, pDataSize, pData);
+ VkResult result = nextTable.GetGpuInfo(gpu, infoType, pDataSize, pData);
return result;
}
@@ -243,11 +242,10 @@ void PostCreateDevice(VkResult result, VkDevice* pDevice)
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(&tabOnce, initParamChecker);
PreCreateDevice(gpu, pCreateInfo);
- VkResult result = nextTable.CreateDevice((VkPhysicalGpu)gpuw->nextObject, pCreateInfo, pDevice);
+ VkResult result = nextTable.CreateDevice(gpu, pCreateInfo, pDevice);
PostCreateDevice(result, pDevice);
return result;
}
@@ -261,11 +259,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device)
VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu;
loader_platform_thread_once(&tabOnce, initParamChecker);
- VkResult result = nextTable.GetExtensionSupport((VkPhysicalGpu)gpuw->nextObject, pExtName);
+ VkResult result = nextTable.GetExtensionSupport(gpu, pExtName);
return result;
}
@@ -273,12 +270,11 @@ VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxLa
{
char str[1024];
if (gpu != NULL) {
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
sprintf(str, "At start of layered EnumerateLayers\n");
layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, nullptr, 0, 0, "PARAMCHECK", str);
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu;
loader_platform_thread_once(&tabOnce, initParamChecker);
- VkResult result = nextTable.EnumerateLayers((VkPhysicalGpu)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayerCount, pOutLayers, pReserved);
+ VkResult result = nextTable.EnumerateLayers(gpu, maxLayerCount, maxStringSize, pOutLayerCount, pOutLayers, pReserved);
sprintf(str, "Completed layered EnumerateLayers\n");
layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, nullptr, 0, 0, "PARAMCHECK", str);
fflush(stdout);
@@ -386,11 +382,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkPinSystemMemory(VkDevice device, const void* pS
VK_LAYER_EXPORT VkResult VKAPI vkGetMultiGpuCompatibility(VkPhysicalGpu gpu0, VkPhysicalGpu gpu1, VkGpuCompatibilityInfo* pInfo)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu0;
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu0;
loader_platform_thread_once(&tabOnce, initParamChecker);
- VkResult result = nextTable.GetMultiGpuCompatibility((VkPhysicalGpu)gpuw->nextObject, gpu1, pInfo);
+ VkResult result = nextTable.GetMultiGpuCompatibility(gpu0, gpu1, pInfo);
return result;
}
@@ -1932,11 +1927,10 @@ VK_LAYER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer)
VK_LAYER_EXPORT VkResult VKAPI vkWsiX11AssociateConnection(VkPhysicalGpu gpu, const VK_WSI_X11_CONNECTION_INFO* pConnectionInfo)
{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
- pCurObj = gpuw;
+ pCurObj = (VkBaseLayerObject *) gpu;
loader_platform_thread_once(&tabOnce, initParamChecker);
- VkResult result = nextTable.WsiX11AssociateConnection((VkPhysicalGpu)gpuw->nextObject, pConnectionInfo);
+ VkResult result = nextTable.WsiX11AssociateConnection(gpu, pConnectionInfo);
return result;
}