From d06a78d935b2743494d47ed5cd3f36e38ac9c5ac Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 3 Feb 2022 19:17:30 -0800 Subject: Add gfx interop to allow more direct D3D12 usage scenarios. (#2117) * Add gfx interop to allow more direct D3D12 usage scenarios. * Fix compile error in win32. * gfx: Implement IFence::getNativeHandle() on d3d12. * More GFX-D3D interop interface. * Fix cuda. Co-authored-by: Yong He --- tools/gfx/renderer-shared.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'tools/gfx/renderer-shared.cpp') diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index 7ba939530..d1cedaa61 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -155,6 +155,13 @@ IResourceView* ResourceViewBase::getInterface(const Guid& guid) return nullptr; } +Result ResourceViewBase::getNativeHandle(InteropHandle* outHandle) +{ + outHandle->api = InteropHandleAPI::Unknown; + outHandle->handleValue = 0; + return SLANG_E_NOT_IMPLEMENTED; +} + ISamplerState* SamplerStateBase::getInterface(const Slang::Guid& guid) { if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_ISamplerState) @@ -162,6 +169,13 @@ ISamplerState* SamplerStateBase::getInterface(const Slang::Guid& guid) return nullptr; } +Result SamplerStateBase::getNativeHandle(InteropHandle* outHandle) +{ + outHandle->api = InteropHandleAPI::Unknown; + outHandle->handleValue = 0; + return SLANG_E_NOT_IMPLEMENTED; +} + IAccelerationStructure* AccelerationStructureBase::getInterface(const Slang::Guid& guid) { if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IResourceView || @@ -264,13 +278,20 @@ IQueryPool* QueryPoolBase::getInterface(const Guid& guid) return nullptr; } -IPipelineState* gfx::PipelineStateBase::getInterface(const Guid& guid) +IPipelineState* PipelineStateBase::getInterface(const Guid& guid) { if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IPipelineState) return static_cast(this); return nullptr; } +Result PipelineStateBase::getNativeHandle(InteropHandle* outHandle) +{ + outHandle->api = InteropHandleAPI::Unknown; + outHandle->handleValue = 0; + return SLANG_E_NOT_IMPLEMENTED; +} + void PipelineStateBase::initializeBase(const PipelineStateDesc& inDesc) { desc = inDesc; -- cgit v1.2.3