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