SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::RenderEngine Namespace Reference

Backend-facing rendering layer shared by the four graphics backends. More...

Classes

class  BindConstantBufferCommand
 Binds a constant buffer to a pipeline slot. More...
class  BindMaterialCommand
 Binds a material's shader and textures for subsequent draws. More...
class  BindShaderCommand
 Binds a shader program for subsequent draws. More...
class  BindTextureCommand
 Binds a texture for subsequent draws. More...
class  BufferBase
 Backend-agnostic GPU buffer: vertex, index, constant, or resource view target. More...
struct  ConstantBuffer
 Interface for a CPU-side payload that can be uploaded to a GPU constant buffer. More...
class  CustomCommand
 Wraps an arbitrary callback as a queueable render command. More...
struct  DeferredBuffer
 ConstantBuffer wrapper around DeferredCBData. More...
struct  DeferredCBData
 Per-frame deferred lighting pass CB: inverse view-projection plus screen/near-far metrics. More...
class  DirectX11Buffer
 D3D11 buffer wrapper covering vertex/index/constant usages and custom configurations. More...
class  DirectX11CubemapTexture
 D3D11 cubemap texture, loadable from six face images or a single equirectangular panorama. More...
class  DirectX11Shader
 D3D11 vertex+pixel shader pair, compiled from HLSL and paired with an input layout. More...
class  DirectX11Texture
 D3D11 2D texture, loadable from disk or an in-memory pixel buffer. More...
class  DirectX12Buffer
 D3D12 buffer wrapper: default-heap resource plus an upload heap for CPU-to-GPU copies. More...
class  DirectX12Shader
 D3D12 vertex+pixel shader pair; the pipeline state object itself is owned per-shader. More...
class  DrawCommand
 Non-indexed draw command with its vertex and constant buffers. More...
class  DrawIndexedCommand
 Indexed draw command with its vertex, index, and constant buffers. More...
struct  IBLSettingsGPUData
 Image-based lighting toggle, intensity, and prefiltered-map LOD range. More...
struct  LightBuffer
 ConstantBuffer wrapper around LightCBData. More...
struct  LightCBData
 Full per-frame lighting UBO: camera, ambient, fog, and the packed light array. More...
struct  LightGPUEntry
 One light's packed GPU representation, laid out for std140/cbuffer alignment. More...
struct  MaterialBuffer
 ConstantBuffer wrapper around MaterialGPUData. More...
struct  MaterialGPUData
 Packed PBR material parameters uploaded to the material constant buffer. More...
class  OpenGLBuffer
 OpenGL VBO/EBO/UBO wrapper; target is derived from BufferType at construction. More...
class  OpenGLCubemapTexture
 OpenGL cubemap texture, loadable from six face images, a panorama, or a procedural gradient. More...
class  OpenGLIBL
class  OpenGLRenderer
 OpenGL 3.3+ backend: deferred GBuffer pipeline, SSAO, shadow mapping, and baked IBL. More...
class  OpenGLShader
 GLSL shader program compiled from either a combined source file or separate vertex/fragment files. More...
class  OpenGLTexture
 OpenGL 2D texture, loadable from disk or an in-memory pixel buffer. More...
struct  PCSSShadowGPUData
 PCSS soft-shadow parameters for the DX11/OpenGL PBR shader path. More...
struct  PostProcessGPUData
 Tonemapping/exposure settings uploaded to the post-process pass. More...
struct  QueueIndices
class  RenderCommandBase
 One recorded draw plus the state it needs to replay into a command list. More...
class  RenderCommandQueue
 Frame-scoped queue of recorded draw/state commands, replayed into a RenderContext at flush time. More...
class  RenderContext
 Abstract interface for high-level graphics command execution and resource management. More...
class  Renderer
 Abstract render backend: swapchain, frame lifecycle, and post-effect toggles. More...
class  RendererFactory
 Constructs the concrete Renderer for a requested backend. More...
class  ResourceManager
class  SetRenderFaceCommand
 Switches the cull-face mode. More...
class  SetRenderModeCommand
 Switches the rasterizer fill mode. More...
class  Shader
 Backend-agnostic compiled shader program. More...
struct  ShadowLightUBO
 Shadow-pass UBO: light/shadow parameters, fog, and extra fill lights (set 2, binding 0). More...
struct  SSAOCompositeGPUData
 Controls whether the forward PBR shader multiplies in the SSAO texture. More...
struct  SSAOKernel
struct  SSAOSettingsGPUData
 SSAO pass parameters: kernel size, radius/bias/power, and screen/near-far metrics. More...
struct  SwapchainDetails
struct  TransformBuffer
 Per-draw world-view-projection and world matrices. More...
class  UpdateConstantBufferCommand
 Constant buffer write, captured by value into inline storage or a heap fallback for larger payloads. More...
class  VulkanBuffer
 VMA-backed Vulkan buffer with staging uploads, batched copies, and a size-bucketed recycling pool. More...
class  VulkanCubemapTexture
 Vulkan cubemap texture, loadable from six face images or a single equirectangular panorama. More...
class  VulkanRenderer
class  VulkanShader
 Vulkan vertex+fragment shader pair, loaded from precompiled SPIR-V modules. More...
class  VulkanTexture
 Vulkan 2D texture: image + view + sampler, with per-swapchain-image descriptor sets. More...

Enumerations

enum class  BufferType {
  Vertex = 0 , Index = 1 , Constant = 2 , ShaderResource = 3 ,
  DepthStencil = 4 , RenderTarget = 5 , UnorderedAccess = 6
}
 GPU buffer usage kind, drives backend binding flags and layout. More...
enum class  CBIds { Transformation = 0 , Material = 1 , Lighting = 2 }
 Well-known constant buffer slot identifiers. More...
enum class  CommandType {
  Draw = 0 , DrawIndexed = 1 , DrawInstanced = 2 , UpdateConstantBuffer = 3 ,
  BindConstantBuffer = 4 , SetRenderTarget = 5 , ClearRenderTarget = 6 , SetViewport = 7 ,
  SetShader = 8 , SetTexture = 9 , SetMode = 10 , SetFace = 11 ,
  SetBlendStae = 12 , SetDepthStencilState = 13 , SetRasterizerState = 14 , CustomCommand = 15 ,
  BindMaterial = 16
}
 Discriminator for RenderCommandBase subclasses, used for sorting and batching. More...
enum class  DepthCompare {
  Less , LessEqual , Greater , GreaterEqual ,
  Equal , NotEqual , Always , Never
}
 Depth test comparison function. More...
enum  GraphicsCaps : uint32_t {
  CapDeferred = 1 << 0 , CapSSAO = 1 << 1 , CapSSR = 1 << 2 , CapTAA = 1 << 3 ,
  CapBloom = 1 << 4 , CapIBL = 1 << 5 , CapTonemapPass = 1 << 6 , CapShadows = 1 << 7 ,
  CapHDRTarget = 1 << 8 , CapVelocity = 1 << 9 , CapLightShaft = 1 << 10 , CapProceduralSky = 1 << 11
}
 Per-backend feature capability bits, queried to gate optional pipeline stages. More...
enum class  RendererType { Vulkan , OpenGL , DirectX11 , DirectX12 }
 Selects which graphics API a Renderer instance targets. More...
enum class  RenderFace { None , Back , Front }
 Which triangle winding gets culled. More...
enum class  RenderMode {
  None , Fill , Wireframe , Points ,
  Outline
}
 Rasterizer fill style for a draw. More...
enum class  ResourceType : uint8_t { Buffer = 0 , Shader = 1 , Texture = 2 }
 Coarse kind tag for a graphics resource. More...

Functions

static VkDeviceSize BucketSize (VkDeviceSize s)
 Rounds a size up to the nearest pool bucket so similar-sized buffers can share slots.
float HaltonSeq (int index, int base)
 Halton low-discrepancy sequence value for TAA sub-pixel jitter.
bool InvertMat4 (const float M[16], float out[16])
 Row-major 4x4 inverse via Gauss-Jordan elimination.
static bool IsRecyclable (VkBufferUsageFlags usage, VkMemoryPropertyFlags props)
 True when a buffer is both device-local and a recyclable usage, the pool's eligibility gate.
void MatMul4 (const float A[16], const float B[16], float C[16])
 Row-major mat4 multiply: C = A * B.
static VkFormat ToVkVertexFormat (VertexAttribFormat format)
 Translates a registry attribute format into its Vulkan vertex format.
static bool UsageIsRecyclable (VkBufferUsageFlags usage)
 True for vertex/index usages, the only kinds worth pooling for reuse.
static void WriteSingleImageSampler (VkDevice dev, VkDescriptorSet set, VkImageView view, VkSampler sampler, VkImageLayout layout)
 Writes a filter-DSL descriptor set for a given source view.

Variables

static uint32_t g_idleFrames = 0
static uint64_t g_lastPoolWarnFrame = UINT64_MAX
static uint64_t g_lastReclaimWarnFrame = UINT64_MAX
static uint32_t g_maxFramesInFlight = 3
static constexpr uint32_t kIdleFramesBeforeTrim = 120
static constexpr size_t kIdleTrimPerFrame = 8
static constexpr size_t kMaxDeletesPerFrame = 64
static constexpr VkDeviceSize kPoolBucket = 64 * 1024
static constexpr uint32_t MAX_LIGHTS = 16
static std::vector< Microsoft::WRL::ComPtr< ID3D12Resource > > s_deferredResources
static std::vector< Microsoft::WRL::ComPtr< ID3D12Resource > > s_pendingResources
static constexpr uint32_t SSAO_KERNEL_SIZE = 64

Detailed Description

Backend-facing rendering layer shared by the four graphics backends.

The Renderer base class, the command queue, shaders, and GPU buffer types live here. Most of it is internal; the pieces a game touches are the opaque handle types carried by public resources such as Material and MeshHandle.

Enumeration Type Documentation

◆ BufferType

GPU buffer usage kind, drives backend binding flags and layout.

Enumerator
Vertex 
Index 
Constant 
ShaderResource 
DepthStencil 
RenderTarget 
UnorderedAccess 

Definition at line 13 of file BufferBase.hpp.

◆ CBIds

enum class Sleak::RenderEngine::CBIds
strong

Well-known constant buffer slot identifiers.

Enumerator
Transformation 
Material 
Lighting 

Definition at line 12 of file ConstantBuffer.hpp.

◆ CommandType

Discriminator for RenderCommandBase subclasses, used for sorting and batching.

Enumerator
Draw 
DrawIndexed 
DrawInstanced 
UpdateConstantBuffer 
BindConstantBuffer 
SetRenderTarget 
ClearRenderTarget 
SetViewport 
SetShader 
SetTexture 
SetMode 
SetFace 
SetBlendStae 
SetDepthStencilState 
SetRasterizerState 
CustomCommand 
BindMaterial 

Definition at line 29 of file RenderCommands.hpp.

◆ DepthCompare

Depth test comparison function.

Enumerator
Less 
LessEqual 
Greater 
GreaterEqual 
Equal 
NotEqual 
Always 
Never 

Definition at line 32 of file RenderContext.hpp.

◆ GraphicsCaps

Per-backend feature capability bits, queried to gate optional pipeline stages.

Enumerator
CapDeferred 
CapSSAO 
CapSSR 
CapTAA 
CapBloom 
CapIBL 
CapTonemapPass 
CapShadows 
CapHDRTarget 
CapVelocity 
CapLightShaft 
CapProceduralSky 

Definition at line 21 of file Renderer.hpp.

◆ RendererType

Selects which graphics API a Renderer instance targets.

Enumerator
Vulkan 
OpenGL 
DirectX11 
DirectX12 

Definition at line 13 of file Renderer.hpp.

◆ RenderFace

Which triangle winding gets culled.

Enumerator
None 
Back 
Front 

Definition at line 25 of file RenderContext.hpp.

◆ RenderMode

Rasterizer fill style for a draw.

Enumerator
None 
Fill 
Wireframe 
Points 
Outline 

Definition at line 16 of file RenderContext.hpp.

◆ ResourceType

enum class Sleak::RenderEngine::ResourceType : uint8_t
strong

Coarse kind tag for a graphics resource.

Enumerator
Buffer 
Shader 
Texture 

Definition at line 27 of file ResourceManager.hpp.

Function Documentation

◆ BucketSize()

VkDeviceSize Sleak::RenderEngine::BucketSize ( VkDeviceSize s)
static

Rounds a size up to the nearest pool bucket so similar-sized buffers can share slots.

Definition at line 68 of file VulkanBuffer.cpp.

◆ HaltonSeq()

float Sleak::RenderEngine::HaltonSeq ( int index,
int base )
inline

Halton low-discrepancy sequence value for TAA sub-pixel jitter.

Definition at line 11 of file VulkanInternal.hpp.

◆ InvertMat4()

bool Sleak::RenderEngine::InvertMat4 ( const float M[16],
float out[16] )
inline

Row-major 4x4 inverse via Gauss-Jordan elimination.

Definition at line 32 of file VulkanInternal.hpp.

◆ IsRecyclable()

bool Sleak::RenderEngine::IsRecyclable ( VkBufferUsageFlags usage,
VkMemoryPropertyFlags props )
static

True when a buffer is both device-local and a recyclable usage, the pool's eligibility gate.

Definition at line 77 of file VulkanBuffer.cpp.

◆ MatMul4()

void Sleak::RenderEngine::MatMul4 ( const float A[16],
const float B[16],
float C[16] )
inline

Row-major mat4 multiply: C = A * B.

Definition at line 22 of file VulkanInternal.hpp.

◆ ToVkVertexFormat()

VkFormat Sleak::RenderEngine::ToVkVertexFormat ( VertexAttribFormat format)
static

Translates a registry attribute format into its Vulkan vertex format.

Definition at line 725 of file VulkanPipelines.cpp.

◆ UsageIsRecyclable()

bool Sleak::RenderEngine::UsageIsRecyclable ( VkBufferUsageFlags usage)
static

True for vertex/index usages, the only kinds worth pooling for reuse.

Definition at line 72 of file VulkanBuffer.cpp.

◆ WriteSingleImageSampler()

void Sleak::RenderEngine::WriteSingleImageSampler ( VkDevice dev,
VkDescriptorSet set,
VkImageView view,
VkSampler sampler,
VkImageLayout layout )
static

Writes a filter-DSL descriptor set for a given source view.

Definition at line 537 of file VulkanBloom.cpp.

Variable Documentation

◆ g_idleFrames

uint32_t Sleak::RenderEngine::g_idleFrames = 0
static

Definition at line 64 of file VulkanBuffer.cpp.

◆ g_lastPoolWarnFrame

uint64_t Sleak::RenderEngine::g_lastPoolWarnFrame = UINT64_MAX
static

Definition at line 54 of file VulkanBuffer.cpp.

◆ g_lastReclaimWarnFrame

uint64_t Sleak::RenderEngine::g_lastReclaimWarnFrame = UINT64_MAX
static

Definition at line 55 of file VulkanBuffer.cpp.

◆ g_maxFramesInFlight

uint32_t Sleak::RenderEngine::g_maxFramesInFlight = 3
static

Definition at line 53 of file VulkanBuffer.cpp.

◆ kIdleFramesBeforeTrim

uint32_t Sleak::RenderEngine::kIdleFramesBeforeTrim = 120
staticconstexpr

Definition at line 63 of file VulkanBuffer.cpp.

◆ kIdleTrimPerFrame

size_t Sleak::RenderEngine::kIdleTrimPerFrame = 8
staticconstexpr

Definition at line 60 of file VulkanBuffer.cpp.

◆ kMaxDeletesPerFrame

size_t Sleak::RenderEngine::kMaxDeletesPerFrame = 64
staticconstexpr

Definition at line 59 of file VulkanBuffer.cpp.

◆ kPoolBucket

VkDeviceSize Sleak::RenderEngine::kPoolBucket = 64 * 1024
staticconstexpr

Definition at line 58 of file VulkanBuffer.cpp.

◆ MAX_LIGHTS

uint32_t Sleak::RenderEngine::MAX_LIGHTS = 16
staticconstexpr

Definition at line 44 of file ConstantBuffer.hpp.

◆ s_deferredResources

std::vector<Microsoft::WRL::ComPtr<ID3D12Resource> > Sleak::RenderEngine::s_deferredResources
static

Definition at line 450 of file DirectX12Buffer.cpp.

◆ s_pendingResources

std::vector<Microsoft::WRL::ComPtr<ID3D12Resource> > Sleak::RenderEngine::s_pendingResources
static

Definition at line 451 of file DirectX12Buffer.cpp.

◆ SSAO_KERNEL_SIZE

uint32_t Sleak::RenderEngine::SSAO_KERNEL_SIZE = 64
staticconstexpr

Definition at line 221 of file ConstantBuffer.hpp.