From 65c2e7f1ccc6cdb5daec343c7e32b4a9dc463ae4 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 12 Apr 2022 15:23:53 -0700 Subject: Support `[DllImport]` (#2181) * Support `[DllImport]` * Fix. * Fix. * Fix array type emit in cpp. * Fix. * Fix. * Fix Co-authored-by: Yong He --- tools/gfx/d3d12/render-d3d12.cpp | 11 +++++++++-- tools/gfx/d3d12/render-d3d12.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp index 657769284..b98229d7b 100644 --- a/tools/gfx/d3d12/render-d3d12.cpp +++ b/tools/gfx/d3d12/render-d3d12.cpp @@ -2784,11 +2784,18 @@ Result AccelerationStructureImpl::getNativeHandle(InteropHandle* outHandle) #endif // SLANG_GFX_HAS_DXR_SUPPORT -Result TransientResourceHeapImpl::synchronizeAndReset() +Result TransientResourceHeapImpl::synchronize() { WaitForMultipleObjects( (DWORD)m_waitHandles.getCount(), m_waitHandles.getArrayView().getBuffer(), TRUE, INFINITE); m_waitHandles.clear(); + return SLANG_OK; +} + +Result TransientResourceHeapImpl::synchronizeAndReset() +{ + synchronize(); + m_currentViewHeapIndex = -1; m_currentSamplerHeapIndex = -1; allocateNewViewDescriptorHeap(m_device); @@ -2875,7 +2882,7 @@ Result TransientResourceHeapImpl::allocateTransientDescriptorTable( TransientResourceHeapImpl::~TransientResourceHeapImpl() { - synchronizeAndReset(); + synchronize(); for (auto& waitInfo : m_waitInfos) CloseHandle(waitInfo.fenceEvent); } diff --git a/tools/gfx/d3d12/render-d3d12.h b/tools/gfx/d3d12/render-d3d12.h index 89498d033..c8929984b 100644 --- a/tools/gfx/d3d12/render-d3d12.h +++ b/tools/gfx/d3d12/render-d3d12.h @@ -546,6 +546,8 @@ public: virtual SLANG_NO_THROW Result SLANG_MCALL createCommandBuffer(ICommandBuffer** outCommandBuffer) override; + Result synchronize(); + virtual SLANG_NO_THROW Result SLANG_MCALL synchronizeAndReset() override; virtual SLANG_NO_THROW Result SLANG_MCALL finish() override; -- cgit v1.2.3