Vulkan UI: Track if debug marker extension is enabled

This commit is contained in:
DrChat 2017-02-12 19:05:59 -06:00
parent 4ee16fd193
commit ba8e315a69
2 changed files with 18 additions and 3 deletions

View File

@ -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<uint32_t>(enabled_layers.size());
create_info.ppEnabledLayerNames = enabled_layers.data();
create_info.enabledExtensionCount =
static_cast<uint32_t>(enabled_extensions.size());
create_info.ppEnabledExtensionNames = enabled_extensions.data();
static_cast<uint32_t>(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);
}

View File

@ -100,6 +100,9 @@ class VulkanDevice {
std::vector<Requirement> required_layers_;
std::vector<Requirement> required_extensions_;
std::vector<const char*> enabled_extensions_;
bool debug_marker_ena_ = false;
DeviceInfo device_info_;
uint32_t queue_family_index_ = 0;