11/*
2- * Copyright 2019-2022 Diligent Graphics LLC
2+ * Copyright 2019-2025 Diligent Graphics LLC
33 * Copyright 2015-2019 Egor Yusov
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -52,7 +52,7 @@ SHADER_RESOURCE_VARIABLE_TYPE GetShaderVariableType(SHADER_TYPE
5252{
5353 for (Uint32 v = 0 ; v < NumVars; ++v)
5454 {
55- const auto & CurrVarDesc = Variables[v];
55+ const ShaderResourceVariableDesc & CurrVarDesc = Variables[v];
5656 if (((CurrVarDesc.ShaderStages & ShaderStage) != 0 ) && NameCompare (CurrVarDesc.Name ))
5757 {
5858 return CurrVarDesc.Type ;
@@ -183,7 +183,7 @@ bool VerifyResourceBinding(const char* ExpectedResourceTypeName,
183183 (BindInfo.Flags & SET_SHADER_RESOURCE_FLAG_ALLOW_OVERWRITE) == 0 &&
184184 pCachedObject != nullptr && pCachedObject != pResourceImpl)
185185 {
186- auto VarTypeStr = GetShaderVariableTypeLiteralName (ResDesc.VarType );
186+ const char * VarTypeStr = GetShaderVariableTypeLiteralName (ResDesc.VarType );
187187
188188 std::stringstream ss;
189189 ss << " Non-null " << ExpectedResourceTypeName << " '" << pCachedObject->GetDesc ().Name << " ' is already bound to " << VarTypeStr
@@ -235,7 +235,7 @@ bool VerifyConstantBufferBinding(const PipelineResourceDesc& ResDesc,
235235
236236 if (pBufferImpl != nullptr )
237237 {
238- const auto & BuffDesc = pBufferImpl->GetDesc ();
238+ const BufferDesc & BuffDesc = pBufferImpl->GetDesc ();
239239 if ((BuffDesc.BindFlags & BIND_UNIFORM_BUFFER) == 0 )
240240 {
241241 std::stringstream ss;
@@ -273,7 +273,7 @@ bool VerifyConstantBufferBinding(const PipelineResourceDesc& ResDesc,
273273 RangeIsOutOfBounds = true ;
274274 }
275275
276- const auto OffsetAlignment = pBufferImpl->GetDevice ()->GetAdapterInfo ().Buffer .ConstantBufferOffsetAlignment ;
276+ const Uint32 OffsetAlignment = pBufferImpl->GetDevice ()->GetAdapterInfo ().Buffer .ConstantBufferOffsetAlignment ;
277277 VERIFY_EXPR (OffsetAlignment != 0 );
278278 if ((BindInfo.BufferBaseOffset % OffsetAlignment) != 0 )
279279 {
@@ -286,7 +286,7 @@ bool VerifyConstantBufferBinding(const PipelineResourceDesc& ResDesc,
286286 {
287287 if (CachedRangeSize == 0 )
288288 CachedRangeSize = BuffDesc.Size - CachedBaseOffset;
289- auto NewBufferRangeSize = BindInfo.BufferRangeSize ;
289+ Uint64 NewBufferRangeSize = BindInfo.BufferRangeSize ;
290290 if (NewBufferRangeSize == 0 )
291291 NewBufferRangeSize = BuffDesc.Size - BindInfo.BufferBaseOffset ;
292292
@@ -367,7 +367,7 @@ bool ValidateResourceViewDimension(const char* ResName,
367367
368368 if (ExpectedResourceDim != RESOURCE_DIM_UNDEFINED)
369369 {
370- const auto ResourceDim = GetResourceViewDimension (pViewImpl);
370+ const RESOURCE_DIMENSION ResourceDim = GetResourceViewDimension (pViewImpl);
371371 if (ResourceDim != ExpectedResourceDim)
372372 {
373373 RESOURCE_VALIDATION_FAILURE (" The dimension of resource view '" , pViewImpl->GetDesc ().Name ,
@@ -378,7 +378,7 @@ bool ValidateResourceViewDimension(const char* ResName,
378378
379379 if (ResourceDim == RESOURCE_DIM_TEX_2D || ResourceDim == RESOURCE_DIM_TEX_2D_ARRAY)
380380 {
381- auto SampleCount = GetResourceSampleCount (pViewImpl);
381+ Uint32 SampleCount = GetResourceSampleCount (pViewImpl);
382382 if (IsMultisample && SampleCount == 1 )
383383 {
384384 RESOURCE_VALIDATION_FAILURE (" Texture view '" , pViewImpl->GetDesc ().Name , " ' bound to variable '" ,
@@ -415,9 +415,9 @@ bool VerifyResourceViewBinding(const PipelineResourceDesc& ResDesc,
415415
416416 if (pViewImpl)
417417 {
418- auto ViewType = pViewImpl->GetDesc ().ViewType ;
419- bool IsExpectedViewType = false ;
420- for (auto ExpectedViewType : ExpectedViewTypes)
418+ ViewTypeEnumType ViewType = pViewImpl->GetDesc ().ViewType ;
419+ bool IsExpectedViewType = false ;
420+ for (ViewTypeEnumType ExpectedViewType : ExpectedViewTypes)
421421 {
422422 if (ExpectedViewType == ViewType)
423423 IsExpectedViewType = true ;
@@ -434,7 +434,7 @@ bool VerifyResourceViewBinding(const PipelineResourceDesc& ResDesc,
434434 }
435435 ss << " . Incorrect view type: " ;
436436 bool IsFirstViewType = true ;
437- for (auto ExpectedViewType : ExpectedViewTypes)
437+ for (ViewTypeEnumType ExpectedViewType : ExpectedViewTypes)
438438 {
439439 if (!IsFirstViewType)
440440 {
@@ -472,7 +472,7 @@ bool ValidateBufferMode(const PipelineResourceDesc& ResDesc,
472472 bool BindingOK = true ;
473473 if (pBufferView != nullptr )
474474 {
475- const auto & BuffDesc = pBufferView->GetBuffer ()->GetDesc ();
475+ const BufferDesc & BuffDesc = pBufferView->GetBuffer ()->GetDesc ();
476476 if (ResDesc.Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER)
477477 {
478478 if (BuffDesc.Mode != BUFFER_MODE_FORMATTED)
@@ -555,11 +555,11 @@ bool VerifyDynamicBufferOffset(const PipelineResourceDesc& ResDesc,
555555
556556 case SHADER_RESOURCE_TYPE_BUFFER_SRV:
557557 case SHADER_RESOURCE_TYPE_BUFFER_UAV:
558- if (const auto * pBuffView = ClassPtrCast<const BufferViewImplType>(pObject))
558+ if (const BufferViewImplType * pBuffView = ClassPtrCast<const BufferViewImplType>(pObject))
559559 {
560560 pBuffer = pObject != nullptr ? pBuffView->template GetBuffer <const BufferImplType>() : nullptr ;
561561
562- const auto & ViewDesc = pBuffView->GetDesc ();
562+ const BufferViewDesc & ViewDesc = pBuffView->GetDesc ();
563563 VERIFY_EXPR (BufferBaseOffset == 0 || BufferBaseOffset == ViewDesc.ByteOffset );
564564 VERIFY_EXPR (BufferRangeSize == 0 || BufferRangeSize == ViewDesc.ByteWidth );
565565 BufferBaseOffset = ViewDesc.ByteOffset ;
@@ -573,7 +573,7 @@ bool VerifyDynamicBufferOffset(const PipelineResourceDesc& ResDesc,
573573
574574 if (pBuffer != nullptr )
575575 {
576- const auto & BuffDesc = pBuffer->GetDesc ();
576+ const BufferDesc & BuffDesc = pBuffer->GetDesc ();
577577 if (BufferBaseOffset + BufferRangeSize + BufferDynamicOffset > BuffDesc.Size )
578578 {
579579 RESOURCE_VALIDATION_FAILURE (" Dynamic offset " , BufferDynamicOffset, " specified for variable '" , ResDesc.Name ,
@@ -583,9 +583,9 @@ bool VerifyDynamicBufferOffset(const PipelineResourceDesc& ResDesc,
583583 BindingOK = false ;
584584 }
585585
586- const auto & BufferProps = pBuffer->GetDevice ()->GetAdapterInfo ().Buffer ;
586+ const BufferProperties & BufferProps = pBuffer->GetDevice ()->GetAdapterInfo ().Buffer ;
587587
588- const auto OffsetAlignment = (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_CONSTANT_BUFFER) ?
588+ const Uint32 OffsetAlignment = (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_CONSTANT_BUFFER) ?
589589 BufferProps.ConstantBufferOffsetAlignment :
590590 BufferProps.StructuredBufferOffsetAlignment ;
591591 VERIFY_EXPR (OffsetAlignment != 0 );
@@ -676,7 +676,7 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
676676 Uint32 NumElements,
677677 SET_SHADER_RESOURCE_FLAGS Flags) override final
678678 {
679- const auto & Desc = GetDesc ();
679+ const PipelineResourceDesc & Desc = GetDesc ();
680680
681681 DEV_CHECK_ERR (FirstElement + NumElements <= Desc.ArraySize ,
682682 " SetArray arguments are invalid for '" , Desc.Name , " ' variable: specified element range (" , FirstElement, " .. " ,
@@ -701,7 +701,7 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
701701 {
702702#ifdef DILIGENT_DEVELOPMENT
703703 {
704- const auto & Desc = GetDesc ();
704+ const PipelineResourceDesc & Desc = GetDesc ();
705705 DEV_CHECK_ERR ((Desc.Flags & PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS) == 0 ,
706706 " SetBufferOffset() is not only allowed for variables created with PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS flag." );
707707 DEV_CHECK_ERR (Desc.VarType != SHADER_RESOURCE_VARIABLE_TYPE_STATIC,
@@ -720,7 +720,8 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
720720
721721 virtual void DILIGENT_CALL_TYPE GetResourceDesc (ShaderResourceDesc& ResourceDesc) const override final
722722 {
723- const auto & Desc = GetDesc ();
723+ const PipelineResourceDesc& Desc = GetDesc ();
724+
724725 ResourceDesc.Name = Desc.Name ;
725726 ResourceDesc.Type = Desc.ResourceType ;
726727 ResourceDesc.ArraySize = Desc.ArraySize ;
@@ -733,8 +734,8 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
733734
734735 void BindResources (IResourceMapping* pResourceMapping, BIND_SHADER_RESOURCES_FLAGS Flags)
735736 {
736- auto * const pThis = static_cast <ThisImplType*>(this );
737- const auto & ResDesc = pThis->GetDesc ();
737+ ThisImplType * const pThis = static_cast <ThisImplType*>(this );
738+ const PipelineResourceDesc & ResDesc = pThis->GetDesc ();
738739
739740 if ((Flags & (1u << ResDesc.VarType )) == 0 )
740741 return ;
@@ -744,9 +745,9 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
744745 if ((Flags & BIND_SHADER_RESOURCES_KEEP_EXISTING) != 0 && pThis->Get (ArrInd) != nullptr )
745746 continue ;
746747
747- if (auto * pObj = pResourceMapping->GetResource (ResDesc.Name , ArrInd))
748+ if (IDeviceObject * pObj = pResourceMapping->GetResource (ResDesc.Name , ArrInd))
748749 {
749- const auto SetResFlags = (Flags & BIND_SHADER_RESOURCES_ALLOW_OVERWRITE) != 0 ?
750+ const SET_SHADER_RESOURCE_FLAGS SetResFlags = (Flags & BIND_SHADER_RESOURCES_ALLOW_OVERWRITE) != 0 ?
750751 SET_SHADER_RESOURCE_FLAG_ALLOW_OVERWRITE :
751752 SET_SHADER_RESOURCE_FLAG_NONE;
752753 pThis->BindResource (BindResourceInfo{ArrInd, pObj, SetResFlags});
@@ -766,10 +767,10 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
766767
767768 void CheckResources (IResourceMapping* pResourceMapping, BIND_SHADER_RESOURCES_FLAGS Flags, SHADER_RESOURCE_VARIABLE_TYPE_FLAGS& StaleVarTypes) const
768769 {
769- auto * const pThis = static_cast <const ThisImplType*>(this );
770- const auto & ResDesc = pThis->GetDesc ();
770+ const ThisImplType * const pThis = static_cast <const ThisImplType*>(this );
771+ const PipelineResourceDesc & ResDesc = pThis->GetDesc ();
771772
772- const auto VarTypeFlag = static_cast <SHADER_RESOURCE_VARIABLE_TYPE_FLAGS>(1u << ResDesc.VarType );
773+ const SHADER_RESOURCE_VARIABLE_TYPE_FLAGS VarTypeFlag = static_cast <SHADER_RESOURCE_VARIABLE_TYPE_FLAGS>(1u << ResDesc.VarType );
773774 if ((Flags & VarTypeFlag) == 0 )
774775 return ; // This variable type is not being processed
775776
@@ -778,7 +779,7 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
778779
779780 for (Uint32 ArrInd = 0 ; ArrInd < ResDesc.ArraySize ; ++ArrInd)
780781 {
781- const auto * const pBoundObj = pThis->Get (ArrInd);
782+ const IDeviceObject * const pBoundObj = pThis->Get (ArrInd);
782783 if ((pBoundObj != nullptr ) && (Flags & BIND_SHADER_RESOURCES_KEEP_EXISTING) != 0 )
783784 continue ;
784785
@@ -790,7 +791,7 @@ struct ShaderVariableBase : public ResourceVariableBaseInterface
790791
791792 if (pResourceMapping != nullptr )
792793 {
793- if (auto * pObj = pResourceMapping->GetResource (ResDesc.Name , ArrInd))
794+ if (IDeviceObject * pObj = pResourceMapping->GetResource (ResDesc.Name , ArrInd))
794795 {
795796 if (pObj != pBoundObj)
796797 {
@@ -838,7 +839,7 @@ class ShaderVariableManagerBase
838839
839840 if (Size > 0 )
840841 {
841- auto * pRawMem = ALLOCATE_RAW (Allocator, " Memory buffer for shader variables" , Size);
842+ void * pRawMem = ALLOCATE_RAW (Allocator, " Memory buffer for shader variables" , Size);
842843 m_pVariables = reinterpret_cast <VariableType*>(pRawMem);
843844 }
844845
@@ -880,8 +881,8 @@ class ShaderVariableManagerBase
880881 if ((Flags & BIND_SHADER_RESOURCES_UPDATE_ALL) == 0 )
881882 Flags |= BIND_SHADER_RESOURCES_UPDATE_ALL;
882883
883- const auto * pThis = static_cast <const ThisImplType*>(this );
884- const auto AllowedTypes = m_ResourceCache.GetContentType () == ResourceCacheContentType::SRB ?
884+ const ThisImplType* pThis = static_cast <const ThisImplType*>(this );
885+ const SHADER_RESOURCE_VARIABLE_TYPE_FLAGS AllowedTypes = m_ResourceCache.GetContentType () == ResourceCacheContentType::SRB ?
885886 SHADER_RESOURCE_VARIABLE_TYPE_FLAG_MUT_DYN :
886887 SHADER_RESOURCE_VARIABLE_TYPE_FLAG_STATIC;
887888 for (Uint32 v = 0 ; (v < pThis->m_NumVariables ) && (StaleVarTypes & AllowedTypes) != AllowedTypes; ++v)
0 commit comments