Archived
1
Fork 0

Add protections for debug marker functions

This commit is contained in:
Joshua Goins 2022-02-15 09:26:19 -05:00
parent 2ce04b686d
commit 30fa329550

View file

@ -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<const char*> layers, std::vector<cons
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.pEngineName = "Prism Engine";
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.apiVersion = VK_API_VERSION_1_2;
appInfo.apiVersion = VK_API_VERSION_1_1;
VkInstanceCreateInfo createInfo = {};
createInfo.pNext = &debugCreateInfo;
@ -1829,14 +1831,16 @@ void GFXVulkan::createLogicalDevice(std::vector<const char*> extensions) {
std::vector<VkPhysicalDevice> 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);