mirror of https://github.com/auygun/kaliber.git
Stringify error values
This commit is contained in:
parent
0a2f1bd7c3
commit
beba055645
|
@ -18,6 +18,7 @@
|
||||||
#include "third_party/glslang/glslang/Include/Types.h"
|
#include "third_party/glslang/glslang/Include/Types.h"
|
||||||
#include "third_party/glslang/glslang/Public/ShaderLang.h"
|
#include "third_party/glslang/glslang/Public/ShaderLang.h"
|
||||||
#include "third_party/spirv-reflect/spirv_reflect.h"
|
#include "third_party/spirv-reflect/spirv_reflect.h"
|
||||||
|
#include "third_party/vulkan/vk_enum_string_helper.h"
|
||||||
|
|
||||||
using namespace base;
|
using namespace base;
|
||||||
|
|
||||||
|
@ -345,7 +346,7 @@ std::pair<int, int> GetBlockSizeForImageFormat(VkFormat format) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NOTREACHED << "Invalid format: " << format;
|
NOTREACHED << "Invalid format: " << string_VkFormat(format);
|
||||||
return {0, 0};
|
return {0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +362,7 @@ std::pair<int, int> GetNumBlocksForImageFormat(VkFormat format,
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NOTREACHED << "Invalid format: " << format;
|
NOTREACHED << "Invalid format: " << string_VkFormat(format);
|
||||||
return {width, height};
|
return {width, height};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,14 +866,14 @@ bool RendererVulkan::InitializeInternal() {
|
||||||
VkResult err = vkCreateCommandPool(device_, &cmd_pool_info, nullptr,
|
VkResult err = vkCreateCommandPool(device_, &cmd_pool_info, nullptr,
|
||||||
&frames_[i].setup_command_pool);
|
&frames_[i].setup_command_pool);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateCommandPool failed with error " << std::to_string(err);
|
DLOG << "vkCreateCommandPool failed with error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = vkCreateCommandPool(device_, &cmd_pool_info, nullptr,
|
err = vkCreateCommandPool(device_, &cmd_pool_info, nullptr,
|
||||||
&frames_[i].draw_command_pool);
|
&frames_[i].draw_command_pool);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateCommandPool failed with error " << std::to_string(err);
|
DLOG << "vkCreateCommandPool failed with error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +889,7 @@ bool RendererVulkan::InitializeInternal() {
|
||||||
&frames_[i].setup_command_buffer);
|
&frames_[i].setup_command_buffer);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkAllocateCommandBuffers failed with error "
|
DLOG << "vkAllocateCommandBuffers failed with error "
|
||||||
<< std::to_string(err);
|
<< string_VkResult(err);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,7 +898,7 @@ bool RendererVulkan::InitializeInternal() {
|
||||||
&frames_[i].draw_command_buffer);
|
&frames_[i].draw_command_buffer);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkAllocateCommandBuffers failed with error "
|
DLOG << "vkAllocateCommandBuffers failed with error "
|
||||||
<< std::to_string(err);
|
<< string_VkResult(err);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -918,10 +919,10 @@ bool RendererVulkan::InitializeInternal() {
|
||||||
ds_layout_info.bindingCount = 1;
|
ds_layout_info.bindingCount = 1;
|
||||||
ds_layout_info.pBindings = &ds_layout_binding;
|
ds_layout_info.pBindings = &ds_layout_binding;
|
||||||
|
|
||||||
VkResult res = vkCreateDescriptorSetLayout(device_, &ds_layout_info, nullptr,
|
VkResult err = vkCreateDescriptorSetLayout(device_, &ds_layout_info, nullptr,
|
||||||
&descriptor_set_layout_);
|
&descriptor_set_layout_);
|
||||||
if (res) {
|
if (err) {
|
||||||
DLOG << "Error (" << std::to_string(res)
|
DLOG << "Error (" << string_VkResult(err)
|
||||||
<< ") creating descriptor set layout for set";
|
<< ") creating descriptor set layout for set";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -947,9 +948,9 @@ bool RendererVulkan::InitializeInternal() {
|
||||||
sampler_info.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK;
|
sampler_info.borderColor = VK_BORDER_COLOR_INT_OPAQUE_BLACK;
|
||||||
sampler_info.unnormalizedCoordinates = VK_FALSE;
|
sampler_info.unnormalizedCoordinates = VK_FALSE;
|
||||||
|
|
||||||
res = vkCreateSampler(device_, &sampler_info, nullptr, &sampler_);
|
err = vkCreateSampler(device_, &sampler_info, nullptr, &sampler_);
|
||||||
if (res) {
|
if (err) {
|
||||||
DLOG << "vkCreateSampler failed with error " << std::to_string(res);
|
DLOG << "vkCreateSampler failed with error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1036,14 +1037,14 @@ void RendererVulkan::BeginFrame() {
|
||||||
VkResult err = vkBeginCommandBuffer(
|
VkResult err = vkBeginCommandBuffer(
|
||||||
frames_[current_frame_].setup_command_buffer, &cmdbuf_begin);
|
frames_[current_frame_].setup_command_buffer, &cmdbuf_begin);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkBeginCommandBuffer failed with error " << std::to_string(err);
|
DLOG << "vkBeginCommandBuffer failed with error " << string_VkResult(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = vkBeginCommandBuffer(frames_[current_frame_].draw_command_buffer,
|
err = vkBeginCommandBuffer(frames_[current_frame_].draw_command_buffer,
|
||||||
&cmdbuf_begin);
|
&cmdbuf_begin);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkBeginCommandBuffer failed with error " << std::to_string(err);
|
DLOG << "vkBeginCommandBuffer failed with error " << string_VkResult(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1074,7 +1075,7 @@ void RendererVulkan::FlushSetupBuffer() {
|
||||||
VkResult err = vkBeginCommandBuffer(
|
VkResult err = vkBeginCommandBuffer(
|
||||||
frames_[current_frame_].setup_command_buffer, &cmdbuf_begin);
|
frames_[current_frame_].setup_command_buffer, &cmdbuf_begin);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkBeginCommandBuffer failed with error " << std::to_string(err);
|
DLOG << "vkBeginCommandBuffer failed with error " << string_VkResult(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
context_.AppendCommandBuffer(frames_[current_frame_].setup_command_buffer,
|
context_.AppendCommandBuffer(frames_[current_frame_].setup_command_buffer,
|
||||||
|
@ -1287,7 +1288,7 @@ bool RendererVulkan::InsertStagingBuffer() {
|
||||||
&std::get<0>(block.buffer),
|
&std::get<0>(block.buffer),
|
||||||
&std::get<1>(block.buffer), &block.alloc_info);
|
&std::get<1>(block.buffer), &block.alloc_info);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vmaCreateBuffer failed with error " << std::to_string(err);
|
DLOG << "vmaCreateBuffer failed with error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1325,11 +1326,11 @@ RendererVulkan::DescPool* RendererVulkan::AllocateDescriptorPool() {
|
||||||
descriptor_pool_create_info.pPoolSizes = &sizes;
|
descriptor_pool_create_info.pPoolSizes = &sizes;
|
||||||
|
|
||||||
VkDescriptorPool desc_pool;
|
VkDescriptorPool desc_pool;
|
||||||
VkResult res = vkCreateDescriptorPool(device_, &descriptor_pool_create_info,
|
VkResult err = vkCreateDescriptorPool(device_, &descriptor_pool_create_info,
|
||||||
nullptr, &desc_pool);
|
nullptr, &desc_pool);
|
||||||
if (res) {
|
if (err) {
|
||||||
DLOG << "vkCreateDescriptorPool failed with error "
|
DLOG << "vkCreateDescriptorPool failed with error "
|
||||||
<< std::to_string(res);
|
<< string_VkResult(err);
|
||||||
return VK_NULL_HANDLE;
|
return VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1385,7 +1386,7 @@ bool RendererVulkan::AllocateBuffer(Buffer<VkBuffer>& buffer,
|
||||||
&vk_buffer, &allocation, nullptr);
|
&vk_buffer, &allocation, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "Can't create buffer of size: " << std::to_string(size)
|
DLOG << "Can't create buffer of size: " << std::to_string(size)
|
||||||
<< ", error " << std::to_string(err);
|
<< ", error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,7 +1502,7 @@ bool RendererVulkan::AllocateImage(Buffer<VkImage>& image,
|
||||||
VkResult err = vmaCreateImage(allocator_, &image_create_info, &allocInfo,
|
VkResult err = vmaCreateImage(allocator_, &image_create_info, &allocInfo,
|
||||||
&vk_image, &allocation, nullptr);
|
&vk_image, &allocation, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vmaCreateImage failed with error " << std::to_string(err);
|
DLOG << "vmaCreateImage failed with error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1527,7 +1528,7 @@ bool RendererVulkan::AllocateImage(Buffer<VkImage>& image,
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
vmaDestroyImage(allocator_, vk_image, allocation);
|
vmaDestroyImage(allocator_, vk_image, allocation);
|
||||||
DLOG << "vkCreateImageView failed with error " << std::to_string(err);
|
DLOG << "vkCreateImageView failed with error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,11 +1545,11 @@ bool RendererVulkan::AllocateImage(Buffer<VkImage>& image,
|
||||||
descriptor_set_allocate_info.pSetLayouts = &descriptor_set_layout_;
|
descriptor_set_allocate_info.pSetLayouts = &descriptor_set_layout_;
|
||||||
|
|
||||||
VkDescriptorSet descriptor_set;
|
VkDescriptorSet descriptor_set;
|
||||||
VkResult res = vkAllocateDescriptorSets(
|
err = vkAllocateDescriptorSets(device_, &descriptor_set_allocate_info,
|
||||||
device_, &descriptor_set_allocate_info, &descriptor_set);
|
&descriptor_set);
|
||||||
if (res) {
|
if (err) {
|
||||||
--std::get<1>(*desc_pool);
|
--std::get<1>(*desc_pool);
|
||||||
DLOG << "Cannot allocate descriptor sets, error " << std::to_string(res);
|
DLOG << "Cannot allocate descriptor sets, error " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,8 @@ bool VulkanContext::CreateValidationLayers() {
|
||||||
uint32_t instance_layer_count = 0;
|
uint32_t instance_layer_count = 0;
|
||||||
err = vkEnumerateInstanceLayerProperties(&instance_layer_count, nullptr);
|
err = vkEnumerateInstanceLayerProperties(&instance_layer_count, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumerateInstanceLayerProperties failed. Error: " << err;
|
DLOG << "vkEnumerateInstanceLayerProperties failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +228,8 @@ bool VulkanContext::CreateValidationLayers() {
|
||||||
err = vkEnumerateInstanceLayerProperties(&instance_layer_count,
|
err = vkEnumerateInstanceLayerProperties(&instance_layer_count,
|
||||||
instance_layers.get());
|
instance_layers.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumerateInstanceLayerProperties failed. Error: " << err;
|
DLOG << "vkEnumerateInstanceLayerProperties failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +285,8 @@ bool VulkanContext::InitializeExtensions() {
|
||||||
err = vkEnumerateInstanceExtensionProperties(
|
err = vkEnumerateInstanceExtensionProperties(
|
||||||
nullptr, &instance_extension_count, nullptr);
|
nullptr, &instance_extension_count, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumerateInstanceExtensionProperties failed. Error: " << err;
|
DLOG << "vkEnumerateInstanceExtensionProperties failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +296,8 @@ bool VulkanContext::InitializeExtensions() {
|
||||||
err = vkEnumerateInstanceExtensionProperties(
|
err = vkEnumerateInstanceExtensionProperties(
|
||||||
nullptr, &instance_extension_count, instance_extensions.get());
|
nullptr, &instance_extension_count, instance_extensions.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumerateInstanceExtensionProperties failed. Error: " << err;
|
DLOG << "vkEnumerateInstanceExtensionProperties failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < instance_extension_count; i++) {
|
for (uint32_t i = 0; i < instance_extension_count; i++) {
|
||||||
|
@ -408,7 +412,7 @@ bool VulkanContext::CreatePhysicalDevice() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateInstance failed. Error: " << err;
|
DLOG << "vkCreateInstance failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +422,8 @@ bool VulkanContext::CreatePhysicalDevice() {
|
||||||
// Make initial call to query gpu_count.
|
// Make initial call to query gpu_count.
|
||||||
VkResult err = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr);
|
VkResult err = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumeratePhysicalDevices failed. Error: " << err;
|
DLOG << "vkEnumeratePhysicalDevices failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +436,8 @@ bool VulkanContext::CreatePhysicalDevice() {
|
||||||
err =
|
err =
|
||||||
vkEnumeratePhysicalDevices(instance_, &gpu_count, physical_devices.get());
|
vkEnumeratePhysicalDevices(instance_, &gpu_count, physical_devices.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumeratePhysicalDevices failed. Error: " << err;
|
DLOG << "vkEnumeratePhysicalDevices failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Grab the first physical device for now.
|
// Grab the first physical device for now.
|
||||||
|
@ -446,7 +452,8 @@ bool VulkanContext::CreatePhysicalDevice() {
|
||||||
err = vkEnumerateDeviceExtensionProperties(gpu_, nullptr,
|
err = vkEnumerateDeviceExtensionProperties(gpu_, nullptr,
|
||||||
&device_extension_count, nullptr);
|
&device_extension_count, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumerateDeviceExtensionProperties failed. Error: " << err;
|
DLOG << "vkEnumerateDeviceExtensionProperties failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +463,8 @@ bool VulkanContext::CreatePhysicalDevice() {
|
||||||
err = vkEnumerateDeviceExtensionProperties(
|
err = vkEnumerateDeviceExtensionProperties(
|
||||||
gpu_, nullptr, &device_extension_count, device_extensions.get());
|
gpu_, nullptr, &device_extension_count, device_extensions.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEnumerateDeviceExtensionProperties failed. Error: " << err;
|
DLOG << "vkEnumerateDeviceExtensionProperties failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +608,7 @@ bool VulkanContext::CreateDevice() {
|
||||||
}
|
}
|
||||||
err = vkCreateDevice(gpu_, &sdevice, nullptr, &device_);
|
err = vkCreateDevice(gpu_, &sdevice, nullptr, &device_);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateDevice failed. Error: " << err;
|
DLOG << "vkCreateDevice failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -678,14 +686,16 @@ bool VulkanContext::InitializeQueues(VkSurfaceKHR surface) {
|
||||||
VkResult err =
|
VkResult err =
|
||||||
GetPhysicalDeviceSurfaceFormatsKHR(gpu_, surface, &format_count, nullptr);
|
GetPhysicalDeviceSurfaceFormatsKHR(gpu_, surface, &format_count, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "GetPhysicalDeviceSurfaceFormatsKHR failed. Error: " << err;
|
DLOG << "GetPhysicalDeviceSurfaceFormatsKHR failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto surf_formats = std::make_unique<VkSurfaceFormatKHR[]>(format_count);
|
auto surf_formats = std::make_unique<VkSurfaceFormatKHR[]>(format_count);
|
||||||
err = GetPhysicalDeviceSurfaceFormatsKHR(gpu_, surface, &format_count,
|
err = GetPhysicalDeviceSurfaceFormatsKHR(gpu_, surface, &format_count,
|
||||||
surf_formats.get());
|
surf_formats.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "GetPhysicalDeviceSurfaceFormatsKHR failed. Error: " << err;
|
DLOG << "GetPhysicalDeviceSurfaceFormatsKHR failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,26 +753,26 @@ bool VulkanContext::CreateSemaphores() {
|
||||||
for (uint32_t i = 0; i < kFrameLag; i++) {
|
for (uint32_t i = 0; i < kFrameLag; i++) {
|
||||||
err = vkCreateFence(device_, &fence_ci, nullptr, &fences_[i]);
|
err = vkCreateFence(device_, &fence_ci, nullptr, &fences_[i]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateFence failed. Error: " << err;
|
DLOG << "vkCreateFence failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
err = vkCreateSemaphore(device_, &semaphoreCreateInfo, nullptr,
|
err = vkCreateSemaphore(device_, &semaphoreCreateInfo, nullptr,
|
||||||
&image_acquired_semaphores_[i]);
|
&image_acquired_semaphores_[i]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateSemaphore failed. Error: " << err;
|
DLOG << "vkCreateSemaphore failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
err = vkCreateSemaphore(device_, &semaphoreCreateInfo, nullptr,
|
err = vkCreateSemaphore(device_, &semaphoreCreateInfo, nullptr,
|
||||||
&draw_complete_semaphores_[i]);
|
&draw_complete_semaphores_[i]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateSemaphore failed. Error: " << err;
|
DLOG << "vkCreateSemaphore failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (separate_present_queue_) {
|
if (separate_present_queue_) {
|
||||||
err = vkCreateSemaphore(device_, &semaphoreCreateInfo, nullptr,
|
err = vkCreateSemaphore(device_, &semaphoreCreateInfo, nullptr,
|
||||||
&image_ownership_semaphores_[i]);
|
&image_ownership_semaphores_[i]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateSemaphore failed. Error: " << err;
|
DLOG << "vkCreateSemaphore failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -834,7 +844,8 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = GetPhysicalDeviceSurfaceCapabilitiesKHR(gpu_, window->surface,
|
err = GetPhysicalDeviceSurfaceCapabilitiesKHR(gpu_, window->surface,
|
||||||
&surf_capabilities);
|
&surf_capabilities);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "GetPhysicalDeviceSurfaceCapabilitiesKHR failed. Error: " << err;
|
DLOG << "GetPhysicalDeviceSurfaceCapabilitiesKHR failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,7 +853,8 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = GetPhysicalDeviceSurfacePresentModesKHR(gpu_, window->surface,
|
err = GetPhysicalDeviceSurfacePresentModesKHR(gpu_, window->surface,
|
||||||
&present_mode_count, nullptr);
|
&present_mode_count, nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "GetPhysicalDeviceSurfacePresentModesKHR failed. Error: " << err;
|
DLOG << "GetPhysicalDeviceSurfacePresentModesKHR failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +863,8 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = GetPhysicalDeviceSurfacePresentModesKHR(
|
err = GetPhysicalDeviceSurfacePresentModesKHR(
|
||||||
gpu_, window->surface, &present_mode_count, present_modes.get());
|
gpu_, window->surface, &present_mode_count, present_modes.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "GetPhysicalDeviceSurfacePresentModesKHR failed. Error: " << err;
|
DLOG << "GetPhysicalDeviceSurfacePresentModesKHR failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -998,7 +1011,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
|
|
||||||
err = CreateSwapchainKHR(device_, &swapchain_ci, nullptr, &window->swapchain);
|
err = CreateSwapchainKHR(device_, &swapchain_ci, nullptr, &window->swapchain);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "CreateSwapchainKHR failed. Error: " << err;
|
DLOG << "CreateSwapchainKHR failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,7 +1019,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = GetSwapchainImagesKHR(device_, window->swapchain, &sp_image_count,
|
err = GetSwapchainImagesKHR(device_, window->swapchain, &sp_image_count,
|
||||||
nullptr);
|
nullptr);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "CreateSwapchainKHR failed. Error: " << err;
|
DLOG << "CreateSwapchainKHR failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,7 +1036,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = GetSwapchainImagesKHR(device_, window->swapchain,
|
err = GetSwapchainImagesKHR(device_, window->swapchain,
|
||||||
&swapchain_image_count_, swapchain_images.get());
|
&swapchain_image_count_, swapchain_images.get());
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "GetSwapchainImagesKHR failed. Error: " << err;
|
DLOG << "GetSwapchainImagesKHR failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,7 +1073,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = vkCreateImageView(device_, &color_image_view, nullptr,
|
err = vkCreateImageView(device_, &color_image_view, nullptr,
|
||||||
&window->swapchain_image_resources[i].view);
|
&window->swapchain_image_resources[i].view);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateImageView failed. Error: " << err;
|
DLOG << "vkCreateImageView failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1144,7 +1157,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
|
|
||||||
err = vkCreateRenderPass(device_, &rp_info, nullptr, &window->render_pass);
|
err = vkCreateRenderPass(device_, &rp_info, nullptr, &window->render_pass);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateRenderPass failed. Error: " << err;
|
DLOG << "vkCreateRenderPass failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,7 +1182,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
device_, &fb_info, nullptr,
|
device_, &fb_info, nullptr,
|
||||||
&window->swapchain_image_resources[i].frame_buffer);
|
&window->swapchain_image_resources[i].frame_buffer);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateFramebuffer failed. Error: " << err;
|
DLOG << "vkCreateFramebuffer failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1200,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = vkCreateCommandPool(device_, &present_cmd_pool_info, nullptr,
|
err = vkCreateCommandPool(device_, &present_cmd_pool_info, nullptr,
|
||||||
&window->present_cmd_pool);
|
&window->present_cmd_pool);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateCommandPool failed. Error: " << err;
|
DLOG << "vkCreateCommandPool failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,7 +1216,8 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
device_, &present_cmd_info,
|
device_, &present_cmd_info,
|
||||||
&window->swapchain_image_resources[i].graphics_to_present_cmd);
|
&window->swapchain_image_resources[i].graphics_to_present_cmd);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkAllocateCommandBuffers failed. Error: " << err;
|
DLOG << "vkAllocateCommandBuffers failed. Error: "
|
||||||
|
<< string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,7 +1231,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
window->swapchain_image_resources[i].graphics_to_present_cmd,
|
window->swapchain_image_resources[i].graphics_to_present_cmd,
|
||||||
&cmd_buf_info);
|
&cmd_buf_info);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkBeginCommandBuffer failed. Error: " << err;
|
DLOG << "vkBeginCommandBuffer failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1241,7 +1255,7 @@ bool VulkanContext::UpdateSwapChain(Window* window) {
|
||||||
err = vkEndCommandBuffer(
|
err = vkEndCommandBuffer(
|
||||||
window->swapchain_image_resources[i].graphics_to_present_cmd);
|
window->swapchain_image_resources[i].graphics_to_present_cmd);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkEndCommandBuffer failed. Error: " << err;
|
DLOG << "vkEndCommandBuffer failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1294,7 @@ bool VulkanContext::CreateDepthImage(Window* window) {
|
||||||
VkResult err =
|
VkResult err =
|
||||||
vkCreateImage(device_, &depth_image_ci, nullptr, &window->depth_image);
|
vkCreateImage(device_, &depth_image_ci, nullptr, &window->depth_image);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkCreateImage failed. Error: " << err;
|
DLOG << "vkCreateImage failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,7 +1326,7 @@ bool VulkanContext::CreateDepthImage(Window* window) {
|
||||||
err = vkAllocateMemory(device_, &alloc_info, nullptr,
|
err = vkAllocateMemory(device_, &alloc_info, nullptr,
|
||||||
&window->depth_image_memory);
|
&window->depth_image_memory);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkAllocateMemory failed. Error: " << err;
|
DLOG << "vkAllocateMemory failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,7 +1396,7 @@ void VulkanContext::Flush(bool all) {
|
||||||
vkQueueSubmit(graphics_queue_, 1, &submit_info, VK_NULL_HANDLE);
|
vkQueueSubmit(graphics_queue_, 1, &submit_info, VK_NULL_HANDLE);
|
||||||
command_buffers_[0] = nullptr;
|
command_buffers_[0] = nullptr;
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkQueueSubmit failed. Error: " << err;
|
DLOG << "vkQueueSubmit failed. Error: " << string_VkResult(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1440,7 @@ bool VulkanContext::PrepareBuffers() {
|
||||||
UpdateSwapChain(&window_);
|
UpdateSwapChain(&window_);
|
||||||
break;
|
break;
|
||||||
} else if (err != VK_SUCCESS) {
|
} else if (err != VK_SUCCESS) {
|
||||||
DLOG << "AcquireNextImageKHR failed. Error: " << err;
|
DLOG << "AcquireNextImageKHR failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} while (err != VK_SUCCESS);
|
} while (err != VK_SUCCESS);
|
||||||
|
@ -1463,7 +1477,7 @@ bool VulkanContext::SwapBuffers() {
|
||||||
submit_info.pSignalSemaphores = &draw_complete_semaphores_[frame_index_];
|
submit_info.pSignalSemaphores = &draw_complete_semaphores_[frame_index_];
|
||||||
err = vkQueueSubmit(graphics_queue_, 1, &submit_info, fences_[frame_index_]);
|
err = vkQueueSubmit(graphics_queue_, 1, &submit_info, fences_[frame_index_]);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkQueueSubmit failed. Error: " << err;
|
DLOG << "vkQueueSubmit failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1494,7 +1508,7 @@ bool VulkanContext::SwapBuffers() {
|
||||||
submit_info.pSignalSemaphores = &image_ownership_semaphores_[frame_index_];
|
submit_info.pSignalSemaphores = &image_ownership_semaphores_[frame_index_];
|
||||||
err = vkQueueSubmit(present_queue_, 1, &submit_info, null_fence);
|
err = vkQueueSubmit(present_queue_, 1, &submit_info, null_fence);
|
||||||
if (err) {
|
if (err) {
|
||||||
DLOG << "vkQueueSubmit failed. Error: " << err;
|
DLOG << "vkQueueSubmit failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1555,7 @@ bool VulkanContext::SwapBuffers() {
|
||||||
// presentation engine will still present the image correctly.
|
// presentation engine will still present the image correctly.
|
||||||
DLOG << "Swapchain is Suboptimal.";
|
DLOG << "Swapchain is Suboptimal.";
|
||||||
} else if (err) {
|
} else if (err) {
|
||||||
DLOG << "QueuePresentKHR failed. Error: " << err;
|
DLOG << "QueuePresentKHR failed. Error: " << string_VkResult(err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue