Cleaned up result formatting.
This commit is contained in:
parent
e55f30e7e7
commit
e120b38066
|
|
@ -85,7 +85,7 @@ Context::Context(cstr appName, Version version, bool enableValidation)
|
|||
|
||||
// May throw. Irrecoverable.
|
||||
vk::Result result = vk::createInstance(&instanceCreateInfo, nullptr, &m_Instance);
|
||||
ERROR_IF(result, "Instance creation failed. Cause: {}", to_string(result))
|
||||
ERROR_IF(result, "Instance creation failed. Cause: {}", result)
|
||||
THEN_ABORT(result)
|
||||
ELSE_DEBUG("Instance Created.");
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(m_Instance);
|
||||
|
|
@ -94,7 +94,7 @@ Context::Context(cstr appName, Version version, bool enableValidation)
|
|||
if (enableValidation)
|
||||
{
|
||||
result = m_Instance.createDebugUtilsMessengerEXT(&debugUtilsMessengerCreateInfo, nullptr, &m_DebugMessenger);
|
||||
ERROR_IF(result, "Debug Messenger creation failed. Cause: {}", to_string(result)) // Non-critical. Continue.
|
||||
ERROR_IF(result, "Debug Messenger creation failed. Cause: {}", result) // Non-critical. Continue.
|
||||
ELSE_DEBUG("Debug Messenger Created.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ Device::Device(const Context *context, PhysicalDevice *physicalDevice,
|
|||
};
|
||||
|
||||
result = cast<vk::Result>(vmaCreateAllocator(&allocatorCreateInfo, &m_Allocator));
|
||||
ERROR_IF(failed(result), "Memory allocator creation failed. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Memory allocator creation failed. Cause: {}", result)
|
||||
DO(m_Device.destroy(nullptr))
|
||||
THEN_ABORT(result)
|
||||
ELSE_VERBOSE("Memory Allocator Created");
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ getSurfaceFormats(const vk::SurfaceKHR surface, const vk::PhysicalDevice physica
|
|||
// vk::Result::eIncomplete should not occur in this function. The rest are errors. Thus, abort is allowed.
|
||||
u32 count = 0;
|
||||
vk::Result result = physicalDevice.getSurfaceFormatsKHR(surface, &count, nullptr);
|
||||
ERROR_IF(failed(result), "Could not get surface formats. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not get surface formats. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
eastl::vector<vk::SurfaceFormatKHR> surfaceFormats(count);
|
||||
result = physicalDevice.getSurfaceFormatsKHR(surface, &count, surfaceFormats.data());
|
||||
ERROR_IF(failed(result), "Could not get surface formats. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not get surface formats. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
return surfaceFormats;
|
||||
|
|
@ -31,12 +31,12 @@ getSurfacePresentModes(const vk::SurfaceKHR surface, const vk::PhysicalDevice ph
|
|||
// vk::Result::eIncomplete should not occur in this function. The rest are errors. Thus, abort is allowed.
|
||||
u32 count = 0;
|
||||
vk::Result result = physicalDevice.getSurfacePresentModesKHR(surface, &count, nullptr);
|
||||
ERROR_IF(failed(result), "Could not get present modes. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not get present modes. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
eastl::vector<vk::PresentModeKHR> presentModes(count);
|
||||
result = physicalDevice.getSurfacePresentModesKHR(surface, &count, presentModes.data());
|
||||
ERROR_IF(failed(result), "Could not get present modes. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not get present modes. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
return presentModes;
|
||||
|
|
@ -47,7 +47,7 @@ getQueuePresentSupport(const u32 queueFamilyIndex, vk::SurfaceKHR surface, const
|
|||
{
|
||||
b32 supported = false;
|
||||
const vk::Result result = physicalDevice.getSurfaceSupportKHR(queueFamilyIndex, surface, &supported);
|
||||
ERROR_IF(failed(result), "Could not get queue family surface support. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not get queue family surface support. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
return supported;
|
||||
|
|
@ -130,12 +130,12 @@ enumeratePhysicalDevices(const vk::Instance instance)
|
|||
{
|
||||
u32 count = 0;
|
||||
vk::Result result = instance.enumeratePhysicalDevices(&count, nullptr);
|
||||
ERROR_IF(failed(result), "Could not fetch vulkan devices. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not fetch vulkan devices. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
eastl::fixed_vector<vk::PhysicalDevice, 8> physicalDevices(count);
|
||||
result = instance.enumeratePhysicalDevices(&count, physicalDevices.data());
|
||||
ERROR_IF(failed(result), "Could not fetch vulkan devices. Cause: {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Could not fetch vulkan devices. Cause: {}", result)
|
||||
THEN_ABORT(result);
|
||||
|
||||
return physicalDevices;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Window::Window(cstr title, Context *context, vk::Extent2D extent, b8 isFullScree
|
|||
m_Window = glfwCreateWindow(cast<i32>(extent.width), cast<i32>(extent.height), m_Name.c_str(),
|
||||
isFullScreen ? monitor : nullptr, nullptr);
|
||||
ERROR_IF(m_Window == nullptr, "Window creation failed")
|
||||
ELSE_DEBUG("Window '{}' created with resolution '{}x{}'", m_Name.c_str(), extent.width, extent.height);
|
||||
ELSE_DEBUG("Window '{}' created with resolution '{}x{}'", m_Name, extent.width, extent.height);
|
||||
if (m_Window == nullptr)
|
||||
{
|
||||
auto code = GlfwContext::PostError();
|
||||
|
|
@ -65,9 +65,9 @@ Window::Window(cstr title, Context *context, vk::Extent2D extent, b8 isFullScree
|
|||
VkSurfaceKHR surface;
|
||||
auto result =
|
||||
cast<vk::Result>(glfwCreateWindowSurface(cast<VkInstance>(m_Context->m_Instance), m_Window, nullptr, &surface));
|
||||
ERROR_IF(failed(result), "Failed to create Surface with {}", to_string(result))
|
||||
ERROR_IF(failed(result), "Failed to create Surface with {}", result)
|
||||
THEN_ABORT(result)
|
||||
ELSE_DEBUG("Surface {} Created", m_Name.c_str());
|
||||
ELSE_DEBUG("Surface {} Created", m_Name);
|
||||
m_Surface = vk::SurfaceKHR(surface);
|
||||
}
|
||||
|
||||
|
|
@ -85,5 +85,5 @@ Window::~Window()
|
|||
m_Window = nullptr;
|
||||
}
|
||||
|
||||
DEBUG("Window '{}' Destroyed", m_Name.c_str());
|
||||
DEBUG("Window '{}' Destroyed", m_Name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue