SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
ConstantBuffer.hpp
Go to the documentation of this file.
1
#ifndef _CONSTANTBUFFER_H_
2
#define _CONSTANTBUFFER_H_
3
4
#include <
Math/Color.hpp
>
5
#include <
Math/Matrix.hpp
>
6
#include <cstddef>
7
#include <cstdint>
8
9
namespace
Sleak
{
10
namespace
RenderEngine
{
11
12
/// Well-known constant buffer slot identifiers.
13
enum class
CBIds
{
14
Transformation
= 0,
15
Material
= 1,
16
Lighting
= 2
17
};
18
19
// Per-light GPU entry (64 bytes = 4 x 16-byte rows)
20
/// One light's packed GPU representation, laid out for std140/cbuffer alignment.
21
struct
alignas
(16)
LightGPUEntry
{
22
// Row 0: Position.xyz + Type
23
float
PositionX
,
PositionY
,
PositionZ
;
24
uint32_t
Type
;
// 0=dir, 1=point, 2=spot, 3=area
25
26
// Row 1: Direction.xyz + Intensity
27
float
DirectionX
,
DirectionY
,
DirectionZ
;
28
float
Intensity
;
29
30
// Row 2: Color.rgb + Range
31
float
ColorR
,
ColorG
,
ColorB
;
32
float
Range
;
33
34
// Row 3: SpotInnerCos + SpotOuterCos + AreaWidth + AreaHeight
35
float
SpotInnerCos
;
36
float
SpotOuterCos
;
37
float
AreaWidth
;
38
float
AreaHeight
;
39
};
40
41
// Full lighting constant buffer (64 + 64*16 + 32 trailing = 1120 bytes).
42
// The trailing fog gradient + height-fog block is appended AFTER the
43
// Lights[] array so that older shader UBO declarations (which stop at
44
// Lights[]) still read a valid prefix. Don't reorder.
45
static
constexpr
uint32_t
MAX_LIGHTS
= 16;
46
47
/// Full per-frame lighting UBO: camera, ambient, fog, and the packed light array.
48
struct
alignas
(16)
LightCBData
{
49
// Header Row 0: CameraPos.xyz + NumActiveLights
50
float
CameraPosX
,
CameraPosY
,
CameraPosZ
;
51
uint32_t
NumActiveLights
;
52
53
// Header Row 1: AmbientColor.rgb + AmbientIntensity
54
float
AmbientR
,
AmbientG
,
AmbientB
;
55
float
AmbientIntensity
;
56
57
// Header Row 2: Fog color (HORIZON)
58
float
FogColorR
,
FogColorG
,
FogColorB
,
FogColorA
;
59
60
// Header Row 3: Fog distances + reserved
61
float
FogStart
,
FogEnd
;
62
float
_reserved
[2];
63
64
// Per-light array
65
LightGPUEntry
Lights
[
MAX_LIGHTS
];
66
67
// ---- Trailing sky-matched + height fog block ----
68
float
FogColorZenith
[4];
// ZENITH color of fog gradient
69
float
HeightFogTop
;
// world Y above which height fog goes to 0
70
float
HeightFogDensity
;
// max density at low elevations [0..1]
71
float
HeightFogFalloff
;
// exponential falloff per world unit
72
float
HeightFogEnabled
;
// 0 = off, 1 = on
73
};
74
75
/// Interface for a CPU-side payload that can be uploaded to a GPU constant buffer.
76
struct
ConstantBuffer
{
77
public
:
78
virtual
void
*
GetData
()
const
= 0;
79
80
virtual
uint16_t
GetSize
()
const
= 0;
81
};
82
83
/// Per-draw world-view-projection and world matrices.
84
struct
alignas
(16)
TransformBuffer
:
public
ConstantBuffer
{
85
86
/// Composes WVP from world/view/proj and keeps World separately for lighting.
87
TransformBuffer
(
const
Sleak::Math::Matrix4
& world,
88
const
Sleak::Math::Matrix4
& view,
89
const
Sleak::Math::Matrix4
& proj)
90
: WVP(world * view * proj), World(world) {
91
}
92
93
/// Takes a pre-composed WVP with an identity world matrix (e.g. skybox, UI).
94
explicit
TransformBuffer
(
const
Sleak::Math::Matrix4
& mvp)
95
: WVP(mvp), World(
Sleak
::
Math
::
Matrix4
::Identity()) {
96
}
97
98
virtual
void
*
GetData
()
const override
{
99
return
(
void
*) &WVP;
100
}
101
102
virtual
uint16_t
GetSize
()
const override
{
103
return
sizeof
(
Sleak::Math::Matrix4
) * 2;
104
}
105
106
private
:
107
Sleak::Math::Matrix4
WVP;
108
Sleak::Math::Matrix4
World;
109
};
110
111
// GPU-aligned POD struct for material constant buffer data.
112
// Total: 128 bytes (8 x 16-byte rows), matches all shader backends.
113
/// Packed PBR material parameters uploaded to the material constant buffer.
114
struct
alignas
(16)
MaterialGPUData
{
115
// Row 0: Texture presence flags (16 bytes)
116
uint32_t
HasDiffuseMap
;
117
uint32_t
HasNormalMap
;
118
uint32_t
HasSpecularMap
;
119
uint32_t
HasRoughnessMap
;
120
121
// Row 1: More texture flags (16 bytes)
122
uint32_t
HasMetallicMap
;
123
uint32_t
HasAOMap
;
124
uint32_t
HasEmissiveMap
;
125
uint32_t
_pad0
;
126
127
// Row 2: Diffuse/Albedo color RGBA (16 bytes)
128
float
DiffuseR
,
DiffuseG
,
DiffuseB
,
DiffuseA
;
129
130
// Row 3: Specular color RGB + Shininess (16 bytes)
131
float
SpecularR
,
SpecularG
,
SpecularB
;
132
float
Shininess
;
133
134
// Row 4: Emissive color RGB + Intensity (16 bytes)
135
float
EmissiveR
,
EmissiveG
,
EmissiveB
;
136
float
EmissiveIntensity
;
137
138
// Row 5: PBR factors (16 bytes)
139
float
Metallic
;
140
float
Roughness
;
141
float
AO
;
142
float
NormalIntensity
;
143
144
// Row 6: UV transform (16 bytes)
145
float
TilingX
,
TilingY
;
146
float
OffsetX
,
OffsetY
;
147
148
// Row 7: Alpha properties (16 bytes)
149
float
Opacity
;
150
float
AlphaCutoff
;
151
float
_pad1
,
_pad2
;
152
};
153
154
/// ConstantBuffer wrapper around MaterialGPUData.
155
struct
alignas
(16)
MaterialBuffer
:
public
ConstantBuffer
{
156
157
MaterialBuffer
() :
gpuData
{} {}
158
159
MaterialBuffer
(
const
MaterialGPUData
& data)
160
:
gpuData
(data) {}
161
162
virtual
void
*
GetData
()
const override
{
163
return
(
void
*) &
gpuData
;
164
}
165
166
virtual
uint16_t
GetSize
()
const override
{
167
return
sizeof
(
MaterialGPUData
);
168
}
169
170
MaterialGPUData
gpuData
;
171
};
172
173
// GPU-aligned struct for light + shadow data, bound via UBO (set 2, binding 0)
174
// NOTE: trailing fog/sky fields are appended in fixed order — do not
175
// reorder. Shader UBO declarations may stop short of the full struct
176
// (size mismatch in that direction is fine for std140/cbuffer reads).
177
/// Shadow-pass UBO: light/shadow parameters, fog, and extra fill lights (set 2, binding 0).
178
struct
alignas
(16)
ShadowLightUBO
{
179
float
LightDir
[4];
// xyz + normalBias
180
float
LightColor
[4];
// rgb + intensity
181
float
Ambient
[4];
// rgb + intensity
182
float
CameraPos
[4];
// xyz + sceneClock
183
float
LightVP
[16];
// mat4 (light view-projection)
184
float
ShadowBias
;
185
float
ShadowStrength
;
186
float
ShadowTexelSize
;
187
float
LightSize
;
// world-space light size for PCSS penumbra
188
float
FogColor
[4];
// rgb + a — HORIZON color of the fog gradient
189
float
FogStart
;
// distance where fog begins
190
float
FogEnd
;
// distance where fog fully obscures
191
float
_fogPad
[2];
192
float
FogColorZenith
[4];
// rgb + pad — ZENITH color of the fog gradient
193
float
HeightFogTop
;
// world Y above which height fog density goes to 0
194
float
HeightFogDensity
;
// max density at low elevations [0..1]
195
float
HeightFogFalloff
;
// exponential falloff per world unit (e^-(top-y)*falloff)
196
float
HeightFogEnabled
;
// 0 = off, 1 = on
197
198
// Extra directional lights (fill, rim, etc.) — no shadow casting
199
float
ExtraLightDir
[3][4];
// xyz + unused (w=0)
200
float
ExtraLightColor
[3][4];
// rgb + intensity
201
uint32_t
NumExtraLights
;
// 0-3
202
float
_extraPad
[3];
203
204
// NDC -> shadow clip, composed on CPU (InvViewProj * LightVP).
205
// Shadow coords must use this — a per-fragment round trip
206
// through reconstructed world position shimmers under rotation.
207
float
NdcToShadow
[16];
208
};
209
210
// GPU-aligned POD struct for post-process settings constant buffer.
211
// Total: 16 bytes (1 x 16-byte row).
212
/// Tonemapping/exposure settings uploaded to the post-process pass.
213
struct
alignas
(16)
PostProcessGPUData
{
214
float
Exposure
;
// HDR exposure multiplier (default 1.0)
215
float
Gamma
;
// Gamma correction exponent (default 2.2)
216
uint32_t
TonemapEnabled
;
// 0 = passthrough, 1 = ACES tonemap
217
uint32_t
_ppPad0
;
218
};
219
220
// GPU-aligned POD struct for SSAO settings constant buffer.
221
// Total: 64 bytes (4 x 16-byte rows).
222
static
constexpr
uint32_t
SSAO_KERNEL_SIZE
= 64;
223
224
/// SSAO pass parameters: kernel size, radius/bias/power, and screen/near-far metrics.
225
struct
alignas
(16)
SSAOSettingsGPUData
{
226
// Row 0
227
float
Radius
;
// Sample hemisphere radius (default 0.5)
228
float
Bias
;
// Depth bias to prevent self-occlusion (default 0.025)
229
float
Power
;
// AO power exponent (default 2.0)
230
uint32_t
KernelSize
;
// Number of samples (default 64)
231
232
// Row 1
233
float
ScreenWidth
;
234
float
ScreenHeight
;
235
uint32_t
SSAOEnabled
;
// 0 = disabled, 1 = enabled
236
uint32_t
_ssaoPad0
;
237
238
// Row 2: near/far plane for linearizing depth
239
float
NearPlane
;
240
float
FarPlane
;
241
float
_ssaoPad1
,
_ssaoPad2
;
242
243
// Row 3: reserved
244
float
_ssaoPad3
[4];
245
};
246
247
// GPU-aligned POD struct for PCSS shadow settings (used in PBR shader, DX11/OpenGL).
248
// Total: 96 bytes (6 x 16-byte rows).
249
/// PCSS soft-shadow parameters for the DX11/OpenGL PBR shader path.
250
struct
alignas
(16)
PCSSShadowGPUData
{
251
// Row 0-3: Light view-projection matrix (64 bytes)
252
float
LightVP
[16];
253
254
// Row 4: Shadow parameters
255
float
ShadowBias
;
256
float
ShadowStrength
;
257
float
ShadowTexelSize
;
258
float
ShadowLightSize
;
259
260
// Row 5: Toggles
261
uint32_t
PCSSEnabled
;
262
uint32_t
ShadowMapEnabled
;
263
float
_shadowPad0
,
_shadowPad1
;
264
265
// Row 6-9: NDC -> shadow clip (see ShadowLightUBO::NdcToShadow)
266
float
NdcToShadow
[16];
267
};
268
269
// GPU-aligned POD struct for SSAO composite settings (used in PBR shader).
270
// Total: 16 bytes (1 x 16-byte row).
271
/// Controls whether the forward PBR shader multiplies in the SSAO texture.
272
struct
alignas
(16)
SSAOCompositeGPUData
{
273
uint32_t
SSAOCompositeEnabled
;
// 0 = disabled, 1 = multiply AO by SSAO texture
274
float
ScreenWidth
;
275
float
ScreenHeight
;
276
float
_ssaoCompPad
;
277
};
278
279
// GPU-aligned POD struct for IBL settings constant buffer.
280
// Total: 16 bytes (1 x 16-byte row).
281
/// Image-based lighting toggle, intensity, and prefiltered-map LOD range.
282
struct
alignas
(16)
IBLSettingsGPUData
{
283
uint32_t
IBLEnabled
;
// 0 = disabled, 1 = enabled
284
float
IBLIntensity
;
// multiplier for IBL contribution (default 1.0)
285
float
MaxReflectionLOD
;
// max mip level for prefiltered env map (default 4.0)
286
uint32_t
_iblPad0
;
287
};
288
289
/// ConstantBuffer wrapper around LightCBData.
290
struct
alignas
(16)
LightBuffer
:
public
ConstantBuffer
{
291
LightBuffer
() :
gpuData
{} {}
292
LightBuffer
(
const
LightCBData
& data)
293
:
gpuData
(data) {}
294
295
virtual
void
*
GetData
()
const override
{
296
return
(
void
*)&
gpuData
;
297
}
298
299
virtual
uint16_t
GetSize
()
const override
{
300
return
sizeof
(
LightCBData
);
301
}
302
303
LightCBData
gpuData
;
304
};
305
306
// Per-frame CB for the deferred lighting pass (bound at slot 3).
307
// Provides inverse view-projection for world-position reconstruction from depth.
308
// Total: 80 bytes (5 x 16-byte rows).
309
/// Per-frame deferred lighting pass CB: inverse view-projection plus screen/near-far metrics.
310
struct
alignas
(16)
DeferredCBData
{
311
// Rows 0-3: Inverse view-projection matrix (64 bytes)
312
float
InvViewProj
[16];
313
314
// Row 4: Screen size + near/far planes
315
float
ScreenWidth
;
316
float
ScreenHeight
;
317
float
NearPlane
;
318
float
FarPlane
;
319
};
320
321
/// ConstantBuffer wrapper around DeferredCBData.
322
struct
alignas
(16)
DeferredBuffer
:
public
ConstantBuffer
{
323
DeferredBuffer
() :
gpuData
{} {}
324
DeferredBuffer
(
const
DeferredCBData
& data) :
gpuData
(data) {}
325
326
virtual
void
*
GetData
()
const override
{
return
(
void
*)&
gpuData
; }
327
virtual
uint16_t
GetSize
()
const override
{
return
sizeof
(
DeferredCBData
); }
328
329
DeferredCBData
gpuData
;
330
};
331
332
/// Camera block for transparent formats that read the scene behind
333
/// them (VertexLayoutDesc::transparentReadsScene), std140 layout.
334
struct
alignas
(16)
SceneReadUBO
{
335
float
ViewProj
[16];
336
float
InvViewProj
[16];
337
float
ScreenWidth
,
ScreenHeight
,
InvScreenWidth
,
InvScreenHeight
;
338
float
JitterX
,
JitterY
,
NearPlane
,
FarPlane
;
// jitter in NDC
339
float
SceneValid
,
SkyValid
,
_pad0
,
_pad1
;
340
};
341
static_assert
(
342
offsetof(
SceneReadUBO
, _pad1) +
sizeof
(float) ==
343
sizeof
(
SceneReadUBO
),
344
"SceneReadUBO must match the std140 block without padding"
);
345
}
346
}
347
348
#endif
Color.hpp
Matrix.hpp
Sleak::Material
Definition
Material.hpp:90
Sleak::Math
Vectors, matrices, quaternions, colors, AABBs, and random helpers.
Definition
GameObject.hpp:13
Sleak::Math::Matrix4
Matrix< float, 4, 4 > Matrix4
Definition
Matrix.hpp:404
Sleak::RenderEngine
Backend-facing rendering layer shared by the four graphics backends.
Definition
Application.hpp:60
Sleak::RenderEngine::SSAO_KERNEL_SIZE
static constexpr uint32_t SSAO_KERNEL_SIZE
Definition
ConstantBuffer.hpp:222
Sleak::RenderEngine::MAX_LIGHTS
static constexpr uint32_t MAX_LIGHTS
Definition
ConstantBuffer.hpp:45
Sleak::RenderEngine::CBIds
CBIds
Well-known constant buffer slot identifiers.
Definition
ConstantBuffer.hpp:13
Sleak::RenderEngine::CBIds::Lighting
@ Lighting
Definition
ConstantBuffer.hpp:16
Sleak::RenderEngine::CBIds::Transformation
@ Transformation
Definition
ConstantBuffer.hpp:14
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
Sleak::RenderEngine::ConstantBuffer
Interface for a CPU-side payload that can be uploaded to a GPU constant buffer.
Definition
ConstantBuffer.hpp:76
Sleak::RenderEngine::ConstantBuffer::GetSize
virtual uint16_t GetSize() const =0
Sleak::RenderEngine::ConstantBuffer::GetData
virtual void * GetData() const =0
Sleak::RenderEngine::DeferredBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:327
Sleak::RenderEngine::DeferredBuffer::gpuData
DeferredCBData gpuData
Definition
ConstantBuffer.hpp:329
Sleak::RenderEngine::DeferredBuffer::DeferredBuffer
DeferredBuffer()
Definition
ConstantBuffer.hpp:323
Sleak::RenderEngine::DeferredBuffer::DeferredBuffer
DeferredBuffer(const DeferredCBData &data)
Definition
ConstantBuffer.hpp:324
Sleak::RenderEngine::DeferredBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:326
Sleak::RenderEngine::DeferredCBData
Per-frame deferred lighting pass CB: inverse view-projection plus screen/near-far metrics.
Definition
ConstantBuffer.hpp:310
Sleak::RenderEngine::DeferredCBData::NearPlane
float NearPlane
Definition
ConstantBuffer.hpp:317
Sleak::RenderEngine::DeferredCBData::InvViewProj
float InvViewProj[16]
Definition
ConstantBuffer.hpp:312
Sleak::RenderEngine::DeferredCBData::FarPlane
float FarPlane
Definition
ConstantBuffer.hpp:318
Sleak::RenderEngine::DeferredCBData::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:315
Sleak::RenderEngine::DeferredCBData::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:316
Sleak::RenderEngine::IBLSettingsGPUData
Image-based lighting toggle, intensity, and prefiltered-map LOD range.
Definition
ConstantBuffer.hpp:282
Sleak::RenderEngine::IBLSettingsGPUData::_iblPad0
uint32_t _iblPad0
Definition
ConstantBuffer.hpp:286
Sleak::RenderEngine::IBLSettingsGPUData::IBLIntensity
float IBLIntensity
Definition
ConstantBuffer.hpp:284
Sleak::RenderEngine::IBLSettingsGPUData::IBLEnabled
uint32_t IBLEnabled
Definition
ConstantBuffer.hpp:283
Sleak::RenderEngine::IBLSettingsGPUData::MaxReflectionLOD
float MaxReflectionLOD
Definition
ConstantBuffer.hpp:285
Sleak::RenderEngine::LightBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:299
Sleak::RenderEngine::LightBuffer::gpuData
LightCBData gpuData
Definition
ConstantBuffer.hpp:303
Sleak::RenderEngine::LightBuffer::LightBuffer
LightBuffer(const LightCBData &data)
Definition
ConstantBuffer.hpp:292
Sleak::RenderEngine::LightBuffer::LightBuffer
LightBuffer()
Definition
ConstantBuffer.hpp:291
Sleak::RenderEngine::LightBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:295
Sleak::RenderEngine::LightCBData
Full per-frame lighting UBO: camera, ambient, fog, and the packed light array.
Definition
ConstantBuffer.hpp:48
Sleak::RenderEngine::LightCBData::HeightFogDensity
float HeightFogDensity
Definition
ConstantBuffer.hpp:70
Sleak::RenderEngine::LightCBData::CameraPosZ
float CameraPosZ
Definition
ConstantBuffer.hpp:50
Sleak::RenderEngine::LightCBData::FogStart
float FogStart
Definition
ConstantBuffer.hpp:61
Sleak::RenderEngine::LightCBData::AmbientB
float AmbientB
Definition
ConstantBuffer.hpp:54
Sleak::RenderEngine::LightCBData::FogColorB
float FogColorB
Definition
ConstantBuffer.hpp:58
Sleak::RenderEngine::LightCBData::HeightFogFalloff
float HeightFogFalloff
Definition
ConstantBuffer.hpp:71
Sleak::RenderEngine::LightCBData::FogColorZenith
float FogColorZenith[4]
Definition
ConstantBuffer.hpp:68
Sleak::RenderEngine::LightCBData::_reserved
float _reserved[2]
Definition
ConstantBuffer.hpp:62
Sleak::RenderEngine::LightCBData::FogColorG
float FogColorG
Definition
ConstantBuffer.hpp:58
Sleak::RenderEngine::LightCBData::FogColorA
float FogColorA
Definition
ConstantBuffer.hpp:58
Sleak::RenderEngine::LightCBData::CameraPosY
float CameraPosY
Definition
ConstantBuffer.hpp:50
Sleak::RenderEngine::LightCBData::AmbientIntensity
float AmbientIntensity
Definition
ConstantBuffer.hpp:55
Sleak::RenderEngine::LightCBData::FogColorR
float FogColorR
Definition
ConstantBuffer.hpp:58
Sleak::RenderEngine::LightCBData::NumActiveLights
uint32_t NumActiveLights
Definition
ConstantBuffer.hpp:51
Sleak::RenderEngine::LightCBData::HeightFogEnabled
float HeightFogEnabled
Definition
ConstantBuffer.hpp:72
Sleak::RenderEngine::LightCBData::HeightFogTop
float HeightFogTop
Definition
ConstantBuffer.hpp:69
Sleak::RenderEngine::LightCBData::AmbientG
float AmbientG
Definition
ConstantBuffer.hpp:54
Sleak::RenderEngine::LightCBData::FogEnd
float FogEnd
Definition
ConstantBuffer.hpp:61
Sleak::RenderEngine::LightCBData::AmbientR
float AmbientR
Definition
ConstantBuffer.hpp:54
Sleak::RenderEngine::LightCBData::Lights
LightGPUEntry Lights[MAX_LIGHTS]
Definition
ConstantBuffer.hpp:65
Sleak::RenderEngine::LightCBData::CameraPosX
float CameraPosX
Definition
ConstantBuffer.hpp:50
Sleak::RenderEngine::LightGPUEntry
One light's packed GPU representation, laid out for std140/cbuffer alignment.
Definition
ConstantBuffer.hpp:21
Sleak::RenderEngine::LightGPUEntry::SpotInnerCos
float SpotInnerCos
Definition
ConstantBuffer.hpp:35
Sleak::RenderEngine::LightGPUEntry::Range
float Range
Definition
ConstantBuffer.hpp:32
Sleak::RenderEngine::LightGPUEntry::AreaHeight
float AreaHeight
Definition
ConstantBuffer.hpp:38
Sleak::RenderEngine::LightGPUEntry::AreaWidth
float AreaWidth
Definition
ConstantBuffer.hpp:37
Sleak::RenderEngine::LightGPUEntry::Type
uint32_t Type
Definition
ConstantBuffer.hpp:24
Sleak::RenderEngine::LightGPUEntry::DirectionY
float DirectionY
Definition
ConstantBuffer.hpp:27
Sleak::RenderEngine::LightGPUEntry::PositionY
float PositionY
Definition
ConstantBuffer.hpp:23
Sleak::RenderEngine::LightGPUEntry::Intensity
float Intensity
Definition
ConstantBuffer.hpp:28
Sleak::RenderEngine::LightGPUEntry::PositionX
float PositionX
Definition
ConstantBuffer.hpp:23
Sleak::RenderEngine::LightGPUEntry::ColorB
float ColorB
Definition
ConstantBuffer.hpp:31
Sleak::RenderEngine::LightGPUEntry::DirectionX
float DirectionX
Definition
ConstantBuffer.hpp:27
Sleak::RenderEngine::LightGPUEntry::DirectionZ
float DirectionZ
Definition
ConstantBuffer.hpp:27
Sleak::RenderEngine::LightGPUEntry::ColorG
float ColorG
Definition
ConstantBuffer.hpp:31
Sleak::RenderEngine::LightGPUEntry::SpotOuterCos
float SpotOuterCos
Definition
ConstantBuffer.hpp:36
Sleak::RenderEngine::LightGPUEntry::ColorR
float ColorR
Definition
ConstantBuffer.hpp:31
Sleak::RenderEngine::LightGPUEntry::PositionZ
float PositionZ
Definition
ConstantBuffer.hpp:23
Sleak::RenderEngine::MaterialBuffer::MaterialBuffer
MaterialBuffer(const MaterialGPUData &data)
Definition
ConstantBuffer.hpp:159
Sleak::RenderEngine::MaterialBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:162
Sleak::RenderEngine::MaterialBuffer::MaterialBuffer
MaterialBuffer()
Definition
ConstantBuffer.hpp:157
Sleak::RenderEngine::MaterialBuffer::gpuData
MaterialGPUData gpuData
Definition
ConstantBuffer.hpp:170
Sleak::RenderEngine::MaterialBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:166
Sleak::RenderEngine::MaterialGPUData
Packed PBR material parameters uploaded to the material constant buffer.
Definition
ConstantBuffer.hpp:114
Sleak::RenderEngine::MaterialGPUData::DiffuseA
float DiffuseA
Definition
ConstantBuffer.hpp:128
Sleak::RenderEngine::MaterialGPUData::Roughness
float Roughness
Definition
ConstantBuffer.hpp:140
Sleak::RenderEngine::MaterialGPUData::SpecularG
float SpecularG
Definition
ConstantBuffer.hpp:131
Sleak::RenderEngine::MaterialGPUData::TilingX
float TilingX
Definition
ConstantBuffer.hpp:145
Sleak::RenderEngine::MaterialGPUData::EmissiveG
float EmissiveG
Definition
ConstantBuffer.hpp:135
Sleak::RenderEngine::MaterialGPUData::Opacity
float Opacity
Definition
ConstantBuffer.hpp:149
Sleak::RenderEngine::MaterialGPUData::HasSpecularMap
uint32_t HasSpecularMap
Definition
ConstantBuffer.hpp:118
Sleak::RenderEngine::MaterialGPUData::NormalIntensity
float NormalIntensity
Definition
ConstantBuffer.hpp:142
Sleak::RenderEngine::MaterialGPUData::TilingY
float TilingY
Definition
ConstantBuffer.hpp:145
Sleak::RenderEngine::MaterialGPUData::HasAOMap
uint32_t HasAOMap
Definition
ConstantBuffer.hpp:123
Sleak::RenderEngine::MaterialGPUData::OffsetX
float OffsetX
Definition
ConstantBuffer.hpp:146
Sleak::RenderEngine::MaterialGPUData::DiffuseB
float DiffuseB
Definition
ConstantBuffer.hpp:128
Sleak::RenderEngine::MaterialGPUData::Shininess
float Shininess
Definition
ConstantBuffer.hpp:132
Sleak::RenderEngine::MaterialGPUData::OffsetY
float OffsetY
Definition
ConstantBuffer.hpp:146
Sleak::RenderEngine::MaterialGPUData::HasRoughnessMap
uint32_t HasRoughnessMap
Definition
ConstantBuffer.hpp:119
Sleak::RenderEngine::MaterialGPUData::EmissiveR
float EmissiveR
Definition
ConstantBuffer.hpp:135
Sleak::RenderEngine::MaterialGPUData::HasDiffuseMap
uint32_t HasDiffuseMap
Definition
ConstantBuffer.hpp:116
Sleak::RenderEngine::MaterialGPUData::_pad2
float _pad2
Definition
ConstantBuffer.hpp:151
Sleak::RenderEngine::MaterialGPUData::HasMetallicMap
uint32_t HasMetallicMap
Definition
ConstantBuffer.hpp:122
Sleak::RenderEngine::MaterialGPUData::AlphaCutoff
float AlphaCutoff
Definition
ConstantBuffer.hpp:150
Sleak::RenderEngine::MaterialGPUData::AO
float AO
Definition
ConstantBuffer.hpp:141
Sleak::RenderEngine::MaterialGPUData::SpecularB
float SpecularB
Definition
ConstantBuffer.hpp:131
Sleak::RenderEngine::MaterialGPUData::EmissiveIntensity
float EmissiveIntensity
Definition
ConstantBuffer.hpp:136
Sleak::RenderEngine::MaterialGPUData::SpecularR
float SpecularR
Definition
ConstantBuffer.hpp:131
Sleak::RenderEngine::MaterialGPUData::_pad1
float _pad1
Definition
ConstantBuffer.hpp:151
Sleak::RenderEngine::MaterialGPUData::_pad0
uint32_t _pad0
Definition
ConstantBuffer.hpp:125
Sleak::RenderEngine::MaterialGPUData::HasEmissiveMap
uint32_t HasEmissiveMap
Definition
ConstantBuffer.hpp:124
Sleak::RenderEngine::MaterialGPUData::HasNormalMap
uint32_t HasNormalMap
Definition
ConstantBuffer.hpp:117
Sleak::RenderEngine::MaterialGPUData::DiffuseG
float DiffuseG
Definition
ConstantBuffer.hpp:128
Sleak::RenderEngine::MaterialGPUData::DiffuseR
float DiffuseR
Definition
ConstantBuffer.hpp:128
Sleak::RenderEngine::MaterialGPUData::EmissiveB
float EmissiveB
Definition
ConstantBuffer.hpp:135
Sleak::RenderEngine::MaterialGPUData::Metallic
float Metallic
Definition
ConstantBuffer.hpp:139
Sleak::RenderEngine::PCSSShadowGPUData
PCSS soft-shadow parameters for the DX11/OpenGL PBR shader path.
Definition
ConstantBuffer.hpp:250
Sleak::RenderEngine::PCSSShadowGPUData::ShadowStrength
float ShadowStrength
Definition
ConstantBuffer.hpp:256
Sleak::RenderEngine::PCSSShadowGPUData::ShadowLightSize
float ShadowLightSize
Definition
ConstantBuffer.hpp:258
Sleak::RenderEngine::PCSSShadowGPUData::NdcToShadow
float NdcToShadow[16]
Definition
ConstantBuffer.hpp:266
Sleak::RenderEngine::PCSSShadowGPUData::LightVP
float LightVP[16]
Definition
ConstantBuffer.hpp:252
Sleak::RenderEngine::PCSSShadowGPUData::ShadowMapEnabled
uint32_t ShadowMapEnabled
Definition
ConstantBuffer.hpp:262
Sleak::RenderEngine::PCSSShadowGPUData::_shadowPad1
float _shadowPad1
Definition
ConstantBuffer.hpp:263
Sleak::RenderEngine::PCSSShadowGPUData::PCSSEnabled
uint32_t PCSSEnabled
Definition
ConstantBuffer.hpp:261
Sleak::RenderEngine::PCSSShadowGPUData::_shadowPad0
float _shadowPad0
Definition
ConstantBuffer.hpp:263
Sleak::RenderEngine::PCSSShadowGPUData::ShadowTexelSize
float ShadowTexelSize
Definition
ConstantBuffer.hpp:257
Sleak::RenderEngine::PCSSShadowGPUData::ShadowBias
float ShadowBias
Definition
ConstantBuffer.hpp:255
Sleak::RenderEngine::PostProcessGPUData
Tonemapping/exposure settings uploaded to the post-process pass.
Definition
ConstantBuffer.hpp:213
Sleak::RenderEngine::PostProcessGPUData::Gamma
float Gamma
Definition
ConstantBuffer.hpp:215
Sleak::RenderEngine::PostProcessGPUData::Exposure
float Exposure
Definition
ConstantBuffer.hpp:214
Sleak::RenderEngine::PostProcessGPUData::TonemapEnabled
uint32_t TonemapEnabled
Definition
ConstantBuffer.hpp:216
Sleak::RenderEngine::PostProcessGPUData::_ppPad0
uint32_t _ppPad0
Definition
ConstantBuffer.hpp:217
Sleak::RenderEngine::SSAOCompositeGPUData
Controls whether the forward PBR shader multiplies in the SSAO texture.
Definition
ConstantBuffer.hpp:272
Sleak::RenderEngine::SSAOCompositeGPUData::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:274
Sleak::RenderEngine::SSAOCompositeGPUData::_ssaoCompPad
float _ssaoCompPad
Definition
ConstantBuffer.hpp:276
Sleak::RenderEngine::SSAOCompositeGPUData::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:275
Sleak::RenderEngine::SSAOCompositeGPUData::SSAOCompositeEnabled
uint32_t SSAOCompositeEnabled
Definition
ConstantBuffer.hpp:273
Sleak::RenderEngine::SSAOSettingsGPUData
SSAO pass parameters: kernel size, radius/bias/power, and screen/near-far metrics.
Definition
ConstantBuffer.hpp:225
Sleak::RenderEngine::SSAOSettingsGPUData::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:234
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad0
uint32_t _ssaoPad0
Definition
ConstantBuffer.hpp:236
Sleak::RenderEngine::SSAOSettingsGPUData::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:233
Sleak::RenderEngine::SSAOSettingsGPUData::NearPlane
float NearPlane
Definition
ConstantBuffer.hpp:239
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad1
float _ssaoPad1
Definition
ConstantBuffer.hpp:241
Sleak::RenderEngine::SSAOSettingsGPUData::SSAOEnabled
uint32_t SSAOEnabled
Definition
ConstantBuffer.hpp:235
Sleak::RenderEngine::SSAOSettingsGPUData::Bias
float Bias
Definition
ConstantBuffer.hpp:228
Sleak::RenderEngine::SSAOSettingsGPUData::FarPlane
float FarPlane
Definition
ConstantBuffer.hpp:240
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad2
float _ssaoPad2
Definition
ConstantBuffer.hpp:241
Sleak::RenderEngine::SSAOSettingsGPUData::KernelSize
uint32_t KernelSize
Definition
ConstantBuffer.hpp:230
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad3
float _ssaoPad3[4]
Definition
ConstantBuffer.hpp:244
Sleak::RenderEngine::SSAOSettingsGPUData::Power
float Power
Definition
ConstantBuffer.hpp:229
Sleak::RenderEngine::SSAOSettingsGPUData::Radius
float Radius
Definition
ConstantBuffer.hpp:227
Sleak::RenderEngine::SceneReadUBO
Definition
ConstantBuffer.hpp:334
Sleak::RenderEngine::SceneReadUBO::InvScreenHeight
float InvScreenHeight
Definition
ConstantBuffer.hpp:337
Sleak::RenderEngine::SceneReadUBO::ViewProj
float ViewProj[16]
Definition
ConstantBuffer.hpp:335
Sleak::RenderEngine::SceneReadUBO::SkyValid
float SkyValid
Definition
ConstantBuffer.hpp:339
Sleak::RenderEngine::SceneReadUBO::InvScreenWidth
float InvScreenWidth
Definition
ConstantBuffer.hpp:337
Sleak::RenderEngine::SceneReadUBO::SceneValid
float SceneValid
Definition
ConstantBuffer.hpp:339
Sleak::RenderEngine::SceneReadUBO::NearPlane
float NearPlane
Definition
ConstantBuffer.hpp:338
Sleak::RenderEngine::SceneReadUBO::JitterX
float JitterX
Definition
ConstantBuffer.hpp:338
Sleak::RenderEngine::SceneReadUBO::JitterY
float JitterY
Definition
ConstantBuffer.hpp:338
Sleak::RenderEngine::SceneReadUBO::FarPlane
float FarPlane
Definition
ConstantBuffer.hpp:338
Sleak::RenderEngine::SceneReadUBO::_pad1
float _pad1
Definition
ConstantBuffer.hpp:339
Sleak::RenderEngine::SceneReadUBO::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:337
Sleak::RenderEngine::SceneReadUBO::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:337
Sleak::RenderEngine::SceneReadUBO::InvViewProj
float InvViewProj[16]
Definition
ConstantBuffer.hpp:336
Sleak::RenderEngine::SceneReadUBO::_pad0
float _pad0
Definition
ConstantBuffer.hpp:339
Sleak::RenderEngine::ShadowLightUBO
Shadow-pass UBO: light/shadow parameters, fog, and extra fill lights (set 2, binding 0).
Definition
ConstantBuffer.hpp:178
Sleak::RenderEngine::ShadowLightUBO::ShadowBias
float ShadowBias
Definition
ConstantBuffer.hpp:184
Sleak::RenderEngine::ShadowLightUBO::FogStart
float FogStart
Definition
ConstantBuffer.hpp:189
Sleak::RenderEngine::ShadowLightUBO::LightSize
float LightSize
Definition
ConstantBuffer.hpp:187
Sleak::RenderEngine::ShadowLightUBO::ExtraLightDir
float ExtraLightDir[3][4]
Definition
ConstantBuffer.hpp:199
Sleak::RenderEngine::ShadowLightUBO::FogColor
float FogColor[4]
Definition
ConstantBuffer.hpp:188
Sleak::RenderEngine::ShadowLightUBO::FogEnd
float FogEnd
Definition
ConstantBuffer.hpp:190
Sleak::RenderEngine::ShadowLightUBO::ShadowTexelSize
float ShadowTexelSize
Definition
ConstantBuffer.hpp:186
Sleak::RenderEngine::ShadowLightUBO::ExtraLightColor
float ExtraLightColor[3][4]
Definition
ConstantBuffer.hpp:200
Sleak::RenderEngine::ShadowLightUBO::NdcToShadow
float NdcToShadow[16]
Definition
ConstantBuffer.hpp:207
Sleak::RenderEngine::ShadowLightUBO::LightColor
float LightColor[4]
Definition
ConstantBuffer.hpp:180
Sleak::RenderEngine::ShadowLightUBO::LightVP
float LightVP[16]
Definition
ConstantBuffer.hpp:183
Sleak::RenderEngine::ShadowLightUBO::_fogPad
float _fogPad[2]
Definition
ConstantBuffer.hpp:191
Sleak::RenderEngine::ShadowLightUBO::NumExtraLights
uint32_t NumExtraLights
Definition
ConstantBuffer.hpp:201
Sleak::RenderEngine::ShadowLightUBO::_extraPad
float _extraPad[3]
Definition
ConstantBuffer.hpp:202
Sleak::RenderEngine::ShadowLightUBO::HeightFogFalloff
float HeightFogFalloff
Definition
ConstantBuffer.hpp:195
Sleak::RenderEngine::ShadowLightUBO::FogColorZenith
float FogColorZenith[4]
Definition
ConstantBuffer.hpp:192
Sleak::RenderEngine::ShadowLightUBO::HeightFogDensity
float HeightFogDensity
Definition
ConstantBuffer.hpp:194
Sleak::RenderEngine::ShadowLightUBO::HeightFogEnabled
float HeightFogEnabled
Definition
ConstantBuffer.hpp:196
Sleak::RenderEngine::ShadowLightUBO::CameraPos
float CameraPos[4]
Definition
ConstantBuffer.hpp:182
Sleak::RenderEngine::ShadowLightUBO::LightDir
float LightDir[4]
Definition
ConstantBuffer.hpp:179
Sleak::RenderEngine::ShadowLightUBO::Ambient
float Ambient[4]
Definition
ConstantBuffer.hpp:181
Sleak::RenderEngine::ShadowLightUBO::ShadowStrength
float ShadowStrength
Definition
ConstantBuffer.hpp:185
Sleak::RenderEngine::ShadowLightUBO::HeightFogTop
float HeightFogTop
Definition
ConstantBuffer.hpp:193
Sleak::RenderEngine::TransformBuffer::TransformBuffer
TransformBuffer(const Sleak::Math::Matrix4 &world, const Sleak::Math::Matrix4 &view, const Sleak::Math::Matrix4 &proj)
Composes WVP from world/view/proj and keeps World separately for lighting.
Definition
ConstantBuffer.hpp:87
Sleak::RenderEngine::TransformBuffer::TransformBuffer
TransformBuffer(const Sleak::Math::Matrix4 &mvp)
Takes a pre-composed WVP with an identity world matrix (e.g. skybox, UI).
Definition
ConstantBuffer.hpp:94
Sleak::RenderEngine::TransformBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:102
Sleak::RenderEngine::TransformBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:98
include
private
Graphics
Common
ConstantBuffer.hpp
Generated on
for SleakEngine by
1.18.0