Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D12: Fix out of bounds root parameter index when per-pixel lighting is disabled #13275

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,8 @@ bool Gfx::ApplyState()

if (dirty_bits & DirtyState_PS_CUS_CBV)
{
cmdlist->SetGraphicsRootConstantBufferView(
g_ActiveConfig.bBBoxEnable ? ROOT_PARAMETER_PS_CUS_CBV : ROOT_PARAMETER_PS_CBV2,
m_state.constant_buffers[2]);
cmdlist->SetGraphicsRootConstantBufferView(ROOT_PARAMETER_PS_CUS_CBV,
m_state.constant_buffers[2]);
}

if (dirty_bits & DirtyState_VS_SRV_Descriptor && UsesDynamicVertexLoader(pipeline))
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/VideoBackends/D3D12/DX12Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ bool DXContext::CreateGXRootSignature()
SetRootParamConstant(&params[param_count], 4, 1, D3D12_SHADER_VISIBILITY_VERTEX);
param_count++;

SetRootParamCBV(&params[param_count], 2, D3D12_SHADER_VISIBILITY_PIXEL);
param_count++;

// Since these must be contiguous, pixel lighting goes to bbox if not enabled.
if (g_ActiveConfig.bBBoxEnable)
{
Expand All @@ -383,9 +386,6 @@ bool DXContext::CreateGXRootSignature()
param_count++;
}

SetRootParamCBV(&params[param_count], 2, D3D12_SHADER_VISIBILITY_PIXEL);
param_count++;

return BuildRootSignature(m_device.Get(), &m_gx_root_signature, params.data(), param_count);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoBackends/D3D12/DX12Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ enum ROOT_PARAMETER
ROOT_PARAMETER_GS_CBV,
ROOT_PARAMETER_VS_SRV,
ROOT_PARAMETER_BASE_VERTEX_CONSTANT,
ROOT_PARAMETER_PS_CUS_CBV,
ROOT_PARAMETER_PS_UAV_OR_CBV2,
ROOT_PARAMETER_PS_CBV2, // ROOT_PARAMETER_PS_UAV_OR_CBV2 if bbox is not enabled
ROOT_PARAMETER_PS_CUS_CBV, // ROOT_PARAMETER_PS_CBV2 if bbox is not enabled
ROOT_PARAMETER_PS_CBV2, // ROOT_PARAMETER_PS_UAV_OR_CBV2 if bbox is not enabled
NUM_ROOT_PARAMETERS
};
// Compute shader root parameters
Expand Down