diff --git a/src/xenia/ui/vulkan/vulkan_device.cc b/src/xenia/ui/vulkan/vulkan_device.cc index 178e2d3cc..9e03d2608 100644 --- a/src/xenia/ui/vulkan/vulkan_device.cc +++ b/src/xenia/ui/vulkan/vulkan_device.cc @@ -75,7 +75,7 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) { // Gather list of enabled extension names. auto extensions_result = CheckRequirements(required_extensions_, device_info.extensions); - auto& enabled_extensions = extensions_result.second; + enabled_extensions_ = extensions_result.second; // We wait until both extensions and layers are checked before failing out so // that the user gets a complete list of what they have/don't. @@ -166,8 +166,8 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) { create_info.enabledLayerCount = static_cast(enabled_layers.size()); create_info.ppEnabledLayerNames = enabled_layers.data(); create_info.enabledExtensionCount = - static_cast(enabled_extensions.size()); - create_info.ppEnabledExtensionNames = enabled_extensions.data(); + static_cast(enabled_extensions_.size()); + create_info.ppEnabledExtensionNames = enabled_extensions_.data(); create_info.pEnabledFeatures = &enabled_features; auto err = vkCreateDevice(device_info.handle, &create_info, nullptr, &handle); @@ -192,6 +192,13 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) { return false; } + // Set flags so we can track enabled extensions easily. + for (auto& ext : enabled_extensions_) { + if (!std::strcmp(ext, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { + debug_marker_ena_ = true; + } + } + device_info_ = std::move(device_info); queue_family_index_ = ideal_queue_family_index; @@ -239,6 +246,11 @@ void VulkanDevice::DbgSetObjectName(VkDevice device, uint64_t object, void VulkanDevice::DbgSetObjectName(uint64_t object, VkDebugReportObjectTypeEXT object_type, std::string name) { + if (!debug_marker_ena_) { + // Extension disabled. + return; + } + DbgSetObjectName(*this, object, object_type, name); } diff --git a/src/xenia/ui/vulkan/vulkan_device.h b/src/xenia/ui/vulkan/vulkan_device.h index 08886e487..0916a7909 100644 --- a/src/xenia/ui/vulkan/vulkan_device.h +++ b/src/xenia/ui/vulkan/vulkan_device.h @@ -100,6 +100,9 @@ class VulkanDevice { std::vector required_layers_; std::vector required_extensions_; + std::vector enabled_extensions_; + + bool debug_marker_ena_ = false; DeviceInfo device_info_; uint32_t queue_family_index_ = 0;