Mesh Shading works as well
This commit is contained in:
@@ -18,9 +18,9 @@ void meshMain(
|
||||
out vertices FragmentParameter vertices[MAX_VERTICES],
|
||||
out indices uint3 indices[MAX_PRIMITIVES]
|
||||
){
|
||||
InstanceData inst = pScene.instanceData[meshPayload.instanceId];
|
||||
MeshData data = pScene.meshData[meshPayload.instanceId];
|
||||
MeshletDescription m = pScene.meshletInfos[data.meshletOffset + groupID];
|
||||
InstanceData inst = pScene.instances[meshPayload.instanceId];
|
||||
//MeshData data = pScene.meshData[meshPayload.instanceId];
|
||||
MeshletDescription m = pScene.meshletInfos[meshPayload.culledMeshlets[groupID]];
|
||||
SetMeshOutputCounts(m.vertexCount, m.primitiveCount);
|
||||
|
||||
for(uint i = threadID; i < MAX_PRIMITIVES; i += MESH_GROUP_SIZE)
|
||||
|
||||
@@ -28,24 +28,22 @@ void taskMain(
|
||||
viewFrustum.sides[1] = computePlane(origin, corners[1], corners[3]);
|
||||
viewFrustum.sides[2] = computePlane(origin, corners[0], corners[1]);
|
||||
viewFrustum.sides[3] = computePlane(origin, corners[3], corners[2]);
|
||||
//p.instanceId = pOffsets.instanceOffset + groupID;
|
||||
p.instanceData = instance;
|
||||
p.meshData = mesh;
|
||||
p.instanceId = pOffsets.instanceOffset + groupID;
|
||||
//p.cullingOffset = pScene.cullingOffsets[pOffsets.cullingCounterOffset + groupID];
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
//for(uint i = threadID; i < mesh.numMeshlets; i += TASK_GROUP_SIZE)
|
||||
//{
|
||||
// uint m = mesh.meshletOffset + i;
|
||||
// MeshletDescription meshlet = pScene.meshletInfos[m];
|
||||
// //if(meshlet.bounding.insideFrustum(viewFrustum))
|
||||
// {
|
||||
// uint index;
|
||||
// InterlockedAdd(head, 1, index);
|
||||
// p.culledMeshlets[index] = m;
|
||||
// //pScene.culledMeshlets[p.cullingOffset + index] = m;
|
||||
// }
|
||||
//}
|
||||
//GroupMemoryBarrierWithGroupSync();
|
||||
for(uint i = threadID; i < mesh.numMeshlets; i += TASK_GROUP_SIZE)
|
||||
{
|
||||
uint m = mesh.meshletOffset + i;
|
||||
MeshletDescription meshlet = pScene.meshletInfos[m];
|
||||
if(meshlet.bounding.insideFrustum(viewFrustum))
|
||||
{
|
||||
uint index;
|
||||
InterlockedAdd(head, 1, index);
|
||||
p.culledMeshlets[index] = m;
|
||||
//pScene.culledMeshlets[p.cullingOffset + index] = m;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
DispatchMesh(mesh.numMeshlets, 1, 1, p);
|
||||
}
|
||||
@@ -496,7 +496,7 @@ void Graphics::pickPhysicalDevice()
|
||||
{
|
||||
if (std::strcmp(VK_EXT_MESH_SHADER_EXTENSION_NAME, extensionProps[i].extensionName) == 0)
|
||||
{
|
||||
//meshShadingEnabled = true;
|
||||
meshShadingEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user