summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends
diff options
context:
space:
mode:
authorPokechu22 <pokechu022@gmail.com>2025-01-20 14:53:40 -0800
committerGitHub <noreply@github.com>2025-01-20 14:53:40 -0800
commit761e65ed262d77a13805b22b21795b5e97bc33ab (patch)
treef8200ef32517279b1bd602860d608162e19971bd /Source/Core/VideoBackends
parenta9a720faa7509e229d20fa7d6cae23a32b0f1c46 (diff)
parent64514bd8d4de45305788ebbdcf576034cf77bcf8 (diff)
Merge pull request #13275 from Pokechu22/d3d12-custom-root-param-index
D3D12: Fix out of bounds root parameter index when per-pixel lighting is disabled
Diffstat (limited to 'Source/Core/VideoBackends')
-rw-r--r--Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp5
-rw-r--r--Source/Core/VideoBackends/D3D12/DX12Context.cpp6
-rw-r--r--Source/Core/VideoBackends/D3D12/DX12Context.h4
3 files changed, 7 insertions, 8 deletions
diff --git a/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp b/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
index 1b126a3909..49b63fe07f 100644
--- a/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
+++ b/Source/Core/VideoBackends/D3D12/D3D12Gfx.cpp
@@ -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))
diff --git a/Source/Core/VideoBackends/D3D12/DX12Context.cpp b/Source/Core/VideoBackends/D3D12/DX12Context.cpp
index 843efc79d4..574ce9c016 100644
--- a/Source/Core/VideoBackends/D3D12/DX12Context.cpp
+++ b/Source/Core/VideoBackends/D3D12/DX12Context.cpp
@@ -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)
{
@@ -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);
}
diff --git a/Source/Core/VideoBackends/D3D12/DX12Context.h b/Source/Core/VideoBackends/D3D12/DX12Context.h
index d492e7face..b43ece742a 100644
--- a/Source/Core/VideoBackends/D3D12/DX12Context.h
+++ b/Source/Core/VideoBackends/D3D12/DX12Context.h
@@ -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