From 82198dc5b8284382d27d5f6776fb2531b805a83e Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 24 Nov 2018 11:15:28 -0800 Subject: Added explicit control over resource transitions in draw command Added explicit static resource binding initialization in SRB objects --- unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp | 3 ++- unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'unityplugin/GhostCubePlugin/PluginSource') diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp index aee52b2..adef5a3 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp @@ -97,6 +97,7 @@ SamplePlugin::SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, T PSODesc.GraphicsPipeline.InputLayout.LayoutElements = LayoutElems; PSODesc.GraphicsPipeline.InputLayout.NumElements = _countof(LayoutElems); pDevice->CreatePipelineState(PSODesc, &m_PSO); + m_PSO->CreateShaderResourceBinding(&m_SRB, true); } { @@ -163,7 +164,7 @@ void SamplePlugin::Render(Diligent::IDeviceContext *pContext, const float4x4 &Vi pContext->SetIndexBuffer(m_CubeIndexBuffer, 0); pContext->SetPipelineState(m_PSO); - pContext->CommitShaderResources(nullptr, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES); + pContext->CommitShaderResources(m_SRB, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES); DrawAttribs DrawAttrs; DrawAttrs.IsIndexed = true; diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h index 56b4a33..879db60 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h +++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h @@ -17,4 +17,5 @@ private: Diligent::RefCntAutoPtr m_CubeIndexBuffer; Diligent::RefCntAutoPtr m_VSConstants; Diligent::RefCntAutoPtr m_PSO; + Diligent::RefCntAutoPtr m_SRB; }; -- cgit v1.2.3