From c9dbb589e29aaf48fd20f047b2fa4c234496fda8 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 9 Apr 2019 14:25:18 +0200 Subject: [PATCH] - once the Vulkan backend booted all the remaining vulkan calls are unrecoverable (unless the code calling it gets actively involved, which means that particular action is not exceptional in nature and shouldn't be done as an exception) --- src/rendering/vulkan/system/vk_builders.cpp | 4 ++-- src/rendering/vulkan/system/vk_builders.h | 22 ++++++++++----------- src/rendering/vulkan/system/vk_device.cpp | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/rendering/vulkan/system/vk_builders.cpp b/src/rendering/vulkan/system/vk_builders.cpp index f1308a819..4aec11613 100644 --- a/src/rendering/vulkan/system/vk_builders.cpp +++ b/src/rendering/vulkan/system/vk_builders.cpp @@ -157,7 +157,7 @@ std::unique_ptr ShaderBuilder::create(VulkanDevice *device) glslang::TIntermediate *intermediate = program.getIntermediate(stage); if (!intermediate) { - I_Error("Internal shader compiler error"); + I_FatalError("Internal shader compiler error"); } glslang::SpvOptions spvOptions; @@ -177,7 +177,7 @@ std::unique_ptr ShaderBuilder::create(VulkanDevice *device) VkShaderModule shaderModule; VkResult result = vkCreateShaderModule(device->device, &createInfo, nullptr, &shaderModule); if (result != VK_SUCCESS) - I_Error("Could not create vulkan shader module"); + I_FatalError("Could not create vulkan shader module"); return std::make_unique(device, shaderModule); } diff --git a/src/rendering/vulkan/system/vk_builders.h b/src/rendering/vulkan/system/vk_builders.h index a5ea835fa..e415466a9 100644 --- a/src/rendering/vulkan/system/vk_builders.h +++ b/src/rendering/vulkan/system/vk_builders.h @@ -408,7 +408,7 @@ inline std::unique_ptr ImageBuilder::create(VulkanDevice *device) VkResult result = vmaCreateImage(device->allocator, &imageInfo, &allocInfo, &image, &allocation, nullptr); if (result != VK_SUCCESS) - I_Error("Could not create vulkan image"); + I_FatalError("Could not create vulkan image"); return std::make_unique(device, image, allocation, imageInfo.extent.width, imageInfo.extent.height, imageInfo.mipLevels); } @@ -438,7 +438,7 @@ inline std::unique_ptr ImageViewBuilder::create(VulkanDevice *d VkImageView view; VkResult result = vkCreateImageView(device->device, &viewInfo, nullptr, &view); if (result != VK_SUCCESS) - I_Error("Could not create texture image view"); + I_FatalError("Could not create texture image view"); return std::make_unique(device, view); } @@ -510,7 +510,7 @@ inline std::unique_ptr SamplerBuilder::create(VulkanDevice *devic VkSampler sampler; VkResult result = vkCreateSampler(device->device, &samplerInfo, nullptr, &sampler); if (result != VK_SUCCESS) - I_Error("Could not create texture sampler"); + I_FatalError("Could not create texture sampler"); return std::make_unique(device, sampler); } @@ -541,7 +541,7 @@ inline std::unique_ptr BufferBuilder::create(VulkanDevice *device) VkResult result = vmaCreateBuffer(device->allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr); if (result != VK_SUCCESS) - I_Error("could not allocate memory for vulkan buffer"); + I_FatalError("could not allocate memory for vulkan buffer"); return std::make_unique(device, buffer, allocation, bufferInfo.size); } @@ -601,7 +601,7 @@ inline std::unique_ptr DescriptorSetLayoutBuilder::cr VkDescriptorSetLayout layout; VkResult result = vkCreateDescriptorSetLayout(device->device, &layoutInfo, nullptr, &layout); if (result != VK_SUCCESS) - I_Error("Could not create descriptor set layout"); + I_FatalError("Could not create descriptor set layout"); return std::make_unique(device, layout); } @@ -635,7 +635,7 @@ inline std::unique_ptr DescriptorPoolBuilder::create(Vulka VkDescriptorPool descriptorPool; VkResult result = vkCreateDescriptorPool(device->device, &poolInfo, nullptr, &descriptorPool); if (result != VK_SUCCESS) - I_Error("Could not create descriptor pool"); + I_FatalError("Could not create descriptor pool"); return std::make_unique(device, descriptorPool); } @@ -679,7 +679,7 @@ inline std::unique_ptr FramebufferBuilder::create(VulkanDevic VkFramebuffer framebuffer = 0; VkResult result = vkCreateFramebuffer(device->device, &framebufferInfo, nullptr, &framebuffer); if (result != VK_SUCCESS) - I_Error("Failed to create framebuffer"); + I_FatalError("Failed to create framebuffer"); return std::make_unique(device, framebuffer); } @@ -972,7 +972,7 @@ inline std::unique_ptr GraphicsPipelineBuilder::create(VulkanDev VkPipeline pipeline = 0; VkResult result = vkCreateGraphicsPipelines(device->device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &pipeline); if (result != VK_SUCCESS) - I_Error("Could not create graphics pipeline"); + I_FatalError("Could not create graphics pipeline"); return std::make_unique(device, pipeline); } @@ -1006,7 +1006,7 @@ inline std::unique_ptr PipelineLayoutBuilder::create(Vulka VkPipelineLayout pipelineLayout; VkResult result = vkCreatePipelineLayout(device->device, &pipelineLayoutInfo, nullptr, &pipelineLayout); if (result != VK_SUCCESS) - I_Error("Could not create pipeline layout"); + I_FatalError("Could not create pipeline layout"); return std::make_unique(device, pipelineLayout); } @@ -1102,7 +1102,7 @@ inline std::unique_ptr RenderPassBuilder::create(VulkanDevice VkRenderPass renderPass = 0; VkResult result = vkCreateRenderPass(device->device, &renderPassInfo, nullptr, &renderPass); if (result != VK_SUCCESS) - I_Error("Could not create render pass"); + I_FatalError("Could not create render pass"); return std::make_unique(device, renderPass); } @@ -1235,7 +1235,7 @@ inline void QueueSubmit::execute(VulkanDevice *device, VkQueue queue, VulkanFenc { VkResult result = vkQueueSubmit(device->graphicsQueue, 1, &submitInfo, fence ? fence->fence : VK_NULL_HANDLE); if (result < VK_SUCCESS) - I_Error("Failed to submit command buffer"); + I_FatalError("Failed to submit command buffer"); } ///////////////////////////////////////////////////////////////////////////// diff --git a/src/rendering/vulkan/system/vk_device.cpp b/src/rendering/vulkan/system/vk_device.cpp index e5d43144c..06dff224c 100644 --- a/src/rendering/vulkan/system/vk_device.cpp +++ b/src/rendering/vulkan/system/vk_device.cpp @@ -520,6 +520,6 @@ uint32_t VulkanDevice::FindMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags return i; } - I_Error("failed to find suitable memory type!"); + I_FatalError("failed to find suitable memory type!"); return 0; }