From 30fa329550c4f98fb8727af50e1ad53d93157071 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 15 Feb 2022 09:26:19 -0500 Subject: [PATCH] Add protections for debug marker functions --- engine/gfx/vulkan/src/gfx_vulkan.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/engine/gfx/vulkan/src/gfx_vulkan.cpp b/engine/gfx/vulkan/src/gfx_vulkan.cpp index c048b63..2e4b4d5 100755 --- a/engine/gfx/vulkan/src/gfx_vulkan.cpp +++ b/engine/gfx/vulkan/src/gfx_vulkan.cpp @@ -193,12 +193,14 @@ VkResult name_object(VkDevice device, VkObjectType type, uint64_t object, std::s void cmd_debug_marker_begin(VkDevice device, VkCommandBuffer command_buffer, VkDebugUtilsLabelEXT marker_info) { auto func = (PFN_vkCmdBeginDebugUtilsLabelEXT)vkGetDeviceProcAddr(device, "vkCmdBeginDebugUtilsLabelEXT"); - func(command_buffer, &marker_info); + if(func != nullptr) + func(command_buffer, &marker_info); } void cmd_debug_marker_end(VkDevice device, VkCommandBuffer command_buffer) { auto func = (PFN_vkCmdEndDebugUtilsLabelEXT)vkGetDeviceProcAddr(device, "vkCmdEndDebugUtilsLabelEXT"); - func(command_buffer); + if(func != nullptr) + func(command_buffer); } bool GFXVulkan::initialize(const GFXCreateInfo& info) { @@ -1805,7 +1807,7 @@ void GFXVulkan::createInstance(std::vector layers, std::vector extensions) { std::vector devices(deviceCount); vkEnumeratePhysicalDevices(instance, &deviceCount, devices.data()); + + for(auto device : devices) { + VkPhysicalDeviceProperties deviceProperties; + vkGetPhysicalDeviceProperties(device, &deviceProperties); + + prism::log("GPU = {}", deviceProperties.deviceName); + } physicalDevice = devices[0]; - VkPhysicalDeviceProperties deviceProperties; - vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties); - - prism::log("GPU = {}", deviceProperties.deviceName); - uint32_t extensionCount = 0; vkEnumerateDeviceExtensionProperties(physicalDevice, nullptr, &extensionCount, nullptr);