summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-16 03:07:48 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:23 +0000
commitfb2c37094a4faad7014303a65d2800894c013c42 (patch)
tree000a105cb1fc642f9c9491bdf019e29d0e3dcc32 /Graphics/GraphicsEngineOpenGL
parentFixed Vulkan command buffer leak (diff)
downloadDiligentCore-fb2c37094a4faad7014303a65d2800894c013c42.tar.gz
DiligentCore-fb2c37094a4faad7014303a65d2800894c013c42.zip
GL backend: fixed issue with immutable sampler stages in default signature with non-separable programs
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp20
1 files changed, 18 insertions, 2 deletions
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<PipelineResourceSignatureGLImpl> PipelineStateGLImpl::CreateDefaul
ResSignDesc.Name = SignName.c_str();
ResSignDesc.Resources = Resources.data();
ResSignDesc.NumResources = static_cast<Uint32>(Resources.size());
- ResSignDesc.ImmutableSamplers = LayoutDesc.ImmutableSamplers;
- ResSignDesc.NumImmutableSamplers = LayoutDesc.NumImmutableSamplers;
ResSignDesc.BindingIndex = 0;
ResSignDesc.SRBAllocationGranularity = CreateInfo.PSODesc.SRBAllocationGranularity;
ResSignDesc.UseCombinedTextureSamplers = true;
+ std::vector<ImmutableSamplerDesc> 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.