@@ -415,69 +415,43 @@ DeviceContextVkImpl::ResourceBindInfo& DeviceContextVkImpl::GetBindInfo(PIPELINE
415415 return m_BindInfo[Indices[Uint32{Type}]];
416416}
417417
418- void DeviceContextVkImpl::UpdateInlineConstantBuffers (ResourceBindInfo& BindInfo)
418+ void DeviceContextVkImpl::CommitInlineConstants (ResourceBindInfo& BindInfo)
419419{
420- const PipelineLayoutVk& Layout = m_pPipelineState->GetPipelineLayout ();
421- const auto & PushConstantInfo = Layout.GetPushConstantInfo ();
422- const Uint32 SignCount = m_pPipelineState->GetResourceSignatureCount ();
423-
420+ const PipelineLayoutVk& Layout = m_pPipelineState->GetPipelineLayout ();
421+ const PipelineLayoutVk::PushConstantInfo& PCInfo = Layout.GetPushConstantInfo ();
422+ const Uint32 SignCount = m_pPipelineState->GetResourceSignatureCount ();
423+
424+ PipelineResourceSignatureVkImpl::CommitInlineConstantsAttribs CommitAttribs{
425+ *this ,
426+ Layout.GetVkPipelineLayout (),
427+ PCInfo.vkRange ,
428+ };
424429 for (Uint32 i = 0 ; i < SignCount; ++i)
425430 {
426431 const PipelineResourceSignatureVkImpl* pSign = m_pPipelineState->GetResourceSignature (i);
427432 if (pSign == nullptr || !pSign->HasInlineConstants ())
428433 continue ;
429434
430- const ShaderResourceCacheVk* pResourceCache = BindInfo.ResourceCaches [i];
431- if (pResourceCache == nullptr )
435+ CommitAttribs. pResourceCache = BindInfo.ResourceCaches [i];
436+ if (CommitAttribs. pResourceCache == nullptr )
432437 {
433438 // Each signature with inline constants must have a bound SRB with a valid resource cache
434439 DEV_CHECK_ERR (false , " Signature '" , pSign->GetDesc ().Name , " ' has inline constants but no SRB is bound. "
435440 " Did you call CommitShaderResources()?" );
436441 continue ;
437442 }
438443
439- if (!pResourceCache->HasInlineConstants ())
444+ if (!CommitAttribs. pResourceCache ->HasInlineConstants ())
440445 continue ;
441446
442447 // Determine which resource (if any) in this signature should use push constant path
443448 // If this signature contains the selected push constant, pass its resource index
444449 // Otherwise pass ~0u to use emulated buffer path for all
445- const Uint32 PushConstantResIndex = (i == PushConstantInfo .SignatureIndex ) ? PushConstantInfo .ResourceIndex : ~0u ;
450+ CommitAttribs. PushConstantResIndex = (i == PCInfo .SignatureIndex ) ? PCInfo .ResourceIndex : ~0u ;
446451
447452 // Update inline constant buffers
448- pSign->UpdateInlineConstantBuffers (*pResourceCache, *this , PushConstantResIndex);
449- }
450- }
451-
452- void DeviceContextVkImpl::CommitPushConstants (ResourceBindInfo& BindInfo)
453- {
454- VERIFY_EXPR (m_pPipelineState != nullptr );
455- const PipelineLayoutVk& Layout = m_pPipelineState->GetPipelineLayout ();
456- const auto & PushConstantInfo = Layout.GetPushConstantInfo ();
457-
458- if (!PushConstantInfo)
459- return ;
460-
461- const PipelineResourceSignatureVkImpl* pSign = m_pPipelineState->GetResourceSignature (PushConstantInfo.SignatureIndex );
462- VERIFY_EXPR (pSign != nullptr );
463-
464- const ShaderResourceCacheVk* pResourceCache = BindInfo.ResourceCaches [PushConstantInfo.SignatureIndex ];
465- if (pResourceCache == nullptr )
466- {
467- DEV_CHECK_ERR (false , " Signature '" , pSign->GetDesc ().Name , " ' has push constants but no SRB is bound. "
468- " Did you call CommitShaderResources()?" );
469- return ;
470- }
471-
472- // Get inline constant data directly from the resource cache
473- const void * pPushConstantData = pSign->GetPushConstantData (*pResourceCache, PushConstantInfo.ResourceIndex );
474- if (pPushConstantData == nullptr )
475- {
476- DEV_CHECK_ERR (false , " Push constant data is null in signature '" , pSign->GetDesc ().Name , " '" );
477- return ;
453+ pSign->CommitInlineConstants (CommitAttribs);
478454 }
479-
480- m_CommandBuffer.PushConstants (Layout.GetVkPipelineLayout (), PushConstantInfo.vkRange , pPushConstantData);
481455}
482456
483457void DeviceContextVkImpl::CommitDescriptorSets (ResourceBindInfo& BindInfo, Uint32 CommitSRBMask)
@@ -829,7 +803,7 @@ void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags)
829803 const bool InlineConstantsIntact = (Flags & DRAW_FLAG_INLINE_CONSTANTS_INTACT) != 0 ;
830804 if (!InlineConstantsIntact)
831805 {
832- UpdateInlineConstantBuffers (BindInfo);
806+ CommitInlineConstants (BindInfo);
833807 }
834808
835809 // First time we must always bind descriptor sets with dynamic offsets as SRBs are stale.
@@ -840,11 +814,6 @@ void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags)
840814 CommitDescriptorSets (BindInfo, CommitMask);
841815 }
842816
843- // Commit push constants directly from SRB cache.
844- // Push constants are always submitted before draw (similar to D3D11/D3D12) because
845- // inline constants are designed to change every draw call.
846- CommitPushConstants (BindInfo);
847-
848817#ifdef DILIGENT_DEVELOPMENT
849818 // Must be called after CommitDescriptorSets as it needs SetInfo.BaseInd
850819 DvpValidateCommittedShaderResources (BindInfo);
@@ -1141,16 +1110,13 @@ void DeviceContextVkImpl::PrepareForDispatchCompute()
11411110 ResourceBindInfo& BindInfo = GetBindInfo (PIPELINE_TYPE_COMPUTE);
11421111
11431112 // Update inline constant buffers before binding descriptor sets
1144- UpdateInlineConstantBuffers (BindInfo);
1113+ CommitInlineConstants (BindInfo);
11451114
11461115 if (Uint32 CommitMask = BindInfo.GetCommitMask ())
11471116 {
11481117 CommitDescriptorSets (BindInfo, CommitMask);
11491118 }
11501119
1151- // Commit push constants directly from SRB cache
1152- CommitPushConstants (BindInfo);
1153-
11541120#ifdef DILIGENT_DEVELOPMENT
11551121 // Must be called after CommitDescriptorSets as it needs SetInfo.BaseInd
11561122 DvpValidateCommittedShaderResources (BindInfo);
@@ -1164,16 +1130,13 @@ void DeviceContextVkImpl::PrepareForRayTracing()
11641130 ResourceBindInfo& BindInfo = GetBindInfo (PIPELINE_TYPE_RAY_TRACING);
11651131
11661132 // Update inline constant buffers before binding descriptor sets
1167- UpdateInlineConstantBuffers (BindInfo);
1133+ CommitInlineConstants (BindInfo);
11681134
11691135 if (Uint32 CommitMask = BindInfo.GetCommitMask ())
11701136 {
11711137 CommitDescriptorSets (BindInfo, CommitMask);
11721138 }
11731139
1174- // Commit push constants directly from SRB cache
1175- CommitPushConstants (BindInfo);
1176-
11771140#ifdef DILIGENT_DEVELOPMENT
11781141 // Must be called after CommitDescriptorSets as it needs SetInfo.BaseInd
11791142 DvpValidateCommittedShaderResources (BindInfo);
0 commit comments