diff --git a/src/d3d8/d3d8_state_block.cpp b/src/d3d8/d3d8_state_block.cpp index 7bd5a5d98de..d0cf55d7eef 100644 --- a/src/d3d8/d3d8_state_block.cpp +++ b/src/d3d8/d3d8_state_block.cpp @@ -8,8 +8,8 @@ HRESULT dxvk::D3D8StateBlock::Capture() { if (m_capture.vs) m_device->GetVertexShader(&m_vertexShader); if (m_capture.ps) m_device->GetPixelShader(&m_pixelShader); - if (m_capture.textures) - for (DWORD stage = 0; stage < m_textures.size(); stage++) + for (DWORD stage = 0; stage < m_textures.size(); stage++) + if (m_capture.textures.get(stage)) m_device->GetTexture(stage, &m_textures[stage]); if (m_capture.indices) m_device->GetIndices(&m_indices, &m_baseVertexIndex); @@ -27,14 +27,9 @@ HRESULT dxvk::D3D8StateBlock::Apply() { if (m_capture.vs) m_device->SetVertexShader(m_vertexShader); if (m_capture.ps) m_device->SetPixelShader(m_pixelShader); - if (m_capture.textures) { - for (DWORD stage = 0; stage < m_textures.size(); stage++) { - IDirect3DBaseTexture8* pTexture = m_textures[stage]; - if (pTexture != nullptr) { - m_device->SetTexture(stage, pTexture); - } - } - } + for (DWORD stage = 0; stage < m_textures.size(); stage++) + if (m_capture.textures.get(stage)) + m_device->SetTexture(stage, m_textures[stage] ); if (m_capture.indices) m_device->SetIndices(m_indices, m_baseVertexIndex); diff --git a/src/d3d8/d3d8_state_block.h b/src/d3d8/d3d8_state_block.h index 4917051efd6..89efd4fc219 100644 --- a/src/d3d8/d3d8_state_block.h +++ b/src/d3d8/d3d8_state_block.h @@ -13,7 +13,8 @@ namespace dxvk { bool vs : 1; bool ps : 1; bool indices : 1; - bool textures : 1; + + bit::bitset textures; D3D8StateCapture() { // Ensure all bits are initialized to false @@ -70,7 +71,7 @@ namespace dxvk { inline HRESULT SetTexture(DWORD Stage, IDirect3DBaseTexture8* pTexture) { m_textures[Stage] = pTexture; - m_capture.textures = true; + m_capture.textures.set(Stage, true); return D3D_OK; }