@@ -241,7 +241,31 @@ void PipelineResourceSignatureGLImpl::CreateLayout(const bool IsSerialized)
241241
242242 if (m_pStaticResCache)
243243 {
244- m_pStaticResCache->Initialize (StaticResCounter, GetRawAllocator (), 0x0 , 0x0 );
244+ m_pStaticResCache->Initialize (StaticResCounter, GetRawAllocator (), 0x0 , 0x0 , m_TotalInlineConstants);
245+
246+ // Initialize inline constant buffers in the static cache.
247+ // This allows static inline constants to be set on the signature and later copied to SRBs.
248+ if (m_NumInlineConstantBuffers > 0 )
249+ {
250+ Uint32 InlineConstantOffset = 0 ;
251+ for (Uint32 i = 0 ; i < m_NumInlineConstantBuffers; ++i)
252+ {
253+ const InlineConstantBufferAttribsGL& InlineCBAttr = GetInlineConstantBuffer (i);
254+ VERIFY_EXPR (InlineCBAttr.pBuffer );
255+ VERIFY_EXPR (InlineCBAttr.NumConstants > 0 );
256+
257+ void * pInlineConstantData = m_pStaticResCache->GetInlineConstantDataPtr (InlineConstantOffset);
258+
259+ m_pStaticResCache->InitInlineConstantBuffer (
260+ InlineCBAttr.CacheOffset ,
261+ RefCntAutoPtr<BufferGLImpl>{InlineCBAttr.pBuffer },
262+ InlineCBAttr.NumConstants ,
263+ pInlineConstantData);
264+
265+ InlineConstantOffset += InlineCBAttr.NumConstants ;
266+ }
267+ VERIFY_EXPR (InlineConstantOffset == m_TotalInlineConstants);
268+ }
245269 }
246270}
247271
@@ -554,7 +578,34 @@ void PipelineResourceSignatureGLImpl::CopyStaticResources(ShaderResourceCacheGL&
554578
555579void PipelineResourceSignatureGLImpl::InitSRBResourceCache (ShaderResourceCacheGL& ResourceCache)
556580{
557- ResourceCache.Initialize (m_BindingCount, m_SRBMemAllocator.GetResourceCacheDataAllocator (0 ), m_DynamicUBOMask, m_DynamicSSBOMask);
581+ ResourceCache.Initialize (m_BindingCount, m_SRBMemAllocator.GetResourceCacheDataAllocator (0 ), m_DynamicUBOMask, m_DynamicSSBOMask, m_TotalInlineConstants);
582+
583+ // Initialize inline constant buffers.
584+ // Each inline constant buffer shares a single dynamic UBO created in CreateLayout().
585+ // The staging data is stored contiguously at the tail of the resource cache memory.
586+ if (m_NumInlineConstantBuffers > 0 )
587+ {
588+ // Inline constant data starts at m_MemoryEndOffset in the cache
589+ Uint32 InlineConstantOffset = 0 ;
590+ for (Uint32 i = 0 ; i < m_NumInlineConstantBuffers; ++i)
591+ {
592+ const InlineConstantBufferAttribsGL& InlineCBAttr = GetInlineConstantBuffer (i);
593+ VERIFY_EXPR (InlineCBAttr.pBuffer );
594+ VERIFY_EXPR (InlineCBAttr.NumConstants > 0 );
595+
596+ // Calculate pointer to inline constant data in the cache memory tail
597+ void * pInlineConstantData = ResourceCache.GetInlineConstantDataPtr (InlineConstantOffset);
598+
599+ ResourceCache.InitInlineConstantBuffer (
600+ InlineCBAttr.CacheOffset ,
601+ RefCntAutoPtr<BufferGLImpl>{InlineCBAttr.pBuffer },
602+ InlineCBAttr.NumConstants ,
603+ pInlineConstantData);
604+
605+ InlineConstantOffset += InlineCBAttr.NumConstants ;
606+ }
607+ VERIFY_EXPR (InlineConstantOffset == m_TotalInlineConstants);
608+ }
558609
559610 // Initialize immutable samplers
560611 for (Uint32 r = 0 ; r < m_Desc.NumResources ; ++r)
0 commit comments