RavEngine
Loading...
Searching...
No Matches
RavEngine::RenderEngine Class Reference
Inheritance diagram for RavEngine::RenderEngine:
[legend]
Collaboration diagram for RavEngine::RenderEngine:
[legend]

Classes

struct  CullingUBO
 
struct  CullingUBOinstance
 
struct  DebugUBO
 
struct  GTAOUBO
 
struct  GUIUBO
 
struct  JointInfluence
 
struct  KillParticleUBO
 
struct  LightToFBUBO
 
struct  navDebugUBO
 
struct  ParticleCreationPushConstants
 
struct  scissor
 
struct  SkinningPrepareUBO
 
struct  SkinningUBO
 
struct  SSAOUBO
 
struct  SSGIUBO
 
struct  vs
 

Public Types

enum class  AOMethod : uint8_t { SSAO , GTAO }
 

Public Member Functions

auto GetDefaultPostEffectVSH () const
 
 RenderEngine (const AppConfig &, RGLDevicePtr device)
 
RenderTargetCollection CreateRenderTargetCollection (dim size, bool createDepth=true)
 
void ResizeRenderTargetCollection (RenderTargetCollection &collection, dim size)
 
RGLCommandBufferPtr Draw (Ref< RavEngine::World >, const std::span< RenderViewCollection > screenTargets, float guiScaleFactor)
 
void SyncVideoSettings ()
 
double GetElapsedTime () override
 
void SetMouseCursor (const Rml::String &cursor_name) override
 
void SetClipboardText (const Rml::String &text) override
 
void GetClipboardText (Rml::String &text) override
 
void RenderGeometry (Rml::Vertex *vertices, int num_vertices, int *indices, int num_indices, Rml::TextureHandle texture, const Rml::Vector2f &translation) override
 Called by RmlUi when it wants to render geometry that it does not wish to optimise.
 
Rml::CompiledGeometryHandle CompileGeometry (Rml::Vertex *vertices, int num_vertices, int *indices, int num_indices, Rml::TextureHandle texture) override
 Called by RmlUi when it wants to compile geometry it believes will be static for the forseeable future.
 
void RenderCompiledGeometry (Rml::CompiledGeometryHandle geometry, const Rml::Vector2f &translation) override
 Called by RmlUi when it wants to render application-compiled geometry.
 
void ReleaseCompiledGeometry (Rml::CompiledGeometryHandle geometry) override
 Called by RmlUi when it wants to release application-compiled geometry.
 
void EnableScissorRegion (bool enable) override
 Called by RmlUi when it wants to enable or disable scissoring to clip content.
 
void SetScissorRegion (int x, int y, int width, int height) override
 Called by RmlUi when it wants to change the scissor region.
 
bool LoadTexture (Rml::TextureHandle &texture_handle, Rml::Vector2i &texture_dimensions, const Rml::String &source) override
 Called by RmlUi when a texture is required by the library.
 
bool GenerateTexture (Rml::TextureHandle &texture_handle, const Rml::byte *source, const Rml::Vector2i &source_dimensions) override
 Called by RmlUi when a texture is required to be built from an internally-generated sequence of pixels.
 
void ReleaseTexture (Rml::TextureHandle texture_handle) override
 Called by RmlUi when a loaded texture is no longer required.
 
void SetTransform (const Rml::Matrix4f *transform) override
 Called by RmlUi when it wants to set the current transform matrix to a new matrix.
 
bool LogMessage (Rml::Log::Type type, const Rml::String &message) override
 
void InitDebugger () const
 
void DeactivateDebugger () const
 
void depthMask (bool state) final
 
void texture (bool state) final
 
void begin (duDebugDrawPrimitives prim, float size=1.0f) final
 
void vertex (const float *pos, unsigned int color) final
 
void vertex (const float x, const float y, const float z, unsigned int color) final
 
void vertex (const float *pos, unsigned int color, const float *uv) final
 
void vertex (const float x, const float y, const float z, unsigned int color, const float u, const float v) final
 
void end () final
 End drawing primitives.
 
void DebugRender (const Im3d::DrawList &)
 
size_t GetCurrentVRAMUse ()
 
size_t GetTotalVRAM ()
 
MeshRange AllocateMesh (const MeshPartView &mesh)
 
void DeallocateMesh (const MeshRange &range)
 
- Public Member Functions inherited from duDebugDraw
virtual unsigned int areaToCol (unsigned int area)
 Compute a color for given area.
 

Static Public Member Functions

static const std::string_view GetCurrentBackendName ()
 

Public Attributes

struct RavEngine::RenderEngine::navDebugUBO currentNavState
 
ConcurrentQueue< RGLBufferPtr > gcBuffers
 
ConcurrentQueue< RGLTexturePtr > gcTextures
 
ConcurrentQueue< RGLPipelineLayoutPtr > gcPipelineLayout
 
ConcurrentQueue< RGLRenderPipelinePtr > gcRenderPipeline
 

Static Public Attributes

static constexpr RGL::TextureFormat depthPyramidFormat = RGL::TextureFormat::R32_Float
 
static constexpr uint32_t maxssgimips = 5
 
static constexpr RGL::TextureFormat colorTexFormat = RGL::TextureFormat::RGBA16_Sfloat
 
static constexpr RGL::TextureFormat radianceFormat = RGL::TextureFormat::RGBA16_Sfloat
 
static constexpr RGL::TextureFormat albedoFormat = RGL::TextureFormat::RGBA16_Sfloat
 
