11/*
2- * Copyright 2019-2024 Diligent Graphics LLC
2+ * Copyright 2019-2025 Diligent Graphics LLC
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -83,9 +83,9 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
8383 // Add pipelines and patched shaders
8484 for (const auto & pso_it : m_Pipelines)
8585 {
86- const auto * Name = pso_it.first .GetName ();
87- const auto ResType = pso_it.first .GetType ();
88- auto & SrcPSO = *pso_it.second ;
86+ const char * Name = pso_it.first .GetName ();
87+ const ResourceType ResType = pso_it.first .GetType ();
88+ SerializedPipelineStateImpl& SrcPSO = *pso_it.second ;
8989
9090 const PIPELINE_STATE_STATUS PSOStatus = SrcPSO.GetStatus (/* WaitForCompletion = */ true );
9191 if (PSOStatus != PIPELINE_STATE_STATUS_READY)
@@ -98,8 +98,8 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
9898
9999 if (!SrcPSO.GetData ().DoNotPackSignatures )
100100 {
101- const auto & Signatures = SrcPSO.GetSignatures ();
102- for (auto & pSign : Signatures)
101+ const SerializedPipelineStateImpl::SignaturesVector & Signatures = SrcPSO.GetSignatures ();
102+ for (const RefCntAutoPtr<IPipelineResourceSignature> & pSign : Signatures)
103103 {
104104 if (!AddPipelineResourceSignature (pSign))
105105 {
@@ -108,11 +108,11 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
108108 }
109109 }
110110
111- const auto & SrcData = SrcPSO.GetData ();
111+ const SerializedPipelineStateImpl::Data & SrcData = SrcPSO.GetData ();
112112 VERIFY_EXPR (SafeStrEqual (Name, SrcPSO.GetDesc ().Name ));
113113 VERIFY_EXPR (ResType == PipelineTypeToArchiveResourceType (SrcPSO.GetDesc ().PipelineType ));
114114
115- auto & DstData = Archive.GetResourceData (ResType, Name);
115+ ResourceData & DstData = Archive.GetResourceData (ResType, Name);
116116 // Add PSO common data
117117 // NB: since the Archive object is temporary, we do not need to copy the data
118118 DstData.Common = SerializedData{SrcData.Common .Ptr (), SrcData.Common .Size ()};
@@ -128,7 +128,7 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
128128
129129 std::vector<Uint32> ShaderIndices;
130130 ShaderIndices.reserve (SrcShaders.size ());
131- for (const auto & SrcShader : SrcShaders)
131+ for (const SerializedPipelineStateImpl::Data::ShaderInfo & SrcShader : SrcShaders)
132132 {
133133 VERIFY_EXPR (SrcShader.Data );
134134
@@ -144,7 +144,7 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
144144 DeviceObjectArchive::ShaderIndexArray Indices{ShaderIndices.data (), StaticCast<Uint32>(ShaderIndices.size ())};
145145
146146 // For pipelines, device-specific data is the shader indices
147- auto & SerializedIndices = DstData.DeviceSpecific [device_type];
147+ SerializedData & SerializedIndices = DstData.DeviceSpecific [device_type];
148148
149149 Serializer<SerializerMode::Measure> MeasureSer;
150150 PSOSerializer<SerializerMode::Measure>::SerializeShaderIndices (MeasureSer, Indices, nullptr );
@@ -159,39 +159,39 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
159159 // Add resource signatures
160160 for (const auto & sign_it : m_Signatures)
161161 {
162- const auto * Name = sign_it.first .GetStr ();
163- const auto & SrcSign = *sign_it.second ;
162+ const char * Name = sign_it.first .GetStr ();
163+ const SerializedResourceSignatureImpl & SrcSign = *sign_it.second ;
164164 VERIFY_EXPR (SafeStrEqual (Name, SrcSign.GetDesc ().Name ));
165- const auto & SrcCommonData = SrcSign.GetCommonData ();
165+ const SerializedData & SrcCommonData = SrcSign.GetCommonData ();
166166
167- auto & DstData = Archive.GetResourceData (ResourceType::ResourceSignature, Name);
167+ ResourceData & DstData = Archive.GetResourceData (ResourceType::ResourceSignature, Name);
168168 // NB: since the Archive object is temporary, we do not need to copy the data
169169 DstData.Common = SerializedData{SrcCommonData.Ptr (), SrcCommonData.Size ()};
170170
171171 for (size_t device_type = 0 ; device_type < static_cast <size_t >(DeviceType::Count); ++device_type)
172172 {
173- if (const auto * pMem = SrcSign.GetDeviceData (static_cast <DeviceType>(device_type)))
173+ if (const SerializedData * pMem = SrcSign.GetDeviceData (static_cast <DeviceType>(device_type)))
174174 DstData.DeviceSpecific [device_type] = SerializedData{pMem->Ptr (), pMem->Size ()};
175175 }
176176 }
177177
178178 // Add render passes
179179 for (const auto & rp_it : m_RenderPasses)
180180 {
181- const auto * Name = rp_it.first .GetStr ();
182- const auto & SrcRP = *rp_it.second ;
181+ const char * Name = rp_it.first .GetStr ();
182+ const SerializedRenderPassImpl & SrcRP = *rp_it.second ;
183183 VERIFY_EXPR (SafeStrEqual (Name, SrcRP.GetDesc ().Name ));
184- const auto & SrcData = SrcRP.GetCommonData ();
184+ const SerializedData & SrcData = SrcRP.GetCommonData ();
185185
186- auto & DstData = Archive.GetResourceData (ResourceType::RenderPass, Name);
187- DstData.Common = SerializedData{SrcData.Ptr (), SrcData.Size ()};
186+ ResourceData & DstData = Archive.GetResourceData (ResourceType::RenderPass, Name);
187+ DstData.Common = SerializedData{SrcData.Ptr (), SrcData.Size ()};
188188 }
189189
190190 // Add standalone shaders
191191 for (const auto & shader_it : m_Shaders)
192192 {
193- const auto * Name = shader_it.first .GetStr ();
194- auto & SrcShader = *shader_it.second ;
193+ const char * Name = shader_it.first .GetStr ();
194+ SerializedShaderImpl& SrcShader = *shader_it.second ;
195195 {
196196 const SHADER_STATUS Status = SrcShader.GetStatus (/* WaitForCompletion = */ true );
197197 if (Status != SHADER_STATUS_READY)
@@ -204,12 +204,12 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
204204 }
205205 VERIFY_EXPR (SafeStrEqual (Name, SrcShader.GetDesc ().Name ));
206206
207- auto & DstData = Archive.GetResourceData (ResourceType::StandaloneShader, Name);
208- DstData.Common = SrcShader.GetCommonData ();
207+ ResourceData & DstData = Archive.GetResourceData (ResourceType::StandaloneShader, Name);
208+ DstData.Common = SrcShader.GetCommonData ();
209209
210210 for (size_t device_type = 0 ; device_type < static_cast <size_t >(DeviceType::Count); ++device_type)
211211 {
212- auto DeviceData = SrcShader.GetDeviceData (static_cast <DeviceType>(device_type));
212+ SerializedData DeviceData = SrcShader.GetDeviceData (static_cast <DeviceType>(device_type));
213213 if (!DeviceData)
214214 continue ;
215215
@@ -223,7 +223,7 @@ Bool ArchiverImpl::SerializeToBlob(Uint32 ContentVersion, IDataBlob** ppBlob)
223223 const Uint32 Index = it_inserted.first ->second ;
224224
225225 // For shaders, device-specific data is the serialized shader bytecode index
226- auto & SerializedIndex = DstData.DeviceSpecific [device_type];
226+ SerializedData & SerializedIndex = DstData.DeviceSpecific [device_type];
227227
228228 Serializer<SerializerMode::Measure> MeasureSer;
229229 MeasureSer (Index);
@@ -272,7 +272,7 @@ bool AddObjectToArchive(IfaceType*
272272 UNEXPECTED (ObjectTypeStr, " '" , pObject->GetDesc ().Name , " ' was not created by a serialization device." );
273273 return false ;
274274 }
275- const auto * Name = pSerializedObj->GetDesc ().Name ;
275+ const char * Name = pSerializedObj->GetDesc ().Name ;
276276
277277 std::lock_guard<std::mutex> Guard{Mtx};
278278
@@ -325,10 +325,10 @@ Bool ArchiverImpl::AddPipelineState(IPipelineState* pPSO)
325325 return false ;
326326 }
327327
328- const auto & Desc = pSerializedPSO->GetDesc ();
329- const auto * Name = Desc.Name ;
328+ const PipelineStateDesc & Desc = pSerializedPSO->GetDesc ();
329+ const char * Name = Desc.Name ;
330330 // Mesh pipelines are serialized as graphics pipelines
331- const auto ArchiveResType = PipelineTypeToArchiveResourceType (Desc.PipelineType );
331+ const ResourceType ArchiveResType = PipelineTypeToArchiveResourceType (Desc.PipelineType );
332332
333333 {
334334 std::lock_guard<std::mutex> Guard{m_PipelinesMtx};
@@ -342,7 +342,7 @@ Bool ArchiverImpl::AddPipelineState(IPipelineState* pPSO)
342342 }
343343
344344 bool Res = true ;
345- if (auto * pRenderPass = pSerializedPSO->GetRenderPass ())
345+ if (IRenderPass * pRenderPass = pSerializedPSO->GetRenderPass ())
346346 {
347347 if (!AddRenderPass (pRenderPass))
348348 Res = false ;
@@ -412,7 +412,7 @@ IPipelineState* ArchiverImpl::GetPipelineState(PIPELINE_TYPE PSOType,
412412{
413413 std::lock_guard<std::mutex> Guard{m_PipelinesMtx};
414414
415- const auto ResType = PiplineTypeToArchiveResourceType (PSOType);
415+ const ResourceType ResType = PiplineTypeToArchiveResourceType (PSOType);
416416 if (ResType == ResourceType::Undefined)
417417 {
418418 UNEXPECTED (" Unexpected pipeline type" );
0 commit comments