11/*
2- * Copyright 2019-2025 Diligent Graphics LLC
2+ * Copyright 2019-2026 Diligent Graphics LLC
33 * Copyright 2015-2019 Egor Yusov
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -286,7 +286,8 @@ BindResourceHelper::BindResourceHelper(const PipelineResourceSignatureVkImpl& Si
286286 m_DstRes {m_CachedSet.GetResource (m_DstResCacheOffset)}
287287// clang-format on
288288{
289- VERIFY (ArrayIndex < m_ResDesc.ArraySize , " Array index is out of range, but it should've been corrected by ShaderVariableBase::SetArray()" );
289+ // For inline constants, GetArraySize() returns 1 (actual array size), while ArraySize is the number of constants
290+ VERIFY (ArrayIndex < m_ResDesc.GetArraySize (), " Array index is out of range, but it should've been corrected by ShaderVariableBase::SetArray()" );
290291 VERIFY (m_DstRes.Type == m_Attribs.GetDescriptorType (), " Inconsistent types" );
291292
292293#ifdef DILIGENT_DEBUG
@@ -655,7 +656,21 @@ void ShaderVariableManagerVk::SetInlineConstants(Uint32 ResIndex,
655656 Uint32 FirstConstant,
656657 Uint32 NumConstants)
657658{
658- UNSUPPORTED (" Not yet implemented" );
659+ const PipelineResourceAttribsVk& Attribs = m_pSignature->GetResourceAttribs (ResIndex);
660+ const ResourceCacheContentType CacheType = m_ResourceCache.GetContentType ();
661+ const Uint32 CacheOffset = Attribs.CacheOffset (CacheType);
662+
663+ #ifdef DILIGENT_DEVELOPMENT
664+ {
665+ const PipelineResourceDesc& ResDesc = m_pSignature->GetResourceDesc (ResIndex);
666+ VerifyInlineConstants (ResDesc, pConstants, FirstConstant, NumConstants);
667+ }
668+ #endif
669+
670+ // All inline constants use the same path at PRS level - store data in the resource cache.
671+ // The data will be used either for push constants (vkCmdPushConstants) or emulated buffers
672+ // depending on the PSO's selection.
673+ m_ResourceCache.SetInlineConstants (Attribs.DescrSet , CacheOffset, pConstants, FirstConstant, NumConstants);
659674}
660675
661676IDeviceObject* ShaderVariableManagerVk::Get (Uint32 ArrayIndex, Uint32 ResIndex) const
@@ -664,7 +679,8 @@ IDeviceObject* ShaderVariableManagerVk::Get(Uint32 ArrayIndex, Uint32 ResIndex)
664679 const PipelineResourceAttribsVk& Attribs = GetResourceAttribs (ResIndex);
665680 const Uint32 CacheOffset = Attribs.CacheOffset (m_ResourceCache.GetContentType ());
666681
667- VERIFY_EXPR (ArrayIndex < ResDesc.ArraySize );
682+ // For inline constants, GetArraySize() returns 1 (actual array size), while ArraySize is the number of constants
683+ VERIFY_EXPR (ArrayIndex < ResDesc.GetArraySize ());
668684
669685 if (Attribs.DescrSet < m_ResourceCache.GetNumDescriptorSets ())
670686 {
0 commit comments