@@ -83,10 +83,13 @@ PipelineLayoutVk::PushConstantInfo PipelineLayoutVk::GetPushConstantInfo(
8383 {
8484 VERIFY_EXPR (ResDesc.ArraySize > 0 );
8585 // For inline constants, ArraySize contains the number of 32-bit constants.
86- PCInfo.Size = ResDesc.ArraySize * sizeof (Uint32);
87- PCInfo.StageFlags = ShaderTypesToVkShaderStageFlags (ResDesc.ShaderStages );
86+ PCInfo.vkRange .size = ResDesc.ArraySize * sizeof (Uint32);
87+ PCInfo.vkRange .offset = 0 ;
88+ PCInfo.vkRange .stageFlags = ShaderTypesToVkShaderStageFlags (ResDesc.ShaderStages );
89+
8890 PCInfo.SignatureIndex = BindInd;
8991 PCInfo.ResourceIndex = r;
92+
9093 break ;
9194 }
9295 }
@@ -156,22 +159,15 @@ void PipelineLayoutVk::Create(RenderDeviceVkImpl* pD
156159 " ) used by the pipeline layout exceeds device limit (" , Limits.maxDescriptorSetStorageBuffersDynamic , " )" );
157160 }
158161
159- m_PushConstantInfo = GetPushConstantInfo (ppSignatures, SignatureCount);
160-
161- // Set up push constant range if present
162- VkPushConstantRange PushConstantRange{};
163- if (m_PushConstantInfo)
162+ if (PushConstantInfo PCInfo = GetPushConstantInfo (ppSignatures, SignatureCount))
164163 {
165164 // Validate push constant size against device limits
166- if (m_PushConstantInfo. Size > Limits.maxPushConstantsSize )
165+ if (PCInfo. vkRange . size > Limits.maxPushConstantsSize )
167166 {
168- LOG_ERROR_AND_THROW (" Push constant size (" , m_PushConstantInfo. Size ,
167+ LOG_ERROR_AND_THROW (" Push constant size (" , PCInfo. vkRange . size ,
169168 " bytes) exceeds device limit (" , Limits.maxPushConstantsSize , " bytes)" );
170169 }
171-
172- PushConstantRange.stageFlags = m_PushConstantInfo.StageFlags ;
173- PushConstantRange.offset = 0 ;
174- PushConstantRange.size = m_PushConstantInfo.Size ;
170+ m_PushConstantInfo = std::make_unique<PushConstantInfo>(std::move (PCInfo));
175171 }
176172
177173 VkPipelineLayoutCreateInfo PipelineLayoutCI{};
@@ -181,7 +177,7 @@ void PipelineLayoutVk::Create(RenderDeviceVkImpl* pD
181177 PipelineLayoutCI.setLayoutCount = DescSetLayoutCount;
182178 PipelineLayoutCI.pSetLayouts = DescSetLayoutCount ? DescSetLayouts.data () : nullptr ;
183179 PipelineLayoutCI.pushConstantRangeCount = m_PushConstantInfo ? 1 : 0 ;
184- PipelineLayoutCI.pPushConstantRanges = m_PushConstantInfo ? &PushConstantRange : nullptr ;
180+ PipelineLayoutCI.pPushConstantRanges = m_PushConstantInfo ? &m_PushConstantInfo-> vkRange : nullptr ;
185181
186182 m_VkPipelineLayout = pDeviceVk->GetLogicalDevice ().CreatePipelineLayout (PipelineLayoutCI);
187183
0 commit comments