Improper DirectX mesh shader topology warning on Windows 11
Hi,
I have a problem where I'm receiving a topology error from DirectX:
D3D12 ERROR: ID3D12Device1::CreateMeshShader_TopologyMismatch: Since the mesh shader specifies output topology of line, if the PSO desc ALSO specifies a primitive topology (even though not necessary to do), it must be D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE to match the mesh shader. Since the topologies don't match, behavior is undefined. Earlier runtimes didn't validate this, so this error isn't explicitly failing PSO create. But this really should be considered an application error. [ MISCELLANEOUS ERROR #1323: CREATEMESHSHADER_TOPOLOGY_MISMATCH]
As you can see, it's complaining about a topology mismatch between my mesh shader and the topology supplied in the pipeline state description. I only get this for my mesh shader which uses line topology, but not for any that use triangles.
The issue is that I'm actually not specifying any topology in the PSO description (since it is not needed). You can see the helper struct I use below and there the only use of primitive topology is when I'm using the vertex pipeline (which I'm not when I get this error).
template
See here the stream object I'm passing into CreatePipelineState:
Looking at the DirectX call stack when I hit the error, it looks like perhaps my stream description is being duplicated into a CD3DX12_PIPELINE_STATE_STREAM5 object by DirectX. If this object is anything like the public struct of a similar name, it contains all possible sub-object descs including the topology one. I think DirectX is making an assumption here that the mesh shader topology is triangle and therefore auto-populating the topology with a mismatching type for my line mesh shader.
There's no way for me to fix this in my calling code since I'm already doing the right thing (and the thing that the error itself suggests!). I concede that I would be a bit surprised if my hypothesis is true since that would indicate that there are no DirectX tests for line mesh shaders.
Any help from the DirectX team would be appreciated here.
Thanks,
Rory