Skip to content

Commit 1095b7e

Browse files
VulkanTypeConversions: don't use auto where not necessary
1 parent d401492 commit 1095b7e

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

Graphics/GraphicsEngineVulkan/src/VulkanTypeConversions.cpp

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -961,8 +961,8 @@ void BlendStateDesc_To_VkBlendStateCI(const BlendStateDesc&
961961
// attachmentCount must equal the colorAttachmentCount for the subpass in which this pipeline is used.
962962
for (uint32_t attachment = 0; attachment < ColorBlendStateCI.attachmentCount; ++attachment)
963963
{
964-
const auto& RTBlendState = BSDesc.IndependentBlendEnable ? BSDesc.RenderTargets[attachment] : BSDesc.RenderTargets[0];
965-
ColorBlendAttachments[attachment] = RenderTargetBlendDescToVkColorBlendAttachmentState(RTBlendState);
964+
const RenderTargetBlendDesc& RTBlendState = BSDesc.IndependentBlendEnable ? BSDesc.RenderTargets[attachment] : BSDesc.RenderTargets[0];
965+
ColorBlendAttachments[attachment] = RenderTargetBlendDescToVkColorBlendAttachmentState(RTBlendState);
966966
}
967967
}
968968

@@ -1008,31 +1008,31 @@ void InputLayoutDesc_To_VkVertexInputStateCI(const InputLayoutDesc&
10081008
BufferSlot2BindingDescInd.fill(-1);
10091009
for (Uint32 elem = 0; elem < LayoutDesc.NumElements; ++elem)
10101010
{
1011-
auto& LayoutElem = LayoutDesc.LayoutElements[elem];
1012-
auto& BindingDescInd = BufferSlot2BindingDescInd[LayoutElem.BufferSlot];
1011+
const LayoutElement& LayoutElem = LayoutDesc.LayoutElements[elem];
1012+
Int32& BindingDescInd = BufferSlot2BindingDescInd[LayoutElem.BufferSlot];
10131013
if (BindingDescInd < 0)
10141014
{
1015-
BindingDescInd = VertexInputStateCI.vertexBindingDescriptionCount++;
1016-
auto& BindingDesc = BindingDescriptions[BindingDescInd];
1015+
BindingDescInd = VertexInputStateCI.vertexBindingDescriptionCount++;
1016+
VkVertexInputBindingDescription& BindingDesc{BindingDescriptions[BindingDescInd]};
10171017
BindingDesc.binding = LayoutElem.BufferSlot;
10181018
BindingDesc.stride = LayoutElem.Stride;
10191019
BindingDesc.inputRate = LayoutElemFrequencyToVkInputRate(LayoutElem.Frequency);
10201020
}
10211021

1022-
const auto& BindingDesc = BindingDescriptions[BindingDescInd];
1022+
const VkVertexInputBindingDescription& BindingDesc = BindingDescriptions[BindingDescInd];
10231023
VERIFY(BindingDesc.binding == LayoutElem.BufferSlot, "Inconsistent buffer slot");
10241024
VERIFY(BindingDesc.stride == LayoutElem.Stride, "Inconsistent strides");
10251025
VERIFY(BindingDesc.inputRate == LayoutElemFrequencyToVkInputRate(LayoutElem.Frequency), "Inconsistent layout element frequency");
10261026

1027-
auto& AttribDesc = AttributeDescription[elem];
1027+
VkVertexInputAttributeDescription& AttribDesc{AttributeDescription[elem]};
10281028
AttribDesc.binding = BindingDesc.binding;
10291029
AttribDesc.location = LayoutElem.InputIndex;
10301030
AttribDesc.format = TypeToVkFormat(LayoutElem.ValueType, LayoutElem.NumComponents, LayoutElem.IsNormalized);
10311031
AttribDesc.offset = LayoutElem.RelativeOffset;
10321032

10331033
if (LayoutElem.Frequency == INPUT_ELEMENT_FREQUENCY_PER_INSTANCE && LayoutElem.InstanceDataStepRate != 1)
10341034
{
1035-
auto& AttribDivisor = VertexBindingDivisors[VertexInputDivisorCI.vertexBindingDivisorCount++];
1035+
VkVertexInputBindingDivisorDescriptionEXT& AttribDivisor{VertexBindingDivisors[VertexInputDivisorCI.vertexBindingDivisorCount++]};
10361036
AttribDivisor.binding = BindingDesc.binding;
10371037
AttribDivisor.divisor = LayoutElem.InstanceDataStepRate;
10381038
}
@@ -1240,7 +1240,7 @@ VkPipelineStageFlags ResourceStateFlagsToVkPipelineStageFlags(RESOURCE_STATE Sta
12401240
VkPipelineStageFlags vkPipelineStages = 0;
12411241
while (StateFlags != RESOURCE_STATE_UNKNOWN)
12421242
{
1243-
auto StateBit = ExtractLSB(StateFlags);
1243+
RESOURCE_STATE StateBit = ExtractLSB(StateFlags);
12441244
vkPipelineStages |= ResourceStateFlagToVkPipelineStage(StateBit);
12451245
}
12461246
return vkPipelineStages;
@@ -1304,7 +1304,7 @@ VkPipelineStageFlags ResourceStateFlagsToVkAccessFlags(RESOURCE_STATE StateFlags
13041304
VkAccessFlags AccessFlags = 0;
13051305
while (StateFlags != RESOURCE_STATE_UNKNOWN)
13061306
{
1307-
auto StateBit = ExtractLSB(StateFlags);
1307+
RESOURCE_STATE StateBit = ExtractLSB(StateFlags);
13081308
AccessFlags |= ResourceStateFlagToVkAccessFlags(StateBit);
13091309
}
13101310
return AccessFlags;
@@ -1320,7 +1320,7 @@ VkAccessFlags AccelStructStateFlagsToVkAccessFlags(RESOURCE_STATE StateFlags)
13201320
Uint32 Bits = StateFlags;
13211321
while (Bits != 0)
13221322
{
1323-
auto Bit = ExtractLSB(Bits);
1323+
Uint32 Bit = ExtractLSB(Bits);
13241324
switch (Bit)
13251325
{
13261326
// clang-format off
@@ -1406,7 +1406,7 @@ RESOURCE_STATE VkAccessFlagsToResourceStates(VkAccessFlags AccessFlags)
14061406
Uint32 State = 0;
14071407
while (AccessFlags != 0)
14081408
{
1409-
auto lsb = PlatformMisc::GetLSB(AccessFlags);
1409+
Uint32 lsb = PlatformMisc::GetLSB(AccessFlags);
14101410
State |= BitPosToState(lsb);
14111411
AccessFlags &= ~(1 << lsb);
14121412
}
@@ -1671,7 +1671,7 @@ VkShaderStageFlags ShaderTypesToVkShaderStageFlags(SHADER_TYPE ShaderTypes)
16711671
VkShaderStageFlags Result = 0;
16721672
while (ShaderTypes != SHADER_TYPE_UNKNOWN)
16731673
{
1674-
auto Type = ExtractLSB(ShaderTypes);
1674+
SHADER_TYPE Type = ExtractLSB(ShaderTypes);
16751675
Result |= ShaderTypeToVkShaderStageFlagBit(Type);
16761676
}
16771677
return Result;
@@ -1692,7 +1692,7 @@ SHADER_TYPE VkShaderStageFlagsToShaderTypes(VkShaderStageFlags StageFlags)
16921692
SHADER_TYPE Result = SHADER_TYPE_UNKNOWN;
16931693
while (StageFlags != 0)
16941694
{
1695-
auto Type = ExtractLSB(StageFlags);
1695+
VkShaderStageFlags Type = ExtractLSB(StageFlags);
16961696

16971697
static_assert(SHADER_TYPE_LAST == 0x4000, "Please update the switch below to handle the new shader type");
16981698
switch (Type)
@@ -1728,7 +1728,7 @@ VkBuildAccelerationStructureFlagsKHR BuildASFlagsToVkBuildAccelerationStructureF
17281728
VkBuildAccelerationStructureFlagsKHR Result = 0;
17291729
while (Flags != RAYTRACING_BUILD_AS_NONE)
17301730
{
1731-
auto FlagBit = ExtractLSB(Flags);
1731+
RAYTRACING_BUILD_AS_FLAGS FlagBit = ExtractLSB(Flags);
17321732
switch (FlagBit)
17331733
{
17341734
// clang-format off
@@ -1752,7 +1752,7 @@ VkGeometryFlagsKHR GeometryFlagsToVkGeometryFlags(RAYTRACING_GEOMETRY_FLAGS Flag
17521752
VkGeometryFlagsKHR Result = 0;
17531753
while (Flags != RAYTRACING_GEOMETRY_FLAG_NONE)
17541754
{
1755-
auto FlagBit = ExtractLSB(Flags);
1755+
RAYTRACING_GEOMETRY_FLAGS FlagBit = ExtractLSB(Flags);
17561756
switch (FlagBit)
17571757
{
17581758
// clang-format off
@@ -1773,7 +1773,7 @@ VkGeometryInstanceFlagsKHR InstanceFlagsToVkGeometryInstanceFlags(RAYTRACING_INS
17731773
VkGeometryInstanceFlagsKHR Result = 0;
17741774
while (Flags != RAYTRACING_INSTANCE_NONE)
17751775
{
1776-
auto FlagBit = ExtractLSB(Flags);
1776+
RAYTRACING_INSTANCE_FLAGS FlagBit = ExtractLSB(Flags);
17771777
switch (FlagBit)
17781778
{
17791779
// clang-format off
@@ -1810,7 +1810,7 @@ WAVE_FEATURE VkSubgroupFeatureFlagsToWaveFeatures(VkSubgroupFeatureFlags Feature
18101810
WAVE_FEATURE Result = WAVE_FEATURE_UNKNOWN;
18111811
while (FeatureFlags != 0)
18121812
{
1813-
auto Feature = ExtractLSB(FeatureFlags);
1813+
VkSubgroupFeatureFlags Feature = ExtractLSB(FeatureFlags);
18141814
static_assert(WAVE_FEATURE_LAST == WAVE_FEATURE_QUAD,
18151815
"Please update the switch below to handle the new wave feature");
18161816
switch (Feature)
@@ -1899,8 +1899,8 @@ VkExtent2D ShadingRateToVkFragmentSize(SHADING_RATE Rate)
18991899
SHADING_RATE VkFragmentSizeToShadingRate(const VkExtent2D& Size)
19001900
{
19011901
VERIFY_EXPR(IsPowerOfTwo(Size.width) && IsPowerOfTwo(Size.height));
1902-
auto X = PlatformMisc::GetMSB(Size.width);
1903-
auto Y = PlatformMisc::GetMSB(Size.height);
1902+
uint32_t X = PlatformMisc::GetMSB(Size.width);
1903+
uint32_t Y = PlatformMisc::GetMSB(Size.height);
19041904
VERIFY_EXPR((1u << X) == Size.width);
19051905
VERIFY_EXPR((1u << Y) == Size.height);
19061906
return static_cast<SHADING_RATE>((X << SHADING_RATE_X_SHIFT) | Y);
@@ -1939,7 +1939,7 @@ DeviceFeatures VkFeaturesToDeviceFeatures(uint32_t
19391939

19401940
// Enable features
19411941
#define INIT_FEATURE(FeatureName, Supported) \
1942-
Features.FeatureName = (Supported) ? OptionalState : DEVICE_FEATURE_STATE_DISABLED;
1942+
Features.FeatureName = (Supported) ? OptionalState : DEVICE_FEATURE_STATE_DISABLED
19431943

19441944
// The following features are always enabled
19451945
Features.SeparablePrograms = DEVICE_FEATURE_STATE_ENABLED;
@@ -1978,56 +1978,56 @@ DeviceFeatures VkFeaturesToDeviceFeatures(uint32_t
19781978
INIT_FEATURE(SparseResources, vkFeatures.sparseBinding && (vkFeatures.sparseResidencyBuffer || vkFeatures.sparseResidencyImage2D)); // requires support for resident resources
19791979
// clang-format on
19801980

1981-
const auto& MeshShaderFeats = ExtFeatures.MeshShader;
1981+
const VkPhysicalDeviceMeshShaderFeaturesEXT& MeshShaderFeats = ExtFeatures.MeshShader;
19821982
INIT_FEATURE(MeshShaders, MeshShaderFeats.taskShader != VK_FALSE && MeshShaderFeats.meshShader != VK_FALSE);
19831983

1984-
const auto& ShaderFloat16Int8Feats = ExtFeatures.ShaderFloat16Int8;
1984+
const VkPhysicalDeviceShaderFloat16Int8FeaturesKHR& ShaderFloat16Int8Feats = ExtFeatures.ShaderFloat16Int8;
19851985
// clang-format off
19861986
INIT_FEATURE(ShaderFloat16, ShaderFloat16Int8Feats.shaderFloat16 != VK_FALSE);
19871987
INIT_FEATURE(ShaderInt8, ShaderFloat16Int8Feats.shaderInt8 != VK_FALSE);
19881988
// clang-format on
19891989

1990-
const auto& Storage16BitFeats = ExtFeatures.Storage16Bit;
1990+
const VkPhysicalDevice16BitStorageFeaturesKHR& Storage16BitFeats = ExtFeatures.Storage16Bit;
19911991
// clang-format off
19921992
INIT_FEATURE(ResourceBuffer16BitAccess, Storage16BitFeats.storageBuffer16BitAccess != VK_FALSE && vkFeatures.shaderInt16 != VK_FALSE);
19931993
INIT_FEATURE(UniformBuffer16BitAccess, Storage16BitFeats.uniformAndStorageBuffer16BitAccess != VK_FALSE && vkFeatures.shaderInt16 != VK_FALSE);
19941994
INIT_FEATURE(ShaderInputOutput16, Storage16BitFeats.storageInputOutput16 != VK_FALSE && vkFeatures.shaderInt16 != VK_FALSE);
19951995
// clang-format on
19961996

1997-
const auto& Storage8BitFeats = ExtFeatures.Storage8Bit;
1997+
const VkPhysicalDevice8BitStorageFeaturesKHR& Storage8BitFeats = ExtFeatures.Storage8Bit;
19981998
// clang-format off
19991999
INIT_FEATURE(ResourceBuffer8BitAccess, Storage8BitFeats.storageBuffer8BitAccess != VK_FALSE);
20002000
INIT_FEATURE(UniformBuffer8BitAccess, Storage8BitFeats.uniformAndStorageBuffer8BitAccess != VK_FALSE);
20012001
// clang-format on
20022002

2003-
const auto& DescrIndexingFeats = ExtFeatures.DescriptorIndexing;
2003+
const VkPhysicalDeviceDescriptorIndexingFeaturesEXT& DescrIndexingFeats = ExtFeatures.DescriptorIndexing;
20042004
INIT_FEATURE(ShaderResourceRuntimeArrays, DescrIndexingFeats.runtimeDescriptorArray != VK_FALSE);
2005-
const auto& AccelStructFeats = ExtFeatures.AccelStruct;
2006-
const auto& RayTracingFeats = ExtFeatures.RayTracingPipeline;
2007-
const auto& RayQueryFeats = ExtFeatures.RayQuery;
2005+
const VkPhysicalDeviceAccelerationStructureFeaturesKHR& AccelStructFeats = ExtFeatures.AccelStruct;
2006+
const VkPhysicalDeviceRayTracingPipelineFeaturesKHR& RayTracingFeats = ExtFeatures.RayTracingPipeline;
2007+
const VkPhysicalDeviceRayQueryFeaturesKHR& RayQueryFeats = ExtFeatures.RayQuery;
20082008
// clang-format off
20092009
INIT_FEATURE(RayTracing,
20102010
vkVersion >= VK_API_VERSION_1_1 &&
20112011
AccelStructFeats.accelerationStructure != VK_FALSE &&
20122012
(RayTracingFeats.rayTracingPipeline != VK_FALSE || RayQueryFeats.rayQuery != VK_FALSE));
20132013
// clang-format on
20142014

2015-
const auto& SubgroupProps = ExtProps.Subgroup;
2016-
const auto RequiredSubgroupFeats = VK_SUBGROUP_FEATURE_BASIC_BIT;
2017-
const auto RequiredSubgroupStages = VK_SHADER_STAGE_COMPUTE_BIT;
2015+
const VkPhysicalDeviceSubgroupProperties& SubgroupProps = ExtProps.Subgroup;
2016+
const VkSubgroupFeatureFlagBits RequiredSubgroupFeats = VK_SUBGROUP_FEATURE_BASIC_BIT;
2017+
const VkShaderStageFlagBits RequiredSubgroupStages = VK_SHADER_STAGE_COMPUTE_BIT;
20182018
Features.WaveOp =
20192019
(vkVersion >= VK_API_VERSION_1_1 &&
20202020
(SubgroupProps.supportedOperations & RequiredSubgroupFeats) == RequiredSubgroupFeats &&
20212021
(SubgroupProps.supportedStages & RequiredSubgroupStages) == RequiredSubgroupStages) ?
20222022
DEVICE_FEATURE_STATE_ENABLED :
20232023
DEVICE_FEATURE_STATE_DISABLED;
20242024

2025-
const auto& VertexAttribDivisorFeats = ExtFeatures.VertexAttributeDivisor;
2025+
const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT& VertexAttribDivisorFeats = ExtFeatures.VertexAttributeDivisor;
20262026
INIT_FEATURE(InstanceDataStepRate,
20272027
(VertexAttribDivisorFeats.vertexAttributeInstanceRateDivisor != VK_FALSE &&
20282028
VertexAttribDivisorFeats.vertexAttributeInstanceRateZeroDivisor != VK_FALSE));
20292029

2030-
const auto& TimelineSemaphoreFeats = ExtFeatures.TimelineSemaphore;
2030+
const VkPhysicalDeviceTimelineSemaphoreFeaturesKHR& TimelineSemaphoreFeats = ExtFeatures.TimelineSemaphore;
20312031
INIT_FEATURE(NativeFence,
20322032
TimelineSemaphoreFeats.timelineSemaphore != VK_FALSE);
20332033

@@ -2064,7 +2064,7 @@ SPARSE_TEXTURE_FLAGS VkSparseImageFormatFlagsToSparseTextureFlags(VkSparseImageF
20642064
SPARSE_TEXTURE_FLAGS Result = SPARSE_TEXTURE_FLAG_NONE;
20652065
while (Flags != 0)
20662066
{
2067-
auto FlagBit = static_cast<VkSparseImageFormatFlagBits>(ExtractLSB(Flags));
2067+
VkSparseImageFormatFlagBits FlagBit = static_cast<VkSparseImageFormatFlagBits>(ExtractLSB(Flags));
20682068
static_assert(SPARSE_TEXTURE_FLAG_LAST == (1u << 2), "This function must be updated to handle new sparse texture flag");
20692069
switch (FlagBit)
20702070
{
@@ -2085,7 +2085,7 @@ VkImageUsageFlags BindFlagsToVkImageUsage(BIND_FLAGS Flags, bool IsMemoryless, b
20852085
VkImageUsageFlags Result = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
20862086
while (Flags != BIND_NONE)
20872087
{
2088-
auto FlagBit = ExtractLSB(Flags);
2088+
BIND_FLAGS FlagBit = ExtractLSB(Flags);
20892089
static_assert(BIND_FLAG_LAST == (1u << 11), "This function must be updated to handle new bind flag");
20902090
switch (FlagBit)
20912091
{
@@ -2127,7 +2127,7 @@ void GetAllowedStagesAndAccessMask(BIND_FLAGS Flags, VkPipelineStageFlags& Stage
21272127
AccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT;
21282128
while (Flags != BIND_NONE)
21292129
{
2130-
auto FlagBit = ExtractLSB(Flags);
2130+
BIND_FLAGS FlagBit = ExtractLSB(Flags);
21312131
static_assert(BIND_FLAG_LAST == (1u << 11), "This function must be updated to handle new bind flag");
21322132
switch (FlagBit)
21332133
{

0 commit comments

Comments
 (0)