From f2a3c933bc11a498c622fa18694c84beca8ca031 Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:19:49 -0700 Subject: Add method to retrieve native handles (#1944) * Added a getNativeHandle() method that retrieves the natively created handles; Modified RendererBase, VKDevice, D3D12Device, and DebugDevice to implement this new method * Moved ExistingDeviceHandles out of Desc directly inside IDevice and renamed to NativeHandles; Modified calls accessing the struct accordingly in RendererBase, DebugDevice, VKDevice, and D3D12Device * Minor cleanup changes (renames, etc.) --- tools/gfx/d3d12/render-d3d12.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/gfx/d3d12/render-d3d12.cpp') diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp index 22f846ded..b9419c0f1 100644 --- a/tools/gfx/d3d12/render-d3d12.cpp +++ b/tools/gfx/d3d12/render-d3d12.cpp @@ -146,6 +146,8 @@ public: return m_info; } + virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override; + ~D3D12Device(); #if SLANG_GFX_HAS_DXR_SUPPORT @@ -4115,6 +4117,12 @@ Result D3D12Device::captureTextureToSurface( // !!!!!!!!!!!!!!!!!!!!!!!!!!!! Renderer interface !!!!!!!!!!!!!!!!!!!!!!!!!! +Result D3D12Device::getNativeHandle(NativeHandle* outHandle) +{ + *outHandle = NativeHandle::fromD3D12Handle(m_device); + return SLANG_OK; +} + Result D3D12Device::_createDevice(DeviceCheckFlags deviceCheckFlags, const UnownedStringSlice& nameMatch, D3D_FEATURE_LEVEL featureLevel, DeviceInfo& outDeviceInfo) { outDeviceInfo.clear(); -- cgit v1.2.3