From b3dfe383c6d31ff3dbd76dcfb32de8d536382f3e Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Mon, 4 Oct 2021 09:46:33 -0700 Subject: Get native handles for TextureResource and BufferResource (#1960) * Added getNativeHandle() to TextureResource and BufferResource; Implemented getNativeHandle() in Vulkan and D3D12; Added new unit test files for the aforementioned implementation * Added missing getNativeHandle() implementations to renderer-shared.cpp and CUDA * Finished new getNativeHandle() unit tests for ITextureResource and IBufferResource; Modified ICommandQueue and ICommandBuffer unit tests to call QueryInterface to convert to IUnknown then back and compare resulting pointers for equality * Unit tests updated and pass locally * Cast m_buffer.m_buffer and m_image to uint64_t --- tools/gfx/renderer-shared.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools/gfx/renderer-shared.cpp') diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index 18f99ad1b..c5a0c826d 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -74,6 +74,11 @@ IResource* BufferResource::getInterface(const Slang::Guid& guid) SLANG_NO_THROW IResource::Type SLANG_MCALL BufferResource::getType() { return m_type; } SLANG_NO_THROW IBufferResource::Desc* SLANG_MCALL BufferResource::getDesc() { return &m_desc; } +Result BufferResource::getNativeHandle(NativeHandle* outHandle) +{ + *outHandle = NULL; + return SLANG_OK; +} IResource* TextureResource::getInterface(const Slang::Guid& guid) { @@ -86,6 +91,12 @@ IResource* TextureResource::getInterface(const Slang::Guid& guid) SLANG_NO_THROW IResource::Type SLANG_MCALL TextureResource::getType() { return m_type; } SLANG_NO_THROW ITextureResource::Desc* SLANG_MCALL TextureResource::getDesc() { return &m_desc; } +Result TextureResource::getNativeHandle(NativeHandle* outHandle) +{ + *outHandle = NULL; + return SLANG_OK; +} + StageType mapStage(SlangStage stage) { switch( stage ) -- cgit v1.2.3