From a901a8540114abb17427bddbdab8b5be244b0c53 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 7 Dec 2017 14:01:17 +0100 Subject: [PATCH] [dxvk] Added support for vertex index types --- src/dxvk/dxvk_context.cpp | 10 +++++++--- src/dxvk/dxvk_context.h | 4 +++- src/dxvk/dxvk_context_state.h | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 67f2eb88..c4bc95e9 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -54,9 +54,13 @@ namespace dxvk { void DxvkContext::bindIndexBuffer( - const DxvkBufferBinding& buffer) { - if (m_state.vi.indexBuffer != buffer) { + const DxvkBufferBinding& buffer, + VkIndexType indexType) { + if (m_state.vi.indexBuffer != buffer + || m_state.vi.indexType != indexType) { m_state.vi.indexBuffer = buffer; + m_state.vi.indexType = indexType; + m_flags.set(DxvkContextFlag::GpDirtyIndexBuffer); } } @@ -547,7 +551,7 @@ namespace dxvk { m_cmd->cmdBindIndexBuffer( m_state.vi.indexBuffer.bufferHandle(), m_state.vi.indexBuffer.bufferOffset(), - VK_INDEX_TYPE_UINT32); + m_state.vi.indexType); m_cmd->trackResource( m_state.vi.indexBuffer.resource()); } diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index d40c49c6..db5bcb57 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -60,9 +60,11 @@ namespace dxvk { * The index buffer will be used when * issuing \c drawIndexed commands. * \param [in] buffer New index buffer + * \param [in] indexType Index type */ void bindIndexBuffer( - const DxvkBufferBinding& buffer); + const DxvkBufferBinding& buffer, + VkIndexType indexType); /** * \brief Binds buffer as a shader resource diff --git a/src/dxvk/dxvk_context_state.h b/src/dxvk/dxvk_context_state.h index 4b91f8c3..e493c535 100644 --- a/src/dxvk/dxvk_context_state.h +++ b/src/dxvk/dxvk_context_state.h @@ -38,6 +38,8 @@ namespace dxvk { struct DxvkVertexInputState { DxvkBufferBinding indexBuffer; + VkIndexType indexType = VK_INDEX_TYPE_UINT32; + std::array vertexBuffers; std::array