Added comments about Vulkan init
This commit is contained in:
@@ -33,21 +33,81 @@ namespace PB::Renderer
|
|||||||
VulkanManager() = delete;
|
VulkanManager() = delete;
|
||||||
~VulkanManager() = delete;
|
~VulkanManager() = delete;
|
||||||
|
|
||||||
|
/* Shorthand for calling all the initialisation functions, returns false if any fail */
|
||||||
static bool Init(GLFWwindow* window);
|
static bool Init(GLFWwindow* window);
|
||||||
|
|
||||||
|
/* Frees ALL allocated Vulkan resources */
|
||||||
static bool Cleanup();
|
static bool Cleanup();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates the global Vulkan instance, which connects the application to Vulkan.
|
||||||
|
Defines the application info and imports the needed (GLFW) extensions.
|
||||||
|
*/
|
||||||
static bool CreateInstance();
|
static bool CreateInstance();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Ties a surface to the window to present images. Abstracts platform specific code.
|
||||||
|
Required for creating a swap chain.
|
||||||
|
*/
|
||||||
static bool CreateSurface(GLFWwindow* window);
|
static bool CreateSurface(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Scans for all available GPUs and picks the first one that supports the necessary capabilities.
|
||||||
|
Only looks for discrete (non-integrated) GPUs and uses that for all rendering.
|
||||||
|
*/
|
||||||
static bool PickPhysicalDevice();
|
static bool PickPhysicalDevice();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates a logical device which handles the commands from Vulkan to hardware instructions.
|
||||||
|
Also requests the queues needed.
|
||||||
|
*/
|
||||||
static bool CreateLogicalDevice();
|
static bool CreateLogicalDevice();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates a swap chain with suitable image formats, present modes and image dimensions.
|
||||||
|
The swap chain is the series of images that are displayed to the screen.
|
||||||
|
*/
|
||||||
static bool CreateSwapChain(GLFWwindow* window);
|
static bool CreateSwapChain(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Each swap chain image requires a view, which describes how shaders and
|
||||||
|
the pipeline interact with the image data.
|
||||||
|
*/
|
||||||
static bool CreateImageViews();
|
static bool CreateImageViews();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Defines the attachments (such as color and depth) and defines how they are rendered.
|
||||||
|
Also defines the subpasses and dependencies between them.
|
||||||
|
*/
|
||||||
static bool CreateRenderPass();
|
static bool CreateRenderPass();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates a framebuffer for each swap chain image, pairing the render pass with the relevant image.
|
||||||
|
Each framebuffer is a specific set of attachments used drawing a render pass instance.
|
||||||
|
*/
|
||||||
static bool CreateFramebuffer();
|
static bool CreateFramebuffer();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Assembles shaders, fixed function state and creates the render pipeline.
|
||||||
|
Also checks that the render pass is compatiable.
|
||||||
|
*/
|
||||||
static bool CreateGraphicsPipeline();
|
static bool CreateGraphicsPipeline();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Allocates a command pool and command buffers.
|
||||||
|
The buffers represent the exact instructions the GPU will execute.
|
||||||
|
*/
|
||||||
static bool CreateCommandBuffers();
|
static bool CreateCommandBuffers();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates sync between coordinate operations between different parts of the rendering.
|
||||||
|
Required to stop race conditions between frames.
|
||||||
|
*/
|
||||||
static bool CreateSemaphores();
|
static bool CreateSemaphores();
|
||||||
|
|
||||||
|
/*
|
||||||
|
Draws a frame to the screen using the command buffers and sync objects.
|
||||||
|
*/
|
||||||
static bool RenderPass();
|
static bool RenderPass();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user