Skip to content

Commit 0f5c8e3

Browse files
RenderDeviceVkImpl: don't use auto where not necessary
1 parent a5a85e4 commit 0f5c8e3

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 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");
@@ -148,9 +148,9 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters*
148148
{
149149
static_assert(sizeof(VulkanDescriptorPoolSize) == sizeof(Uint32) * 11, "Please add new descriptors to m_DescriptorSetAllocator and m_DynamicDescriptorPool constructors");
150150

151-
const auto vkVersion = m_PhysicalDevice->GetVkVersion();
152-
m_DeviceInfo.Type = RENDER_DEVICE_TYPE_VULKAN;
153-
m_DeviceInfo.APIVersion = Version{VK_API_VERSION_MAJOR(vkVersion), VK_API_VERSION_MINOR(vkVersion)};
151+
const uint32_t vkVersion = m_PhysicalDevice->GetVkVersion();
152+
m_DeviceInfo.Type = RENDER_DEVICE_TYPE_VULKAN;
153+
m_DeviceInfo.APIVersion = Version{VK_API_VERSION_MAJOR(vkVersion), VK_API_VERSION_MINOR(vkVersion)};
154154

155155
m_DeviceInfo.Features = VkFeaturesToDeviceFeatures(vkVersion,
156156
m_LogicalVkDevice->GetEnabledFeatures(),
@@ -173,7 +173,7 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters*
173173
m_QueryMgrs.reserve(CommandQueueCount);
174174
for (Uint32 q = 0; q < CommandQueueCount; ++q)
175175
{
176-
auto QueueFamilyIndex = HardwareQueueIndex{GetCommandQueue(SoftwareQueueIndex{q}).GetQueueFamilyIndex()};
176+
const HardwareQueueIndex QueueFamilyIndex{GetCommandQueue(SoftwareQueueIndex{q}).GetQueueFamilyIndex()};
177177

178178
if (m_TransientCmdPoolMgrs.find(QueueFamilyIndex) == m_TransientCmdPoolMgrs.end())
179179
{
@@ -239,8 +239,8 @@ void RenderDeviceVkImpl::AllocateTransientCmdPool(SoftwareQueueIndex
239239
VulkanUtilities::VulkanCommandBuffer& CmdBuffer,
240240
const Char* DebugPoolName)
241241
{
242-
auto QueueFamilyIndex = HardwareQueueIndex{GetCommandQueue(CommandQueueId).GetQueueFamilyIndex()};
243-
auto CmdPoolMgrIter = m_TransientCmdPoolMgrs.find(QueueFamilyIndex);
242+
HardwareQueueIndex QueueFamilyIndex{GetCommandQueue(CommandQueueId).GetQueueFamilyIndex()};
243+
auto CmdPoolMgrIter = m_TransientCmdPoolMgrs.find(QueueFamilyIndex);
244244
VERIFY(CmdPoolMgrIter != m_TransientCmdPoolMgrs.end(),
245245
"Con not find transient command pool manager for queue family index (", Uint32{QueueFamilyIndex}, ")");
246246

@@ -254,7 +254,7 @@ void RenderDeviceVkImpl::AllocateTransientCmdPool(SoftwareQueueIndex
254254
BuffAllocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
255255
BuffAllocInfo.commandBufferCount = 1;
256256

257-
auto vkCmdBuff = m_LogicalVkDevice->AllocateVkCommandBuffer(BuffAllocInfo);
257+
VkCommandBuffer vkCmdBuff = m_LogicalVkDevice->AllocateVkCommandBuffer(BuffAllocInfo);
258258
DEV_CHECK_ERR(vkCmdBuff != VK_NULL_HANDLE, "Failed to allocate Vulkan command buffer");
259259

260260

@@ -266,7 +266,7 @@ void RenderDeviceVkImpl::AllocateTransientCmdPool(SoftwareQueueIndex
266266
// and recorded again between each submission.
267267
CmdBuffBeginInfo.pInheritanceInfo = nullptr; // Ignored for a primary command buffer
268268

269-
auto err = vkBeginCommandBuffer(vkCmdBuff, &CmdBuffBeginInfo);
269+
VkResult err = vkBeginCommandBuffer(vkCmdBuff, &CmdBuffBeginInfo);
270270
DEV_CHECK_ERR(err == VK_SUCCESS, "vkBeginCommandBuffer() failed");
271271
(void)err;
272272

@@ -282,7 +282,7 @@ void RenderDeviceVkImpl::ExecuteAndDisposeTransientCmdBuff(SoftwareQueueIndex
282282
{
283283
VERIFY_EXPR(vkCmdBuff != VK_NULL_HANDLE);
284284

285-
auto err = vkEndCommandBuffer(vkCmdBuff);
285+
VkResult err = vkEndCommandBuffer(vkCmdBuff);
286286
DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to end command buffer");
287287
(void)err;
288288

@@ -370,8 +370,8 @@ void RenderDeviceVkImpl::ExecuteAndDisposeTransientCmdBuff(SoftwareQueueIndex
370370
VkCommandBuffer vkCmdBuffer = VK_NULL_HANDLE;
371371
};
372372

373-
auto QueueFamilyIndex = HardwareQueueIndex{GetCommandQueue(CommandQueueId).GetQueueFamilyIndex()};
374-
auto CmdPoolMgrIter = m_TransientCmdPoolMgrs.find(QueueFamilyIndex);
373+
HardwareQueueIndex QueueFamilyIndex{GetCommandQueue(CommandQueueId).GetQueueFamilyIndex()};
374+
auto CmdPoolMgrIter = m_TransientCmdPoolMgrs.find(QueueFamilyIndex);
375375
VERIFY(CmdPoolMgrIter != m_TransientCmdPoolMgrs.end(),
376376
"Unable to find transient command pool manager for queue family index ", Uint32{QueueFamilyIndex}, ".");
377377

@@ -398,14 +398,14 @@ void RenderDeviceVkImpl::SubmitCommandBuffer(SoftwareQueueIndex
398398
)
399399
{
400400
// Submit the command list to the queue
401-
auto CmbBuffInfo = TRenderDeviceBase::SubmitCommandBuffer(CommandQueueId, true, SubmitInfo);
402-
SubmittedFenceValue = CmbBuffInfo.FenceValue;
403-
SubmittedCmdBuffNumber = CmbBuffInfo.CmdBufferNumber;
401+
SubmittedCommandBufferInfo CmbBuffInfo = TRenderDeviceBase::SubmitCommandBuffer(CommandQueueId, true, SubmitInfo);
402+
SubmittedFenceValue = CmbBuffInfo.FenceValue;
403+
SubmittedCmdBuffNumber = CmbBuffInfo.CmdBufferNumber;
404404

405405
if (pSignalFences != nullptr && !pSignalFences->empty())
406406
{
407-
auto* pQueue = m_CommandQueues[CommandQueueId].CmdQueue.RawPtr<CommandQueueVkImpl>();
408-
auto pSyncPoint = pQueue->GetLastSyncPoint();
407+
CommandQueueVkImpl* pQueue = m_CommandQueues[CommandQueueId].CmdQueue.RawPtr<CommandQueueVkImpl>();
408+
SyncPointVkPtr pSyncPoint = pQueue->GetLastSyncPoint();
409409

410410
for (auto& val_fence : *pSignalFences)
411411
{
@@ -457,13 +457,13 @@ void RenderDeviceVkImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
457457
auto& TexFormatInfo = m_TextureFormatsInfo[TexFormat];
458458
VERIFY(TexFormatInfo.Supported, "Texture format is not supported");
459459

460-
auto vkPhysicalDevice = m_PhysicalDevice->GetVkDeviceHandle();
460+
VkPhysicalDevice vkPhysicalDevice = m_PhysicalDevice->GetVkDeviceHandle();
461461

462462
auto CheckFormatProperties =
463463
[vkPhysicalDevice](VkFormat vkFmt, VkImageType vkImgType, VkImageUsageFlags vkUsage, VkImageFormatProperties& ImgFmtProps) //
464464
{
465-
auto err = vkGetPhysicalDeviceImageFormatProperties(vkPhysicalDevice, vkFmt, vkImgType, VK_IMAGE_TILING_OPTIMAL,
466-
vkUsage, 0, &ImgFmtProps);
465+
VkResult err = vkGetPhysicalDeviceImageFormatProperties(vkPhysicalDevice, vkFmt, vkImgType, VK_IMAGE_TILING_OPTIMAL,
466+
vkUsage, 0, &ImgFmtProps);
467467
return err == VK_SUCCESS;
468468
};
469469

@@ -472,7 +472,7 @@ void RenderDeviceVkImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
472472
TexFormatInfo.Dimensions = RESOURCE_DIMENSION_SUPPORT_NONE;
473473

474474
{
475-
auto SRVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_SHADER_RESOURCE, BIND_SHADER_RESOURCE);
475+
TEXTURE_FORMAT SRVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_SHADER_RESOURCE, BIND_SHADER_RESOURCE);
476476
if (SRVFormat != TEX_FORMAT_UNKNOWN)
477477
{
478478
VkFormat vkSrvFormat = TexFormatToVkFormat(SRVFormat);
@@ -495,8 +495,8 @@ void RenderDeviceVkImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
495495
TexFormatInfo.Dimensions |= RESOURCE_DIMENSION_SUPPORT_TEX_3D;
496496

497497
{
498-
auto err = vkGetPhysicalDeviceImageFormatProperties(vkPhysicalDevice, vkSrvFormat, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
499-
VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, &ImgFmtProps);
498+
VkResult err = vkGetPhysicalDeviceImageFormatProperties(vkPhysicalDevice, vkSrvFormat, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL,
499+
VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, &ImgFmtProps);
500500
if (err == VK_SUCCESS)
501501
TexFormatInfo.Dimensions |= RESOURCE_DIMENSION_SUPPORT_TEX_CUBE | RESOURCE_DIMENSION_SUPPORT_TEX_CUBE_ARRAY;
502502
}
@@ -505,7 +505,7 @@ void RenderDeviceVkImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
505505
}
506506

507507
{
508-
auto RTVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_RENDER_TARGET, BIND_RENDER_TARGET);
508+
TEXTURE_FORMAT RTVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_RENDER_TARGET, BIND_RENDER_TARGET);
509509
if (RTVFormat != TEX_FORMAT_UNKNOWN)
510510
{
511511
VkFormat vkRtvFormat = TexFormatToVkFormat(RTVFormat);
@@ -525,7 +525,7 @@ void RenderDeviceVkImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
525525
}
526526

527527
{
528-
auto DSVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_DEPTH_STENCIL, BIND_DEPTH_STENCIL);
528+
TEXTURE_FORMAT DSVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_DEPTH_STENCIL, BIND_DEPTH_STENCIL);
529529
if (DSVFormat != TEX_FORMAT_UNKNOWN)
530530
{
531531
VkFormat vkDsvFormat = TexFormatToVkFormat(DSVFormat);
@@ -546,7 +546,7 @@ void RenderDeviceVkImpl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
546546
}
547547

548548
{
549-
auto UAVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_UNORDERED_ACCESS, BIND_DEPTH_STENCIL);
549+
TEXTURE_FORMAT UAVFormat = GetDefaultTextureViewFormat(TexFormat, TEXTURE_VIEW_UNORDERED_ACCESS, BIND_DEPTH_STENCIL);
550550
if (UAVFormat != TEX_FORMAT_UNKNOWN)
551551
{
552552
VkFormat vkUavFormat = TexFormatToVkFormat(UAVFormat);
@@ -742,11 +742,11 @@ std::vector<uint32_t> RenderDeviceVkImpl::ConvertCmdQueueIdsToQueueFamilies(Uint
742742
std::vector<uint32_t> QueueFamilyIndices;
743743
while (CommandQueueMask != 0)
744744
{
745-
auto CmdQueueInd = PlatformMisc::GetLSB(CommandQueueMask);
745+
Uint64 CmdQueueInd = PlatformMisc::GetLSB(CommandQueueMask);
746746
CommandQueueMask &= ~(Uint64{1} << Uint64{CmdQueueInd});
747747

748-
auto& CmdQueue = GetCommandQueue(SoftwareQueueIndex{CmdQueueInd});
749-
auto FamilyIndex = CmdQueue.GetQueueFamilyIndex();
748+
const ICommandQueueVk& CmdQueue = GetCommandQueue(SoftwareQueueIndex{CmdQueueInd});
749+
uint32_t FamilyIndex = CmdQueue.GetQueueFamilyIndex();
750750
if (!QueueFamilyBits[FamilyIndex])
751751
{
752752
QueueFamilyBits[FamilyIndex] = true;
@@ -758,23 +758,23 @@ std::vector<uint32_t> RenderDeviceVkImpl::ConvertCmdQueueIdsToQueueFamilies(Uint
758758

759759
HardwareQueueIndex RenderDeviceVkImpl::GetQueueFamilyIndex(SoftwareQueueIndex CmdQueueInd) const
760760
{
761-
const auto& CmdQueue = GetCommandQueue(SoftwareQueueIndex{CmdQueueInd});
761+
const ICommandQueueVk& CmdQueue = GetCommandQueue(SoftwareQueueIndex{CmdQueueInd});
762762
return HardwareQueueIndex{CmdQueue.GetQueueFamilyIndex()};
763763
}
764764

765765
SparseTextureFormatInfo RenderDeviceVkImpl::GetSparseTextureFormatInfo(TEXTURE_FORMAT TexFormat,
766766
RESOURCE_DIMENSION Dimension,
767767
Uint32 SampleCount) const
768768
{
769-
const auto ComponentType = CheckSparseTextureFormatSupport(TexFormat, Dimension, SampleCount, m_AdapterInfo.SparseResources);
769+
const COMPONENT_TYPE ComponentType = CheckSparseTextureFormatSupport(TexFormat, Dimension, SampleCount, m_AdapterInfo.SparseResources);
770770
if (ComponentType == COMPONENT_TYPE_UNDEFINED)
771771
return {};
772772

773-
const auto vkDevice = m_PhysicalDevice->GetVkDeviceHandle();
774-
const auto vkType = Dimension == RESOURCE_DIM_TEX_3D ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
775-
const auto vkFormat = TexFormatToVkFormat(TexFormat);
776-
const auto vkDefaultUsage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
777-
const auto vkSampleCount = static_cast<VkSampleCountFlagBits>(SampleCount);
773+
const VkPhysicalDevice vkDevice = m_PhysicalDevice->GetVkDeviceHandle();
774+
const VkImageType vkType = Dimension == RESOURCE_DIM_TEX_3D ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
775+
const VkFormat vkFormat = TexFormatToVkFormat(TexFormat);
776+
const VkImageUsageFlags vkDefaultUsage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
777+
const VkSampleCountFlagBits vkSampleCount = static_cast<VkSampleCountFlagBits>(SampleCount);
778778

779779
// Texture with depth-stencil format may be implemented with two memory blocks per tile.
780780
VkSparseImageFormatProperties FmtProps[2] = {};

0 commit comments

Comments
 (0)