aboutsummaryrefslogtreecommitdiff
path: root/demo/DemoAppD3D12/imguiInteropD3D12.cpp
diff options
context:
space:
mode:
authorAndrew Reidmeyer <[email protected]>2017-03-15 09:28:59 -0600
committerAndrew Reidmeyer <[email protected]>2017-03-15 09:28:59 -0600
commitf5f6a899903a309f1fc93b31c0297fc7b3b5cf46 (patch)
treeed3dece338b579d5b51af494b2d543fb46c43fa3 /demo/DemoAppD3D12/imguiInteropD3D12.cpp
downloadflow-1.0.0.tar.xz
flow-1.0.0.zip
Initial 1.0.0 binary releasev1.0.0
Diffstat (limited to 'demo/DemoAppD3D12/imguiInteropD3D12.cpp')
-rw-r--r--demo/DemoAppD3D12/imguiInteropD3D12.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/demo/DemoAppD3D12/imguiInteropD3D12.cpp b/demo/DemoAppD3D12/imguiInteropD3D12.cpp
new file mode 100644
index 0000000..322e1b5
--- /dev/null
+++ b/demo/DemoAppD3D12/imguiInteropD3D12.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * NVIDIA CORPORATION and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA CORPORATION is strictly prohibited.
+ */
+
+ //direct3d headers
+#include <d3d12.h>
+
+// include the Direct3D Library file
+#pragma comment (lib, "d3d12.lib")
+
+#include "../DemoApp/imguiInterop.h"
+
+#include "appD3D12Ctx.h"
+#include "imguiGraphD3D12.h"
+
+ImguiDescriptorReserveHandleD3D12 imguiInteropReserveDescriptors(void* userdata, UINT numDescriptors, UINT64 lastFenceCompleted, UINT64 nextFenceValue)
+{
+ auto appctx = static_cast<AppGraphCtx*>(userdata);
+ auto srcHandle = appctx->m_dynamicHeapCbvSrvUav.reserveDescriptors(numDescriptors, lastFenceCompleted, nextFenceValue);
+ ImguiDescriptorReserveHandleD3D12 handle = {};
+ handle.heap = srcHandle.heap;
+ handle.descriptorSize = srcHandle.descriptorSize;
+ handle.cpuHandle = srcHandle.cpuHandle;
+ handle.gpuHandle = srcHandle.gpuHandle;
+ return handle;
+}
+
+void imguiInteropUpdateDesc(ImguiGraphDesc& desc, AppGraphCtx* appctx)
+{
+ desc.device = appctx->m_device;
+ desc.commandList = appctx->m_commandList;
+ desc.lastFenceCompleted = appctx->m_lastFenceComplete;
+ desc.nextFenceValue = appctx->m_thisFrameFenceID;
+ desc.winW = appctx->m_winW;
+ desc.winH = appctx->m_winH;
+ desc.dynamicHeapCbvSrvUav.userdata = appctx;
+ desc.dynamicHeapCbvSrvUav.reserveDescriptors = imguiInteropReserveDescriptors;
+}
+
+bool imguiInteropGraphInit(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctx)
+{
+ ImguiGraphDesc desc;
+ imguiInteropUpdateDesc(desc, appctx);
+
+ return func(fontpath, &desc);
+}
+
+void imguiInteropGraphUpdate(imguiGraphUpdate_t func, AppGraphCtx* appctx)
+{
+ ImguiGraphDesc desc;
+ imguiInteropUpdateDesc(desc, appctx);
+
+ return func(&desc);
+} \ No newline at end of file