summaryrefslogtreecommitdiff
path: root/tools/gfx/d3d12/render-d3d12.cpp
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2021-10-04 09:46:33 -0700
committerGitHub <noreply@github.com>2021-10-04 09:46:33 -0700
commitb3dfe383c6d31ff3dbd76dcfb32de8d536382f3e (patch)
tree06efb21869df7ccdca6d98ab4217b8bf75dfdd2f /tools/gfx/d3d12/render-d3d12.cpp
parent35bca4cc432613af3926da3bed217a6baa9cbd26 (diff)
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
Diffstat (limited to 'tools/gfx/d3d12/render-d3d12.cpp')
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp
index 2d8c5fa10..4002450f3 100644
--- a/tools/gfx/d3d12/render-d3d12.cpp
+++ b/tools/gfx/d3d12/render-d3d12.cpp
@@ -219,6 +219,12 @@ public:
{
return (DeviceAddress)m_resource.getResource()->GetGPUVirtualAddress();
}
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)m_resource.getResource();
+ return SLANG_OK;
+ }
};
class TextureResourceImpl: public TextureResource
@@ -234,6 +240,12 @@ public:
D3D12Resource m_resource;
D3D12_RESOURCE_STATES m_defaultState;
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)m_resource.getResource();
+ return SLANG_OK;
+ }
};
class SamplerStateImpl : public ISamplerState, public ComObject