@@ -600,7 +600,7 @@ void DeviceContextWebGPUImpl::UpdateBuffer(IBuffer* pBuffe
600600 const BufferDesc& BuffDesc = pBufferWebGPU->GetDesc ();
601601 if (BuffDesc.Usage == USAGE_DEFAULT)
602602 {
603- const auto UploadAlloc = AllocateUploadMemory (StaticCast<size_t >(Size));
603+ const UploadMemoryManagerWebGPU::Allocation UploadAlloc = AllocateUploadMemory (StaticCast<size_t >(Size));
604604 if (!UploadAlloc)
605605 {
606606 LOG_ERROR (" Failed to allocate upload memory for buffer update" );
@@ -644,8 +644,8 @@ void DeviceContextWebGPUImpl::CopyBuffer(IBuffer* pSrcBuff
644644 if (wgpuSrcBuffer == nullptr )
645645 {
646646 VERIFY_EXPR (SrcDesc.Usage == USAGE_DYNAMIC);
647- const auto & DynAlloc = pSrcBufferWebGPU->GetDynamicAllocation (GetContextId ());
648- wgpuSrcBuffer = DynAlloc.wgpuBuffer ;
647+ const DynamicMemoryManagerWebGPU::Allocation & DynAlloc = pSrcBufferWebGPU->GetDynamicAllocation (GetContextId ());
648+ wgpuSrcBuffer = DynAlloc.wgpuBuffer ;
649649 SrcOffset += DynAlloc.Offset ;
650650 }
651651
@@ -680,8 +680,8 @@ void DeviceContextWebGPUImpl::CopyBuffer(IBuffer* pSrcBuff
680680 if (wgpuSrcBuffer == nullptr )
681681 {
682682 VERIFY_EXPR (SrcDesc.Usage == USAGE_DYNAMIC);
683- const auto & DynAlloc = pSrcBufferWebGPU->GetDynamicAllocation (GetContextId ());
684- wgpuSrcBuffer = DynAlloc.wgpuBuffer ;
683+ const DynamicMemoryManagerWebGPU::Allocation & DynAlloc = pSrcBufferWebGPU->GetDynamicAllocation (GetContextId ());
684+ wgpuSrcBuffer = DynAlloc.wgpuBuffer ;
685685 SrcOffset += DynAlloc.Offset ;
686686 }
687687
@@ -724,10 +724,10 @@ void DeviceContextWebGPUImpl::MapBuffer(IBuffer* pBuffer,
724724 }
725725 else if (BuffDesc.Usage == USAGE_DYNAMIC)
726726 {
727- const auto & DynAllocation = pBufferWebGPU->GetDynamicAllocation (GetContextId ());
727+ const DynamicMemoryManagerWebGPU::Allocation & DynAllocation = pBufferWebGPU->GetDynamicAllocation (GetContextId ());
728728 if ((MapFlags & MAP_FLAG_DISCARD) != 0 || !DynAllocation)
729729 {
730- auto Allocation = AllocateDynamicMemory (StaticCast<size_t >(BuffDesc.Size ), pBufferWebGPU->GetAlignment ());
730+ DynamicMemoryManagerWebGPU::Allocation Allocation = AllocateDynamicMemory (StaticCast<size_t >(BuffDesc.Size ), pBufferWebGPU->GetAlignment ());
731731 if (!Allocation)
732732 {
733733 LOG_ERROR (" Failed to allocate dynamic memory for buffer mapping. Try increasing the size of the dynamic heap in engine EngineWebGPUCreateInfo" );
@@ -791,7 +791,7 @@ void DeviceContextWebGPUImpl::UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType)
791791 " copying the data from shared memory to private storage. This can only be "
792792 " done by blit encoder outside of render pass." );
793793
794- const auto & DynAllocation = pBufferWebGPU->GetDynamicAllocation (GetContextId ());
794+ const DynamicMemoryManagerWebGPU::Allocation & DynAllocation = pBufferWebGPU->GetDynamicAllocation (GetContextId ());
795795
796796 EndCommandEncoders ();
797797 wgpuCommandEncoderCopyBufferToBuffer (GetCommandEncoder (), DynAllocation.wgpuBuffer , DynAllocation.Offset , wgpuBuffer, 0 , BuffDesc.Size );
@@ -874,7 +874,7 @@ void DeviceContextWebGPUImpl::UpdateTexture(ITexture* pText
874874 const TextureDesc& TexDesc = pTextureWebGPU->GetDesc ();
875875 const BufferToTextureCopyInfo CopyInfo = GetBufferToTextureCopyInfo (TexDesc.Format , DstBox, TextureWebGPUImpl::ImageCopyBufferRowAlignment);
876876
877- const auto UploadAlloc = AllocateUploadMemory (StaticCast<size_t >(CopyInfo.MemorySize ));
877+ const UploadMemoryManagerWebGPU::Allocation UploadAlloc = AllocateUploadMemory (StaticCast<size_t >(CopyInfo.MemorySize ));
878878 if (!UploadAlloc)
879879 {
880880 LOG_ERROR (" Failed to allocate upload memory for texture update" );
@@ -885,8 +885,8 @@ void DeviceContextWebGPUImpl::UpdateTexture(ITexture* pText
885885 {
886886 for (Uint32 RawIdx = 0 ; RawIdx < CopyInfo.RowCount ; ++RawIdx)
887887 {
888- const auto SrcOffset = RawIdx * SubresData.Stride + LayerIdx * SubresData.DepthStride ;
889- const auto DstOffset = RawIdx * CopyInfo.RowStride + LayerIdx * CopyInfo.DepthStride ;
888+ const Uint64 SrcOffset = RawIdx * SubresData.Stride + LayerIdx * SubresData.DepthStride ;
889+ const Uint64 DstOffset = RawIdx * CopyInfo.RowStride + LayerIdx * CopyInfo.DepthStride ;
890890 memcpy (UploadAlloc.pData + DstOffset, static_cast <const uint8_t *>(SubresData.pData ) + SrcOffset, StaticCast<size_t >(CopyInfo.RowSize ));
891891 }
892892 }
@@ -1132,8 +1132,8 @@ void DeviceContextWebGPUImpl::MapTextureSubresource(ITexture* pT
11321132 if ((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_NO_OVERWRITE)) != 0 )
11331133 LOG_INFO_MESSAGE_ONCE (" Mapping textures with flags MAP_FLAG_DISCARD or MAP_FLAG_NO_OVERWRITE has no effect in WebGPU backend" );
11341134
1135- const auto CopyInfo = GetBufferToTextureCopyInfo (TexDesc.Format , *pMapRegion, TextureWebGPUImpl::ImageCopyBufferRowAlignment);
1136- const auto UploadAlloc = AllocateUploadMemory (StaticCast<size_t >(CopyInfo.MemorySize ), TextureWebGPUImpl::ImageCopyBufferRowAlignment);
1135+ const BufferToTextureCopyInfo CopyInfo = GetBufferToTextureCopyInfo (TexDesc.Format , *pMapRegion, TextureWebGPUImpl::ImageCopyBufferRowAlignment);
1136+ const UploadMemoryManagerWebGPU::Allocation UploadAlloc = AllocateUploadMemory (StaticCast<size_t >(CopyInfo.MemorySize ), TextureWebGPUImpl::ImageCopyBufferRowAlignment);
11371137 if (!UploadAlloc)
11381138 {
11391139 LOG_ERROR (" Failed to allocate upload memory for texture mapping" );
@@ -1200,8 +1200,8 @@ void DeviceContextWebGPUImpl::UnmapTextureSubresource(ITexture* pTexture, Uint32
12001200 {
12011201 const TextureFormatAttribs& FmtAttribs = GetTextureFormatAttribs (TexDesc.Format );
12021202
1203- const auto & Allocation = UploadSpaceIt->second .Allocation ;
1204- const auto & CopyInfo = UploadSpaceIt->second .CopyInfo ;
1203+ const UploadMemoryManagerWebGPU::Allocation & Allocation = UploadSpaceIt->second .Allocation ;
1204+ const BufferToTextureCopyInfo& CopyInfo = UploadSpaceIt->second .CopyInfo ;
12051205
12061206 WGPUImageCopyBuffer wgpuImageCopySrc{};
12071207 wgpuImageCopySrc.buffer = Allocation.wgpuBuffer ;
@@ -1771,7 +1771,7 @@ void DeviceContextWebGPUImpl::CommitRenderTargets()
17711771
17721772 if (m_pBoundDepthStencil)
17731773 {
1774- const auto & FormatAttribs = GetTextureFormatAttribs (m_pBoundDepthStencil->GetDesc ().Format );
1774+ const TextureFormatAttribs & FormatAttribs = GetTextureFormatAttribs (m_pBoundDepthStencil->GetDesc ().Format );
17751775
17761776 wgpuRenderPassDepthStencilAttachment.view = m_pBoundDepthStencil->GetWebGPUTextureView ();
17771777 wgpuRenderPassDepthStencilAttachment.depthLoadOp = m_PendingClears.DepthPending () ? WGPULoadOp_Clear : WGPULoadOp_Load;
@@ -1813,11 +1813,11 @@ void DeviceContextWebGPUImpl::CommitSubpassRenderTargets()
18131813{
18141814 VERIFY (!m_wgpuRenderPassEncoder && !m_wgpuComputePassEncoder, " Another command encoder is currently active" );
18151815 VERIFY_EXPR (m_pActiveRenderPass);
1816- const auto & RPDesc = m_pActiveRenderPass->GetDesc ();
1816+ const RenderPassDesc & RPDesc = m_pActiveRenderPass->GetDesc ();
18171817 VERIFY_EXPR (m_pBoundFramebuffer);
1818- const auto & FBDesc = m_pBoundFramebuffer->GetDesc ();
1818+ const FramebufferDesc & FBDesc = m_pBoundFramebuffer->GetDesc ();
18191819 VERIFY_EXPR (m_SubpassIndex < RPDesc.SubpassCount );
1820- const auto & Subpass = RPDesc.pSubpasses [m_SubpassIndex];
1820+ const SubpassDesc & Subpass = RPDesc.pSubpasses [m_SubpassIndex];
18211821 VERIFY (Subpass.RenderTargetAttachmentCount == m_NumBoundRenderTargets,
18221822 " The number of currently bound render targets (" , m_NumBoundRenderTargets,
18231823 " ) is not consistent with the number of render target attachments (" , Subpass.RenderTargetAttachmentCount ,
@@ -1826,21 +1826,21 @@ void DeviceContextWebGPUImpl::CommitSubpassRenderTargets()
18261826 WGPURenderPassColorAttachment RenderPassColorAttachments[MAX_RENDER_TARGETS]{};
18271827 for (Uint32 RTIndex = 0 ; RTIndex < m_NumBoundRenderTargets; ++RTIndex)
18281828 {
1829- const auto & RTAttachmentRef = Subpass.pRenderTargetAttachments [RTIndex];
1829+ const AttachmentReference & RTAttachmentRef = Subpass.pRenderTargetAttachments [RTIndex];
18301830 if (RTAttachmentRef.AttachmentIndex != ATTACHMENT_UNUSED)
18311831 {
18321832 TextureViewWebGPUImpl* pRTV = m_pBoundRenderTargets[RTIndex];
18331833 VERIFY (pRTV == FBDesc.ppAttachments [RTAttachmentRef.AttachmentIndex ], " Render target bound in the device context at slot " , RTIndex, " is not consistent with the corresponding framebuffer attachment" );
1834- const auto FirstLastUse = m_pActiveRenderPass->GetAttachmentFirstLastUse (RTAttachmentRef.AttachmentIndex );
1835- const auto & RTAttachmentDesc = RPDesc.pAttachments [RTAttachmentRef.AttachmentIndex ];
1834+ const auto FirstLastUse = m_pActiveRenderPass->GetAttachmentFirstLastUse (RTAttachmentRef.AttachmentIndex );
1835+ const RenderPassAttachmentDesc & RTAttachmentDesc = RPDesc.pAttachments [RTAttachmentRef.AttachmentIndex ];
18361836
18371837 RenderPassColorAttachments[RTIndex].view = pRTV->GetWebGPUTextureView ();
18381838 RenderPassColorAttachments[RTIndex].loadOp = FirstLastUse.first == m_SubpassIndex ? AttachmentLoadOpToWGPULoadOp (RTAttachmentDesc.LoadOp ) : WGPULoadOp_Load;
18391839 RenderPassColorAttachments[RTIndex].depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
18401840
18411841 if (RTAttachmentDesc.LoadOp == ATTACHMENT_LOAD_OP_CLEAR)
18421842 {
1843- const auto ClearColor = m_AttachmentClearValues[RTAttachmentRef.AttachmentIndex ].Color ;
1843+ const float * ClearColor = m_AttachmentClearValues[RTAttachmentRef.AttachmentIndex ].Color ;
18441844
18451845 RenderPassColorAttachments[RTIndex].clearValue = WGPUColor{ClearColor[0 ], ClearColor[1 ], ClearColor[2 ], ClearColor[3 ]};
18461846 }
@@ -1850,7 +1850,7 @@ void DeviceContextWebGPUImpl::CommitSubpassRenderTargets()
18501850 if (Subpass.pResolveAttachments != nullptr && Subpass.pResolveAttachments [RTIndex].AttachmentIndex != ATTACHMENT_UNUSED)
18511851 {
18521852 VERIFY_EXPR (Subpass.pResolveAttachments [RTIndex].AttachmentIndex < RPDesc.AttachmentCount );
1853- auto * pDstView = ClassPtrCast<TextureViewWebGPUImpl>(FBDesc.ppAttachments [Subpass.pResolveAttachments [RTIndex].AttachmentIndex ]);
1853+ TextureViewWebGPUImpl * pDstView = ClassPtrCast<TextureViewWebGPUImpl>(FBDesc.ppAttachments [Subpass.pResolveAttachments [RTIndex].AttachmentIndex ]);
18541854
18551855 RenderPassColorAttachments[RTIndex].resolveTarget = pDstView->GetWebGPUTextureView ();
18561856 }
@@ -1872,13 +1872,13 @@ void DeviceContextWebGPUImpl::CommitSubpassRenderTargets()
18721872 WGPURenderPassDepthStencilAttachment RenderPassDepthStencilAttachment{};
18731873 if (m_pBoundDepthStencil)
18741874 {
1875- const auto & DSAttachmentRef = *Subpass.pDepthStencilAttachment ;
1875+ const AttachmentReference & DSAttachmentRef = *Subpass.pDepthStencilAttachment ;
18761876 VERIFY_EXPR (Subpass.pDepthStencilAttachment != nullptr && DSAttachmentRef.AttachmentIndex != ATTACHMENT_UNUSED);
18771877 VERIFY (m_pBoundDepthStencil == (DSAttachmentRef.State == RESOURCE_STATE_DEPTH_READ ? m_pBoundFramebuffer->GetReadOnlyDSV (m_SubpassIndex) : FBDesc.ppAttachments [DSAttachmentRef.AttachmentIndex ]),
18781878 " Depth-stencil buffer in the device context is inconsistent with the framebuffer" );
1879- const auto FirstLastUse = m_pActiveRenderPass->GetAttachmentFirstLastUse (DSAttachmentRef.AttachmentIndex );
1880- const auto & DSAttachmentDesc = RPDesc.pAttachments [DSAttachmentRef.AttachmentIndex ];
1881- const auto FormatAttribs = GetTextureFormatAttribs (DSAttachmentDesc.Format );
1879+ const auto FirstLastUse = m_pActiveRenderPass->GetAttachmentFirstLastUse (DSAttachmentRef.AttachmentIndex );
1880+ const RenderPassAttachmentDesc & DSAttachmentDesc = RPDesc.pAttachments [DSAttachmentRef.AttachmentIndex ];
1881+ const TextureFormatAttribs FormatAttribs = GetTextureFormatAttribs (DSAttachmentDesc.Format );
18821882
18831883 RenderPassDepthStencilAttachment.view = m_pBoundDepthStencil->GetWebGPUTextureView ();
18841884 if (FirstLastUse.first == m_SubpassIndex)
@@ -1946,7 +1946,7 @@ void DeviceContextWebGPUImpl::ClearAttachment(Int32 RTIndex,
19461946 // How to clear integer texture view?
19471947 VERIFY_EXPR (m_wgpuRenderPassEncoder);
19481948
1949- auto & AttachmentCleaner = m_pDevice->GetAttachmentCleaner ();
1949+ AttachmentCleanerWebGPU & AttachmentCleaner = m_pDevice->GetAttachmentCleaner ();
19501950
19511951 AttachmentCleanerWebGPU::RenderPassInfo RPInfo{};
19521952 RPInfo.NumRenderTargets = m_NumBoundRenderTargets;
@@ -2023,7 +2023,7 @@ WGPURenderPassEncoder DeviceContextWebGPUImpl::PrepareForDraw(DRAW_FLAGS Flags)
20232023 m_EncoderState.SetUpToDate (WebGPUEncoderState::CMD_ENCODER_STATE_STENCIL_REF);
20242024 }
20252025
2026- if (auto CommitSRBMask = m_BindInfo.GetCommitMask (Flags & DRAW_FLAG_DYNAMIC_RESOURCE_BUFFERS_INTACT))
2026+ if (CommittedShaderResources::SRBMaskType CommitSRBMask = m_BindInfo.GetCommitMask (Flags & DRAW_FLAG_DYNAMIC_RESOURCE_BUFFERS_INTACT))
20272027 CommitBindGroups (wgpuRenderCmdEncoder, CommitSRBMask);
20282028
20292029 return wgpuRenderCmdEncoder;
@@ -2050,7 +2050,7 @@ WGPUComputePassEncoder DeviceContextWebGPUImpl::PrepareForDispatchCompute()
20502050 if (!m_EncoderState.IsUpToDate (WebGPUEncoderState::CMD_ENCODER_STATE_PIPELINE_STATE))
20512051 CommitComputePSO (wgpuComputeCmdEncoder);
20522052
2053- if (auto CommitSRBMask = m_BindInfo.GetCommitMask ())
2053+ if (CommittedShaderResources::SRBMaskType CommitSRBMask = m_BindInfo.GetCommitMask ())
20542054 CommitBindGroups (wgpuComputeCmdEncoder, CommitSRBMask);
20552055
20562056 return wgpuComputeCmdEncoder;
@@ -2066,7 +2066,7 @@ WGPUBuffer DeviceContextWebGPUImpl::PrepareForIndirectCommand(IBuffer* pAttribsB
20662066 if (wgpuIndirectBuffer == nullptr )
20672067 {
20682068 VERIFY_EXPR (pAttribsBufferWebGPU->GetDesc ().Usage == USAGE_DYNAMIC);
2069- const auto & DynamicAlloc = pAttribsBufferWebGPU->GetDynamicAllocation (GetContextId ());
2069+ const DynamicMemoryManagerWebGPU::Allocation & DynamicAlloc = pAttribsBufferWebGPU->GetDynamicAllocation (GetContextId ());
20702070
20712071 wgpuIndirectBuffer = DynamicAlloc.wgpuBuffer ;
20722072 IdirectBufferOffset += DynamicAlloc.Offset ;
@@ -2083,9 +2083,9 @@ void DeviceContextWebGPUImpl::CommitGraphicsPSO(WGPURenderPassEncoder CmdEncoder
20832083 WGPURenderPipeline wgpuPipeline = m_pPipelineState->GetWebGPURenderPipeline ();
20842084 wgpuRenderPassEncoderSetPipeline (CmdEncoder, wgpuPipeline);
20852085
2086- const auto & GraphicsPipeline = m_pPipelineState->GetGraphicsPipelineDesc ();
2087- const auto & BlendDesc = GraphicsPipeline.BlendDesc ;
2088- const auto & DepthDesc = GraphicsPipeline.DepthStencilDesc ;
2086+ const GraphicsPipelineDesc& GraphicsPipeline = m_pPipelineState->GetGraphicsPipelineDesc ();
2087+ const BlendStateDesc& BlendDesc = GraphicsPipeline.BlendDesc ;
2088+ const DepthStencilStateDesc & DepthDesc = GraphicsPipeline.DepthStencilDesc ;
20892089
20902090 m_EncoderState.SetUpToDate (WebGPUEncoderState::CMD_ENCODER_STATE_PIPELINE_STATE);
20912091
@@ -2183,8 +2183,8 @@ void DeviceContextWebGPUImpl::CommitViewports(WGPURenderPassEncoder CmdEncoder)
21832183
21842184 for (Uint32 ViewportIdx = 0 ; ViewportIdx < m_NumViewports; ++ViewportIdx)
21852185 {
2186- const auto & RHS = m_Viewports[ViewportIdx];
2187- const auto & LHS = m_EncoderState.Viewports [ViewportIdx];
2186+ const Viewport & RHS = m_Viewports[ViewportIdx];
2187+ const Viewport & LHS = m_EncoderState.Viewports [ViewportIdx];
21882188
21892189 if (LHS != RHS)
21902190 {
@@ -2217,8 +2217,8 @@ void DeviceContextWebGPUImpl::CommitScissorRects(WGPURenderPassEncoder CmdEncode
22172217 bool UpdateScissorRects = false ;
22182218
22192219 auto UpdateWebGPUScissorRect = [&](const Rect& LHS, Rect& RHS) {
2220- const auto ScissorWidth = std::max (std::min (LHS.right - LHS.left , static_cast <Int32>(m_FramebufferWidth) - LHS.left ), 0 );
2221- const auto ScissorHeight = std::max (std::min (LHS.bottom - LHS.top , static_cast <Int32>(m_FramebufferHeight) - LHS.top ), 0 );
2220+ const int ScissorWidth = std::max (std::min (LHS.right - LHS.left , static_cast <Int32>(m_FramebufferWidth) - LHS.left ), 0 );
2221+ const int ScissorHeight = std::max (std::min (LHS.bottom - LHS.top , static_cast <Int32>(m_FramebufferHeight) - LHS.top ), 0 );
22222222
22232223 // clang-format off
22242224 if (RHS.left != LHS.left ||
@@ -2251,7 +2251,7 @@ void DeviceContextWebGPUImpl::CommitScissorRects(WGPURenderPassEncoder CmdEncode
22512251 UpdateWebGPUScissorRect (ScreenSizeRect, m_EncoderState.ScissorRects [i]);
22522252 }
22532253
2254- for (auto i = NumScissors; i < m_EncoderState.ScissorRects .size (); ++i)
2254+ for (Uint32 i = NumScissors; i < m_EncoderState.ScissorRects .size (); ++i)
22552255 m_EncoderState.ScissorRects [i] = Rect{};
22562256
22572257 if (UpdateScissorRects)
0 commit comments