diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-10-19 01:50:01 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-10-19 01:50:01 +0000 |
| commit | 170f13b9c2a2ca17d13e848b037d273abd9efcf5 (patch) | |
| tree | bcf49568f1aa732044516e6c295ef4fd44e2bb7d /unityplugin/GhostCubePlugin/PluginSource | |
| parent | Updated core (diff) | |
| download | DiligentEngine-170f13b9c2a2ca17d13e848b037d273abd9efcf5.tar.gz DiligentEngine-170f13b9c2a2ca17d13e848b037d273abd9efcf5.zip | |
PSO creation refactoring (API240075)
Diffstat (limited to 'unityplugin/GhostCubePlugin/PluginSource')
| -rw-r--r-- | unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp index ed7da87..a9a5f24 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp @@ -43,24 +43,26 @@ SamplePlugin::SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, T { auto deviceType = pDevice->GetDeviceCaps().DevType; { - PipelineStateCreateInfo PSOCreateInfo; - PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineStateCreateInfo PSOCreateInfo; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.PipelineType = PIPELINE_TYPE_GRAPHICS; - PSODesc.Name = "Render sample cube PSO"; - PSODesc.GraphicsPipeline.NumRenderTargets = 1; - PSODesc.GraphicsPipeline.RTVFormats[0] = RTVFormat; - PSODesc.GraphicsPipeline.DSVFormat = DSVFormat; - PSODesc.GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; - PSODesc.GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; - PSODesc.GraphicsPipeline.RasterizerDesc.FrontCounterClockwise = deviceType == RENDER_DEVICE_TYPE_D3D11 || deviceType == RENDER_DEVICE_TYPE_D3D12 ? true : false; - PSODesc.GraphicsPipeline.DepthStencilDesc.DepthFunc = UseReverseZ ? COMPARISON_FUNC_GREATER_EQUAL : COMPARISON_FUNC_LESS_EQUAL; - - PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].BlendEnable = True; - PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlend = BLEND_FACTOR_SRC_ALPHA; - PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlend = BLEND_FACTOR_INV_SRC_ALPHA; - PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlendAlpha = BLEND_FACTOR_ZERO; - PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlendAlpha = BLEND_FACTOR_ONE; + PSODesc.Name = "Render sample cube PSO"; + + GraphicsPipeline.NumRenderTargets = 1; + GraphicsPipeline.RTVFormats[0] = RTVFormat; + GraphicsPipeline.DSVFormat = DSVFormat; + GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; + GraphicsPipeline.RasterizerDesc.FrontCounterClockwise = deviceType == RENDER_DEVICE_TYPE_D3D11 || deviceType == RENDER_DEVICE_TYPE_D3D12 ? true : false; + GraphicsPipeline.DepthStencilDesc.DepthFunc = UseReverseZ ? COMPARISON_FUNC_GREATER_EQUAL : COMPARISON_FUNC_LESS_EQUAL; + + GraphicsPipeline.BlendDesc.RenderTargets[0].BlendEnable = True; + GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlend = BLEND_FACTOR_SRC_ALPHA; + GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlend = BLEND_FACTOR_INV_SRC_ALPHA; + GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlendAlpha = BLEND_FACTOR_ZERO; + GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlendAlpha = BLEND_FACTOR_ONE; ShaderCreateInfo ShaderCI; ShaderCI.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL; @@ -93,11 +95,11 @@ SamplePlugin::SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, T }; PSODesc.ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; - PSODesc.GraphicsPipeline.pVS = pVS; - PSODesc.GraphicsPipeline.pPS = pPS; - PSODesc.GraphicsPipeline.InputLayout.LayoutElements = LayoutElems; - PSODesc.GraphicsPipeline.InputLayout.NumElements = _countof(LayoutElems); - pDevice->CreatePipelineState(PSOCreateInfo, &m_PSO); + PSOCreateInfo.pVS = pVS; + PSOCreateInfo.pPS = pPS; + GraphicsPipeline.InputLayout.LayoutElements = LayoutElems; + GraphicsPipeline.InputLayout.NumElements = _countof(LayoutElems); + pDevice->CreateGraphicsPipelineState(PSOCreateInfo, &m_PSO); m_PSO->GetStaticVariableByName(SHADER_TYPE_VERTEX, "Constants")->Set(m_VSConstants); m_PSO->CreateShaderResourceBinding(&m_SRB, true); } |
