|
Hymn to Beauty
C++ 3D Engine
|
Low level renderer abstracting the underlaying graphics API (OpenGL or Vulkan). More...
#include <LowLevelRenderer.hpp>
Classes | |
| struct | OptionalFeatures |
| Optional features. More... | |
Public Member Functions | |
| LowLevelRenderer () | |
| Create a new low-level renderer. More... | |
| virtual | ~LowLevelRenderer () |
| Destructor. More... | |
| virtual CommandBuffer * | CreateCommandBuffer ()=0 |
| Create a command buffer. More... | |
| virtual void | BeginFrame ()=0 |
| Begin a new frame. More... | |
| virtual void | Submit (CommandBuffer *commandBuffer)=0 |
| Submit a command buffer for execution. More... | |
| virtual void | Present ()=0 |
| Present the rendered image to the swap chain. More... | |
| virtual Buffer * | CreateBuffer (Buffer::BufferUsage bufferUsage, unsigned int size, const void *data=nullptr)=0 |
| Create a GPU buffer. More... | |
| virtual Buffer * | CreateTemporaryBuffer (Buffer::BufferUsage bufferUsage, unsigned int size, const void *data=nullptr)=0 |
| Create a temporary GPU buffer. More... | |
| virtual VertexDescription * | CreateVertexDescription (unsigned int attributeCount, const VertexDescription::Attribute *attributes, bool indexBuffer=false)=0 |
| Create a vertex description. More... | |
| virtual GeometryBinding * | CreateGeometryBinding (const VertexDescription *vertexDescription, Buffer *vertexBuffer, GeometryBinding::IndexType indexType=GeometryBinding::IndexType::NONE, const Buffer *indexBuffer=nullptr)=0 |
| Create a geometry binding. More... | |
| virtual Shader * | CreateShader (const ShaderSource &shaderSource, Shader::Type type)=0 |
| Create a shader. More... | |
| virtual ShaderProgram * | CreateShaderProgram (std::initializer_list< const Shader * > shaders)=0 |
| Create a shader program. More... | |
| virtual Texture * | CreateTexture (const glm::uvec2 size, Texture::Format format, int components, unsigned char *data)=0 |
| Create a texture. More... | |
| virtual const Sampler * | GetSampler (Sampler::Filter filter, Sampler::Clamping clamping) const =0 |
| Get a sampler. More... | |
| virtual Texture * | CreateRenderTarget (const glm::uvec2 &size, Texture::Format format)=0 |
| Create a render target. More... | |
| virtual void | FreeRenderTarget (Texture *renderTarget)=0 |
| Free a render target. More... | |
| virtual GraphicsPipeline * | CreateGraphicsPipeline (const ShaderProgram *shaderProgram, const GraphicsPipeline::Configuration &configuration, const VertexDescription *vertexDescription=nullptr)=0 |
| Create a graphics pipeline. More... | |
| virtual ComputePipeline * | CreateComputePipeline (const ShaderProgram *shaderProgram)=0 |
| Create a compute pipeline. More... | |
| virtual void | Wait ()=0 |
| Wait for all rendering to finish. More... | |
| virtual unsigned char * | ReadImage (Texture *texture)=0 |
| Read a render texture color image. More... | |
| void | SetProfiling (bool profiling) |
| Set whether to profile. More... | |
| bool | IsProfiling () const |
| Get whether profiling is active. More... | |
| virtual const std::vector< Profiling::Event > & | GetTimeline () const =0 |
| Get profiling timeline. More... | |
| virtual const OptionalFeatures & | GetOptionalFeatures () const =0 |
| Get which optional features are supported. More... | |
Low level renderer abstracting the underlaying graphics API (OpenGL or Vulkan).
|
inline |
Create a new low-level renderer.
|
inlinevirtual |
Destructor.
|
pure virtual |
Begin a new frame.
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a GPU buffer.
| bufferUsage | How the buffer will be used. |
| size | The size of the buffer in bytes. |
| data | Data to upload to the buffer. Can be nullptr if no data should be uploaded. |
|
pure virtual |
Create a command buffer.
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a compute pipeline.
| shaderProgram | The shader program to use. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a geometry binding.
| vertexDescription | Description of the attributes in the vertex buffer. |
| vertexBuffer | Buffer containing the vertex data. |
| indexType | The type of values in the index buffer. |
| indexBuffer | Index buffer. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a graphics pipeline.
| shaderProgram | The shader program to use. |
| configuration | The configuration of the pipeline. |
| vertexDescription | The description of the vertex input to the pipeline. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a render target.
| size | The size of the texture, in pixels. |
| format | The format of the texture. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a shader.
| shaderSource | The source of the shader, generated by the shader processor. |
| type | The type of shader to create. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a shader program.
Link together shaders into a shader program that can be run on the GPU.
Sample:
| shaders | List of shaders to link together. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a temporary GPU buffer.
The returned buffer's lifetime is controlled by the rendered and should not be deleted.
| bufferUsage | How the buffer will be used. |
| size | The size of the buffer in bytes. |
| data | Data to upload to the buffer. Can be nullptr if no data should be uploaded. |
|
pure virtual |
Create a texture.
| size | The size of the texture, in pixels. |
| format | The format of the texture. |
| components | The number of components in the texture, 0 if no texture data is supplied. |
| data | The texture data to upload, or nullptr. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Create a vertex description.
| attributeCount | The number of vertex attributes. |
| attributes | The array of attributes. |
| indexBuffer | Whether to use an index buffer. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Free a render target.
| renderTarget | The render target to free. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Get which optional features are supported.
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Get a sampler.
| filter | The interpolation to apply. |
| clamping | How to handle sampling outside the texture dimensions. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Get profiling timeline.
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
inline |
Get whether profiling is active.
|
pure virtual |
Present the rendered image to the swap chain.
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Read a render texture color image.
| texture | The texture to read. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
inline |
Set whether to profile.
| profiling | Whether to profile. |
|
pure virtual |
Submit a command buffer for execution.
| commandBuffer | The command buffer to submit. |
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.
|
pure virtual |
Wait for all rendering to finish.
Implemented in Video::OpenGLRenderer, Video::VulkanRenderer, and Video::WebGPURenderer.