Skip to content

Commit b5981e9

Browse files
committed
Finish 7): Copy static inline constants into SRB cache
1 parent 63c2bba commit b5981e9

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

Graphics/GraphicsEngineOpenGL/src/PipelineResourceSignatureGLImpl.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -473,19 +473,29 @@ void PipelineResourceSignatureGLImpl::CopyStaticResources(ShaderResourceCacheGL&
473473
switch (PipelineResourceToBindingRange(ResDesc))
474474
{
475475
case BINDING_RANGE_UNIFORM_BUFFER:
476-
for (Uint32 ArrInd = 0; ArrInd < ResDesc.ArraySize; ++ArrInd)
476+
if (ResDesc.Flags & PIPELINE_RESOURCE_FLAG_INLINE_CONSTANTS)
477+
{
478+
VERIFY(ResDesc.Flags == PIPELINE_RESOURCE_FLAG_INLINE_CONSTANTS, "INLINE_CONSTANTS flag is not compatible with other flags");
479+
// For inline constants, ResDesc.ArraySize is the number of 32-bit constants, not the array size.
480+
// Copy the staging data from signature cache to SRB cache.
481+
DstResourceCache.CopyInlineConstants(SrcResourceCache, ResAttr.CacheOffset, ResDesc.ArraySize);
482+
}
483+
else
477484
{
478-
const ShaderResourceCacheGL::CachedUB& SrcCachedRes = SrcResourceCache.GetConstUB(ResAttr.CacheOffset + ArrInd);
479-
if (!SrcCachedRes.pBuffer)
485+
for (Uint32 ArrInd = 0; ArrInd < ResDesc.ArraySize; ++ArrInd)
480486
{
481-
if (DstCacheType == ResourceCacheContentType::SRB)
482-
LOG_ERROR_MESSAGE("No resource is assigned to static shader variable '", GetShaderResourcePrintName(ResDesc, ArrInd), "' in pipeline resource signature '", m_Desc.Name, "'.");
483-
continue;
484-
}
487+
const ShaderResourceCacheGL::CachedUB& SrcCachedRes = SrcResourceCache.GetConstUB(ResAttr.CacheOffset + ArrInd);
488+
if (!SrcCachedRes.pBuffer)
489+
{
490+
if (DstCacheType == ResourceCacheContentType::SRB)
491+
LOG_ERROR_MESSAGE("No resource is assigned to static shader variable '", GetShaderResourcePrintName(ResDesc, ArrInd), "' in pipeline resource signature '", m_Desc.Name, "'.");
492+
continue;
493+
}
485494

486-
DstResourceCache.SetUniformBuffer(ResAttr.CacheOffset + ArrInd,
487-
RefCntAutoPtr<BufferGLImpl>{SrcCachedRes.pBuffer},
488-
SrcCachedRes.BaseOffset, SrcCachedRes.RangeSize);
495+
DstResourceCache.SetUniformBuffer(ResAttr.CacheOffset + ArrInd,
496+
RefCntAutoPtr<BufferGLImpl>{SrcCachedRes.pBuffer},
497+
SrcCachedRes.BaseOffset, SrcCachedRes.RangeSize);
498+
}
489499
}
490500
break;
491501
case BINDING_RANGE_STORAGE_BUFFER:

0 commit comments

Comments
 (0)