Fix errors which caused win32 builds to fail

The debug_callback_messenger didn't use the VK_API macros and there
were a few places that compared VkHandles to nullptr which weren't liked.
This commit is contained in:
Charles Giessen 2020-12-17 00:42:48 -07:00
parent 325cdff399
commit af5409fcea

View File

@ -289,7 +289,7 @@ void destroy_debug_utils_messenger (
}
}
VkBool32 default_debug_callback (VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VKAPI_ATTR VkBool32 VKAPI_CALL default_debug_callback (VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
void*) {
@ -550,7 +550,7 @@ bool SystemInfo::is_layer_available (const char* layer_name) const {
void destroy_instance (Instance instance) {
if (instance.instance != VK_NULL_HANDLE) {
if (instance.debug_messenger != nullptr)
if (instance.debug_messenger != VK_NULL_HANDLE)
destroy_debug_utils_messenger (instance.instance, instance.debug_messenger, instance.allocation_callbacks);
detail::vulkan_functions ().fp_vkDestroyInstance (instance.instance, instance.allocation_callbacks);
}
@ -1093,7 +1093,7 @@ PhysicalDeviceSelector::PhysicalDeviceSelector (Instance const& instance) {
detail::Result<PhysicalDevice> PhysicalDeviceSelector::select () const {
if (!system_info.headless && !criteria.defer_surface_initialization) {
if (system_info.surface == nullptr)
if (system_info.surface == VK_NULL_HANDLE)
return detail::Result<PhysicalDevice>{ PhysicalDeviceError::no_surface_provided };
}
@ -1541,7 +1541,11 @@ SwapchainBuilder::SwapchainBuilder (Device const& device, VkSurfaceKHR const sur
info.graphics_queue_index = present.value ();
info.present_queue_index = graphics.value ();
}
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, int32_t graphics_queue_index, int32_t present_queue_index){
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device,
VkDevice const device,
VkSurfaceKHR const surface,
int32_t graphics_queue_index,
int32_t present_queue_index) {
info.physical_device = physical_device;
info.device = device;
info.surface = surface;
@ -1551,9 +1555,11 @@ SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device, VkDe
auto queue_families = detail::get_vector_noerror<VkQueueFamilyProperties> (
detail::vulkan_functions ().fp_vkGetPhysicalDeviceQueueFamilyProperties, physical_device);
if (graphics_queue_index < 0)
info.graphics_queue_index = static_cast<uint32_t>(detail::get_graphics_queue_index (queue_families));
info.graphics_queue_index =
static_cast<uint32_t> (detail::get_graphics_queue_index (queue_families));
if (present_queue_index < 0)
info.present_queue_index = static_cast<uint32_t>(detail::get_present_queue_index (physical_device, surface, queue_families));
info.present_queue_index = static_cast<uint32_t> (
detail::get_present_queue_index (physical_device, surface, queue_families));
}
}
detail::Result<Swapchain> SwapchainBuilder::build () const {