Basic meshlet generation algorithm

This commit is contained in:
Dynamitos
2023-10-31 16:16:23 +01:00
parent 7773c55e1a
commit d53492d07b
15 changed files with 350 additions and 191 deletions
+2 -1
View File
@@ -82,6 +82,7 @@ void meshMain(
out Indices<uint3, MAX_PRIMITIVES> indices
){
InstanceData inst = scene.instances[meshPayload.instanceId[groupID]];
MeshData md = scene.meshData[meshPayload.instanceId[groupID]];
MeshletDescription m = meshlets.meshletInfos[meshPayload.meshletId[groupID]];
const uint vertexLoops = (MAX_VERTICES + MESH_GROUP_SIZE - 1) / MESH_GROUP_SIZE;
for(uint loop = 0; loop < vertexLoops; ++loop)
@@ -91,7 +92,7 @@ void meshMain(
InterlockedMax(gs_numVertices, v + 1);
{
int vertexIndex = meshlets.vertexIndices[m.vertexOffset + v];
gs_vertices[v] = vertexData.getAttributes(vertexIndex, inst);
gs_vertices[v] = vertexData.getAttributes(md.indexOffset + vertexIndex, inst);
}
}
+5 -9
View File
@@ -9,18 +9,11 @@ struct MeshletDescription
uint32_t primitiveOffset;
};
struct MeshletData
{
StructuredBuffer<MeshletDescription> meshletInfos;
StructuredBuffer<uint8_t> primitiveIndices;
StructuredBuffer<uint32_t> vertexIndices;
};
struct MeshData
{
uint numMeshlets;
uint meshletOffset;
uint indicesOffset;
};
static const uint MAX_VERTICES = 64;
@@ -38,7 +31,10 @@ struct Scene
{
StructuredBuffer<InstanceData> instances;
StructuredBuffer<MeshData> meshData;
StructuredBuffer<MeshletData> meshlets;
StructuredBuffer<MeshletDescription> meshletInfos;
StructuredBuffer<uint8_t> primitiveIndices;
StructuredBuffer<uint32_t> vertexIndices;
};
layout(set = INDEX_SCENE_DATA)