Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions layers/chassis/chassis_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something I realized, with this, if we hit an error while creating the object, we now actually have the opportunity to provide a debug name at object creation time, which we could do if we had some way make it simple to search on an error message (like in LogError or something)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah piping down this new info to LogError is not straightforward

device_dispatch->debug_report->SetUtilsObjectName(pCreateInfos[i].pNext, HandleToUint64(pPipelines[i]));
}
{
VVL_ZoneScopedN("PostCallRecord_CreateComputePipelines");
for (auto& vo : device_dispatch->object_dispatch) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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]) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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]) {
Expand Down
13 changes: 13 additions & 0 deletions layers/error_message/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<VkDebugUtilsObjectNameInfoEXT>(pNext); name_info && name_info->pObjectName) {
std::unique_lock<std::mutex> lock(debug_output_mutex);
debug_utils_object_name_map[object_handle] = name_info->pObjectName;

// Given this function is called at object creation time,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, should add a VU to just ban having a null pObjectName when passed in (forgot this was a feature of this extension)

// no need to try to erase object name: it cannot possibly be there already
}
}

void DebugReport::SetMarkerObjectName(const VkDebugMarkerObjectNameInfoEXT* pNameInfo) {
std::unique_lock<std::mutex> lock(debug_output_mutex);
if (pNameInfo->pObjectName) {
Expand Down
1 change: 1 addition & 0 deletions layers/error_message/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading
Loading