|
KarmaEngine
Game Engine for practical learning and research purposes
|
Vulkan specific implementation of RendererAPI pure virtual functions. More...
#include <VulkanRendererAPI.h>
Public Member Functions | |
| VulkanRendererAPI () | |
| A constructor. | |
| virtual | ~VulkanRendererAPI () |
| A destructor. | |
| virtual void | SetClearColor (const glm::vec4 &color) override |
| Sets the color to be used for clear (rendering) screen. | |
| virtual void | Clear () override |
| Clear the rendering screen. Not much use in Vulkan as such since we record commands in command buffers. | |
| virtual void | BeginScene () override |
| Setting up resources for rendering of a scene which includes allocating command buffers if not already done or when swapchain is rebuilt. | |
| virtual void | DrawIndexed (std::shared_ptr< VertexArray > vertexArray) override |
| Routine for drawing primitives. | |
| virtual void | EndScene () override |
| Instructions for end of the scene. | |
| void | AllocateCommandBuffers () |
| Allocates resources for command buffers. | |
| void | RecordCommandBuffers (VkCommandBuffer commandBuffer, uint32_t imageIndex) |
| Records the command buffers with rendering commands for a particular image in the swapchain. | |
| void | SubmitCommandBuffers () |
| Submits the recorded command buffers to the graphics queue for execution. | |
| void | CreateSynchronicity () |
| Creates synchronization objects like semaphores and fences for coordinating rendering operations. | |
| void | ClearVulkanRendererAPI () |
| Clears up VulkanRendererAPI specific resources like command buffers and synchronization objects. | |
| void | RemoveSynchronicity () |
| Removes synchronization objects like semaphores and fences. | |
| void | RecreateCommandBuffersPipelineSwapchain () |
| Recreates command buffers, graphics pipelines, and uniform buffer objects when swapchain is recreated (like on window resize when acquiring next image from swapchain gives VK_ERROR_OUT_OF_DATE_KHR). | |
| void | RecreateCommandBuffersAndSwapChain () |
| Recreates command buffers and swapchain when swapchain is recreated (like on window resize when acquiring next image from swapchain gives VK_ERROR_OUT_OF_DATE_KHR). | |
| const std::vector< VkCommandBuffer > & | GetCommandBuffers () const |
| const int & | GetMaxFramesInFlight () const |
| const std::vector< VkFence > & | GetFences () const |
| const std::vector< VkSemaphore > & | GetImageAvailableSemaphores () const |
| const std::vector< VkSemaphore > | GetRenderFinishedSemaphore () const |
| Public Member Functions inherited from Karma::RendererAPI | |
| virtual | ~RendererAPI () |
| A destructor. | |
| glm::vec4 & | GetClearColor () const |
| Getter for m_ClearColor variable. | |
Additional Inherited Members | |
| Public Types inherited from Karma::RendererAPI | |
| enum class | API { None = 0 , OpenGL = 1 , Vulkan = 2 } |
| The rendering API used by the Engine. More... | |
| Static Public Member Functions inherited from Karma::RendererAPI | |
| static API | GetAPI () |
| Getter for rendering api being used. | |
| Static Protected Attributes inherited from Karma::RendererAPI | |
| static glm::vec4 | m_ClearColor = { 0.0f, 0.0f, 0.0f, 0.0f } |
Vulkan specific implementation of RendererAPI pure virtual functions.
| Karma::VulkanRendererAPI::VulkanRendererAPI | ( | ) |
|
virtual |
A destructor.
| void Karma::VulkanRendererAPI::AllocateCommandBuffers | ( | ) |
Allocates resources for command buffers.
Command buffers are objects used to record commands which can be subsequently submitted to a device queue for execution. For instance the graphics and presentation queues.
|
overridevirtual |
Setting up resources for rendering of a scene which includes allocating command buffers if not already done or when swapchain is rebuilt.
Implements Karma::RendererAPI.
|
overridevirtual |
Clear the rendering screen. Not much use in Vulkan as such since we record commands in command buffers.
The commandbuffers are reset and begin command recording afresh each frame in RecordCommandBuffers() which includes clearing the screen.
Implements Karma::RendererAPI.
| void Karma::VulkanRendererAPI::ClearVulkanRendererAPI | ( | ) |
Clears up VulkanRendererAPI specific resources like command buffers and synchronization objects.
| void Karma::VulkanRendererAPI::CreateSynchronicity | ( | ) |
Creates synchronization objects like semaphores and fences for coordinating rendering operations.
|
overridevirtual |
Routine for drawing primitives.
| vertexArray | The format and relevant information of the rendrable vertex data |
Implements Karma::RendererAPI.
|
overridevirtual |
Instructions for end of the scene.
Implements Karma::RendererAPI.
| void Karma::VulkanRendererAPI::RecordCommandBuffers | ( | VkCommandBuffer | commandBuffer, |
| uint32_t | imageIndex ) |
Records the command buffers with rendering commands for a particular image in the swapchain.
| commandBuffer | The command buffer to be recorded |
| imageIndex | The index of the swapchain image to record commands for |
| void Karma::VulkanRendererAPI::RecreateCommandBuffersAndSwapChain | ( | ) |
Recreates command buffers and swapchain when swapchain is recreated (like on window resize when acquiring next image from swapchain gives VK_ERROR_OUT_OF_DATE_KHR).
| void Karma::VulkanRendererAPI::RecreateCommandBuffersPipelineSwapchain | ( | ) |
Recreates command buffers, graphics pipelines, and uniform buffer objects when swapchain is recreated (like on window resize when acquiring next image from swapchain gives VK_ERROR_OUT_OF_DATE_KHR).
| void Karma::VulkanRendererAPI::RemoveSynchronicity | ( | ) |
Removes synchronization objects like semaphores and fences.
|
overridevirtual |
Sets the color to be used for clear (rendering) screen.
| color | The color to be used for clearing |
Implements Karma::RendererAPI.
| void Karma::VulkanRendererAPI::SubmitCommandBuffers | ( | ) |
Submits the recorded command buffers to the graphics queue for execution.