From 884401f8ed7fdaf79032b99787501fc7f770b64e Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 27 Mar 2021 17:02:20 +0100 Subject: GLTF: hacky VR rendering support --- .../src/PipelineStateVkImpl.cpp | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan/src') diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index a6cc4ba3..f6de5dd7 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -738,7 +738,8 @@ RenderPassDesc PipelineStateVkImpl::GetImplicitRenderPassDesc( RefCntAutoPtr PipelineStateVkImpl::CreateDefaultSignature( const PipelineStateCreateInfo& CreateInfo, - const TShaderStages& ShaderStages) + const TShaderStages& ShaderStages, + Uint32 BindingIndex) { struct UniqueResource { @@ -841,15 +842,15 @@ RefCntAutoPtr PipelineStateVkImpl::CreateDefaul RefCntAutoPtr pSignature; if (Resources.size()) { - String SignName = String{"Implicit signature of PSO '"} + m_Desc.Name + '\''; + String SignName = String{"Implicit signature of PSO '"} + m_Desc.Name + String{BindingIndex ? "':1" : "':0"}; PipelineResourceSignatureDesc ResSignDesc; ResSignDesc.Name = SignName.c_str(); ResSignDesc.Resources = Resources.data(); ResSignDesc.NumResources = static_cast(Resources.size()); - ResSignDesc.ImmutableSamplers = LayoutDesc.ImmutableSamplers; - ResSignDesc.NumImmutableSamplers = LayoutDesc.NumImmutableSamplers; - ResSignDesc.BindingIndex = 0; + ResSignDesc.ImmutableSamplers = BindingIndex ? nullptr : LayoutDesc.ImmutableSamplers; + ResSignDesc.NumImmutableSamplers = BindingIndex ? 0 : LayoutDesc.NumImmutableSamplers; + ResSignDesc.BindingIndex = BindingIndex; ResSignDesc.SRBAllocationGranularity = CreateInfo.PSODesc.SRBAllocationGranularity; ResSignDesc.UseCombinedTextureSamplers = pCombinedSamplerSuffix != nullptr; ResSignDesc.CombinedSamplerSuffix = pCombinedSamplerSuffix; @@ -870,10 +871,25 @@ RefCntAutoPtr PipelineStateVkImpl::CreateDefaul void PipelineStateVkImpl::InitPipelineLayout(const PipelineStateCreateInfo& CreateInfo, TShaderStages& ShaderStages) { - if (m_UsingImplicitSignature) + if (m_Desc.SeparateGeometrySignature) { + TShaderStages AllOtherStages; + TShaderStages GeometryStage; + + for (const auto& Stage : ShaderStages) + { + if (Stage.Type == SHADER_TYPE_GEOMETRY) + GeometryStage.push_back(Stage); + else + AllOtherStages.push_back(Stage); + } + + VERIFY_EXPR(m_SignatureCount == 2); + m_Signatures[1] = CreateDefaultSignature(CreateInfo, GeometryStage, 1); + m_Signatures[0] = CreateDefaultSignature(CreateInfo, AllOtherStages, 0); + } else if (m_UsingImplicitSignature) { VERIFY_EXPR(m_SignatureCount == 1); - m_Signatures[0] = CreateDefaultSignature(CreateInfo, ShaderStages); + m_Signatures[0] = CreateDefaultSignature(CreateInfo, ShaderStages, 0); VERIFY_EXPR(!m_Signatures[0] || m_Signatures[0]->GetDesc().BindingIndex == 0); } -- cgit v1.2.3