I've got an unusaul problem - when I am trying to create Compute PSO, function fails with E_INVALIDARGS. It is probably due to no CachedPso available, though I saw on MSDN that Graphics PSO is created without cached data.
So here is the code itself. Both Serializing Root Signature and RS creation report S_OK, but CreateComputePS fails. Shader is compiled by Visual Studio (shader version 5.1), then it is ReadFileToBlob'ed.
COMPTR<ID3DBlob> pSRSignatre = nullptr;
COMPTR<ID3DBlob> pError = nullptr;
D3D12_ROOT_SIGNATURE_DESC RSDesc;
ZeroMemory(&RSDesc, sizeof(D3D12_ROOT_SIGNATURE_DESC));
RSDesc.NumParameters = 1;
RSDesc.NumStaticSamplers = 0;
RSDesc.pParameters = &rootParam;
RSDesc.pStaticSamplers = nullptr;
RSDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
result = D3D12SerializeRootSignature(
&RSDesc,
D3D_ROOT_SIGNATURE_VERSION_1,
pSRSignatre.GetAddressOf(),
pError.GetAddressOf()
);
#ifdef DEBUG
Report(result, L"Serializaing root signature");
#endif
COMPTR<ID3D12RootSignature> pRootSign = nullptr;
result = sm_pDevice->CreateRootSignature(
0,
pSRSignatre->GetBufferPointer(),
pSRSignatre->GetBufferSize(),
IID_PPV_ARGS(pRootSign.GetAddressOf())
);
#ifdef DEBUG
Report(result, L"Root signature");
#endif
COMPTR<ID3D12PipelineState> pState = nullptr;
D3D12_COMPUTE_PIPELINE_STATE_DESC CPSDesc;
ZeroMemory(&CPSDesc, sizeof(D3D12_COMPUTE_PIPELINE_STATE_DESC));
CPSDesc.CS = m_Shader;
CPSDesc.NodeMask = 0;
CPSDesc.pRootSignature = pRootSign.Get();
CPSDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
result = sm_pDevice->CreateComputePipelineState(&CPSDesc, IID_PPV_ARGS(pState.GetAddressOf()));
#ifdef DEBUG
Report(result, L"Compute PSO");
#endif
UPD: There is an error in the output log (no exception actually thrown, just a text message, hard to notice) which appears right after call to CreateCompPS: Exception thrown at 0x774CD928 in DirectComputeInteropLib.exe: Microsoft C++ exception: _com_error at memory location 0x001DEFF4.