summaryrefslogtreecommitdiff
path: root/tools/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx')
-rw-r--r--tools/gfx/cuda/render-cuda.cpp14
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp14
-rw-r--r--tools/gfx/debug-layer.cpp10
-rw-r--r--tools/gfx/debug-layer.h2
-rw-r--r--tools/gfx/immediate-renderer-base.cpp13
-rw-r--r--tools/gfx/vulkan/render-vk.cpp14
6 files changed, 67 insertions, 0 deletions
diff --git a/tools/gfx/cuda/render-cuda.cpp b/tools/gfx/cuda/render-cuda.cpp
index 9b99e5f26..ec6f1212a 100644
--- a/tools/gfx/cuda/render-cuda.cpp
+++ b/tools/gfx/cuda/render-cuda.cpp
@@ -1021,6 +1021,13 @@ public:
}
virtual SLANG_NO_THROW void SLANG_MCALL close() override {}
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = 0;
+ return SLANG_OK;
+ }
};
class CommandQueueImpl
@@ -1079,6 +1086,13 @@ public:
SLANG_CUDA_HANDLE_ERROR(resultCode);
}
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)stream;
+ return SLANG_OK;
+ }
+
public:
void setPipelineState(IPipelineState* state)
{
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp
index c867e156b..2d8c5fa10 100644
--- a/tools/gfx/d3d12/render-d3d12.cpp
+++ b/tools/gfx/d3d12/render-d3d12.cpp
@@ -3520,6 +3520,13 @@ public:
#endif
virtual SLANG_NO_THROW void SLANG_MCALL close() override { m_cmdList->Close(); }
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)m_cmdList.get();
+ return SLANG_OK;
+ }
};
class CommandQueueImpl
@@ -3609,6 +3616,13 @@ public:
m_fence->SetEventOnCompletion(m_fenceValue, globalWaitHandle);
WaitForSingleObject(globalWaitHandle, INFINITE);
}
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)m_d3dQueue.get();
+ return SLANG_OK;
+ }
};
class SwapchainImpl : public D3DSwapchainBase
diff --git a/tools/gfx/debug-layer.cpp b/tools/gfx/debug-layer.cpp
index 3e22bd510..74b319a08 100644
--- a/tools/gfx/debug-layer.cpp
+++ b/tools/gfx/debug-layer.cpp
@@ -814,6 +814,11 @@ void DebugCommandBuffer::close()
baseObject->close();
}
+Result DebugCommandBuffer::getNativeHandle(NativeHandle* outHandle)
+{
+ return baseObject->getNativeHandle(outHandle);
+}
+
void DebugCommandBuffer::checkEncodersClosedBeforeNewEncoder()
{
if (m_renderCommandEncoder.isOpen || m_resourceCommandEncoder.isOpen ||
@@ -1160,6 +1165,11 @@ void DebugCommandQueue::executeCommandBuffers(uint32_t count, ICommandBuffer* co
void DebugCommandQueue::wait() { baseObject->wait(); }
+Result DebugCommandQueue::getNativeHandle(NativeHandle* outHandle)
+{
+ return baseObject->getNativeHandle(outHandle);
+}
+
Result DebugTransientResourceHeap::synchronizeAndReset()
{
SLANG_GFX_API_FUNC;
diff --git a/tools/gfx/debug-layer.h b/tools/gfx/debug-layer.h
index 69ef5ffe2..88e0e5ecd 100644
--- a/tools/gfx/debug-layer.h
+++ b/tools/gfx/debug-layer.h
@@ -396,6 +396,7 @@ public:
virtual SLANG_NO_THROW void SLANG_MCALL
encodeRayTracingCommands(IRayTracingCommandEncoder** outEncoder) override;
virtual SLANG_NO_THROW void SLANG_MCALL close() override;
+ virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override;
private:
void checkEncodersClosedBeforeNewEncoder();
@@ -416,6 +417,7 @@ public:
virtual SLANG_NO_THROW void SLANG_MCALL
executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers) override;
virtual SLANG_NO_THROW void SLANG_MCALL wait() override;
+ virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override;
};
class DebugFramebuffer
diff --git a/tools/gfx/immediate-renderer-base.cpp b/tools/gfx/immediate-renderer-base.cpp
index fbe5ad423..e87c1e558 100644
--- a/tools/gfx/immediate-renderer-base.cpp
+++ b/tools/gfx/immediate-renderer-base.cpp
@@ -277,6 +277,13 @@ public:
virtual SLANG_NO_THROW void SLANG_MCALL close() override { }
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle)
+ {
+ *outHandle = 0;
+ return SLANG_OK;
+ }
+
void execute()
{
for (auto& cmd : m_writer.m_commands)
@@ -412,6 +419,12 @@ public:
}
virtual SLANG_NO_THROW void SLANG_MCALL wait() override { getRenderer()->waitForGpu(); }
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ return getRenderer()->m_queue->getNativeHandle(outHandle);
+ }
};
using TransientResourceHeapImpl =
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 186c7eb40..7af7d086f 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -4492,6 +4492,13 @@ public:
}
vkAPI.vkEndCommandBuffer(m_commandBuffer);
}
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)m_commandBuffer;
+ return SLANG_OK;
+ }
};
class CommandQueueImpl
@@ -4551,6 +4558,13 @@ public:
vkAPI.vkQueueWaitIdle(m_queue);
}
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ getNativeHandle(NativeHandle* outHandle) override
+ {
+ *outHandle = (uint64_t)m_queue;
+ return SLANG_OK;
+ }
+
virtual SLANG_NO_THROW const Desc& SLANG_MCALL getDesc() override
{
return m_desc;