@@ -63,15 +63,19 @@ ASSERT_SIZEOF(ImmutableSamplerAttribsVk, 8, "The struct is used in serialization
6363// / Inline constants can be either:
6464// / 1. True push constants (from SPIR-V push_constant storage class) - use vkCmdPushConstants
6565// / 2. Emulated inline constants - use dynamic uniform buffers (similar to D3D11 backend)
66+ // /
67+ // / Note: This structure only stores attributes/metadata. The actual storage (pBuffer for emulated
68+ // / inline constants, push constant data for true push constants) is managed per-SRB in
69+ // / ShaderResourceCacheVk to avoid conflicts between multiple PipelineStates sharing the same
70+ // / PipelineResourceSignature.
6671struct InlineConstantBufferAttribsVk
6772{
68- Uint32 ResIndex = 0 ; // Resource index in the signature (used for matching)
69- Uint32 DescrSet = 0 ; // Descriptor set index (0 for push constants as placeholder)
70- Uint32 BindingIndex = 0 ; // Binding index within the descriptor set
71- Uint32 NumConstants = 0 ; // Number of 32-bit constants
72- bool IsPushConstant = false ; // True if this is a Vulkan push constant (not emulated)
73- RefCntAutoPtr<BufferVkImpl> pBuffer; // Internal dynamic uniform buffer (null for true push constants)
74- void * pPushConstantData = nullptr ; // CPU-side staging buffer for push constants (only used when IsPushConstant is true)
73+ Uint32 ResIndex = 0 ; // Resource index in the signature (used for matching)
74+ Uint32 DescrSet = 0 ; // Descriptor set index (0 for push constants as placeholder)
75+ Uint32 BindingIndex = 0 ; // Binding index within the descriptor set
76+ Uint32 NumConstants = 0 ; // Number of 32-bit constants
77+ bool IsPushConstant = false ; // True if this is a Vulkan push constant (not emulated)
78+ // Note: pBuffer and pPushConstantData are now stored per-SRB in ShaderResourceCacheVk
7579};
7680
7781struct PipelineResourceSignatureInternalDataVk : PipelineResourceSignatureInternalData<PipelineResourceAttribsVk, ImmutableSamplerAttribsVk>
@@ -231,9 +235,10 @@ class PipelineResourceSignatureVkImpl final : public PipelineResourceSignatureBa
231235 // Inline constant buffer attributes
232236 std::unique_ptr<InlineConstantBufferAttribsVk[]> m_InlineConstantBuffers;
233237
234- // Pointer to CPU-side staging buffer for static inline constants
235- // This memory is allocated in CreateSetLayouts and must be freed in Destruct
236- void * m_pStaticInlineConstantData = nullptr ;
238+ // Note: Static inline constant data (including push constants) is stored in m_pStaticResCache.
239+ // For push constants, we use InitializePushConstantDataPtrs() and SetPushConstantDataPtr()
240+ // in the static resource cache, similar to how SRB caches store push constant data.
241+ // This ensures each SRB gets its own copy when CopyStaticResources() is called.
237242};
238243
239244template <> Uint32 PipelineResourceSignatureVkImpl::GetDescriptorSetIndex<PipelineResourceSignatureVkImpl::DESCRIPTOR_SET_ID_STATIC_MUTABLE>() const ;
0 commit comments