1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00

[d3d9] Fix capturing lights in state block

This commit is contained in:
Robin Kertels 2023-02-18 15:42:42 +01:00 committed by Joshie
parent 081181313e
commit 0d28be4ab8
2 changed files with 5 additions and 5 deletions

View File

@ -227,7 +227,7 @@ namespace dxvk {
std::vector<std::optional<D3DLIGHT9>> lights;
std::array<DWORD, caps::MaxEnabledLights> enabledLightIndices;
bool IsLightEnabled(DWORD Index) {
bool IsLightEnabled(DWORD Index) const {
const auto& indices = enabledLightIndices;
return std::find(indices.begin(), indices.end(), Index) != indices.end();
}

View File

@ -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));
}
}
}