@@ -605,8 +605,12 @@ void PipelineResourceSignatureGLImpl::CopyStaticResources(ShaderResourceCacheGL&
605605#endif
606606}
607607
608- void PipelineResourceSignatureGLImpl::UpdateInlineConstantBuffers (const ShaderResourceCacheGL& ResourceCache, GLContextState& CtxState) const
608+ void PipelineResourceSignatureGLImpl::UpdateInlineConstantBuffers (const ShaderResourceCacheGL& ResourceCache,
609+ GLContextState& CtxState,
610+ const TBindings& BaseBindings) const
609611{
612+ const Uint16 BaseUBOBinding = BaseBindings[BINDING_RANGE_UNIFORM_BUFFER];
613+
610614 for (Uint32 i = 0 ; i < m_NumInlineConstantBuffers; ++i)
611615 {
612616 const InlineConstantBufferAttribsGL& InlineCBAttr = GetInlineConstantBuffer (i);
@@ -616,11 +620,24 @@ void PipelineResourceSignatureGLImpl::UpdateInlineConstantBuffers(const ShaderRe
616620 VERIFY (InlineCBAttr.NumConstants * sizeof (Uint32) == InlineCB.RangeSize , " Inline constant buffer size mismatch" );
617621 VERIFY (InlineCB.pInlineConstantData != nullptr , " Inline constant data pointer is null" );
618622
623+ const Uint32 BufferSize = InlineCBAttr.NumConstants * sizeof (Uint32);
624+
619625 // Map the shared buffer and copy the data
620626 PVoid pMappedData = nullptr ;
621627 InlineCBAttr.pBuffer ->Map (CtxState, MAP_WRITE, MAP_FLAG_DISCARD, pMappedData);
622- memcpy (pMappedData, InlineCB.pInlineConstantData , InlineCBAttr. NumConstants * sizeof (Uint32) );
628+ memcpy (pMappedData, InlineCB.pInlineConstantData , BufferSize );
623629 InlineCBAttr.pBuffer ->Unmap (CtxState);
630+
631+ // Re-bind the signature's shared inline constant buffer to the GL slot.
632+ // This is necessary because when an SRB created from a compatible but different
633+ // signature is used, the SRB's cache contains buffer pointers to the original
634+ // signature's shared buffers. BindResources() binds those buffers, but we need
635+ // to bind *this* signature's shared buffers which now contain the updated data.
636+ InlineCBAttr.pBuffer ->BufferMemoryBarrier (MEMORY_BARRIER_UNIFORM_BUFFER, CtxState);
637+ CtxState.BindUniformBuffer (BaseUBOBinding + InlineCBAttr.CacheOffset ,
638+ InlineCBAttr.pBuffer ->GetGLHandle (),
639+ 0 , // BaseOffset
640+ BufferSize);
624641 }
625642}
626643
0 commit comments