[Vulkan] Get debug markers working again

This commit is contained in:
DrChat 2018-02-22 22:58:29 -06:00
parent 5b6766b210
commit 824c39c38a
2 changed files with 11 additions and 22 deletions

View File

@ -210,6 +210,9 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) {
for (auto& ext : enabled_extensions_) {
if (!std::strcmp(ext, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) {
debug_marker_ena_ = true;
pfn_vkDebugMarkerSetObjectNameEXT_ =
(PFN_vkDebugMarkerSetObjectNameEXT)vkGetDeviceProcAddr(
*this, "vkDebugMarkerSetObjectNameEXT");
}
}
@ -263,24 +266,6 @@ void VulkanDevice::ReleaseQueue(VkQueue queue, uint32_t queue_family_index) {
free_queues_[queue_family_index].push_back(queue);
}
void VulkanDevice::DbgSetObjectName(VkDevice device, uint64_t object,
VkDebugReportObjectTypeEXT object_type,
std::string name) {
// Check to see if the extension is even loaded
if (vkGetDeviceProcAddr(device, "vkDebugMarkerSetObjectNameEXT") == nullptr) {
return;
}
// TODO(DrChat): fix linkage errors
VkDebugMarkerObjectNameInfoEXT info;
info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
info.pNext = nullptr;
info.objectType = object_type;
info.object = object;
info.pObjectName = name.c_str();
// vkDebugMarkerSetObjectNameEXT(device, &info);
}
void VulkanDevice::DbgSetObjectName(uint64_t object,
VkDebugReportObjectTypeEXT object_type,
std::string name) {
@ -289,7 +274,13 @@ void VulkanDevice::DbgSetObjectName(uint64_t object,
return;
}
DbgSetObjectName(*this, object, object_type, name);
VkDebugMarkerObjectNameInfoEXT info;
info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
info.pNext = nullptr;
info.objectType = object_type;
info.object = object;
info.pObjectName = name.c_str();
pfn_vkDebugMarkerSetObjectNameEXT_(*this, &info);
}
bool VulkanDevice::is_renderdoc_attached() const {

View File

@ -75,9 +75,6 @@ class VulkanDevice {
// This method is thread safe.
void ReleaseQueue(VkQueue queue, uint32_t queue_family_index);
static void DbgSetObjectName(VkDevice device, uint64_t object,
VkDebugReportObjectTypeEXT object_type,
std::string name);
void DbgSetObjectName(uint64_t object, VkDebugReportObjectTypeEXT object_type,
std::string name);
@ -103,6 +100,7 @@ class VulkanDevice {
std::vector<const char*> enabled_extensions_;
bool debug_marker_ena_ = false;
PFN_vkDebugMarkerSetObjectNameEXT pfn_vkDebugMarkerSetObjectNameEXT_;
DeviceInfo device_info_;
uint32_t queue_family_index_ = 0;