diff --git a/src/d3d9/d3d9_stateblock.cpp b/src/d3d9/d3d9_stateblock.cpp index db292eab..9cbf92f9 100644 --- a/src/d3d9/d3d9_stateblock.cpp +++ b/src/d3d9/d3d9_stateblock.cpp @@ -38,6 +38,9 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D9StateBlock::Capture() { + if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl)) + SetVertexDeclaration(m_deviceState->vertexDecl.ptr()); + ApplyOrCapture(); return D3D_OK; @@ -46,6 +49,10 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D9StateBlock::Apply() { m_applying = true; + + if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl) && m_state.vertexDecl != nullptr) + m_parent->SetVertexDeclaration(m_state.vertexDecl.ptr()); + ApplyOrCapture(); m_applying = false; diff --git a/src/d3d9/d3d9_stateblock.h b/src/d3d9/d3d9_stateblock.h index 5f84b247..8455be10 100644 --- a/src/d3d9/d3d9_stateblock.h +++ b/src/d3d9/d3d9_stateblock.h @@ -174,9 +174,6 @@ namespace dxvk { template void ApplyOrCapture(Dst* dst, const Src* src) { - if (m_captures.flags.test(D3D9CapturedStateFlag::VertexDecl)) - dst->SetVertexDeclaration(src->vertexDecl.ptr()); - if (m_captures.flags.test(D3D9CapturedStateFlag::StreamFreq)) { for (uint32_t stream = m_captures.streamFreq.dword(0); stream; stream &= stream - 1) { uint32_t idx = bit::tzcnt(stream);