static constexpr RGL::TextureFormat viewSpaceNormalTextureFormat = RGL::TextureFormat::RGBA16_Sfloat
 
static constexpr RGL::TextureFormat ssgiOutputFormat = RGL::TextureFormat::RGBA16_Sfloat
 
static constexpr RGL::TextureFormat ssaoOutputFormat = RGL::TextureFormat::R16_Float
 
static constexpr RGL::TextureFormat depthFormat = RGL::TextureFormat::D32SFloat
 
static struct RavEngine::RenderEngine::vs VideoSettings
 
static std::optional< GUIComponent > debuggerContext
 
static std::unique_ptr< InputManager > debuggerInput
 

Protected Member Functions

matrix4 make_gui_matrix (Rml::Vector2f translation)
 
uint32_t WriteTransient (RGL::untyped_span data)
 
void ReallocateVertexAllocationToSize (uint32_t newSize)
 
void ReallocateIndexAllocationToSize (uint32_t newSize)
 
void ReallocateGeneric (RGLBufferPtr &reallocBuffer, uint32_t &reallocBufferSize, uint32_t newSize, allocation_allocatedlist_t &allocatedList, allocation_freelist_t &freelist, uint32_t stride, RGL::BufferConfig::Type bufferType, decltype(frameCount)&lastResizeFrame, const char *debugName=nullptr)
 
void DestroyUnusedResources ()
 

Protected Attributes

dim_t< int > currentRenderSize
 
RGLBufferPtr transientBuffer
 
RGLBufferPtr transientStagingBuffer
 
uint32_t transientOffset = 0
 
allocation_freelist_t vertexFreeList { 1, Range{.start = 0, .count = initialVerts}}
 
allocation_freelist_t indexFreeList { 1, Range{.start = 0, .count = initialIndices}}
 
allocation_allocatedlist_t vertexAllocatedList
 
allocation_allocatedlist_t indexAllocatedList
 
uint32_t currentVertexSize = initialVerts
 
uint32_t currentIndexSize = initialIndices
 
SpinLock allocationLock
 
bool navDebugDepthEnabled = false
 
matrix4 currentGUIMatrix
 
struct RavEngine::RenderEngine::scissor RMLScissor
 

Static Protected Attributes

static constexpr uint32_t transientSizeBytes = 65536
 
static RavEngine::Vector< VertexColorUV > navMeshPolygon
 
static Ref< GUIMaterialInstance > guiMaterial
 

Friends

class App
 
class Material
 

Constructor & Destructor Documentation

◆ RenderEngine()

RenderEngine::RenderEngine ( const AppConfig &  config,
RGLDevicePtr  device 
)

Construct a render engine instance

Parameters
wthe owning world for this engine instance

Member Function Documentation

◆ AllocateMesh()

MeshRange RavEngine::RenderEngine::AllocateMesh ( const MeshPartView &  mesh)

Find a Range that can fit the current allocation. If one does not exist, returns -1 (aka uint max)

Returns
an interator into the freelist.

Given a byte size, find a possible block, resizing the underlying memory if necessary.

Returns
an iterator into the freelist

◆ begin()

void RenderEngine::begin ( duDebugDrawPrimitives  prim,
float  size = 1.0f 
)
finalvirtual

Size here is not the number of primitives, it's the pixel size of the primitive, for line and point primitives

Implements duDebugDraw.

◆ depthMask()

void RenderEngine::depthMask ( bool  state)
finalvirtual

Implements duDebugDraw.

◆ Draw()

RGLCommandBufferPtr RavEngine::RenderEngine::Draw ( Ref< RavEngine::World >  worldOwning,
const std::span< RenderViewCollection >  screenTargets,
float  guiScaleFactor 
)

Render one frame using the current state of every object in the world

◆ end()

void RenderEngine::end ( )
finalvirtual

End drawing primitives.

Implements duDebugDraw.

◆ GetCurrentBackendName()

const string_view RenderEngine::GetCurrentBackendName ( )
static
Returns
The name of the current rendering API in use
the name of the current rendering API

◆ texture()

void RenderEngine::texture ( bool  state)
finalvirtual

Implements duDebugDraw.

◆ vertex() [1/4]

void RenderEngine::vertex ( const float *  pos,
unsigned int  color 
)
finalvirtual

Submit a vertex

Parameters
pos[in] position of the verts.
color[in] color of the verts.

Implements duDebugDraw.

◆ vertex() [2/4]

void RenderEngine::vertex ( const float *  pos,
unsigned int  color,
const float *  uv 
)
finalvirtual

Submit a vertex

Parameters
pos[in] position of the verts.
color[in] color of the verts.

Implements duDebugDraw.

◆ vertex() [3/4]

void RenderEngine::vertex ( const float  x,
const float  y,
const float  z,
unsigned int  color 
)
finalvirtual

Submit a vertex

Parameters
x,y,z[in] position of the verts.
color[in] color of the verts.

Implements duDebugDraw.

◆ vertex() [4/4]

void RenderEngine::vertex ( const float  x,
const float  y,
const float  z,
unsigned int  color,
const float  u,
const float  v 
)
finalvirtual

Submit a vertex

Parameters
x,y,z[in] position of the verts.
color[in] color of the verts.

Implements duDebugDraw.

◆ WriteTransient()

uint32_t RavEngine::RenderEngine::WriteTransient ( RGL::untyped_span  data)
protected

Add data to the transient buffer. The transient buffer is reset every frame.

Returns
the offset in bytes to the transient buffer

The documentation for this class was generated from the following files: