Lots of shader changes, basic primitive writing

This commit is contained in:
Dynamitos
2024-05-30 21:24:21 +02:00
parent f278afad66
commit 953c90f2de
18 changed files with 599 additions and 464 deletions
+27 -21
View File
@@ -7,25 +7,31 @@ groupshared uint head;
[numthreads(TASK_GROUP_SIZE, 1, 1)]
[shader("amplification")]
void taskMain(
uint threadID: SV_GroupIndex,
uint groupID: SV_GroupID,
){
InstanceData instance = pScene.instances[pOffsets.instanceOffset + groupID];
MeshData mesh = pScene.meshData[pOffsets.instanceOffset + groupID];
//head = 0;
//GroupMemoryBarrierWithGroupSync();
//for(uint i = threadID; i < mesh.numMeshlets; i += TASK_GROUP_SIZE)
//{
// uint m = mesh.meshletOffset + i;
// MeshletDescription meshlet = pScene.meshletInfos[m];
// MeshletCullingInfo culling = pScene.culledMeshlets[instance.meshletCullingOffset];
// if(culling.anyVisible())
// {
// uint index;
// InterlockedAdd(head, 1, index);
// p.culledMeshlets[index] = m;
// }
//}
//GroupMemoryBarrierWithGroupSync();
//DispatchMesh(head, 1, 1, p);
uint threadID: SV_GroupIndex,
uint groupID: SV_GroupID, )
{
MeshData mesh = pScene.meshData[pOffsets.instanceOffset + groupID];
if (threadID == 0)
{
head = 0;
p.instanceId = pOffsets.instanceOffset + groupID;
p.meshletOffset = mesh.meshletOffset;
p.cullingOffset = pScene.cullingOffsets[p.instanceId];
}
GroupMemoryBarrierWithGroupSync();
for (uint i = threadID; i < mesh.numMeshlets; i += TASK_GROUP_SIZE)
{
uint m = p.meshletOffset + i;
uint cull = p.cullingOffset + i;
MeshletDescription meshlet = pScene.meshletInfos[m];
MeshletCullingInfo culling = pScene.culledMeshlets[cull];
if(false)
{
uint index;
InterlockedAdd(head, 1, index);
p.culledMeshlets[index] = i;
}
}
GroupMemoryBarrierWithGroupSync();
DispatchMesh(head, 1, 1, p);
}