Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10341 from AdmiralCurtiss/dx12-shader-crash
D3D12: Fix nullptr dereference when creating a shader with a name.
  • Loading branch information
leoetlino committed Jan 3, 2022
2 parents 04a2581 + 8af737d commit a026ef3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/Core/VideoBackends/D3D12/DX12Shader.cpp
Expand Up @@ -13,10 +13,6 @@ namespace DX12
DXShader::DXShader(ShaderStage stage, BinaryData bytecode, std::string_view name)
: D3DCommon::Shader(stage, std::move(bytecode)), m_name(UTF8ToWString(name))
{
if (!m_name.empty())
{
m_compute_pipeline->SetName(m_name.c_str());
}
}

DXShader::~DXShader() = default;
Expand Down Expand Up @@ -56,6 +52,10 @@ bool DXShader::CreateComputePipeline()
HRESULT hr = g_dx_context->GetDevice()->CreateComputePipelineState(
&desc, IID_PPV_ARGS(&m_compute_pipeline));
CHECK(SUCCEEDED(hr), "Creating compute pipeline failed");

if (m_compute_pipeline && !m_name.empty())
m_compute_pipeline->SetName(m_name.c_str());

return SUCCEEDED(hr);
}

Expand Down

0 comments on commit a026ef3

Please sign in to comment.