diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index fd58b0dc7..728c599d5 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -1465,7 +1465,6 @@ namespace dxvk { UINT StartIndexLocation, INT BaseVertexLocation) { D3D10DeviceLock lock = LockContext(); - StartIndexLocation += m_state.ia.indexBuffer.firstIndex; EmitCs([=] (DxvkContext* ctx) { ctx->drawIndexed( @@ -1500,7 +1499,6 @@ namespace dxvk { INT BaseVertexLocation, UINT StartInstanceLocation) { D3D10DeviceLock lock = LockContext(); - StartIndexLocation += m_state.ia.indexBuffer.firstIndex; EmitCs([=] (DxvkContext* ctx) { ctx->drawIndexed( @@ -1675,12 +1673,6 @@ namespace dxvk { if (needsUpdate) m_state.ia.indexBuffer.buffer = newBuffer; - if (likely(m_state.ia.indexBuffer.optimized)) { - uint32_t shift = Format == DXGI_FORMAT_R16_UINT ? 1 : 2; - m_state.ia.indexBuffer.firstIndex = Offset >> shift; - Offset = 0; - } - needsUpdate |= m_state.ia.indexBuffer.offset != Offset || m_state.ia.indexBuffer.format != Format; @@ -1740,12 +1732,8 @@ namespace dxvk { if (pFormat != nullptr) *pFormat = m_state.ia.indexBuffer.format; - if (pOffset != nullptr) { - uint32_t shift = m_state.ia.indexBuffer.format == DXGI_FORMAT_R16_UINT ? 1 : 2; - *pOffset = m_state.ia.indexBuffer.optimized - ? m_state.ia.indexBuffer.firstIndex << shift - : m_state.ia.indexBuffer.offset; - } + if (pOffset != nullptr) + *pOffset = m_state.ia.indexBuffer.offset; } @@ -3401,13 +3389,7 @@ namespace dxvk { void D3D11DeviceContext::BindFramebuffer() { DxvkRenderTargets attachments; - - // Re-enable index buffer optimization here. Some games will - // use indirect draws for actual scene rendering, but then - // use direct draws for things like the user interface. - if (!m_state.ia.indexBuffer.optimized) - SetIndexBufferOptimized(true); - + // D3D11 doesn't have the concept of a framebuffer object, // so we'll just create a new one every time the render // target bindings are updated. Set up the attachments. @@ -3602,39 +3584,12 @@ namespace dxvk { } - void D3D11DeviceContext::SetIndexBufferOptimized( - BOOL Enable) { - uint32_t shift = m_state.ia.indexBuffer.format == DXGI_FORMAT_R16_UINT ? 1 : 2; - - if (Enable) { - m_state.ia.indexBuffer.firstIndex = m_state.ia.indexBuffer.offset >> shift; - m_state.ia.indexBuffer.offset = 0; - } else { - m_state.ia.indexBuffer.offset += m_state.ia.indexBuffer.firstIndex << shift; - m_state.ia.indexBuffer.firstIndex = 0; - } - - m_state.ia.indexBuffer.optimized = Enable; - - BindIndexBuffer( - m_state.ia.indexBuffer.buffer.ptr(), - m_state.ia.indexBuffer.offset, - m_state.ia.indexBuffer.format); - } - - void D3D11DeviceContext::SetDrawBuffers( ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForCount) { auto argBuffer = static_cast(pBufferForArgs); auto cntBuffer = static_cast(pBufferForCount); - // Bind index buffer with the actual offset since otherwise the - // first index members of the indirect draw structures would be - // incorrect. - if (unlikely(m_state.ia.indexBuffer.optimized)) - SetIndexBufferOptimized(false); - if (m_state.id.argBuffer != argBuffer || m_state.id.cntBuffer != cntBuffer) { m_state.id.argBuffer = argBuffer; diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 65cf1a8ec..de5b82b02 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -786,9 +786,6 @@ namespace dxvk { ID3D11Resource* pResource, UINT Subresource); - void SetIndexBufferOptimized( - BOOL Enable); - void SetDrawBuffers( ID3D11Buffer* pBufferForArgs, ID3D11Buffer* pBufferForCount); diff --git a/src/d3d11/d3d11_context_state.h b/src/d3d11/d3d11_context_state.h index 98635eb0e..eca2a3c9d 100644 --- a/src/d3d11/d3d11_context_state.h +++ b/src/d3d11/d3d11_context_state.h @@ -103,8 +103,6 @@ namespace dxvk { Com buffer = nullptr; UINT offset = 0; DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN; - UINT firstIndex = 0; - BOOL optimized = true; };