From e272aec6a9ddb8b0af82f72c061f5393f2b2bdab Mon Sep 17 00:00:00 2001 From: Yong He Date: Sat, 19 Feb 2022 00:15:17 -0800 Subject: 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 --- tools/gfx/vulkan/render-vk.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tools/gfx/vulkan/render-vk.cpp') diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp index 0a66c653b..ebf25513b 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -2530,6 +2530,14 @@ public: return SLANG_OK; } + Result setPipelineStateWithRootObjectImpl(IPipelineState* state, IShaderObject* inObject) + { + IShaderObject* rootObject = nullptr; + SLANG_RETURN_ON_FAIL(setPipelineStateImpl(state, &rootObject)); + static_cast(rootObject)->copyFrom(inObject, m_commandBuffer->m_transientHeap); + return SLANG_OK; + } + void flushBindingState(VkPipelineBindPoint pipelineBindPoint) { auto& api = *m_api; @@ -5098,6 +5106,12 @@ public: return setPipelineStateImpl(pipelineState, outRootObject); } + virtual SLANG_NO_THROW Result SLANG_MCALL + bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override + { + return setPipelineStateWithRootObjectImpl(pipelineState, rootObject); + } + virtual SLANG_NO_THROW void SLANG_MCALL setViewports(uint32_t count, const Viewport* viewports) override { @@ -5380,6 +5394,12 @@ public: return setPipelineStateImpl(pipelineState, outRootObject); } + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipelineWithRootObject( + IPipelineState* pipelineState, IShaderObject* rootObject) override + { + return setPipelineStateWithRootObjectImpl(pipelineState, rootObject); + } + virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override { auto pipeline = static_cast(m_currentPipeline.Ptr()); @@ -5653,6 +5673,13 @@ public: setPipelineStateImpl(pipeline, outRootObject); } + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipelineWithRootObject( + IPipelineState* pipelineState, IShaderObject* rootObject) override + { + return setPipelineStateWithRootObjectImpl(pipelineState, rootObject); + } + + // TODO: Implement after implementing createRayTracingPipelineState virtual SLANG_NO_THROW void SLANG_MCALL dispatchRays( uint32_t raygenShaderIndex, IShaderTable* shaderTable, -- cgit v1.2.3