c++directx-12

CreateGraphicsPipelineState fails with E_INVALIDARG


Creation of Pipeline State Object in Directx 12 fails with E_INVALIDARG and debug layer outputs a bunch of nonsense saying data in D3D12_GRAPHICS_PIPELINE_STATE_DESC instance is invalid:

D3D12 ERROR: ID3D12Device::CreateBlendState: DestBlendAlpha[ 0 ] is trying to use a D3D11_BLEND value (0x4) that manipulates color, which is invalid. [ STATE_CREATION ERROR #115: CREATEBLENDSTATE_INVALIDDESTBLENDALPHA] D3D12 ERROR: ID3D12Device::CreateDepthStencilState: BackFace.StencilFailOp has an unrecognized value. [ STATE_CREATION ERROR #106: CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP] D3D12 ERROR: ID3D12Device::CreateDepthStencilState: BackFace.StencilDepthFailOp has an unrecognized value. [ STATE_CREATION ERROR #107: CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP] D3D12 ERROR: ID3D12Device::CreateDepthStencilState: BackFace.StencilPassOp has an unrecognized value. [ STATE_CREATION ERROR #108: CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP] D3D12 ERROR: ID3D12Device::CreateDepthStencilState: BackFace.StencilFunc has an unrecognized value. [ STATE_CREATION ERROR #109: CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC] D3D12 ERROR: ID3D12Device::CreateRasterizerState: FillMode has an unrecognized value. [ STATE_CREATION ERROR #95: CREATERASTERIZERSTATE_INVALIDFILLMODE] D3D12 ERROR: ID3D12Device::CreateRasterizerState: FillMode must be D3D12_FILL_MODE_SOLID when ConservativeRaster is D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON: FillMode = D3D12_FILL_MODE_WIREFRAME, ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_ON. [ STATE_CREATION ERROR #95: CREATERASTERIZERSTATE_INVALIDFILLMODE] D3D12 ERROR: ID3D12Device::Create*: The specified node mask (0xcccccccc) contains a bit set beyond the node count of the device. [ STATE_CREATION ERROR #900: INVALID_NODE_INDEX]

list goes on...

Looks like the memory is corrupted when it's not, I've checked all the values over and over, they're fine. At least some of the values must be correct, look at the last message for example, it says

The specified node mask (0xcccccccc)

… I'm sure it's not 0xcccccccc before CreateGraphicsPipelineState call, debugger confirms.


Solution

  • Turned out that exe built on my machine would fail to create PSO on other computers, but if the project was to be built on other machine and run on mine, there would be no PSO problems.

    Reinstalling Windows SDK helped eliminate the issue.