summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/render-vk.cpp
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2021-09-23 12:19:49 -0700
committerGitHub <noreply@github.com>2021-09-23 12:19:49 -0700
commitf2a3c933bc11a498c622fa18694c84beca8ca031 (patch)
tree8420310733f50c9d8d4765c6dd3022b7be08eae3 /tools/gfx/vulkan/render-vk.cpp
parentb9b398d038b524f15a86ff27cd6888d54e8754e0 (diff)
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.)
Diffstat (limited to 'tools/gfx/vulkan/render-vk.cpp')
-rw-r--r--tools/gfx/vulkan/render-vk.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index e67f86217..70eb8de03 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -53,7 +53,7 @@ public:
kMaxDescriptorSets = 8,
};
// Renderer implementation
- Result initVulkanInstanceAndDevice(Desc::ExistingDeviceHandles handles, bool useValidationLayer);
+ Result initVulkanInstanceAndDevice(NativeHandle handles, bool useValidationLayer);
virtual SLANG_NO_THROW Result SLANG_MCALL initialize(const Desc& desc) override;
virtual SLANG_NO_THROW Result SLANG_MCALL createTransientResourceHeap(
const ITransientResourceHeap::Desc& desc,
@@ -134,6 +134,8 @@ public:
{
return m_info;
}
+
+ virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override;
/// Dtor
~VKDevice();
@@ -5222,7 +5224,13 @@ VkPipelineShaderStageCreateInfo VKDevice::compileEntryPoint(
// !!!!!!!!!!!!!!!!!!!!!!!!!!!! Renderer interface !!!!!!!!!!!!!!!!!!!!!!!!!!
-Result VKDevice::initVulkanInstanceAndDevice(const Desc::ExistingDeviceHandles handles, bool useValidationLayer)
+Result VKDevice::getNativeHandle(NativeHandle* outHandle)
+{
+ *outHandle = NativeHandle::fromVulkanHandles((uint64_t)m_api.m_instance, (uint64_t)m_api.m_physicalDevice, (uint64_t)m_api.m_device);
+ return SLANG_OK;
+}
+
+Result VKDevice::initVulkanInstanceAndDevice(const NativeHandle handles, bool useValidationLayer)
{
m_features.clear();