import Bounding; struct PoolRange { uint32_t offset; uint32_t size; }; struct MeshletDescription { AABB bounding; // range into vertexIndices array PoolRange vertexIndices; // range into primitiveIndices array PoolRange primitiveIndices; uint32_t indicesOffset; uint32_t lod; uint32_t pad0; uint32_t pad1; }; struct MeshData { AABB bounding; PoolRange meshletRange; // offset into the global index buffer PoolRange indicesRange; }; static const uint32_t MAX_VERTICES = 128; static const uint32_t MAX_PRIMITIVES = 128; struct InstanceData { float4x4 transformMatrix; float4x4 inverseTransformMatrix; }; struct MeshletCullingInfo { uint32_t visible; bool wasVisible() { return bool(visible); } }; struct Scene { StructuredBuffer positions; StructuredBuffer indexBuffer; StructuredBuffer instances; StructuredBuffer meshData; StructuredBuffer meshletInfos; StructuredBuffer primitiveIndices; StructuredBuffer vertexIndices; StructuredBuffer cullingOffsets; StructuredBuffer cullingInfos; }; ParameterBlock pScene; struct DrawCallOffsets { uint instanceOffset; uint textureOffset; uint samplerOffset; uint floatOffset; }; #ifdef RAY_TRACING // Shader record buffers are accessed via a different mechanism and don't use descriptor set bindings layout(set = 15, shaderRecordEXT) #else layout(push_constant) #endif ConstantBuffer pOffsets; uint32_t encodePrimitive(uint32_t meshletId) { return meshletId; } uint decodePrimitive(uint32_t encoded) { return encoded; } struct MeshPayload { uint culledMeshlets[2048]; uint instanceId; uint meshletOffset; uint cullingOffset; };