diff --git a/layers/chassis/chassis_manual.cpp b/layers/chassis/chassis_manual.cpp index 07eb6ae3cad..882a4aa97f6 100644 --- a/layers/chassis/chassis_manual.cpp +++ b/layers/chassis/chassis_manual.cpp @@ -404,7 +404,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice gpu, const VkDevice InitTracyVk(instance_dispatch->instance, gpu, *pDevice, fpGetInstanceProcAddr, fpGetDeviceProcAddr, device_dispatch->device_dispatch_table); #endif - + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pDevice)); vvl::SetDispatchDevice(*pDevice, std::move(device_dispatch)); for (auto& vo : instance_dispatch->object_dispatch) { if (!vo) { @@ -551,7 +551,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipeli } } record_obj.result = result; - + for (uint32_t i = 0; i < createInfoCount; ++i) { + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos[i].pNext, HandleToUint64(pPipelines[i])); + } { VVL_ZoneScopedN("PostCallRecord_CreateGraphicsPipelines"); for (auto& vo : device_dispatch->object_dispatch) { @@ -618,7 +620,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin } } record_obj.result = result; - + for (uint32_t i = 0; i < createInfoCount; ++i) { + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos[i].pNext, HandleToUint64(pPipelines[i])); + } { VVL_ZoneScopedN("PostCallRecord_CreateComputePipelines"); for (auto& vo : device_dispatch->object_dispatch) { @@ -666,7 +670,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesNV(VkDevice device, VkPi result = device_dispatch->CreateRayTracingPipelinesNV(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); record_obj.result = result; - + for (uint32_t i = 0; i < createInfoCount; ++i) { + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos[i].pNext, HandleToUint64(pPipelines[i])); + } for (auto& vo : device_dispatch->object_dispatch) { if (!vo) { continue; @@ -733,7 +739,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesKHR(VkDevice device, VkD } } record_obj.result = result; - + for (uint32_t i = 0; i < createInfoCount; ++i) { + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos[i].pNext, HandleToUint64(pPipelines[i])); + } { VVL_ZoneScopedN("PostCallRecord_CreateRayTracingPipelinesKHR"); for (auto& vo : device_dispatch->object_dispatch) { @@ -844,7 +852,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(VkDevice device, const VkPip result = device_dispatch->CreatePipelineLayout(device, &chassis_state.modified_create_info, pAllocator, pPipelineLayout); } record_obj.result = result; - + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pPipelineLayout)); { VVL_ZoneScopedN("PostCallRecord_CreatePipelineLayout"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreatePipelineLayout]) { @@ -951,6 +959,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(VkDevice device, const VkShade result = device_dispatch->CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pShaderModule)); + { VVL_ZoneScopedN("PostCallRecord_CreateShaderModule"); for (auto& vo : device_dispatch->object_dispatch) { @@ -1015,7 +1025,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShadersEXT(VkDevice device, uint32_t create } } record_obj.result = result; - + for (uint32_t i = 0; i < createInfoCount; ++i) { + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos[i].pNext, HandleToUint64(pShaders[i])); + } { VVL_ZoneScopedN("PostCallRecord_CreateShadersEXT"); for (auto& vo : device_dispatch->object_dispatch) { @@ -1129,7 +1141,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(VkDevice device, const VkBufferCreat result = device_dispatch->CreateBuffer(device, chassis_state.create_info_copy, pAllocator, pBuffer); } record_obj.result = result; - + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pBuffer)); { VVL_ZoneScopedN("PostCallRecord_CreateBuffer"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateBuffer]) { diff --git a/layers/error_message/logging.cpp b/layers/error_message/logging.cpp index 5c192323e6f..1386d8674c6 100644 --- a/layers/error_message/logging.cpp +++ b/layers/error_message/logging.cpp @@ -468,6 +468,19 @@ void DebugReport::SetUtilsObjectName(const VkDebugUtilsObjectNameInfoEXT* pNameI } } +void DebugReport::SetUtilsObjectName(const void* pNext, uint64_t object_handle) { + if (object_handle == (uint64_t)VK_NULL_HANDLE) { + return; + } + if (auto name_info = vku::FindStructInPNextChain(pNext); name_info && name_info->pObjectName) { + std::unique_lock lock(debug_output_mutex); + debug_utils_object_name_map[object_handle] = name_info->pObjectName; + + // Given this function is called at object creation time, + // no need to try to erase object name: it cannot possibly be there already + } +} + void DebugReport::SetMarkerObjectName(const VkDebugMarkerObjectNameInfoEXT* pNameInfo) { std::unique_lock lock(debug_output_mutex); if (pNameInfo->pObjectName) { diff --git a/layers/error_message/logging.h b/layers/error_message/logging.h index b54ffbb5143..6576011c2d8 100644 --- a/layers/error_message/logging.h +++ b/layers/error_message/logging.h @@ -215,6 +215,7 @@ class DebugReport { MessageFormatSettings message_format_settings; void SetUtilsObjectName(const VkDebugUtilsObjectNameInfoEXT *pNameInfo); + void SetUtilsObjectName(const void* pNext, uint64_t object_handle); void SetMarkerObjectName(const VkDebugMarkerObjectNameInfoEXT *pNameInfo); std::string GetUtilsObjectNameNoLock(const uint64_t object) const; std::string GetMarkerObjectNameNoLock(const uint64_t object) const; diff --git a/layers/vulkan/generated/chassis.cpp b/layers/vulkan/generated/chassis.cpp index 99e7eea49be..cef982b0729 100644 --- a/layers/vulkan/generated/chassis.cpp +++ b/layers/vulkan/generated/chassis.cpp @@ -665,6 +665,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(VkDevice device, const VkMemoryAll result = device_dispatch->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pAllocateInfo->pNext, HandleToUint64(*pMemory)); { VVL_ZoneScopedN("PostCallRecord_vkAllocateMemory"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordAllocateMemory]) { @@ -1326,6 +1327,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateFence(VkDevice device, const VkFenceCreateI result = device_dispatch->CreateFence(device, pCreateInfo, pAllocator, pFence); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pFence)); { VVL_ZoneScopedN("PostCallRecord_vkCreateFence"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateFence]) { @@ -1572,6 +1574,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(VkDevice device, const VkSemaphor result = device_dispatch->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pSemaphore)); { VVL_ZoneScopedN("PostCallRecord_vkCreateSemaphore"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateSemaphore]) { @@ -1664,6 +1667,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(VkDevice device, const VkQueryPoo result = device_dispatch->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pQueryPool)); { VVL_ZoneScopedN("PostCallRecord_vkCreateQueryPool"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateQueryPool]) { @@ -1857,6 +1861,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateI result = device_dispatch->CreateImage(device, pCreateInfo, pAllocator, pImage); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pImage)); { VVL_ZoneScopedN("PostCallRecord_vkCreateImage"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateImage]) { @@ -1994,6 +1999,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageVie result = device_dispatch->CreateImageView(device, pCreateInfo, pAllocator, pView); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pView)); { VVL_ZoneScopedN("PostCallRecord_vkCreateImageView"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateImageView]) { @@ -2086,6 +2092,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(VkDevice device, const VkComman result = device_dispatch->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pCommandPool)); { VVL_ZoneScopedN("PostCallRecord_vkCreateCommandPool"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateCommandPool]) { @@ -2225,6 +2232,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkC result = device_dispatch->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pAllocateInfo->pNext, HandleToUint64(*pCommandBuffers)); { VVL_ZoneScopedN("PostCallRecord_vkAllocateCommandBuffers"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordAllocateCommandBuffers]) { @@ -3023,6 +3031,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(VkDevice device, const VkEventCreateI result = device_dispatch->CreateEvent(device, pCreateInfo, pAllocator, pEvent); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pEvent)); { VVL_ZoneScopedN("PostCallRecord_vkCreateEvent"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateEvent]) { @@ -3262,6 +3271,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferV result = device_dispatch->CreateBufferView(device, pCreateInfo, pAllocator, pView); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pView)); { VVL_ZoneScopedN("PostCallRecord_vkCreateBufferView"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateBufferView]) { @@ -3399,6 +3409,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(VkDevice device, const VkPipe result = device_dispatch->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pPipelineCache)); { VVL_ZoneScopedN("PostCallRecord_vkCreatePipelineCache"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreatePipelineCache]) { @@ -3677,6 +3688,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCre result = device_dispatch->CreateSampler(device, pCreateInfo, pAllocator, pSampler); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pSampler)); { VVL_ZoneScopedN("PostCallRecord_vkCreateSampler"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateSampler]) { @@ -3770,6 +3782,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(VkDevice device, const result = device_dispatch->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pSetLayout)); { VVL_ZoneScopedN("PostCallRecord_vkCreateDescriptorSetLayout"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateDescriptorSetLayout]) { @@ -3863,6 +3876,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDes result = device_dispatch->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pDescriptorPool)); { VVL_ZoneScopedN("PostCallRecord_vkCreateDescriptorPool"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateDescriptorPool]) { @@ -4523,6 +4537,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFrameb result = device_dispatch->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pFramebuffer)); { VVL_ZoneScopedN("PostCallRecord_vkCreateFramebuffer"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateFramebuffer]) { @@ -4615,6 +4630,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderP result = device_dispatch->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pRenderPass)); { VVL_ZoneScopedN("PostCallRecord_vkCreateRenderPass"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateRenderPass]) { @@ -6735,6 +6751,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplate(VkDevice device, result = device_dispatch->CreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pDescriptorUpdateTemplate)); { VVL_ZoneScopedN("PostCallRecord_vkCreateDescriptorUpdateTemplate"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateDescriptorUpdateTemplate]) { @@ -6921,6 +6938,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSamplerYcbcrConversion(VkDevice device, con result = device_dispatch->CreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pYcbcrConversion)); { VVL_ZoneScopedN("PostCallRecord_vkCreateSamplerYcbcrConversion"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateSamplerYcbcrConversion]) { @@ -7633,6 +7651,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePrivateDataSlot(VkDevice device, const VkPr result = device_dispatch->CreatePrivateDataSlot(device, pCreateInfo, pAllocator, pPrivateDataSlot); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pPrivateDataSlot)); { VVL_ZoneScopedN("PostCallRecord_vkCreatePrivateDataSlot"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreatePrivateDataSlot]) { @@ -10392,6 +10411,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapc result = device_dispatch->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pSwapchain)); { VVL_ZoneScopedN("PostCallRecord_vkCreateSwapchainKHR"); @@ -11115,6 +11135,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(VkDevice device, uint32 result = device_dispatch->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos->pNext, HandleToUint64(*pSwapchains)); { VVL_ZoneScopedN("PostCallRecord_vkCreateSharedSwapchainsKHR"); @@ -11695,6 +11716,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionKHR(VkDevice device, const VkVi result = device_dispatch->CreateVideoSessionKHR(device, pCreateInfo, pAllocator, pVideoSession); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pVideoSession)); { VVL_ZoneScopedN("PostCallRecord_vkCreateVideoSessionKHR"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateVideoSessionKHR]) { @@ -11897,6 +11919,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateVideoSessionParametersKHR(VkDevice device, result = device_dispatch->CreateVideoSessionParametersKHR(device, pCreateInfo, pAllocator, pVideoSessionParameters); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pVideoSessionParameters)); { VVL_ZoneScopedN("PostCallRecord_vkCreateVideoSessionParametersKHR"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateVideoSessionParametersKHR]) { @@ -13448,6 +13471,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR(VkDevice device result = device_dispatch->CreateDescriptorUpdateTemplateKHR(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pDescriptorUpdateTemplate)); { VVL_ZoneScopedN("PostCallRecord_vkCreateDescriptorUpdateTemplateKHR"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateDescriptorUpdateTemplateKHR]) { @@ -14688,6 +14712,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSamplerYcbcrConversionKHR(VkDevice device, result = device_dispatch->CreateSamplerYcbcrConversionKHR(device, pCreateInfo, pAllocator, pYcbcrConversion); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pYcbcrConversion)); { VVL_ZoneScopedN("PostCallRecord_vkCreateSamplerYcbcrConversionKHR"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateSamplerYcbcrConversionKHR]) { @@ -17460,6 +17485,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructure2KHR(VkDevice device, result = device_dispatch->CreateAccelerationStructure2KHR(device, pCreateInfo, pAllocator, pAccelerationStructure); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pAccelerationStructure)); { VVL_ZoneScopedN("PostCallRecord_vkCreateAccelerationStructure2KHR"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateAccelerationStructure2KHR]) { @@ -19847,6 +19873,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateCuModuleNVX(VkDevice device, const VkCuModu result = device_dispatch->CreateCuModuleNVX(device, pCreateInfo, pAllocator, pModule); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pModule)); { VVL_ZoneScopedN("PostCallRecord_vkCreateCuModuleNVX"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateCuModuleNVX]) { @@ -19895,6 +19922,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateCuFunctionNVX(VkDevice device, const VkCuFu result = device_dispatch->CreateCuFunctionNVX(device, pCreateInfo, pAllocator, pFunction); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pFunction)); { VVL_ZoneScopedN("PostCallRecord_vkCreateCuFunctionNVX"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateCuFunctionNVX]) { @@ -22119,6 +22147,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGpaSessionAMD(VkDevice device, const VkGpaS result = device_dispatch->CreateGpaSessionAMD(device, pCreateInfo, pAllocator, pGpaSession); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pGpaSession)); { VVL_ZoneScopedN("PostCallRecord_vkCreateGpaSessionAMD"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateGpaSessionAMD]) { @@ -22685,6 +22714,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateExecutionGraphPipelinesAMDX(VkDevice device pAllocator, pPipelines); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos->pNext, HandleToUint64(*pPipelines)); { VVL_ZoneScopedN("PostCallRecord_vkCreateExecutionGraphPipelinesAMDX"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateExecutionGraphPipelinesAMDX]) { @@ -23770,6 +23800,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureNV(VkDevice device, result = device_dispatch->CreateAccelerationStructureNV(device, pCreateInfo, pAllocator, pAccelerationStructure); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pAccelerationStructure)); { VVL_ZoneScopedN("PostCallRecord_vkCreateAccelerationStructureNV"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateAccelerationStructureNV]) { @@ -27493,6 +27524,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreatePrivateDataSlotEXT(VkDevice device, const V result = device_dispatch->CreatePrivateDataSlotEXT(device, pCreateInfo, pAllocator, pPrivateDataSlot); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pPrivateDataSlot)); { VVL_ZoneScopedN("PostCallRecord_vkCreatePrivateDataSlotEXT"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreatePrivateDataSlotEXT]) { @@ -30157,6 +30189,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateMicromapEXT(VkDevice device, const VkMicrom result = device_dispatch->CreateMicromapEXT(device, pCreateInfo, pAllocator, pMicromap); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pMicromap)); { VVL_ZoneScopedN("PostCallRecord_vkCreateMicromapEXT"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateMicromapEXT]) { @@ -32946,6 +32979,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateTensorARM(VkDevice device, const VkTensorCr result = device_dispatch->CreateTensorARM(device, pCreateInfo, pAllocator, pTensor); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pTensor)); { VVL_ZoneScopedN("PostCallRecord_vkCreateTensorARM"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateTensorARM]) { @@ -33038,6 +33072,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateTensorViewARM(VkDevice device, const VkTens result = device_dispatch->CreateTensorViewARM(device, pCreateInfo, pAllocator, pView); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pView)); { VVL_ZoneScopedN("PostCallRecord_vkCreateTensorViewARM"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateTensorViewARM]) { @@ -33605,6 +33640,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateOpticalFlowSessionNV(VkDevice device, const result = device_dispatch->CreateOpticalFlowSessionNV(device, pCreateInfo, pAllocator, pSession); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pSession)); { VVL_ZoneScopedN("PostCallRecord_vkCreateOpticalFlowSessionNV"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateOpticalFlowSessionNV]) { @@ -34442,6 +34478,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDataGraphPipelineSessionARM(VkDevice device result = device_dispatch->CreateDataGraphPipelineSessionARM(device, pCreateInfo, pAllocator, pSession); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pSession)); { VVL_ZoneScopedN("PostCallRecord_vkCreateDataGraphPipelineSessionARM"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateDataGraphPipelineSessionARM]) { @@ -35236,6 +35273,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateExternalComputeQueueNV(VkDevice device, con result = device_dispatch->CreateExternalComputeQueueNV(device, pCreateInfo, pAllocator, pExternalQueue); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pExternalQueue)); { VVL_ZoneScopedN("PostCallRecord_vkCreateExternalComputeQueueNV"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateExternalComputeQueueNV]) { @@ -35717,6 +35755,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateIndirectCommandsLayoutEXT(VkDevice device, result = device_dispatch->CreateIndirectCommandsLayoutEXT(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pIndirectCommandsLayout)); { VVL_ZoneScopedN("PostCallRecord_vkCreateIndirectCommandsLayoutEXT"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateIndirectCommandsLayoutEXT]) { @@ -35813,6 +35852,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateIndirectExecutionSetEXT(VkDevice device, result = device_dispatch->CreateIndirectExecutionSetEXT(device, pCreateInfo, pAllocator, pIndirectExecutionSet); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pIndirectExecutionSet)); { VVL_ZoneScopedN("PostCallRecord_vkCreateIndirectExecutionSetEXT"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateIndirectExecutionSetEXT]) { @@ -36308,6 +36348,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateShaderInstrumentationARM(VkDevice device, result = device_dispatch->CreateShaderInstrumentationARM(device, pCreateInfo, pAllocator, pInstrumentation); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pInstrumentation)); { VVL_ZoneScopedN("PostCallRecord_vkCreateShaderInstrumentationARM"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateShaderInstrumentationARM]) { @@ -36922,6 +36963,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateAccelerationStructureKHR(VkDevice device, result = device_dispatch->CreateAccelerationStructureKHR(device, pCreateInfo, pAllocator, pAccelerationStructure); } record_obj.result = result; + device_dispatch->debug_report->SetUtilsObjectName(pCreateInfo->pNext, HandleToUint64(*pAccelerationStructure)); { VVL_ZoneScopedN("PostCallRecord_vkCreateAccelerationStructureKHR"); for (auto& vo : device_dispatch->intercept_vectors[InterceptIdPostCallRecordCreateAccelerationStructureKHR]) { diff --git a/scripts/generate_source.py b/scripts/generate_source.py index f418334fc34..c8aa1a089eb 100755 --- a/scripts/generate_source.py +++ b/scripts/generate_source.py @@ -97,7 +97,90 @@ def RunGenerators(api: str, registry: str, grammar: str, directory: str, styleFi # These set fields that are needed by both OutputGenerator and BaseGenerator, # but are uniform and don't need to be set at a per-generated file level - from base_generator import SetOutputDirectory, SetTargetApiName, SetMergedApiNames, EnableCaching + + # HACK: force VkDebugUtilsObjectNameInfoEXT/VkDebugUtilsObjectTagInfoEXT to extend these structs + # Remove after merging https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/8336 + debug_utils_hack = ["VkResourceDescriptorInfoEXT", + "VkDescriptorGetInfoEXT", + "VkInstanceCreateInfo", + "VkDeviceCreateInfo", + "VkSemaphoreCreateInfo", + "VkFenceCreateInfo", + "VkCommandBufferAllocateInfo", + "VkMemoryAllocateInfo", + "VkBufferCreateInfo", + "VkImageCreateInfo", + "VkEventCreateInfo", + "VkQueryPoolCreateInfo", + "VkBufferViewCreateInfo", + "VkImageViewCreateInfo", + "VkShaderModuleCreateInfo", + "VkPipelineShaderStageCreateInfo", + "VkPipelineCacheCreateInfo", + "VkPipelineLayoutCreateInfo", + "VkRenderPassCreateInfo", + "VkGraphicsPipelineCreateInfo", + "VkComputePipelineCreateInfo", + "VkRayTracingPipelineCreateInfoKHR", + "VkRayTracingPipelineCreateInfoNV", + "VkExecutionGraphPipelineCreateInfoAMDX", + "VkDataGraphPipelineCreateInfoARM", + "VkDescriptorSetLayoutCreateInfo", + "VkSamplerCreateInfo", + "VkDescriptorPoolCreateInfo", + "VkDescriptorSetAllocateInfo", + "VkFramebufferCreateInfo", + "VkCommandPoolCreateInfo", + "VkDescriptorUpdateTemplateCreateInfo", + "VkSamplerYcbcrConversionCreateInfo", + "VkPrivateDataSlotCreateInfo", + "VkDisplaySurfaceCreateInfoKHR", + "VkXlibSurfaceCreateInfoKHR", + "VkXcbSurfaceCreateInfoKHR", + "VkWaylandSurfaceCreateInfoKHR", + "VkAndroidSurfaceCreateInfoKHR", + "VkWin32SurfaceCreateInfoKHR", + "VkStreamDescriptorSurfaceCreateInfoGGP", + "VkViSurfaceCreateInfoNN", + "VkIOSSurfaceCreateInfoMVK", + "VkMacOSSurfaceCreateInfoMVK", + "VkImagePipeSurfaceCreateInfoFUCHSIA", + "VkMetalSurfaceCreateInfoEXT", + "VkHeadlessSurfaceCreateInfoEXT", + "VkDirectFBSurfaceCreateInfoEXT", + "VkScreenSurfaceCreateInfoQNX", + "VkSurfaceCreateInfoOHOS", + "VkUbmSurfaceCreateInfoSEC", + "VkSwapchainCreateInfoKHR", + "VkDisplayModeCreateInfoKHR", + "VkVideoSessionCreateInfoKHR", + "VkVideoSessionParametersCreateInfoKHR", + "VkCuFunctionCreateInfoNVX", + "VkCuModuleCreateInfoNVX", + "VkGpaSessionCreateInfoAMD", + "VkAccelerationStructureCreateInfoKHR", + "VkAccelerationStructureCreateInfo2KHR", + "VkAccelerationStructureCreateInfoNV", + "VkMicromapCreateInfoEXT", + "VkTensorCreateInfoARM", + "VkTensorViewCreateInfoARM", + "VkOpticalFlowSessionCreateInfoNV", + "VkShaderCreateInfoEXT", + "VkDataGraphPipelineSessionCreateInfoARM", + "VkExternalComputeQueueCreateInfoNV", + "VkIndirectCommandsLayoutCreateInfoEXT", + "VkIndirectExecutionSetCreateInfoEXT", + "VkShaderInstrumentationCreateInfoARM"] + + from base_generator import BaseGenerator, SetOutputDirectory, SetTargetApiName, SetMergedApiNames, EnableCaching + _orig_endFile = BaseGenerator.endFile + def _patched_endFile(self): + for struct_name in debug_utils_hack: + if struct_name in self.vk.structs: + self.vk.structs[struct_name].extendedBy.extend(['VkDebugUtilsObjectNameInfoEXT', 'VkDebugUtilsObjectTagInfoEXT']) + _orig_endFile(self) + BaseGenerator.endFile = _patched_endFile + SetOutputDirectory(directory) SetTargetApiName(api) diff --git a/scripts/generators/layer_chassis_generator.py b/scripts/generators/layer_chassis_generator.py index fa421e3df24..94f5e96627e 100644 --- a/scripts/generators/layer_chassis_generator.py +++ b/scripts/generators/layer_chassis_generator.py @@ -436,6 +436,17 @@ def generateSource(self): elif command.returnType == 'VkDeviceAddress': out.append('record_obj.device_address = result;\n') + # Add a SetUtilsObjectName call for commands with a CreateInfo parameter + # that can have a debug utils info struct in its pNext chain + debug_utils_structs = {'VkDebugUtilsObjectNameInfoEXT', 'VkDebugUtilsObjectTagInfoEXT'} + last_param = command.params[-1] + if 'VkDevice' in [param.type for param in command.params]: + for param in command.params: + if (param.pointer and param.type in self.vk.structs and + any(s in self.vk.structs[param.type].extendedBy for s in debug_utils_structs) + and last_param.type in self.vk.handles): + out.append(f'device_dispatch->debug_report->SetUtilsObjectName({param.name}->pNext, HandleToUint64(*{last_param.name}));\n') + # Generate post-call object processing source code out.append(f'{{\nVVL_ZoneScopedN("PostCallRecord_{command.name}");\n') if "QueueSubmit" in command.name: diff --git a/scripts/generators/stateless_validation_helper_generator.py b/scripts/generators/stateless_validation_helper_generator.py index d606ce2a241..333a3b258fa 100644 --- a/scripts/generators/stateless_validation_helper_generator.py +++ b/scripts/generators/stateless_validation_helper_generator.py @@ -529,83 +529,6 @@ def generateSource(self): self.stype_version_dict[alias] = set() self.stype_version_dict[alias].add(extension_name) self.stype_version_dict[alias].add(extension_name) - - # HACK: force VkDebugUtilsObjectNameInfoEXT to extends some structs - # Remove after merging https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/8336 - hack = ["VkResourceDescriptorInfoEXT", - "VkDescriptorGetInfoEXT", - "VkInstanceCreateInfo", - "VkDeviceCreateInfo", - "VkSemaphoreCreateInfo", - "VkFenceCreateInfo", - "VkCommandBufferAllocateInfo", - "VkMemoryAllocateInfo", - "VkBufferCreateInfo", - "VkImageCreateInfo", - "VkEventCreateInfo", - "VkQueryPoolCreateInfo", - "VkBufferViewCreateInfo", - "VkImageViewCreateInfo", - "VkShaderModuleCreateInfo", - "VkPipelineShaderStageCreateInfo", - "VkPipelineCacheCreateInfo", - "VkPipelineLayoutCreateInfo", - "VkRenderPassCreateInfo", - "VkGraphicsPipelineCreateInfo", - "VkComputePipelineCreateInfo", - "VkRayTracingPipelineCreateInfoKHR", - "VkRayTracingPipelineCreateInfoNV", - "VkExecutionGraphPipelineCreateInfoAMDX", - "VkDataGraphPipelineCreateInfoARM", - "VkDescriptorSetLayoutCreateInfo", - "VkSamplerCreateInfo", - "VkDescriptorPoolCreateInfo", - "VkDescriptorSetAllocateInfo", - "VkFramebufferCreateInfo", - "VkCommandPoolCreateInfo", - "VkDescriptorUpdateTemplateCreateInfo", - "VkSamplerYcbcrConversionCreateInfo", - "VkPrivateDataSlotCreateInfo", - "VkDisplaySurfaceCreateInfoKHR", - "VkXlibSurfaceCreateInfoKHR", - "VkXcbSurfaceCreateInfoKHR", - "VkWaylandSurfaceCreateInfoKHR", - "VkAndroidSurfaceCreateInfoKHR", - "VkWin32SurfaceCreateInfoKHR", - "VkStreamDescriptorSurfaceCreateInfoGGP", - "VkViSurfaceCreateInfoNN", - "VkIOSSurfaceCreateInfoMVK", - "VkMacOSSurfaceCreateInfoMVK", - "VkImagePipeSurfaceCreateInfoFUCHSIA", - "VkMetalSurfaceCreateInfoEXT", - "VkHeadlessSurfaceCreateInfoEXT", - "VkDirectFBSurfaceCreateInfoEXT", - "VkScreenSurfaceCreateInfoQNX", - "VkSurfaceCreateInfoOHOS", - "VkUbmSurfaceCreateInfoSEC", - "VkSwapchainCreateInfoKHR", - "VkDisplayModeCreateInfoKHR", - "VkVideoSessionCreateInfoKHR", - "VkVideoSessionParametersCreateInfoKHR", - "VkCuFunctionCreateInfoNVX", - "VkCuModuleCreateInfoNVX", - "VkGpaSessionCreateInfoAMD", - "VkAccelerationStructureCreateInfoKHR", - "VkAccelerationStructureCreateInfo2KHR", - "VkAccelerationStructureCreateInfoNV", - "VkMicromapCreateInfoEXT", - "VkTensorCreateInfoARM", - "VkTensorViewCreateInfoARM", - "VkOpticalFlowSessionCreateInfoNV", - "VkShaderCreateInfoEXT", - "VkDataGraphPipelineSessionCreateInfoARM", - "VkExternalComputeQueueCreateInfoNV", - "VkIndirectCommandsLayoutCreateInfoEXT", - "VkIndirectExecutionSetCreateInfoEXT", - "VkShaderInstrumentationCreateInfoARM"] - for struct_name in hack: - self.vk.structs[struct_name].extendedBy.extend(['VkDebugUtilsObjectNameInfoEXT', 'VkDebugUtilsObjectTagInfoEXT']) - # Generate the struct member checking code from the captured data for struct in self.vk.structs.values(): # The string returned will be nested in an if check for a NULL pointer, so needs its indent incremented diff --git a/tests/unit/debug_extensions.cpp b/tests/unit/debug_extensions.cpp index 85a0a850417..119c982b4fc 100644 --- a/tests/unit/debug_extensions.cpp +++ b/tests/unit/debug_extensions.cpp @@ -694,3 +694,19 @@ TEST_F(NegativeDebugExtensions, DebugUtilsRecording) { vk::CmdInsertDebugUtilsLabelEXT(m_command_buffer, &label); m_errorMonitor->VerifyFound(); } + +TEST_F(NegativeDebugExtensions, VkDebugUtilsObjectNameInfoEXTExtendsCreateInfo) { + RETURN_IF_SKIP(Init()); + + VkDebugUtilsObjectNameInfoEXT name_info = vku::InitStructHelper(); + name_info.objectType = VK_OBJECT_TYPE_UNKNOWN; + name_info.pObjectName = "my buffer"; + VkBufferCreateInfo buff_ci = vku::InitStructHelper(&name_info); + buff_ci.usage = VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT; + buff_ci.size = 256; + // Buffer is not bound to memory + vkt::Buffer buffer(*m_device, buff_ci, vkt::no_mem); + m_errorMonitor->SetDesiredErrorRegex("VUID-VkBufferViewCreateInfo-buffer-00935", "my buffer"); + vkt::BufferView buffer_view(*m_device, buffer, VK_FORMAT_R8_UNORM); + m_errorMonitor->VerifyFound(); +}