summaryrefslogtreecommitdiffstats
path: root/unityplugin/GhostCubeScene/src
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-24 19:15:28 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-24 19:15:28 +0000
commit82198dc5b8284382d27d5f6776fb2531b805a83e (patch)
tree6734be86fdf30c87a7d244e13133bc2bcf7452d2 /unityplugin/GhostCubeScene/src
parentUpdated core (fixed state transiton issue in D3D11) (diff)
downloadDiligentEngine-82198dc5b8284382d27d5f6776fb2531b805a83e.tar.gz
DiligentEngine-82198dc5b8284382d27d5f6776fb2531b805a83e.zip
Added explicit control over resource transitions in draw command
Added explicit static resource binding initialization in SRB objects
Diffstat (limited to 'unityplugin/GhostCubeScene/src')
-rw-r--r--unityplugin/GhostCubeScene/src/GhostCubeScene.cpp5
-rw-r--r--unityplugin/GhostCubeScene/src/GhostCubeScene.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp b/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp
index 62fa900..e1f9937 100644
--- a/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp
+++ b/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp
@@ -84,7 +84,7 @@ void GhostCubeScene::OnGraphicsInitialized()
PipelineStateDesc PSODesc;
PSODesc.IsComputePipeline = false;
- PSODesc.Name = "Render sample cube PSO";
+ PSODesc.Name = "Mirror PSO";
PSODesc.GraphicsPipeline.NumRenderTargets = 1;
PSODesc.GraphicsPipeline.RTVFormats[0] = SCDesc.ColorBufferFormat == TEX_FORMAT_RGBA8_UNORM ? TEX_FORMAT_RGBA8_UNORM_SRGB : SCDesc.ColorBufferFormat;
@@ -132,6 +132,7 @@ void GhostCubeScene::OnGraphicsInitialized()
PSODesc.GraphicsPipeline.pVS = pVS;
PSODesc.GraphicsPipeline.pPS = pPS;
pDevice->CreatePipelineState(PSODesc, &m_pMirrorPSO);
+ m_pMirrorPSO->CreateShaderResourceBinding(&m_pMirrorSRB, true);
}
#if D3D12_SUPPORTED
m_pStateTransitionHandler.reset(new GhostCubeSceneResTrsnHelper(*this));
@@ -194,7 +195,7 @@ void GhostCubeScene::Render(UnityRenderingEvent RenderEventFunc)
pCtx->InvalidateState();
pCtx->SetRenderTargets(0, nullptr, nullptr);
pCtx->SetPipelineState(m_pMirrorPSO);
- pCtx->CommitShaderResources(nullptr, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES);
+ pCtx->CommitShaderResources(m_pMirrorSRB, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES);
{
float4x4 MirrorWorldView = scaleMatrix(5,5,5) * rotationX(PI_F*0.6f) * translationMatrix(0.f, -3.0f, 10.0f);
diff --git a/unityplugin/GhostCubeScene/src/GhostCubeScene.h b/unityplugin/GhostCubeScene/src/GhostCubeScene.h
index f993791..0580f86 100644
--- a/unityplugin/GhostCubeScene/src/GhostCubeScene.h
+++ b/unityplugin/GhostCubeScene/src/GhostCubeScene.h
@@ -58,4 +58,5 @@ private:
Diligent::RefCntAutoPtr<Diligent::ITexture> m_pDepthBuffer;
Diligent::RefCntAutoPtr<Diligent::IBuffer> m_pMirrorVSConstants;
Diligent::RefCntAutoPtr<Diligent::IPipelineState> m_pMirrorPSO;
+ Diligent::RefCntAutoPtr<Diligent::IShaderResourceBinding> m_pMirrorSRB;
}; \ No newline at end of file