From fb2c37094a4faad7014303a65d2800894c013c42 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 15 Mar 2021 20:07:48 -0700 Subject: GL backend: fixed issue with immutable sampler stages in default signature with non-separable programs --- .../GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp index dae24b58..29bd647a 100644 --- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp @@ -161,12 +161,28 @@ RefCntAutoPtr PipelineStateGLImpl::CreateDefaul 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.SRBAllocationGranularity = CreateInfo.PSODesc.SRBAllocationGranularity; ResSignDesc.UseCombinedTextureSamplers = true; + std::vector ImmutableSamplers; + if (m_IsProgramPipelineSupported) + { + ResSignDesc.ImmutableSamplers = LayoutDesc.ImmutableSamplers; + } + else + { + // Apply each immutable sampler to all shader stages + ImmutableSamplers.resize(LayoutDesc.NumImmutableSamplers); + for (Uint32 i = 0; i < LayoutDesc.NumImmutableSamplers; ++i) + { + ImmutableSamplers[i] = LayoutDesc.ImmutableSamplers[i]; + ImmutableSamplers[i].ShaderStages = ActiveStages; + } + ResSignDesc.ImmutableSamplers = ImmutableSamplers.data(); + } + ResSignDesc.NumImmutableSamplers = LayoutDesc.NumImmutableSamplers; + // Always initialize default resource signature as internal device object. // This is necessary to avoud cyclic references from TexRegionRenderer. // This may never be a problem as the PSO keeps the reference to the device if necessary. -- cgit v1.2.3