diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-05-29 04:16:33 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-05-29 04:16:33 +0000 |
| commit | 60e2802464102539b3e0302aa899e22b43b97c0b (patch) | |
| tree | 5a7f854bdcc4ac9d2da616060d33d60816e99965 /Graphics/GraphicsEngineD3D12 | |
| parent | Fixed issue with storage buffer not being bound through UAV in Vulkan; fixed ... (diff) | |
| download | DiligentCore-60e2802464102539b3e0302aa899e22b43b97c0b.tar.gz DiligentCore-60e2802464102539b3e0302aa899e22b43b97c0b.zip | |
Moved vertex buffer stride definition from IDeviceContext::SetVertexBuffers() to vertex layout description
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index c5f757bd..b4ae5de5 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -58,7 +58,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/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 63444a17..8b10da01 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -262,7 +262,8 @@ namespace Diligent // Do not initialize array with zeroes for performance reasons D3D12_VERTEX_BUFFER_VIEW VBViews[MaxBufferSlots];// = {} VERIFY( m_NumVertexStreams <= MaxBufferSlots, "Too many buffers are being set" ); - const auto *TightStrides = pPipelineStateD3D12->GetTightStrides(); + const auto *Strides = pPipelineStateD3D12->GetBufferStrides(); + VERIFY( m_NumVertexStreams >= pPipelineStateD3D12->GetNumBufferSlotsUsed(), "Currently bound pipeline state \"", pPipelineStateD3D12->GetDesc().Name, "\" expects ", pPipelineStateD3D12->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); bool DynamicBufferPresent = false; for( UINT Buff = 0; Buff < m_NumVertexStreams; ++Buff ) { @@ -287,7 +288,7 @@ namespace Diligent //GraphicsCtx.AddReferencedObject(pd3d12Resource); VBView.BufferLocation = pBufferD3D12->GetGPUAddress(m_ContextId) + CurrStream.Offset; - VBView.StrideInBytes = CurrStream.Stride ? CurrStream.Stride : TightStrides[Buff]; + VBView.StrideInBytes = Strides[Buff]; // Note that for a dynamic buffer, what we use here is the size of the buffer itself, not the upload heap buffer! VBView.SizeInBytes = pBufferD3D12->GetDesc().uiSizeInBytes - CurrStream.Offset; } @@ -537,9 +538,9 @@ namespace Diligent Flush(true); } - void DeviceContextD3D12Impl::SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pStrides, Uint32 *pOffsets, Uint32 Flags ) + void DeviceContextD3D12Impl::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_bCommittedD3D12VBsUpToDate = false; } |
