From ebae832becfe966d2f413ca17cd2f9e7d4e804f1 Mon Sep 17 00:00:00 2001 From: Mike Stroyan Date: Fri, 17 Apr 2015 12:36:38 -0600 Subject: update to vulkan.h header version 90, bug 13529 --- layers/draw_state.cpp | 24 +++++++------- layers/glave_snapshot.c | 78 ++++++++++++++++++++++---------------------- layers/layers_msg.h | 4 +-- layers/mem_tracker.cpp | 54 ++++++++++++++++++++----------- layers/multi.cpp | 4 +-- layers/param_checker.cpp | 84 ++++++++++++++++++++++++------------------------ 6 files changed, 133 insertions(+), 115 deletions(-) (limited to 'layers') diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 852eb915..aae865b8 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -1546,10 +1546,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCo return result; } -VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkObject object) +VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object) { // TODO : When wrapped objects (such as dynamic state) are destroyed, need to clean up memory - VkResult result = nextTable.DestroyObject(object); + VkResult result = nextTable.DestroyObject(device, objType, object); return result; } @@ -1746,13 +1746,13 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescrip // Insert this pool into Global Pool LL at head char str[1024]; sprintf(str, "Created Descriptor Pool %p", (void*)*pDescriptorPool); - layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, (VkBaseObject)pDescriptorPool, 0, DRAWSTATE_NONE, "DS", str); + layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, (VkObject)pDescriptorPool, 0, DRAWSTATE_NONE, "DS", str); loader_platform_thread_lock_mutex(&globalLock); POOL_NODE* pNewNode = new POOL_NODE; if (NULL == pNewNode) { char str[1024]; sprintf(str, "Out of memory while attempting to allocate POOL_NODE in vkCreateDescriptorPool()"); - layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, (VkBaseObject)*pDescriptorPool, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", str); + layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, (VkObject)*pDescriptorPool, 0, DRAWSTATE_OUT_OF_MEMORY, "DS", str); } else { memset(pNewNode, 0, sizeof(POOL_NODE)); @@ -1777,18 +1777,18 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescrip return result; } -VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDescriptorPool descriptorPool) +VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) { - VkResult result = nextTable.ResetDescriptorPool(descriptorPool); + VkResult result = nextTable.ResetDescriptorPool(device, descriptorPool); if (VK_SUCCESS == result) { clearDescriptorPool(descriptorPool); } return result; } -VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) +VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) { - VkResult result = nextTable.AllocDescriptorSets(descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); + VkResult result = nextTable.AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); if ((VK_SUCCESS == result) || (*pCount > 0)) { POOL_NODE *pPoolNode = getPoolNode(descriptorPool); if (!pPoolNode) { @@ -1837,15 +1837,15 @@ VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDescriptorPool descriptor return result; } -VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) +VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) { for (uint32_t i = 0; i < count; i++) { clearDescriptorSet(pDescriptorSets[i]); } - nextTable.ClearDescriptorSets(descriptorPool, count, pDescriptorSets); + nextTable.ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets); } -VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) +VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDevice device, VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) { SET_NODE* pSet = getSetNode(descriptorSet); if (!dsUpdateActive(descriptorSet)) { @@ -1858,7 +1858,7 @@ VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDescriptorSet descriptorSet, ui dsUpdate(descriptorSet, updateCount, ppUpdateArray); } - nextTable.UpdateDescriptors(descriptorSet, updateCount, ppUpdateArray); + nextTable.UpdateDescriptors(device, descriptorSet, updateCount, ppUpdateArray); } VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState) diff --git a/layers/glave_snapshot.c b/layers/glave_snapshot.c index b4a25076..81a2b588 100644 --- a/layers/glave_snapshot.c +++ b/layers/glave_snapshot.c @@ -610,41 +610,41 @@ VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllo return result; } -VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkGpuMemory mem) +VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkGpuMemory mem) { - VkResult result = nextTable.FreeMemory(mem); + VkResult result = nextTable.FreeMemory(device, mem); loader_platform_thread_lock_mutex(&objLock); snapshot_remove_object(&s_delta, (void*)mem); loader_platform_thread_unlock_mutex(&objLock); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkGpuMemory mem, VkMemoryPriority priority) +VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkGpuMemory mem, VkMemoryPriority priority) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.SetMemoryPriority(mem, priority); + VkResult result = nextTable.SetMemoryPriority(device, mem, priority); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkGpuMemory mem, VkFlags flags, void** ppData) +VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkGpuMemory mem, VkFlags flags, void** ppData) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY); loader_platform_thread_unlock_mutex(&objLock); set_status((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY, OBJSTATUS_GPU_MEM_MAPPED); - VkResult result = nextTable.MapMemory(mem, flags, ppData); + VkResult result = nextTable.MapMemory(device, mem, flags, ppData); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkGpuMemory mem) +VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkGpuMemory mem) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY); loader_platform_thread_unlock_mutex(&objLock); reset_status((void*)mem, VK_OBJECT_TYPE_GPU_MEMORY, OBJSTATUS_GPU_MEM_MAPPED); - VkResult result = nextTable.UnmapMemory(mem); + VkResult result = nextTable.UnmapMemory(device, mem); return result; } @@ -705,39 +705,39 @@ VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImag return result; } -VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkObject object) +VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object) { - VkResult result = nextTable.DestroyObject(object); + VkResult result = nextTable.DestroyObject(device, objType, object); loader_platform_thread_lock_mutex(&objLock); snapshot_remove_object(&s_delta, (void*)object); loader_platform_thread_unlock_mutex(&objLock); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkBaseObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)object, ll_get_obj_type(object)); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); + VkResult result = nextTable.GetObjectInfo(device, objType, object, infoType, pDataSize, pData); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(VkObject object, uint32_t allocationIdx, VkGpuMemory mem, VkGpuSize offset) +VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkGpuMemory mem, VkGpuSize offset) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)object, ll_get_obj_type(object)); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.BindObjectMemory(object, allocationIdx, mem, offset); + VkResult result = nextTable.BindObjectMemory(queue, objType, object, allocationIdx, mem, offset); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemoryRange(VkObject object, uint32_t allocationIdx, VkGpuSize rangeOffset, VkGpuSize rangeSize, VkGpuMemory mem, VkGpuSize memOffset) +VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemoryRange(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkGpuSize rangeOffset, VkGpuSize rangeSize, VkGpuMemory mem, VkGpuSize memOffset) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)object, ll_get_obj_type(object)); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.BindObjectMemoryRange(object, allocationIdx, rangeOffset, rangeSize, mem, memOffset); + VkResult result = nextTable.BindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset); return result; } @@ -766,13 +766,13 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreat return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkFence fence) +VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)fence, VK_OBJECT_TYPE_FENCE); loader_platform_thread_unlock_mutex(&objLock); // Warn if submitted_flag is not set - VkResult result = nextTable.GetFenceStatus(fence); + VkResult result = nextTable.GetFenceStatus(device, fence); return result; } @@ -829,30 +829,30 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreat return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkEvent event) +VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)event, VK_OBJECT_TYPE_EVENT); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.GetEventStatus(event); + VkResult result = nextTable.GetEventStatus(device, event); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkEvent event) +VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)event, VK_OBJECT_TYPE_EVENT); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.SetEvent(event); + VkResult result = nextTable.SetEvent(device, event); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkEvent event) +VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)event, VK_OBJECT_TYPE_EVENT); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.ResetEvent(event); + VkResult result = nextTable.ResetEvent(device, event); return result; } @@ -872,12 +872,12 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryP return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)queryPool, VK_OBJECT_TYPE_QUERY_POOL); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData); + VkResult result = nextTable.GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData); return result; } @@ -938,12 +938,12 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreat return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)image, VK_OBJECT_TYPE_IMAGE); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); + VkResult result = nextTable.GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData); return result; } @@ -1043,12 +1043,12 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const Vk return result; } -VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkPipeline pipeline, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)pipeline, VK_OBJECT_TYPE_PIPELINE); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.StorePipeline(pipeline, pDataSize, pData); + VkResult result = nextTable.StorePipeline(device, pipeline, pDataSize, pData); return result; } @@ -1127,21 +1127,21 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescrip return result; } -VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDescriptorPool descriptorPool) +VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.ResetDescriptorPool(descriptorPool); + VkResult result = nextTable.ResetDescriptorPool(device, descriptorPool); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) +VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); loader_platform_thread_unlock_mutex(&objLock); - VkResult result = nextTable.AllocDescriptorSets(descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); + VkResult result = nextTable.AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); if (result == VK_SUCCESS) { for (uint32_t i = 0; i < *pCount; i++) { @@ -1154,20 +1154,20 @@ VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDescriptorPool descriptor return result; } -VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) +VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL); loader_platform_thread_unlock_mutex(&objLock); - nextTable.ClearDescriptorSets(descriptorPool, count, pDescriptorSets); + nextTable.ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets); } -VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) +VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDevice device, VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET); loader_platform_thread_unlock_mutex(&objLock); - nextTable.UpdateDescriptors(descriptorSet, updateCount, ppUpdateArray); + nextTable.UpdateDescriptors(device, descriptorSet, updateCount, ppUpdateArray); } VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState) @@ -1652,7 +1652,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkDbgSetMessageFilter(VkDevice device, int32_t ms return result; } -VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkBaseObject object, size_t tagSize, const void* pTag) +VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkObject object, size_t tagSize, const void* pTag) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)object, ll_get_obj_type(object)); diff --git a/layers/layers_msg.h b/layers/layers_msg.h index cda11051..3cd5a0c2 100644 --- a/layers/layers_msg.h +++ b/layers/layers_msg.h @@ -33,8 +33,8 @@ static FILE *g_logFile = NULL; // Utility function to handle reporting // If callbacks are enabled, use them, otherwise use printf static void layerCbMsg(VK_DBG_MSG_TYPE msgType, - VkValidationLevel validationLevel, - VkBaseObject srcObject, + VkValidationLevel validationLevel, + VkObject srcObject, size_t location, int32_t msgCode, const char* pLayerPrefix, diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index bf0a325f..6f5eb39f 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -177,7 +177,7 @@ static void deleteFenceInfo(uint64_t fenceId) MT_FENCE_INFO* pDelInfo = fenceMap[fenceId]; if (pDelInfo != NULL) { if (pDelInfo->localFence == VK_TRUE) { - nextTable.DestroyObject(pDelInfo->fence); + nextTable.DestroyObject(globalDevice, VK_OBJECT_TYPE_FENCE, pDelInfo->fence); } delete pDelInfo; } @@ -1074,7 +1074,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllo return result; } -VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDeviceMemory mem) +VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem) { /* From spec : A memory object is freed by calling vkFreeMemory() when it is no longer needed. Before * freeing a memory object, an application must ensure the memory object is unbound from @@ -1090,19 +1090,19 @@ VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDeviceMemory mem) printObjList(); printCBList(); loader_platform_thread_unlock_mutex(&globalLock); - VkResult result = nextTable.FreeMemory(mem); + VkResult result = nextTable.FreeMemory(device, mem); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDeviceMemory mem, VkMemoryPriority priority) +VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkDeviceMemory mem, VkMemoryPriority priority) { // TODO : Update tracking for this alloc // Make sure memory is not pinned, which can't have priority set - VkResult result = nextTable.SetMemoryPriority(mem, priority); + VkResult result = nextTable.SetMemoryPriority(device, mem, priority); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData) +VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData) { // TODO : Track when memory is mapped loader_platform_thread_lock_mutex(&globalLock); @@ -1113,15 +1113,15 @@ VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDeviceMemory mem, VkDeviceSize offs layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_STATE, "MEM", str); } loader_platform_thread_unlock_mutex(&globalLock); - VkResult result = nextTable.MapMemory(mem, offset, size, flags, ppData); + VkResult result = nextTable.MapMemory(device, mem, offset, size, flags, ppData); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDeviceMemory mem) +VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem) { // TODO : Track as memory gets unmapped, do we want to check what changed following map? // Make sure that memory was ever mapped to begin with - VkResult result = nextTable.UnmapMemory(mem); + VkResult result = nextTable.UnmapMemory(device, mem); return result; } @@ -1154,7 +1154,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImag return result; } -VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkObject object) +VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object) { loader_platform_thread_lock_mutex(&globalLock); @@ -1185,22 +1185,38 @@ VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkObject object) } loader_platform_thread_unlock_mutex(&globalLock); - VkResult result = nextTable.DestroyObject(object); + VkResult result = nextTable.DestroyObject(device, objType, object); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkBaseObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) { // TODO : What to track here? // Could potentially save returned mem requirements and validate values passed into QueueBindObjectMemory for this object // From spec : The only objects that are guaranteed to have no external memory requirements are devices, queues, command buffers, shaders and memory objects. - VkResult result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); + VkResult result = nextTable.GetObjectInfo(device, objType, object, infoType, pDataSize, pData); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(VkQueue queue, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset) +VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset) { - VkResult result = nextTable.QueueBindObjectMemory(queue, object, allocationIdx, mem, offset); + VkResult result = nextTable.QueueBindObjectMemory(queue, objType, object, allocationIdx, mem, offset); + loader_platform_thread_lock_mutex(&globalLock); + // Track objects tied to memory + if (VK_FALSE == updateObjectBinding(object, mem)) { + char str[1024]; + sprintf(str, "Unable to set object %p binding to mem obj %p", (void*)object, (void*)mem); + layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, object, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str); + } + printObjList(); + printMemList(); + loader_platform_thread_unlock_mutex(&globalLock); + return result; +} + +VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset) +{ + VkResult result = nextTable.QueueBindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset); loader_platform_thread_lock_mutex(&globalLock); // Track objects tied to memory if (VK_FALSE == updateObjectBinding(object, mem)) { @@ -1252,9 +1268,9 @@ VK_LAYER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCoun return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkFence fence) +VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence) { - VkResult result = nextTable.GetFenceStatus(fence); + VkResult result = nextTable.GetFenceStatus(device, fence); if (VK_SUCCESS == result) { loader_platform_thread_lock_mutex(&globalLock); updateFenceTracking(fence); @@ -2015,7 +2031,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(VkSwapChainWSI swapChain, V if (mismatch) { char str[1024]; sprintf(str, "vkGetSwapChainInfoWSI(%p, VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI) returned mismatching data", swapChain); - layerCbMsg(VK_DBG_MSG_WARNING, VK_VALIDATION_LEVEL_0, (VkBaseObject) swapChain, 0, MEMTRACK_NONE, "SWAP_CHAIN", str); + layerCbMsg(VK_DBG_MSG_WARNING, VK_VALIDATION_LEVEL_0, (VkObject) swapChain, 0, MEMTRACK_NONE, "SWAP_CHAIN", str); } } } @@ -2066,6 +2082,8 @@ VK_LAYER_EXPORT void* VKAPI vkGetProcAddr(VkPhysicalDevice gpu, const char* func return (void*) vkGetObjectInfo; if (!strcmp(funcName, "vkQueueBindObjectMemory")) return (void*) vkQueueBindObjectMemory; + if (!strcmp(funcName, "vkQueueBindObjectMemoryRange")) + return (void*) vkQueueBindObjectMemoryRange; if (!strcmp(funcName, "vkCreateFence")) return (void*) vkCreateFence; if (!strcmp(funcName, "vkGetFenceStatus")) diff --git a/layers/multi.cpp b/layers/multi.cpp index 3eb79c66..e70b6383 100644 --- a/layers/multi.cpp +++ b/layers/multi.cpp @@ -87,12 +87,12 @@ VK_LAYER_EXPORT VkResult VKAPI multi1CreateGraphicsPipeline(VkDevice device, con return result; } -VK_LAYER_EXPORT VkResult VKAPI multi1StorePipeline(VkPipeline pipeline, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI multi1StorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData) { VkLayerDispatchTable* pTable = tableMap1[pipeline]; printf("At start of multi1 layer vkStorePipeline()\n"); - VkResult result = pTable->StorePipeline(pipeline, pDataSize, pData); + VkResult result = pTable->StorePipeline(device, pipeline, pDataSize, pData); printf("Completed multi1 layer vkStorePipeline()\n"); return result; } diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp index b3eb1dc3..74d8582a 100644 --- a/layers/param_checker.cpp +++ b/layers/param_checker.cpp @@ -383,42 +383,42 @@ VK_LAYER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllo return result; } -VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDeviceMemory mem) +VK_LAYER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem) { - VkResult result = nextTable.FreeMemory(mem); + VkResult result = nextTable.FreeMemory(device, mem); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDeviceMemory mem, VkMemoryPriority priority) +VK_LAYER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkDeviceMemory mem, VkMemoryPriority priority) { char str[1024]; if (!validate_VkMemoryPriority(priority)) { sprintf(str, "Parameter priority to function SetMemoryPriority has invalid value of %i.", (int)priority); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } - VkResult result = nextTable.SetMemoryPriority(mem, priority); + VkResult result = nextTable.SetMemoryPriority(device, mem, priority); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData) +VK_LAYER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData) { - VkResult result = nextTable.MapMemory(mem, offset, size, flags, ppData); + VkResult result = nextTable.MapMemory(device, mem, offset, size, flags, ppData); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDeviceMemory mem) +VK_LAYER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem) { - VkResult result = nextTable.UnmapMemory(mem); + VkResult result = nextTable.UnmapMemory(device, mem); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkFlushMappedMemory(VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size) +VK_LAYER_EXPORT VkResult VKAPI vkFlushMappedMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size) { - VkResult result = nextTable.FlushMappedMemory(mem, offset, size); + VkResult result = nextTable.FlushMappedMemory(device, mem, offset, size); return result; } @@ -498,35 +498,35 @@ VK_LAYER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImag return result; } -VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkObject object) +VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object) { - VkResult result = nextTable.DestroyObject(object); + VkResult result = nextTable.DestroyObject(device, objType, object); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkBaseObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData) { char str[1024]; if (!validate_VkObjectInfoType(infoType)) { sprintf(str, "Parameter infoType to function GetObjectInfo has invalid value of %i.", (int)infoType); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } - VkResult result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); + VkResult result = nextTable.GetObjectInfo(device, objType, object, infoType, pDataSize, pData); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(VkQueue queue, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset) +VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset) { - VkResult result = nextTable.QueueBindObjectMemory(queue, object, allocationIdx, mem, offset); + VkResult result = nextTable.QueueBindObjectMemory(queue, objType, object, allocationIdx, mem, offset); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(VkQueue queue, VkObject object, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset) +VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset) { - VkResult result = nextTable.QueueBindObjectMemoryRange(queue, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset); + VkResult result = nextTable.QueueBindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset); return result; } @@ -560,10 +560,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreat return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkFence fence) +VK_LAYER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence) { - VkResult result = nextTable.GetFenceStatus(fence); + VkResult result = nextTable.GetFenceStatus(device, fence); return result; } @@ -625,24 +625,24 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreat return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkEvent event) +VK_LAYER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event) { - VkResult result = nextTable.GetEventStatus(event); + VkResult result = nextTable.GetEventStatus(device, event); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkEvent event) +VK_LAYER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event) { - VkResult result = nextTable.SetEvent(event); + VkResult result = nextTable.SetEvent(device, event); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkEvent event) +VK_LAYER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event) { - VkResult result = nextTable.ResetEvent(event); + VkResult result = nextTable.ResetEvent(device, event); return result; } @@ -661,10 +661,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryP return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags) +VK_LAYER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags) { - VkResult result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData, flags); + VkResult result = nextTable.GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData, flags); return result; } @@ -811,7 +811,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreat return result; } -VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData) { char str[1024]; if (!pSubresource) { @@ -825,7 +825,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkImage image, const Vk sprintf(str, "Parameter infoType to function GetImageSubresourceInfo has invalid value of %i.", (int)infoType); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } - VkResult result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); + VkResult result = nextTable.GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData); return result; } @@ -934,10 +934,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const Vk return result; } -VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkPipeline pipeline, size_t* pDataSize, void* pData) +VK_LAYER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData) { - VkResult result = nextTable.StorePipeline(pipeline, pDataSize, pData); + VkResult result = nextTable.StorePipeline(device, pipeline, pDataSize, pData); return result; } @@ -1028,34 +1028,34 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescrip return result; } -VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDescriptorPool descriptorPool) +VK_LAYER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) { - VkResult result = nextTable.ResetDescriptorPool(descriptorPool); + VkResult result = nextTable.ResetDescriptorPool(device, descriptorPool); return result; } -VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) +VK_LAYER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount) { char str[1024]; if (!validate_VkDescriptorSetUsage(setUsage)) { sprintf(str, "Parameter setUsage to function AllocDescriptorSets has invalid value of %i.", (int)setUsage); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } - VkResult result = nextTable.AllocDescriptorSets(descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); + VkResult result = nextTable.AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount); return result; } -VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) +VK_LAYER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) { - nextTable.ClearDescriptorSets(descriptorPool, count, pDescriptorSets); + nextTable.ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets); } -VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) +VK_LAYER_EXPORT void VKAPI vkUpdateDescriptors(VkDevice device, VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray) { - nextTable.UpdateDescriptors(descriptorSet, updateCount, ppUpdateArray); + nextTable.UpdateDescriptors(device, descriptorSet, updateCount, ppUpdateArray); } VK_LAYER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState) @@ -1919,10 +1919,10 @@ VK_LAYER_EXPORT VkResult VKAPI vkDbgSetMessageFilter(VkDevice device, int32_t ms return result; } -VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkBaseObject object, size_t tagSize, const void* pTag) +VK_LAYER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObject object, size_t tagSize, const void* pTag) { - VkResult result = nextTable.DbgSetObjectTag(object, tagSize, pTag); + VkResult result = nextTable.DbgSetObjectTag(device, object, tagSize, pTag); return result; } -- cgit v1.2.3