Revert "Remove code to set Vulkan backend debug labels"
This reverts commit c1f51124621275ffddf6bb55196755ce4ed3567e.
Reason for revert: underyling issue in crbug.com/dawn/1539 fixed
Original change's description:
> Remove code to set Vulkan backend debug labels
>
> This is hitting a memory corruption issue inside the NVIDIA driver.
> Speculatively delete the code in the Vulkan backend until further
> analysis finds the root cause.
>
> Bug: dawn:1539
> Change-Id: Ie7bf5bed31976da5f13325c81033e787c4d376b9
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102100
> Reviewed-by: Loko Kung <lokokung@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Austin Eng <enga@chromium.org>
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: dawn:1539
Change-Id: Ic1e4c4ad05abd6f2e244e4a5364bf54e6288cffb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102107
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/native/vulkan/UtilsVulkan.cpp b/src/dawn/native/vulkan/UtilsVulkan.cpp
index b1ab45c..aa02ec3 100644
--- a/src/dawn/native/vulkan/UtilsVulkan.cpp
+++ b/src/dawn/native/vulkan/UtilsVulkan.cpp
@@ -209,7 +209,28 @@
uint64_t objectHandle,
const char* prefix,
std::string label) {
- // Implementation removed due to crbug.com/dawn/1539.
+ if (!objectHandle) {
+ return;
+ }
+
+ if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) {
+ VkDebugUtilsObjectNameInfoEXT objectNameInfo;
+ objectNameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
+ objectNameInfo.pNext = nullptr;
+ objectNameInfo.objectType = objectType;
+ objectNameInfo.objectHandle = objectHandle;
+
+ std::ostringstream objectNameStream;
+ // Prefix with the device's message ID so that if this label appears in a validation
+ // message it can be parsed out and the message can be associated with the right device.
+ objectNameStream << device->GetDebugPrefix() << kDeviceDebugSeparator << prefix;
+ if (!label.empty() && device->IsToggleEnabled(Toggle::UseUserDefinedLabelsInBackend)) {
+ objectNameStream << "_" << label;
+ }
+ std::string objectName = objectNameStream.str();
+ objectNameInfo.pObjectName = objectName.c_str();
+ device->fn.SetDebugUtilsObjectNameEXT(device->GetVkDevice(), &objectNameInfo);
+ }
}
std::string GetNextDeviceDebugPrefix() {