diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 65516a45..c0b49bbf 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -1213,6 +1213,9 @@ namespace dxvk { BindVertexBuffer(StartSlot + i, newBuffer, pOffsets[i], pStrides[i]); } } + + m_state.ia.maxVbCount = std::clamp(StartSlot + NumBuffers, + m_state.ia.maxVbCount, uint32_t(m_state.ia.vertexBuffers.size())); } @@ -3795,7 +3798,7 @@ namespace dxvk { result.stages[uint32_t(DxbcProgramType::PixelShader)].uavCount = D3D11_1_UAV_SLOT_COUNT; result.stages[uint32_t(DxbcProgramType::ComputeShader)].uavCount = D3D11_1_UAV_SLOT_COUNT; - result.vbCount = D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; + result.vbCount = m_state.ia.maxVbCount; result.soCount = D3D11_SO_BUFFER_SLOT_COUNT; return result; } @@ -4070,7 +4073,7 @@ namespace dxvk { m_state.ia.indexBuffer.offset, m_state.ia.indexBuffer.format); - for (uint32_t i = 0; i < m_state.ia.vertexBuffers.size(); i++) { + for (uint32_t i = 0; i < m_state.ia.maxVbCount; i++) { BindVertexBuffer(i, m_state.ia.vertexBuffers[i].buffer.ptr(), m_state.ia.vertexBuffers[i].offset, diff --git a/src/d3d11/d3d11_context_state.h b/src/d3d11/d3d11_context_state.h index 493f95c2..6c11ff15 100644 --- a/src/d3d11/d3d11_context_state.h +++ b/src/d3d11/d3d11_context_state.h @@ -160,12 +160,14 @@ namespace dxvk { std::array vertexBuffers = { }; D3D11IndexBufferBinding indexBuffer = { }; + uint32_t maxVbCount = 0; + void reset() { inputLayout = nullptr; primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; - for (uint32_t i = 0; i < vertexBuffers.size(); i++) + for (uint32_t i = 0; i < maxVbCount; i++) vertexBuffers[i] = D3D11VertexBufferBinding(); indexBuffer = D3D11IndexBufferBinding();