Fixing some shader stuff

This commit is contained in:
Dynamitos
2024-04-17 14:33:06 +02:00
parent d67c8ebffe
commit a72e92ee37
17 changed files with 292 additions and 225 deletions
+9 -3
View File
@@ -65,6 +65,12 @@ struct PrimitiveAttributes
uint cull: SV_CullPrimitive;
};
uint unpackPrimitiveIndices(uint index)
{
uint32_t packed = pScene.primitiveIndices[index / 4];
return (packed >> (index % 4)) & 0xff;
}
[numthreads(MESH_GROUP_SIZE, 1, 1)]
[outputtopology("triangle")]
[shader("mesh")]
@@ -84,9 +90,9 @@ void meshMain(
{
uint p = min(i, m.primitiveCount - 1);
{
uint local_idx0 = pScene.primitiveIndices[m.primitiveOffset + (p * 3) + 0];
uint local_idx1 = pScene.primitiveIndices[m.primitiveOffset + (p * 3) + 1];
uint local_idx2 = pScene.primitiveIndices[m.primitiveOffset + (p * 3) + 2];
uint local_idx0 = unpackPrimitiveIndices(m.primitiveOffset + (p * 3) + 0);
uint local_idx1 = unpackPrimitiveIndices(m.primitiveOffset + (p * 3) + 1);
uint local_idx2 = unpackPrimitiveIndices(m.primitiveOffset + (p * 3) + 2);
indices[p] = uint3(local_idx0, local_idx1, local_idx2);
}
}