Files
Seele/res/shaders/lib/Scene.slang
T

60 lines
1.1 KiB
Plaintext
Raw Normal View History

2024-03-29 08:49:03 +01:00
import Bounding;
2023-10-24 15:01:09 +02:00
2023-10-07 19:29:53 +02:00
struct MeshletDescription
{
2024-05-05 08:31:40 +02:00
AABB bounding;
2023-10-07 19:29:53 +02:00
uint32_t vertexCount;
uint32_t primitiveCount;
uint32_t vertexOffset;
uint32_t primitiveOffset;
2023-12-23 18:26:54 +01:00
float3 color;
2024-05-09 08:41:46 +02:00
uint32_t indicesOffset;
2023-10-07 19:29:53 +02:00
};
2023-10-24 15:01:09 +02:00
struct MeshData
{
2024-05-05 08:31:40 +02:00
AABB bounding;
uint32_t numMeshlets;
uint32_t meshletOffset;
uint32_t firstIndex;
uint32_t numIndices;
2023-10-24 15:01:09 +02:00
};
2024-04-24 23:25:34 +02:00
static const uint MAX_VERTICES = 256;
static const uint MAX_PRIMITIVES = 256;
2023-11-26 11:27:39 +01:00
static const uint TASK_GROUP_SIZE = 128;
2023-10-24 15:01:09 +02:00
static const uint MESH_GROUP_SIZE = 32;
struct InstanceData
{
float4x4 transformMatrix;
float4x4 inverseTransformMatrix;
2023-10-24 15:01:09 +02:00
};
2024-05-12 19:36:32 +02:00
struct DrawCallOffsets
{
uint32_t instanceOffset;
};
layout(push_constant)
ConstantBuffer<DrawCallOffsets> pOffsets;
2023-10-24 15:01:09 +02:00
struct Scene
{
StructuredBuffer<InstanceData> instances;
StructuredBuffer<MeshData> meshData;
2023-10-31 16:16:23 +01:00
StructuredBuffer<MeshletDescription> meshletInfos;
2024-04-23 19:11:06 +02:00
StructuredBuffer<uint8_t> primitiveIndices;
2024-04-07 16:33:32 +02:00
StructuredBuffer<uint32_t> vertexIndices;
2024-05-22 10:30:45 +02:00
// StructuredBuffer<uint32_t> cullingOffsets;
// RWStructuredBuffer<uint32_t> culledMeshlets;
2023-10-24 15:01:09 +02:00
};
2024-04-24 23:25:34 +02:00
layout(set=2)
2024-04-23 19:11:06 +02:00
ParameterBlock<Scene> pScene;
2023-10-07 19:29:53 +02:00
2024-05-12 19:36:32 +02:00
struct MeshPayload
{
2024-05-22 19:20:30 +02:00
uint instanceId;
2024-05-22 10:30:45 +02:00
uint culledMeshlets[2048];
2024-05-12 19:36:32 +02:00
};