Refactor tracing
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Copium
|
||||
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
|
||||
createInfo.pfnUserCallback = DebugCallback;
|
||||
createInfo.pUserData = nullptr;
|
||||
CP_VK_ASSERT(vkCreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger), "DebugMessenger : Failed to initialze debug messenger");
|
||||
CP_VK_ASSERT(vkCreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger), "Failed to initialze debug messenger");
|
||||
}
|
||||
|
||||
DebugMessenger::~DebugMessenger()
|
||||
@@ -58,9 +58,9 @@ namespace Copium
|
||||
if (messageSeverity >= VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
|
||||
{
|
||||
if (messageSeverity >= VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
|
||||
CP_ABORT("DebugCallback : %s", pCallbackData->pMessage);
|
||||
CP_ABORT("%s", pCallbackData->pMessage);
|
||||
else
|
||||
CP_WARN("DebugCallback : %s", pCallbackData->pMessage);
|
||||
CP_WARN("%s", pCallbackData->pMessage);
|
||||
}
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
||||
@@ -52,18 +52,18 @@ namespace Copium
|
||||
if ((typeFilter & (1 << i)) && (memoryProperties.memoryTypes[i].propertyFlags & properties) == properties)
|
||||
return i;
|
||||
}
|
||||
CP_ABORT("FindMemoryType : Failed to find suitable memory type");
|
||||
CP_ABORT("Failed to find suitable memory type");
|
||||
}
|
||||
|
||||
void Device::SelectPhysicalDevice()
|
||||
{
|
||||
uint32_t deviceCount;
|
||||
vkEnumeratePhysicalDevices(Vulkan::GetInstance(), &deviceCount, nullptr);
|
||||
CP_ASSERT(deviceCount != 0, "SelectPhysicaDevice : No available devices support Vulkan");
|
||||
CP_ASSERT(deviceCount != 0, "No available devices support Vulkan");
|
||||
|
||||
std::vector<VkPhysicalDevice> devices(deviceCount);
|
||||
vkEnumeratePhysicalDevices(Vulkan::GetInstance(), &deviceCount, devices.data());
|
||||
CP_INFO("SelectPhysicaDevice : Available devices:");
|
||||
CP_INFO("Available devices:");
|
||||
for (auto&& device : devices)
|
||||
{
|
||||
VkPhysicalDeviceProperties deviceProperties;
|
||||
@@ -77,11 +77,11 @@ namespace Copium
|
||||
VkPhysicalDeviceProperties deviceProperties;
|
||||
vkGetPhysicalDeviceProperties(device, &deviceProperties);
|
||||
physicalDevice = device;
|
||||
CP_INFO("SelectPhysicaDevice : Selecting device: %s", deviceProperties.deviceName);
|
||||
CP_INFO("Selecting device: %s", deviceProperties.deviceName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
CP_ASSERT(physicalDevice != VK_NULL_HANDLE, "SelectPhysicaDevice : Failed to find suitable GPU");
|
||||
CP_ASSERT(physicalDevice != VK_NULL_HANDLE, "Failed to find suitable GPU");
|
||||
}
|
||||
|
||||
void Device::InitializeLogicalDevice()
|
||||
@@ -113,7 +113,7 @@ namespace Copium
|
||||
createInfo.ppEnabledExtensionNames = deviceExtensions.data();
|
||||
createInfo.enabledExtensionCount = deviceExtensions.size();
|
||||
|
||||
CP_VK_ASSERT(vkCreateDevice(physicalDevice, &createInfo, nullptr, &device), "InitializeLogicalDevice : Failed to initialize logical device");
|
||||
CP_VK_ASSERT(vkCreateDevice(physicalDevice, &createInfo, nullptr, &device), "Failed to initialize logical device");
|
||||
|
||||
graphicsQueueIndex = query.graphicsFamily.value();
|
||||
presentQueueIndex = query.presentFamily.value();
|
||||
@@ -127,7 +127,7 @@ namespace Copium
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||
createInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
||||
createInfo.queueFamilyIndex = graphicsQueueIndex;
|
||||
CP_VK_ASSERT(vkCreateCommandPool(device, &createInfo, nullptr, &commandPool), "InitializeCommandPool : Failed to initialize command pool");
|
||||
CP_VK_ASSERT(vkCreateCommandPool(device, &createInfo, nullptr, &commandPool), "Failed to initialize command pool");
|
||||
}
|
||||
|
||||
bool Device::IsPhysicalDeviceSuitable(VkPhysicalDevice device)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Copium
|
||||
timer.Start();
|
||||
InitializeInstance(applicationName);
|
||||
InitializeDebugMessenger();
|
||||
CP_INFO("Instance : Initialized Vulkan in %f seconds", timer.Elapsed());
|
||||
CP_INFO("Initialized Vulkan in %f seconds", timer.Elapsed());
|
||||
}
|
||||
|
||||
Instance::~Instance()
|
||||
@@ -41,7 +41,7 @@ namespace Copium
|
||||
std::vector<VkExtensionProperties> extensions{extensionCount};
|
||||
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, extensions.data());
|
||||
|
||||
CP_INFO("InitiaizeInstace : Supported Extensions:");
|
||||
CP_INFO("Supported Extensions:");
|
||||
for (auto&& extension : extensions)
|
||||
{
|
||||
CP_INFO_CONT("\t%s", extension.extensionName);
|
||||
@@ -49,7 +49,7 @@ namespace Copium
|
||||
|
||||
std::vector<const char*> layers{};
|
||||
DebugMessenger::AddRequiredLayers(&layers);
|
||||
CP_ASSERT(CheckLayerSupport(layers), "InitializeInstance : Some required layers are not supported");
|
||||
CP_ASSERT(CheckLayerSupport(layers), "Some required layers are not supported");
|
||||
|
||||
VkInstanceCreateInfo createInfo{};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
@@ -58,7 +58,7 @@ namespace Copium
|
||||
createInfo.ppEnabledExtensionNames = requiredExtensions.data();
|
||||
createInfo.enabledLayerCount = layers.size();
|
||||
createInfo.ppEnabledLayerNames = layers.data();
|
||||
CP_VK_ASSERT(vkCreateInstance(&createInfo, nullptr, &instance), "InitializeInstance : Failed to create instance");
|
||||
CP_VK_ASSERT(vkCreateInstance(&createInfo, nullptr, &instance), "Failed to create instance");
|
||||
}
|
||||
|
||||
void Instance::InitializeDebugMessenger()
|
||||
@@ -87,7 +87,7 @@ namespace Copium
|
||||
std::vector<VkLayerProperties> availableLayers(layerCount);
|
||||
vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data());
|
||||
|
||||
CP_INFO("CheckLayerSupport : Supported Layers:");
|
||||
CP_INFO("Supported Layers:");
|
||||
for (auto&& availableLayer : availableLayers)
|
||||
{
|
||||
CP_INFO_CONT("\t%s", availableLayer.layerName);
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Copium
|
||||
submitInfo.signalSemaphoreCount = 1;
|
||||
submitInfo.pSignalSemaphores = &renderFinishedSemaphores[flightIndex];
|
||||
|
||||
CP_VK_ASSERT(vkQueueSubmit(Vulkan::GetDevice().GetGraphicsQueue(), 1, &submitInfo, inFlightFences[flightIndex]), "SubmitGraphicsQueue : Failed to submit command buffer");
|
||||
CP_VK_ASSERT(vkQueueSubmit(Vulkan::GetDevice().GetGraphicsQueue(), 1, &submitInfo, inFlightFences[flightIndex]), "Failed to submit command buffer");
|
||||
}
|
||||
|
||||
void SwapChain::EndPresent()
|
||||
@@ -236,7 +236,7 @@ namespace Copium
|
||||
createInfo.pQueueFamilyIndices = nullptr;
|
||||
}
|
||||
|
||||
CP_VK_ASSERT(vkCreateSwapchainKHR(Vulkan::GetDevice(), &createInfo, nullptr, &handle), "Initialize : Failed to initialize the swapchain");
|
||||
CP_VK_ASSERT(vkCreateSwapchainKHR(Vulkan::GetDevice(), &createInfo, nullptr, &handle), "Failed to initialize the swapchain");
|
||||
|
||||
vkGetSwapchainImagesKHR(Vulkan::GetDevice(), handle, &imageCount, nullptr);
|
||||
images.resize(imageCount);
|
||||
@@ -311,7 +311,7 @@ namespace Copium
|
||||
renderPassCreateInfo.dependencyCount = 1;
|
||||
renderPassCreateInfo.pDependencies = &dependency;
|
||||
|
||||
CP_VK_ASSERT(vkCreateRenderPass(Vulkan::GetDevice(), &renderPassCreateInfo, nullptr, &renderPass), "InitializeRenderPass : Failed to initialze render pass");
|
||||
CP_VK_ASSERT(vkCreateRenderPass(Vulkan::GetDevice(), &renderPassCreateInfo, nullptr, &renderPass), "Failed to initialze render pass");
|
||||
}
|
||||
|
||||
void SwapChain::InitializeFramebuffers()
|
||||
@@ -331,7 +331,7 @@ namespace Copium
|
||||
createInfo.height = extent.height;
|
||||
createInfo.layers = 1;
|
||||
|
||||
CP_VK_ASSERT(vkCreateFramebuffer(Vulkan::GetDevice(), &createInfo, nullptr, &framebuffers[i]), "InitializeFramebuffers : Failed to initialize swap chain framebuffer");
|
||||
CP_VK_ASSERT(vkCreateFramebuffer(Vulkan::GetDevice(), &createInfo, nullptr, &framebuffers[i]), "Failed to initialize swap chain framebuffer");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,14 +344,14 @@ namespace Copium
|
||||
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; ++i)
|
||||
{
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &imageAvailableSemaphores[i]), "InitializeSyncObjects : Failed to initialize available image semaphore");
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &renderFinishedSemaphores[i]), "InitializeSyncObjects : Failed to initialize render finished semaphore");
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &imageAvailableSemaphores[i]), "Failed to initialize available image semaphore");
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &renderFinishedSemaphores[i]), "Failed to initialize render finished semaphore");
|
||||
|
||||
VkFenceCreateInfo fenceCreateInfo{};
|
||||
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
fenceCreateInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
|
||||
|
||||
CP_VK_ASSERT(vkCreateFence(Vulkan::GetDevice(), &fenceCreateInfo, nullptr, &inFlightFences[i]), "InitializeSyncObjects : Failed to initialize in flight fence");
|
||||
CP_VK_ASSERT(vkCreateFence(Vulkan::GetDevice(), &fenceCreateInfo, nullptr, &inFlightFences[i]), "Failed to initialize in flight fence");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace Copium
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CP_ABORT("Window : Unreachable switch case");
|
||||
CP_ABORT("Unreachable switch case");
|
||||
}
|
||||
|
||||
CP_ASSERT(window, "InitializeWindow : Failed to initialize glfw window");
|
||||
CP_ASSERT(window, "Failed to initialize glfw window");
|
||||
|
||||
glfwSetWindowUserPointer(window, this);
|
||||
glfwSetFramebufferSizeCallback(window, FramebufferResizeCallback);
|
||||
@@ -64,7 +64,7 @@ namespace Copium
|
||||
|
||||
void Window::InitializeSurface()
|
||||
{
|
||||
CP_VK_ASSERT(glfwCreateWindowSurface(Vulkan::GetInstance(), window, nullptr, &surface), "InitializeSurface : Failed to create Vulkan surface");
|
||||
CP_VK_ASSERT(glfwCreateWindowSurface(Vulkan::GetInstance(), window, nullptr, &surface), "Failed to create Vulkan surface");
|
||||
}
|
||||
|
||||
void Window::FramebufferResizeCallback(GLFWwindow* glfwWindow, int width, int height)
|
||||
|
||||
Reference in New Issue
Block a user