Skip to content

Commit 59f30aa

Browse files
committed
Fix a latent issue of mesh query on Navi2x
For such mesh shader: layout(local_size_x=1, local_size_y=1, local_size_z=128) in; layout(triangles, max_vertices=0, max_primitives=0) out; void main() { } It is valid when SetMeshOutputs is missing. We will do dummy export with vertexCount=0 and primitiveCount=0. But the dummy export doesn't write the data to mesh pipeline statistics buffer. The mesh query will fail. On Navi2x, mesh statistics still rely on SW compiler emulation and we must do it by calling collectMeshStatsInfo.
1 parent 4320b9c commit 59f30aa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lgc/patch/MeshTaskShader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,11 @@ void MeshTaskShader::processMeshShader(Function *entryPoint) {
765765
m_builder.SetInsertPoint(dummyAllocReqBlock);
766766

767767
m_builder.CreateIntrinsic(Intrinsic::amdgcn_s_sendmsg, {}, {m_builder.getInt32(GsAllocReq), m_builder.getInt32(0)});
768+
769+
// We still collect mesh shader statistics in this special case. This is a valid mesh shader usage when the
770+
// primitive/vertex count is not specified by SetMeshOutputs (both are treated as zeros).
771+
collectMeshStatsInfo(entryPoint, m_builder.getInt32(0));
772+
768773
m_builder.CreateBr(endDummyAllocReqBlock);
769774
}
770775

0 commit comments

Comments
 (0)