From 7f0c27a5ac40c1658daa05affd585c3dd0bbf415 Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Thu, 29 Jun 2023 22:12:27 +0200 Subject: Fix handling result codes in D3D12 resource creation calls (#2949) Co-authored-by: Yong He --- tools/gfx/d3d12/d3d12-swap-chain.cpp | 2 +- tools/gfx/d3d12/d3d12-transient-heap.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/gfx/d3d12/d3d12-swap-chain.cpp b/tools/gfx/d3d12/d3d12-swap-chain.cpp index 57825a323..8d4e723ea 100644 --- a/tools/gfx/d3d12/d3d12-swap-chain.cpp +++ b/tools/gfx/d3d12/d3d12-swap-chain.cpp @@ -19,7 +19,7 @@ Result SwapchainImpl::init( m_dxgiFactory = renderer->m_deviceInfo.m_dxgiFactory; SLANG_RETURN_ON_FAIL( D3DSwapchainBase::init(swapchainDesc, window, DXGI_SWAP_EFFECT_FLIP_DISCARD)); - renderer->m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.writeRef())); + SLANG_RETURN_ON_FAIL(renderer->m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.writeRef()))); SLANG_RETURN_ON_FAIL(m_swapChain->QueryInterface(m_swapChain3.writeRef())); for (GfxIndex i = 0; i < swapchainDesc.imageCount; i++) diff --git a/tools/gfx/d3d12/d3d12-transient-heap.cpp b/tools/gfx/d3d12/d3d12-transient-heap.cpp index 9139f6d8a..60f40cc66 100644 --- a/tools/gfx/d3d12/d3d12-transient-heap.cpp +++ b/tools/gfx/d3d12/d3d12-transient-heap.cpp @@ -202,12 +202,12 @@ Result TransientResourceHeapImpl::createCommandBuffer(ICommandBuffer** outCmdBuf return SLANG_OK; } ComPtr cmdList; - m_device->m_device->CreateCommandList( + SLANG_RETURN_ON_FAIL(m_device->m_device->CreateCommandList( 0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocator, nullptr, - IID_PPV_ARGS(cmdList.writeRef())); + IID_PPV_ARGS(cmdList.writeRef()))); m_d3dCommandListPool.add(cmdList); RefPtr cmdBuffer = new CommandBufferImpl(); -- cgit v1.2.3