summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/VertexManager.cpp
diff options
context:
space:
mode:
authorYuriy O'Donnell <yuriyo@gmail.com>2014-10-25 19:10:41 +0200
committerYuriy O'Donnell <yuriyo@gmail.com>2014-10-26 23:38:14 +0100
commitc35847b795f473fd2f296fd1e2c56160d7e06eae (patch)
treea10e114df0fdd47a84c5fd1c5e8e25c2879619dd /Source/Core/VideoBackends/D3D/VertexManager.cpp
parent48ba55203bf92d35c073d86798d1ec961765e0b6 (diff)
D3D: Using start index and base vertex instead of buffer offsets
Diffstat (limited to 'Source/Core/VideoBackends/D3D/VertexManager.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/VertexManager.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/Core/VideoBackends/D3D/VertexManager.cpp b/Source/Core/VideoBackends/D3D/VertexManager.cpp
index 932354d2d6..ff226eeb37 100644
--- a/Source/Core/VideoBackends/D3D/VertexManager.cpp
+++ b/Source/Core/VideoBackends/D3D/VertexManager.cpp
@@ -127,13 +127,17 @@ void VertexManager::Draw(u32 stride)
u32 components = VertexLoaderManager::GetCurrentVertexFormat()->m_components;
u32 indices = IndexGenerator::GetIndexLen();
- D3D::context->IASetVertexBuffers(0, 1, &m_buffers[m_currentBuffer], &stride, &m_vertexDrawOffset);
- D3D::context->IASetIndexBuffer(m_buffers[m_currentBuffer], DXGI_FORMAT_R16_UINT, m_indexDrawOffset);
+ u32 zero = 0;
+ D3D::context->IASetVertexBuffers(0, 1, &m_buffers[m_currentBuffer], &stride, &zero);
+ D3D::context->IASetIndexBuffer(m_buffers[m_currentBuffer], DXGI_FORMAT_R16_UINT, 0);
+
+ u32 baseVertex = m_vertexDrawOffset / stride;
+ u32 startIndex = m_indexDrawOffset / sizeof(u16);
if (current_primitive_type == PRIMITIVE_TRIANGLES)
{
D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
- D3D::context->DrawIndexed(indices, 0, 0);
+ D3D::context->DrawIndexed(indices, startIndex, baseVertex);
INCSTAT(stats.thisFrame.numDrawCalls);
}
else if (current_primitive_type == PRIMITIVE_LINES)
@@ -153,7 +157,7 @@ void VertexManager::Draw(u32 stride)
{
((DX11::Renderer*)g_renderer)->ApplyCullDisable(); // Disable culling for lines and points
D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
- D3D::context->DrawIndexed(indices, 0, 0);
+ D3D::context->DrawIndexed(indices, startIndex, baseVertex);
INCSTAT(stats.thisFrame.numDrawCalls);
D3D::context->GSSetShader(nullptr, nullptr, 0);
@@ -177,7 +181,7 @@ void VertexManager::Draw(u32 stride)
{
((DX11::Renderer*)g_renderer)->ApplyCullDisable(); // Disable culling for lines and points
D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
- D3D::context->DrawIndexed(indices, 0, 0);
+ D3D::context->DrawIndexed(indices, startIndex, baseVertex);
INCSTAT(stats.thisFrame.numDrawCalls);
D3D::context->GSSetShader(nullptr, nullptr, 0);