diff options
| author | Yong He <yonghe@outlook.com> | 2021-03-31 11:35:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-31 11:35:17 -0700 |
| commit | 3f1632a1450a5879f337b4bd178e48880cd583f8 (patch) | |
| tree | db4adc2ac0f6113dfd4a97a0e2f7a0c4312ef48b /tools/gfx/cpu | |
| parent | 5fde038b1a6b3c8b335cd5b380c3ee8d15403052 (diff) | |
`gfx` explicit transient resource management. (#1774)
Diffstat (limited to 'tools/gfx/cpu')
| -rw-r--r-- | tools/gfx/cpu/render-cpu.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tools/gfx/cpu/render-cpu.cpp b/tools/gfx/cpu/render-cpu.cpp index fa31f7ee1..f0b612e2f 100644 --- a/tools/gfx/cpu/render-cpu.cpp +++ b/tools/gfx/cpu/render-cpu.cpp @@ -9,6 +9,7 @@ #include "../command-writer.h" #include "../renderer-shared.h" +#include "../simple-transient-resource-heap.h" #include "../slang-context.h" #define SLANG_PRELUDE_NAMESPACE slang_prelude @@ -1119,6 +1120,10 @@ private: return nullptr; } public: + void init(CPUDevice* device) + { + SLANG_UNUSED(device); + } virtual SLANG_NO_THROW void SLANG_MCALL encodeRenderCommands( IRenderPassLayout* renderPass, IFramebuffer* framebuffer, @@ -1273,13 +1278,6 @@ private: { return m_desc; } - virtual SLANG_NO_THROW Result SLANG_MCALL - createCommandBuffer(ICommandBuffer** outCommandBuffer) override - { - RefPtr<CommandBufferImpl> result = new CommandBufferImpl(); - *outCommandBuffer = result.detach(); - return SLANG_OK; - } virtual SLANG_NO_THROW void SLANG_MCALL executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers) override @@ -1400,6 +1398,8 @@ private: } }; + using TransientResourceHeapImpl = SimpleTransientResourceHeap<CPUDevice, CommandBufferImpl>; + public: ~CPUDevice() { @@ -1559,6 +1559,15 @@ public: *outQueue = queue.detach(); return SLANG_OK; } + virtual SLANG_NO_THROW Result SLANG_MCALL createTransientResourceHeap( + const ITransientResourceHeap::Desc& desc, + ITransientResourceHeap** outHeap) override + { + RefPtr<TransientResourceHeapImpl> result = new TransientResourceHeapImpl(); + SLANG_RETURN_ON_FAIL(result->init(this, desc)); + *outHeap = result.detach(); + return SLANG_OK; + } virtual SLANG_NO_THROW Result SLANG_MCALL createSwapchain( const ISwapchain::Desc& desc, WindowHandle window, ISwapchain** outSwapchain) override { |
