![]() |
Raven Engine v0.1
|
Core abstraction for GPU rendering operations. More...
#include <RendererAPI.h>
Public Types | |
| enum class | API : u8 { None = 0 , Vulkan = 1 } |
| Supported rendering backends. More... | |
Public Member Functions | |
| virtual | ~RendererAPI ()=default |
| virtual void | Init (Window &wnd)=0 |
| Initializes the rendering backend with a reference to the window. | |
| virtual void | Shutdown ()=0 |
| Shuts down the rendering backend, releasing all GPU resources. | |
| virtual void | InitCommandBuffers ()=0 |
| Initializes command buffers for multi-buffered rendering. | |
| virtual void | BeginFrame ()=0 |
| Marks the start of rendering a new frame. | |
| virtual void | EndFrame ()=0 |
| Marks the end of rendering the current frame and presents it. | |
| virtual void | BeginRenderPass (const Ref< RenderPass > &renderPass, const Ref< RenderCommandBuffer > &commandBuffer)=0 |
| Begins a render pass with the given framebuffer and command buffer. | |
| virtual void | EndRenderPass (const Ref< RenderCommandBuffer > &commandBuffer)=0 |
| Ends the current render pass. | |
| virtual Ref< RenderCommandBuffer > | GetCommandBuffer () const =0 |
| Gets the currently active command buffer. | |
| virtual Ref< RenderCommandBuffer > | GetCommandBuffer (u8 index) const =0 |
| Gets the command buffer at a specific index (for multi-buffering). | |
| virtual u32 | GetImageIndex () const =0 |
| Gets the current swapchain image index. | |
| virtual void | CopyBuffer (void *srcBuffer, void *dstBuffer, u32 size)=0 |
| Copies data between GPU buffers. | |
| virtual void | CopyBufferToImage (void *srcBuffer, void *dstImage, u32 width, u32 height)=0 |
| Copies buffer data to an image resource. | |
| virtual void | TransitionImageLayout (void *image, ImageFormat format, ImageLayout oldLayout, ImageLayout newLayout, u32 mipCount)=0 |
| Transitions an image's layout for usage in different pipeline stages. | |
| virtual void * | BeginSingleTimeCommand ()=0 |
| Begins recording a single-time command buffer for transient operations. | |
| virtual void | EndSingleTimeCommand (void *commandBuffer)=0 |
| Ends recording and submits a single-time command buffer. | |
| virtual void | DrawGeometry (Ref< RenderCommandBuffer > commandBuffer, Ref< Pipeline > pipeline, Ref< VertexBuffer > vertexBuffer, Ref< IndexBuffer > indexBuffer, const Crux::mat4 &transform)=0 |
| Issues a draw call for indexed geometry. | |
| virtual void | DrawStaticMesh (Ref< RenderCommandBuffer > commandBuffer, Ref< Pipeline > pipeline, Ref< Mesh > mesh, const Crux::mat4 &transform)=0 |
| Issues a draw call for a static mesh. | |
| virtual void | Submit (const StaticMeshSubmission &submission)=0 |
| Submits a static mesh draw submission for batched rendering. | |
| virtual const std::vector< StaticMeshSubmission > & | GetStaticMeshSubmissions () const =0 |
| Returns a read-only list of all static mesh submissions queued. | |
| virtual void * | GetDescriptorPool () const =0 |
| Gets the underlying descriptor pool handle (opaque). | |
| virtual void * | GetInstance () const =0 |
| Gets the underlying instance handle (opaque). | |
| virtual Window & | GetWindow () const =0 |
| Gets a reference to the associated application window. | |
| Public Member Functions inherited from Raven::Castable< RendererAPI > | |
| T & | As () |
| Non-const version of As<T>(), for casting to a non-const target type. | |
Static Public Member Functions | |
| static API | GetAPI () |
| Returns the current rendering API in use. | |
| static Scope< RendererAPI > | Create () |
| Factory method to create the renderer API instance for the selected backend. | |
| static std::string_view | APIToString () |
| Converts the API enum to a string representation. | |
Static Public Attributes | |
| static float | m_ElapsedTime = 0.0f |
| Elapsed time tracker for rendering, to be improved with GPU timers. | |
Core abstraction for GPU rendering operations.
This interface defines all necessary commands and states to interact with the GPU through the chosen graphics API. It separates high-level frame control from low-level command buffer management.
Usage:
|
strong |
|
virtualdefault |
|
inlinestatic |
Converts the API enum to a string representation.
|
pure virtual |
Marks the start of rendering a new frame.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Begins a render pass with the given framebuffer and command buffer.
| renderPass | The target render pass defining attachments and states. |
| commandBuffer | The command buffer to record commands into. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Begins recording a single-time command buffer for transient operations.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Copies data between GPU buffers.
| srcBuffer | Source buffer pointer. |
| dstBuffer | Destination buffer pointer. |
| size | Size of data to copy in bytes. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Copies buffer data to an image resource.
| srcBuffer | Source buffer pointer. |
| dstImage | Destination image pointer. |
| width | Width of the image. |
| height | Height of the image. |
Implemented in Raven::VulkanRenderer.
|
static |
Factory method to create the renderer API instance for the selected backend.
|
pure virtual |
Issues a draw call for indexed geometry.
| commandBuffer | Command buffer to record into. |
| pipeline | Pipeline state object. |
| vertexBuffer | Vertex buffer reference. |
| indexBuffer | Index buffer reference. |
| transform | Transform matrix for the geometry. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Issues a draw call for a static mesh.
| commandBuffer | Command buffer to record into. |
| pipeline | Pipeline state object. |
| mesh | Mesh to draw. |
| transform | Transform matrix for the mesh. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Marks the end of rendering the current frame and presents it.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Ends the current render pass.
| commandBuffer | The command buffer used for recording. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Ends recording and submits a single-time command buffer.
| commandBuffer | Pointer to the command buffer. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Gets the currently active command buffer.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Gets the command buffer at a specific index (for multi-buffering).
| index | Index of the command buffer. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Gets the underlying descriptor pool handle (opaque).
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Gets the current swapchain image index.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Gets the underlying instance handle (opaque).
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Returns a read-only list of all static mesh submissions queued.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Gets a reference to the associated application window.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Initializes the rendering backend with a reference to the window.
| wnd | Reference to the application window. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Initializes command buffers for multi-buffered rendering.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Shuts down the rendering backend, releasing all GPU resources.
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Submits a static mesh draw submission for batched rendering.
| submission | The static mesh submission data. |
Implemented in Raven::VulkanRenderer.
|
pure virtual |
Transitions an image's layout for usage in different pipeline stages.
| image | Pointer to the image resource. |
| format | Format of the image. |
| oldLayout | Current layout of the image. |
| newLayout | Desired new layout. |
| mipCount | Number of mip levels. |
Implemented in Raven::VulkanRenderer.
|
static |
Elapsed time tracker for rendering, to be improved with GPU timers.