mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
d3d12: Make compilation more robust
This commit is contained in:
parent
f1ab5abe2e
commit
16e8d6349e
2 changed files with 11 additions and 12 deletions
|
@ -14,12 +14,12 @@ void Shader::Compile(const std::string &code, SHADER_TYPE st)
|
|||
switch (st)
|
||||
{
|
||||
case SHADER_TYPE::SHADER_TYPE_VERTEX:
|
||||
hr = D3DCompile(code.c_str(), code.size(), "test", nullptr, nullptr, "main", "vs_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
|
||||
hr = D3DCompile(code.c_str(), code.size(), "VertexProgram.hlsl", nullptr, nullptr, "main", "vs_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
|
||||
if (hr != S_OK)
|
||||
LOG_ERROR(RSX, "VS build failed:%s", errorBlob->GetBufferPointer());
|
||||
break;
|
||||
case SHADER_TYPE::SHADER_TYPE_FRAGMENT:
|
||||
hr = D3DCompile(code.c_str(), code.size(), "test", nullptr, nullptr, "main", "ps_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
|
||||
hr = D3DCompile(code.c_str(), code.size(), "FragmentProgram.hlsl", nullptr, nullptr, "main", "ps_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
|
||||
if (hr != S_OK)
|
||||
LOG_ERROR(RSX, "FS build failed:%s", errorBlob->GetBufferPointer());
|
||||
break;
|
||||
|
|
|
@ -97,16 +97,15 @@ struct D3D12Traits
|
|||
ID3D12PipelineState *result;
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC graphicPipelineStateDesc = {};
|
||||
|
||||
if (vertexProgramData.bytecode != nullptr)
|
||||
{
|
||||
graphicPipelineStateDesc.VS.BytecodeLength = vertexProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.VS.pShaderBytecode = vertexProgramData.bytecode->GetBufferPointer();
|
||||
}
|
||||
if (fragmentProgramData.bytecode != nullptr)
|
||||
{
|
||||
graphicPipelineStateDesc.PS.BytecodeLength = fragmentProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.PS.pShaderBytecode = fragmentProgramData.bytecode->GetBufferPointer();
|
||||
}
|
||||
if (vertexProgramData.bytecode == nullptr)
|
||||
return nullptr;
|
||||
graphicPipelineStateDesc.VS.BytecodeLength = vertexProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.VS.pShaderBytecode = vertexProgramData.bytecode->GetBufferPointer();
|
||||
|
||||
if (fragmentProgramData.bytecode == nullptr)
|
||||
return nullptr;
|
||||
graphicPipelineStateDesc.PS.BytecodeLength = fragmentProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.PS.pShaderBytecode = fragmentProgramData.bytecode->GetBufferPointer();
|
||||
|
||||
graphicPipelineStateDesc.pRootSignature = extraData.second;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue