4#include <glm/mat4x4.hpp>
162 static_assert(
sizeof(
UnifiedMeshlet ) == 48,
"UnifiedMeshlet size mismatch" );
246 static_assert(
sizeof(
VisibleMeshletInfo ) == 24,
"VisibleMeshletInfo size mismatch" );
303 static_assert(
sizeof(
MeshGeometryData ) == 104,
"MeshGeometryData size mismatch" );
369 static_assert( offsetof(
DiffuseShaderMaterial, baseColorFactor ) == 16,
"baseColorFactor must be at offset 16" );
405 static_assert(
sizeof(
PbrMaterial ) == 96,
"PbrMaterial size mismatch with GLSL std430 layout" );
406 static_assert( offsetof(
PbrMaterial, baseColorFactor ) == 16,
"baseColorFactor must be at offset 16" );
407 static_assert( offsetof(
PbrMaterial, emissiveFactor ) == 32,
"emissiveFactor must be at offset 32 (16-byte aligned for std430 vec3)" );
418 static_assert(
sizeof(
NormalsMaterial ) == 16,
"NormalsMaterial size mismatch" );
438 static_assert(
sizeof(
SHProbeData ) == 160,
"SHProbeData size mismatch" );
454 static_assert(
sizeof(
DynamicPointLight ) == 32,
"DynamicPointLight size mismatch" );
463 std::array<DynamicPointLight, MAX_DYNAMIC_POINT_LIGHTS>
pointLights{};
468 "DynamicPointLightBuffer size mismatch"
485 static_assert(
sizeof(
SunLightBuffer ) == 64,
"SunLightBuffer size mismatch" );
526 static_assert(
sizeof(
ClusterLodData ) == 48,
"ClusterLodData size mismatch" );
541 static_assert(
sizeof(
ClusterGroupData ) == 32,
"ClusterGroupData size mismatch" );
559 static_assert(
sizeof(
LodConfigUBO ) == 48,
"LodConfigUBO size mismatch" );
576 static_assert(
sizeof(
ClusterSurvivor ) == 32,
"ClusterSurvivor size mismatch" );
constexpr uint32_t MAX_SUN_SHADOW_CASCADES
constexpr uint32_t MAX_DYNAMIC_POINT_LIGHTS
GpuBuffers::MeshGeometryData MeshGeometryData
Compatibility alias for GpuBuffers::MeshGeometryData.
GpuBuffers::ObjectCullingData ObjectCullingData
Compatibility alias for GpuBuffers::ObjectCullingData.
GpuBuffers::ClusterSurvivor ClusterSurvivor
Compatibility alias for GpuBuffers::ClusterSurvivor.
GpuBuffers::MeshletBounds MeshletBounds
Compatibility alias for GpuBuffers::MeshletBounds.
GpuBuffers::GpuMeshDescription GpuMeshDescription
Compatibility alias for GpuBuffers::GpuMeshDescription.
GpuBuffers::LodConfigUBO LodConfigUBO
Compatibility alias for GpuBuffers::LodConfigUBO.
GpuBuffers::ClusterLodData ClusterLodData
Compatibility alias for GpuBuffers::ClusterLodData.
GpuBuffers::VisibleLodPrimitive VisibleLodPrimitive
Compatibility alias for GpuBuffers::VisibleLodPrimitive.
GpuBuffers::DynamicPointLightBuffer DynamicPointLightBuffer
Compatibility alias for GpuBuffers::DynamicPointLightBuffer.
GpuBuffers::Dispatch Dispatch
Compatibility alias for GpuBuffers::Dispatch.
GpuBuffers::DynamicPointLight DynamicPointLight
Compatibility alias for GpuBuffers::DynamicPointLight.
GpuBuffers::ObjectCullingCounters ObjectCullingCounters
Compatibility alias for GpuBuffers::ObjectCullingCounters.
GpuBuffers::DiffuseShaderMaterial GpuDiffuseShaderMaterial
Compatibility alias for GpuBuffers::DiffuseShaderMaterial.
GpuBuffers::NormalsMaterial GpuNormalsMaterial
Compatibility alias for GpuBuffers::NormalsMaterial.
GpuBuffers::SHProbeData SHProbeData
Compatibility alias for GpuBuffers::SHProbeData.
GpuBuffers::PrimitiveMeshletData PrimitiveMeshletData
Compatibility alias for GpuBuffers::PrimitiveMeshletData.
GpuBuffers::InstanceData InstanceData
Compatibility alias for GpuBuffers::InstanceData.
GpuBuffers::SunLightBuffer SunLightBuffer
Compatibility alias for GpuBuffers::SunLightBuffer.
GpuBuffers::MeshUnpackingData MeshUnpackingData
Compatibility alias for GpuBuffers::MeshUnpackingData.
GpuBuffers::LocalBoundsData LocalBoundsData
Compatibility alias for GpuBuffers::LocalBoundsData.
GpuBuffers::VisibleMeshletInfo VisibleMeshletInfo
Compatibility alias for GpuBuffers::VisibleMeshletInfo.
GpuBuffers::VisibleMeshletRange VisibleMeshletRange
Compatibility alias for GpuBuffers::VisibleMeshletRange.
GpuBuffers::InstanceCullingData InstanceCullingData
Compatibility alias for GpuBuffers::InstanceCullingData.
GpuBuffers::SunShadowCascadeBuffer SunShadowCascadeBuffer
Compatibility alias for GpuBuffers::SunShadowCascadeBuffer.
GpuBuffers::ClusterGroupData ClusterGroupData
Compatibility alias for GpuBuffers::ClusterGroupData.
GpuBuffers::UnifiedMeshlet UnifiedMeshlet
Compatibility alias for GpuBuffers::UnifiedMeshlet.
GpuBuffers::PbrMaterial GpuPbrMaterial
Compatibility alias for GpuBuffers::PbrMaterial.
GpuBuffers::DiffuseFlatColorMaterial GpuDiffuseFlatColorMaterial
Compatibility alias for GpuBuffers::DiffuseFlatColorMaterial.
GpuBuffers::SingleMeshletGeometryData SingleMeshletGeometryData
Compatibility alias for GpuBuffers::SingleMeshletGeometryData.
GpuBuffers::MeshPrimitiveRenderData MeshPrimitiveRenderData
Compatibility alias for GpuBuffers::MeshPrimitiveRenderData.
CPU-side mesh instance data before conversion to renderer GPU buffers.
std::vector< CpuPrimitiveData > primitives
Primitive records that belong to this mesh instance.
glm::mat4 modelMatrix
Local-to-world transform for all primitives in the mesh.
CPU-side render metadata for one mesh primitive.
uint32_t primitiveIndex
Index used by shader buffers to look up per-primitive data.
uint32_t meshletOffset
First meshlet for this primitive in the unified meshlet buffer.
uint32_t meshletCount
Number of meshlets owned by this primitive.
float boundingSphereRadius
World-space radius of the primitive bounding sphere.
glm::vec3 boundingSphereWorldPosition
World-space center of the primitive bounding sphere.
Per-eye frustum planes passed to compute shader culling.
std::array< glm::vec4, 6 > planes[2]
planes[eyeIndex][planeIndex], with two eyes for stereo rendering.
Per-group LOD data representing simplified child clusters.
float simplifiedError
Error threshold for this group.
glm::vec4 simplifiedBoundsPositionAndRadius
xyz = local center, w = radius
uint32_t _padding[2]
Padding required by the shader layout.
int32_t depth
DAG depth (0 = coarsest level)
Per-cluster LOD data for GPU-driven LOD selection.
uint32_t _padding[2]
Padding required by the shader layout.
uint64_t meshletDataAddress
Device address of the referenced UnifiedMeshlet.
uint32_t meshletIndex
Index into UnifiedMeshlet buffer.
int32_t groupId
Group this cluster belongs to (for parent error check)
float error
Simplification error (mesh-local units)
glm::vec4 boundsPositionAndRadius
xyz = local center, w = radius
int32_t refinedGroupId
Group this cluster simplifies (-1 for base geometry)
Cluster survivor data passed from culling to binning shaders.
uint32_t primitiveID
For transform/material lookup.
uint64_t clusterLodDataAddress
Device address of the slot's ClusterLodData array.
float ditherFactor
0.0-1.0 for transition blending
uint32_t _padding
Padding required by the shader layout.
uint32_t clusterIndex
Local cluster index within the slot.
GPU-side flat color material.
glm::vec3 color
Linear RGB diffuse color.
float _padding
Padding required by the shader layout.
GPU-side diffuse textured material.
uint32_t baseColorTextureIndex
Texture descriptor index, or 0xFFFFFFFF when absent.
glm::vec4 baseColorFactor
Linear RGBA multiplier applied to the base-color texture.
float _padding1[3]
Padding that places baseColorFactor at byte offset 16.
Workgroup counts for an indirect compute dispatch.
uint32_t groupSizeY
Number of workgroups in Y.
uint32_t groupSizeZ
Number of workgroups in Z.
uint32_t groupSizeX
Number of workgroups in X.
Fixed-size dynamic point light buffer for shaders.
std::array< DynamicPointLight, MAX_DYNAMIC_POINT_LIGHTS > pointLights
Fixed-capacity light array.
uint32_t pointLightCount
Active point light count.
uint32_t _padding[3]
Padding required by the shader layout.
GPU-side dynamic point light.
glm::vec4 colorIntensity
rgb = linear light color, w = intensity.
glm::vec4 positionRadius
xyz = world-space position, w = influence radius.
GPU-visible meshlet range for one mesh.
uint32_t meshletCount
Number of meshlets in the range.
uint32_t offset
First meshlet index in the range.
Per-instance bounding data used by compute culling.
uint32_t meshGeometryId
Index into the MeshGeometryData buffer.
uint32_t _padding[2]
Padding required by the shader layout.
uint32_t instanceId
Index into the InstanceData buffer.
glm::vec4 worldPositionAndRadius
xyz = world position, w = radius
Per-instance transform and material data referencing shared geometry.
uint32_t _padding
Padding required by the shader layout.
glm::mat4 worldMatrix
Local-to-world transform for the instance.
uint32_t materialId
Index into the material buffer for the instance's pipeline.
uint32_t colorTextureId
Texture descriptor index for legacy color-texture paths.
uint32_t meshGeometryId
Index into the MeshGeometryData buffer.
Local-space bounding sphere data for GPU transformation.
glm::vec4 localCenterAndRadius
xyz = local center, w = local radius
LOD configuration UBO for GPU shader selection.
float cameraNear
Positive near plane distance.
float cameraProj11
projection[1][1] = cot(fov/2)
uint32_t ditherEnabled
1 = dither transitions, 0 = hard cut
float errorThresholdPixels
Target pixel error (default 1.0)
glm::vec2 _padding
Padding required by the shader layout.
glm::vec4 cameraPosition
World-space camera position.
glm::vec2 screenSize
Render target dimensions.
Shared geometry metadata for instanced rendering with LOD support.
uint32_t pipelineIndex
Pipeline bin used for rendering this geometry.
uint64_t meshletDataAddress
Device address of the slot's UnifiedMeshlet array (0 = none).
uint32_t meshletCount
Number of meshlets for this geometry.
uint64_t boneVertexDataAddress
Device address of the slot's BoneVertexData array (0 = none).
uint32_t singleMeshletGeoIndex
Compact VS-path binning ordinal, or 0xFFFFFFFF if absent.
static constexpr uint32_t FLAG_SKINNED
flags bits (kept in sync with shaders/culling/PrimitiveCulling.comp).
uint64_t vertexDataAddress
Device address of the slot's Vertex array (0 = none).
uint64_t indexDataAddress
Device address of the slot's index array (uint32_t), 0 = none.
uint32_t groupCount
Number of LOD cluster groups for this geometry.
uint64_t singleMeshletGeoDataAddress
Device address of the slot's SingleMeshletGeometryData (0 = none).
uint64_t clusterLodDataAddress
Device address of the slot's ClusterLodData array (0 = none).
uint32_t geometryVertexStart
Base vertex element within the slot's vertex array.
uint32_t boneCount
Number of bones referenced by this geometry. Zero means static geometry.
uint32_t _padding
Pad to 104 bytes.
static constexpr uint32_t FLAG_RESIDENT
Slot payload fully uploaded (safe to render).
uint32_t clusterCount
Number of LOD clusters for this geometry.
uint32_t flags
Bit 0 marks skinned geometry; bit 1 marks the slot payload resident (fully uploaded).
uint64_t clusterGroupDataAddress
Device address of the slot's ClusterGroupData array (0 = none).
Per-primitive material and lighting indices for fragment shaders.
uint32_t materialId
Index into the material buffer for this primitive's pipeline.
uint32_t _padding
Padding required by the shader layout.
uint32_t colorTextureId
Texture descriptor index for legacy color-texture paths.
uint32_t shProbeIndex
Index into the SH probe buffer. Zero selects the fallback probe.
Mesh unpacking metadata for compute shader.
uint32_t meshStartIndex
First meshlet for this mesh.
uint32_t objectIndex
Index into the per-object transform buffer.
uint32_t meshletCount
Number of meshlets to unpack.
Bounding sphere for meshlet culling.
glm::vec4 worldPositionAndRadius
xyz = world-space center, w = radius.
uint32_t meshletIndex
Index into the UnifiedMeshlet buffer.
uint32_t pipelineIndex
Pipeline bin used for culling output routing.
GPU-side material data for normals debug rendering.
uint32_t _padding[3]
Padding required by the shader layout.
uint32_t debug
Debug mode selector used by normals shaders.
Culling operation counters for GPU buffers.
uint32_t totalMeshletCount
Total meshlet count across submitted objects.
uint32_t objectCount
Number of objects submitted for culling.
Object culling data for compute shader.
uint32_t _padding[3]
Padding required by the shader layout.
uint32_t objectIndex
Index into the per-object transform buffer.
glm::vec4 worldPositionAndRadius
xyz = world position, w = radius
GPU-side PBR material with spherical harmonics.
uint32_t roughnessMetallicTextureIndex
0xFFFFFFFF = not present
glm::vec4 baseColorFactor
Linear RGBA base color multiplier.
float metallicFactor
Scalar metallic value when no roughness-metallic texture is present.
uint32_t lightmapTextureIndex
0xFFFFFFFF = not present
uint32_t baseColorTextureIndex
0xFFFFFFFF = not present
float sh_scale
Multiplier applied to spherical harmonics lighting.
uint32_t tone_mapping
Tone-mapping mode consumed by material shaders.
uint32_t hasLightmap
1 when lightmapTextureIndex references a valid lightmap, otherwise 0.
float roughnessFactor
Scalar roughness value when no roughness-metallic texture is present.
uint32_t emissiveTextureIndex
0xFFFFFFFF = not present
float exposure
Exposure value applied by material shaders that perform tone mapping.
uint32_t normalMapBC5
1 when the normal map is BC5/RG and reconstructs Z, 0 when stored as RGB.
uint32_t _padding[1]
Padding required by the shader layout.
uint32_t debug_mode
Debug view mode consumed by material shaders.
glm::vec3 emissiveFactor
Linear RGB emissive multiplier.
float ambient_term
Ambient lighting term mixed with spherical harmonics lighting.
uint32_t normalTextureIndex
0xFFFFFFFF = not present
float normalScale
Scale applied to sampled tangent-space normal maps.
float alphaCutoff
Threshold for MASK mode.
Per-primitive meshlet range for culling shader.
uint64_t meshletDataAddress
Device address of the UnifiedMeshlet buffer.
uint32_t meshletStartIndex
First meshlet for the primitive.
uint32_t pipelineID
Pipeline bin used by culling and binning shaders.
uint32_t meshletCount
Number of meshlets for the primitive.
uint32_t _padding
Padding required by the shader layout.
Spherical harmonics probe data for dynamic lighting.
float _padding0
Global SH influence stored on fallback probe at index 0.
glm::vec4 coefficients[9]
L0-L2 RGB coefficients.
uint32_t _padding1
Padding required by the shader layout.
float scale
Probe lighting multiplier.
float ambientTerm
Ambient term mixed into probe lighting.
Draw metadata for geometry routed through the vertex-shader fast path.
uint32_t firstIndex
First index in the index buffer.
uint32_t indexCount
Number of indices to draw.
int32_t vertexOffset
Vertex offset applied by indexed drawing.
uint32_t pipelineIndex
Pipeline bin used for rendering this draw.
GPU-side single directional sun light.
glm::vec4 colorIntensity
rgb = linear light color, w = intensity.
glm::vec4 shadowParams
x = castsShadows, y = angular diameter degrees.
glm::vec4 lightmapShadowParams
x = sun removal, y = brightness
glm::vec4 directionEnabled
xyz = travel direction, w = enabled flag.
GPU-side cascaded shadow data for the active directional sun.
glm::vec4 cascadeSplits
Camera-forward far split per cascade.
glm::vec4 cameraForward
xyz = cascade camera forward direction, w = render debug mode.
glm::vec4 params
x = enabled, y = cascade count, z = map size, w = max distance.
std::array< glm::mat4, MAX_SUN_SHADOW_CASCADES > lightViewProj
Light view-projection matrix per cascade.
glm::vec4 biasParams
x = depth bias, y = normal bias, z = PCF radius, w = lightmapped receivers
GPU-side meshlet descriptor consumed by mesh shaders.
uint32_t vertexCount
Number of vertices referenced by this meshlet.
uint32_t _padding[2]
Padding required by the shader layout.
uint32_t triangleDataOffset
First packed triangle element for this meshlet.
uint64_t vertexDataAddress
Device address of the vertex buffer used by this meshlet.
uint32_t triangleCount
Number of packed triangles referenced by this meshlet.
uint32_t primitiveIndex
Primitive or mesh geometry index used for object/material lookup.
uint64_t triangleDataAddress
Device address of the packed triangle buffer used by this meshlet.
uint32_t vertexDataOffset
First vertex element for this meshlet.
uint32_t pipelineIndex
Pipeline bin used to route the meshlet to the correct material shader.
Visible LOD primitive data for parallel cluster selection.
uint32_t primitiveID
Primitive index for transform/material lookup.
uint64_t clusterLodDataAddress
Device address of the slot's ClusterLodData array.
uint32_t clusterCount
Number of clusters in this primitive's LOD hierarchy.
uint32_t meshGeometryId
Index into MeshGeometryData buffer.
uint64_t clusterGroupDataAddress
Device address of the slot's ClusterGroupData array.
Visible meshlet result from culling operation.
uint32_t _padding
Padding required by the shader layout.
float ditherFactor
LOD transition dither factor in the range [0.0, 1.0].
uint64_t meshletDataAddress
Device address of the UnifiedMeshlet buffer.
uint32_t objectID
Object or primitive index used for transform/material lookup.
uint32_t meshletIndex
Index of the visible meshlet.
Visible meshlet range per object for dispatch.
uint32_t meshletCount
Number of visible meshlets in the range.
uint32_t startMeshletId
First visible meshlet index for the object.
uint32_t objectIndex
Object index for the visible range.
uint32_t _padding
Padding required by the shader layout.
CPU cache entry that maps a mesh primitive to shared geometry buffer ranges.
uint32_t pipelineIndex
Material pipeline index used for binning and draw routing.
uint32_t vertexBaseOffset
First vertex in the shared vertex buffer.
bool isSingleMeshlet
True when the geometry can use the vertex-shader fast path.
uint32_t groupStartIndex
First ClusterGroupData index in the shared LOD array (or sentinel).
uint32_t groupCount
Number of LOD cluster groups for this geometry.
uint32_t clusterStartIndex
First ClusterLodData index in the shared LOD array (or sentinel).
uint32_t singleMeshletGeoIndex
VS-path binning ordinal into the shared SingleMeshletGeometryData array.
uint32_t clusterCount
Number of LOD clusters for this geometry.
uint32_t vertexCount
Number of vertices appended for this geometry (per-slot range).
uint64_t singleMeshletGeoDataAddress
Device address of the slot's SingleMeshletGeometryData entry.
uint32_t boneCount
Number of bones referenced by the geometry.
uint32_t meshGeometryId
Index into the GPU MeshGeometryData buffer.
uint32_t triangleBaseOffset
First packed triangle in the shared triangle buffer.
uint64_t clusterGroupDataAddress
Device address of the slot's ClusterGroupData array.
bool hasLodData
True when cluster and group LOD data was uploaded.
uint32_t meshletStartIndex
First meshlet in the shared UnifiedMeshlet buffer.
uint32_t vsIndexOffset
First index in the vertex-shader path index buffer.
uint64_t meshletDataAddress
Device address of the slot's UnifiedMeshlet array.
uint32_t boneVertexBaseOffset
First bone vertex record for skinned geometry.
float localBoundsRadius
Local-space radius of the geometry bounding sphere.
uint64_t clusterLodDataAddress
Device address of the slot's ClusterLodData array.
uint32_t vsIndexCount
Number of indices in the vertex-shader path index buffer.
uint64_t vertexDataAddress
Device address of the slot's Vertex array.
glm::vec3 localBoundsCenter
Local-space center of the geometry bounding sphere.
uint64_t boneVertexDataAddress
Device address of the slot's BoneVertexData array.
uint32_t meshletCount
Number of meshlets in the shared geometry range.
CPU-side staging payload for one primitive's meshlet draw data.
uint32_t textureIndex
Texture descriptor index used by legacy paths.
std::vector< GpuBuffers::UnifiedMeshlet > meshletData
Meshlet descriptors for this primitive.
std::vector< uint8_t > tris
Packed meshlet triangle index stream.
std::vector< uint32_t > vertices
Meshlet-local vertex index stream.