From e8f6cc0e5f96af00a4f8c384d0b086f5a4f703d4 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 1 Jun 2018 08:33:49 -0700 Subject: Implemented indirect rendering in Vk --- .../src/DeviceContextD3D12Impl.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 7db39b9e..275ab744 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -355,22 +355,18 @@ namespace Diligent if( DrawAttribs.IsIndirect ) { - if( auto *pBufferD3D12 = ValidatedCast(DrawAttribs.pIndirectDrawAttribs) ) - { + VERIFY(DrawAttribs.pIndirectDrawAttribs != nullptr, "Valid pIndirectDrawAttribs must be provided for indirect draw command"); + auto *pBufferD3D12 = ValidatedCast(DrawAttribs.pIndirectDrawAttribs); + #ifdef _DEBUG - if(pBufferD3D12->GetDesc().Usage == USAGE_DYNAMIC) - pBufferD3D12->DbgVerifyDynamicAllocation(m_ContextId); + if(pBufferD3D12->GetDesc().Usage == USAGE_DYNAMIC) + pBufferD3D12->DbgVerifyDynamicAllocation(m_ContextId); #endif - GraphCtx.TransitionResource(pBufferD3D12, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT); - size_t BuffDataStartByteOffset; - ID3D12Resource *pd3d12ArgsBuff = pBufferD3D12->GetD3D12Buffer(BuffDataStartByteOffset, m_ContextId); - GraphCtx.ExecuteIndirect(DrawAttribs.IsIndexed ? m_pDrawIndexedIndirectSignature : m_pDrawIndirectSignature, pd3d12ArgsBuff, DrawAttribs.IndirectDrawArgsOffset + BuffDataStartByteOffset); - } - else - { - LOG_ERROR_MESSAGE("Valid pIndirectDrawAttribs must be provided for indirect draw command"); - } + GraphCtx.TransitionResource(pBufferD3D12, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT); + size_t BuffDataStartByteOffset; + ID3D12Resource *pd3d12ArgsBuff = pBufferD3D12->GetD3D12Buffer(BuffDataStartByteOffset, m_ContextId); + GraphCtx.ExecuteIndirect(DrawAttribs.IsIndexed ? m_pDrawIndexedIndirectSignature : m_pDrawIndirectSignature, pd3d12ArgsBuff, DrawAttribs.IndirectDrawArgsOffset + BuffDataStartByteOffset); } else { -- cgit v1.2.3