From 0d28be4ab8162b6ee2a37d959f5c791e1e69b166 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Sat, 18 Feb 2023 15:42:42 +0100 Subject: [PATCH] [d3d9] Fix capturing lights in state block --- src/d3d9/d3d9_state.h | 2 +- src/d3d9/d3d9_stateblock.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/d3d9/d3d9_state.h b/src/d3d9/d3d9_state.h index a3dd0a57..da19de1f 100644 --- a/src/d3d9/d3d9_state.h +++ b/src/d3d9/d3d9_state.h @@ -227,7 +227,7 @@ namespace dxvk { std::vector> lights; std::array enabledLightIndices; - bool IsLightEnabled(DWORD Index) { + bool IsLightEnabled(DWORD Index) const { const auto& indices = enabledLightIndices; return std::find(indices.begin(), indices.end(), Index) != indices.end(); } diff --git a/src/d3d9/d3d9_stateblock.h b/src/d3d9/d3d9_stateblock.h index a098b54f..05e7daf3 100644 --- a/src/d3d9/d3d9_stateblock.h +++ b/src/d3d9/d3d9_stateblock.h @@ -306,17 +306,17 @@ namespace dxvk { } if (m_captures.flags.test(D3D9CapturedStateFlag::Lights)) { - for (uint32_t i = 0; i < m_state.lights.size(); i++) { - if (!m_state.lights[i].has_value()) + for (uint32_t i = 0; i < src->lights.size(); i++) { + if (!src->lights[i].has_value()) continue; - dst->SetLight(i, &m_state.lights[i].value()); + dst->SetLight(i, &src->lights[i].value()); } for (uint32_t i = 0; i < m_captures.lightEnabledChanges.dwordCount(); i++) { for (uint32_t consts : bit::BitMask(m_captures.lightEnabledChanges.dword(i))) { uint32_t idx = i * 32 + consts; - dst->LightEnable(idx, m_state.IsLightEnabled(idx)); + dst->LightEnable(idx, src->IsLightEnabled(idx)); } } }