From 60e2802464102539b3e0302aa899e22b43b97c0b Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 28 May 2018 21:16:33 -0700 Subject: Moved vertex buffer stride definition from IDeviceContext::SetVertexBuffers() to vertex layout description --- Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h | 2 +- Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h index d35edc82..fb876a49 100644 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.h @@ -56,7 +56,7 @@ public: virtual void SetBlendFactors(const float* pBlendFactors = nullptr)override final; - virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pStrides, Uint32 *pOffsets, Uint32 Flags )override final; + virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags )override final; virtual void InvalidateState()override final; diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index f9b59ede..77b70ea2 100644 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -616,14 +616,14 @@ namespace Diligent bool BindVBs = m_NumVertexStreams != m_NumCommittedD3D11VBs; - const auto *TightStrides = pPipelineStateD3D11->GetTightStrides(); + const auto *Strides = pPipelineStateD3D11->GetBufferStrides(); for( UINT Slot = 0; Slot < m_NumVertexStreams; ++Slot ) { auto &CurrStream = m_VertexStreams[Slot]; VERIFY( CurrStream.pBuffer, "Attempting to bind a null buffer for rendering" ); auto *pBuffD3D11Impl = CurrStream.pBuffer.RawPtr(); ID3D11Buffer *pd3d11Buffer = pBuffD3D11Impl->m_pd3d11Buffer; - auto Stride = CurrStream.Stride ? CurrStream.Stride : TightStrides[Slot]; + auto Stride = Strides[Slot]; auto Offset = CurrStream.Offset; if(pBuffD3D11Impl->CheckState( D3D11BufferState::UnorderedAccess )) @@ -688,6 +688,7 @@ namespace Diligent auto *pd3d11InputLayout = pPipelineStateD3D11->GetD3D11InputLayout(); if( pd3d11InputLayout != nullptr && !m_bCommittedD3D11VBsUpToDate ) { + VERIFY( m_NumVertexStreams >= pPipelineStateD3D11->GetNumBufferSlotsUsed(), "Currently bound pipeline state \"", pPipelineStateD3D11->GetDesc().Name, "\" expects ", pPipelineStateD3D11->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); CommitD3D11VertexBuffers(pPipelineStateD3D11); } @@ -851,9 +852,9 @@ namespace Diligent m_pd3d11DeviceContext->Flush(); } - void DeviceContextD3D11Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pStrides, Uint32 *pOffsets, Uint32 Flags ) + void DeviceContextD3D11Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags ) { - TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pStrides, pOffsets, Flags ); + TDeviceContextBase::SetVertexBuffers( StartSlot, NumBuffersSet, ppBuffers, pOffsets, Flags ); m_bCommittedD3D11VBsUpToDate = false; } -- cgit v1.2.3