microsoft / D3D11On12

The Direct3D11-On-12 mapping layer
MIT License
269 stars 33 forks source link

translation layer failed to create PSO for VS + SO graphics pipeline #46

Open wuyouZen opened 7 months ago

wuyouZen commented 7 months ago

When runing wgf11draw Draw:1 with -11On12 option, the translation layer failed to create PSO because of invalid D3D12_GRAPHICS_PIPELINE_STATE_DESC argument. This application only use Vertex Shader and StreamOut. It doesn't have Pixel Shader, render target and depth stencil buffer. And its Vertex Shader doesn't output a SV_POSITION value. So in the D3D12_GRAPHICS_PIPELINE_STATE_DESC argument, the D3D12_STREAM_OUTPUT_DESC::RasterizedStream should be set to D3D12_SO_NO_RASTERIZED_STREAM, and the D3D12_DEPTH_STENCIL_DESC::DepthEnable, D3D12_DEPTH_STENCIL_DESC::StencilEnable should be set to false. But the translation layer generates a D3D12_GRAPHICS_PIPELINE_STATE_DESC with D3D12_STREAM_OUTPUT_DESC::RasterizedStream set to 0 and D3D12_DEPTH_STENCIL_DESC::DepthEnable set to true. This result in an invalid argument error when creating PSO. In D3D11On12::StreamOutShader::ProduceDesc, we may need to check if there is any output parameter has "SV_POSITION" semantic name. If not, we should set RasterizedStream to D3D12_SO_NO_RASTERIZED_STREAM and disable depth and stencil.