diff options
| author | Yong He <yonghe@outlook.com> | 2022-02-19 00:15:17 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-19 00:15:17 -0800 |
| commit | e272aec6a9ddb8b0af82f72c061f5393f2b2bdab (patch) | |
| tree | 11ec24a9464f5922e896bfff6e125c2d6279d4b3 /tools/gfx/cuda | |
| parent | e993ff5f8d21d77dd3fb579f7afc51c6dcad834c (diff) | |
Optimize d3d12 mutable shader object implementation. (#2138)
* Optimize d3d12 mutable shader object implementation.
* Disable mismatched clear value warning message from d3d sdk.
* Fix.
* Fix.
* gfx: Avoid redundant d3d12 QueryInterface call.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/cuda')
| -rw-r--r-- | tools/gfx/cuda/render-cuda.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/gfx/cuda/render-cuda.cpp b/tools/gfx/cuda/render-cuda.cpp index b98582ded..db5661f20 100644 --- a/tools/gfx/cuda/render-cuda.cpp +++ b/tools/gfx/cuda/render-cuda.cpp @@ -953,8 +953,14 @@ public: public: CUDADevice* m_device; + TransientResourceHeapBase* m_transientHeap; + + void init(CUDADevice* device, TransientResourceHeapBase* transientHeap) + { + m_device = device; + m_transientHeap = transientHeap; + } - void init(CUDADevice* device) { m_device = device; } virtual SLANG_NO_THROW void SLANG_MCALL encodeRenderCommands( IRenderPassLayout* renderPass, IFramebuffer* framebuffer, @@ -1171,6 +1177,17 @@ public: return SLANG_OK; } + virtual SLANG_NO_THROW Result SLANG_MCALL + bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override + { + m_writer->setPipelineState(state); + PipelineStateBase* pipelineImpl = static_cast<PipelineStateBase*>(state); + SLANG_RETURN_ON_FAIL(m_commandBuffer->m_device->createRootShaderObject( + pipelineImpl->m_program, m_rootObject.writeRef())); + m_rootObject->copyFrom(rootObject, m_commandBuffer->m_transientHeap); + return SLANG_OK; + } + virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override { m_writer->bindRootShaderObject(m_rootObject); |
