From dcab2751ded72dbdb066e51eabc8fb7d931a704b Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 14:40:29 -0700 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFAtom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Processing/PixelFormatInfo.h | 2 +- .../Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h | 2 +- .../Feature/CoreLights/DiskLightFeatureProcessorInterface.h | 2 +- .../Code/Include/Atom/Feature/Material/MaterialAssignmentId.h | 2 +- .../TransformService/TransformServiceFeatureProcessor.h | 2 +- .../Code/Include/Atom/Feature/Utils/MultiSparseVector.h | 4 ++-- .../Common/Code/Include/Atom/Feature/Utils/SparseVector.h | 4 ++-- .../Common/Code/Source/CoreLights/LightCullingPass.cpp | 4 ++-- .../Feature/Common/Code/Source/CoreLights/LightCullingPass.h | 2 +- .../Common/Code/Source/CoreLights/LightCullingRemap.cpp | 2 +- .../Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h | 2 +- .../Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h | 4 ++-- .../RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h | 2 +- .../RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h | 2 +- Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp | 4 ++-- Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp | 2 +- Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp | 2 +- Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h | 2 +- .../RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h | 2 +- .../Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h | 2 +- .../Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h | 2 +- Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h | 2 +- 22 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h index 50d7ea137f..ec1ec1bfaf 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h @@ -82,7 +82,7 @@ namespace ImageProcessingAtom } else // The value is zero { - Exponent = -112; + Exponent = static_cast(-112); } Result = ((h & 0x8000) << 16) | // Sign diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h b/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h index d5e5c7132c..fd34251277 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/CommonTypes.h @@ -278,7 +278,7 @@ namespace AZ { AZ::Name m_nameId; uint32_t m_sizeInBytes = 0; - uint32_t m_space = -1; + uint32_t m_space = std::numeric_limits::max(); uint32_t m_registerId = RHI::UndefinedRegisterSlot; }; } // ShaderBuilder diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h index e4986eee93..bcb470d831 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/CoreLights/DiskLightFeatureProcessorInterface.h @@ -38,7 +38,7 @@ namespace AZ float m_cosInnerConeAngle = 0.0f; // cosine of inner cone angle float m_cosOuterConeAngle = 0.0f; // cosine of outer cone angle float m_bulbPositionOffset = 0.0f; // Distance from the light disk surface to the tip of the cone of the light. m_bulbRadius * tanf(pi/2 - m_outerConeAngle). - uint16_t m_shadowIndex = -1; // index for ProjectedShadowData. A value of 0xFFFF indicates an illegal index. + uint16_t m_shadowIndex = std::numeric_limits::max(); // index for ProjectedShadowData. A value of 0xFFFF indicates an illegal index. uint16_t m_padding; // Explicit padding. }; diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h index e58a8397db..599f4c380e 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Material/MaterialAssignmentId.h @@ -64,7 +64,7 @@ namespace AZ bool operator==(const MaterialAssignmentId& rhs) const; bool operator!=(const MaterialAssignmentId& rhs) const; - static constexpr MaterialAssignmentLodIndex NonLodIndex = -1; + static constexpr MaterialAssignmentLodIndex NonLodIndex = std::numeric_limits::max(); MaterialAssignmentLodIndex m_lodIndex = NonLodIndex; RPI::ModelMaterialSlot::StableId m_materialSlotStableId = RPI::ModelMaterialSlot::InvalidStableId; diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h index 1f31701d91..6482871234 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/TransformService/TransformServiceFeatureProcessor.h @@ -61,7 +61,7 @@ namespace AZ }; // Flag value for when the buffers have no empty spaces. - static const uint32_t NoAvailableTransformIndices = -1; + static const uint32_t NoAvailableTransformIndices = std::numeric_limits::max(); TransformServiceFeatureProcessor(const TransformServiceFeatureProcessor&) = delete; diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h index 2d93b4a7fd..216e90c594 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/MultiSparseVector.h @@ -49,7 +49,7 @@ namespace AZ::Render private: - static constexpr size_t NoFreeSlot = -1; + static constexpr size_t NoFreeSlot = std::numeric_limits::max(); static constexpr size_t InitialReservedCount = 128; using Fn = void(&)(AZStd::vector& ...); @@ -103,7 +103,7 @@ namespace AZ::Render template inline size_t MultiSparseVector::Reserve() { - size_t slotToReturn = -1; + size_t slotToReturn = std::numeric_limits::max(); if (m_nextFreeSlot != NoFreeSlot) { // If there's a free slot, then use that space and update the linked list of free slots. diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h index 525288adb0..8f388e23b9 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/Utils/SparseVector.h @@ -49,7 +49,7 @@ namespace AZ::Render private: - static constexpr size_t NoFreeSlot = -1; + static constexpr size_t NoFreeSlot = std::numeric_limits::max(); static constexpr size_t InitialReservedCount = 128; size_t m_nextFreeSlot = NoFreeSlot; @@ -66,7 +66,7 @@ namespace AZ::Render template inline size_t SparseVector::Reserve() { - size_t slotToReturn = -1; + size_t slotToReturn = std::numeric_limits::max(); if (m_nextFreeSlot != NoFreeSlot) { // If there's a free slot, then use that space and update the linked list of free slots. diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp index a88c587f66..03a423f6db 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.cpp @@ -159,7 +159,7 @@ namespace AZ void LightCullingPass::ResetInternal() { - m_tileDataIndex = -1; + m_tileDataIndex = std::numeric_limits::max(); m_constantDataIndex.Reset(); for (auto& elem : m_lightdata) @@ -234,7 +234,7 @@ namespace AZ return i; } } - return -1; + return std::numeric_limits::max(); } AZ::RHI::Size LightCullingPass::GetTileDataBufferResolution() diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h index af230b8d57..9fa81bd7de 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingPass.h @@ -94,7 +94,7 @@ namespace AZ Data::Instance m_lightList; - uint32_t m_tileDataIndex = -1; + uint32_t m_tileDataIndex = std::numeric_limits::max(); }; } // namespace Render } // namespace AZ diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp index e4881ed665..1a03b7ef38 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/LightCullingRemap.cpp @@ -101,7 +101,7 @@ namespace AZ return i; } } - return -1; + return std::numeric_limits::max(); } void LightCullingRemap::BuildInternal() diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h index f1607191fc..dc7df7de78 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ProjectedShadowmapsPass.h @@ -30,7 +30,7 @@ namespace AZ AZ_CLASS_ALLOCATOR(ProjectedShadowmapsPass, SystemAllocator, 0); AZ_RTTI(ProjectedShadowmapsPass, "00024B13-1095-40FA-BEC3-B0F68110BEA2", Base); - static constexpr uint16_t InvalidIndex = ~0; + static constexpr uint16_t InvalidIndex = std::numeric_limits::max(); struct ShadowmapSizeWithIndices { ShadowmapSize m_size = ShadowmapSize::None; diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h index 5081a9ef9e..f0a372ec5b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/ShadowmapAtlas.h @@ -52,7 +52,7 @@ namespace AZ // then m_nextTableOffset == 0, which works as the terminator for seaching // a shadowmap index in a compute shader. uint32_t m_nextTableOffset = 0; - uint32_t m_shadowmapIndex = ~0; // invalid index + uint32_t m_shadowmapIndex = std::numeric_limits::max(); // invalid index }; //! This initializes the packing of shadowmap sizes. @@ -156,7 +156,7 @@ namespace AZ //! [2,2,2] indicates (0, 1024+512)-(0+511, 1024+512+511) of slice:2 (width 512). using Location = AZStd::vector; static constexpr uint8_t LocationIndexNum = 4; - static constexpr size_t InvalidIndex = ~0; + static constexpr size_t InvalidIndex = std::numeric_limits::max(); struct LocationHasher { diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h index 5c5898e8d1..b2b16692b5 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Edit/ShaderPlatformInterface.h @@ -81,7 +81,7 @@ namespace AZ struct ByProducts { AZStd::set m_intermediatePaths; //!< intermediate file paths (like dxil text form) - static constexpr uint32_t UnknownDynamicBranchCount = -1; + static constexpr uint32_t UnknownDynamicBranchCount = std::numeric_limits::max(); uint32_t m_dynamicBranchCount = UnknownDynamicBranchCount; }; diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h index 5ccb48bf1c..8527d034d5 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/AliasedAttachmentAllocator.h @@ -248,7 +248,7 @@ namespace AZ // The no allocation heap is used when doing a 2 pass strategy. Internal::NoAllocationAliasedHeap::Descriptor heapAllocator; heapAllocator.m_alignment = descriptor.m_alignment; - heapAllocator.m_budgetInBytes = ~0; + heapAllocator.m_budgetInBytes = std::numeric_limits::max(); m_noAllocationHeap.Init(device, heapAllocator); typename decltype(m_garbageCollector)::Descriptor collectorDescriptor; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp index 6018e180ef..823ec8e4e0 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp @@ -353,7 +353,7 @@ namespace AZ if (imageViewDescriptor.m_depthSliceMax == RHI::ImageViewDescriptor::HighestSliceIndex) { - renderTargetView.Texture3D.WSize = -1; + renderTargetView.Texture3D.WSize = std::numeric_limits::max(); } else { @@ -578,7 +578,7 @@ namespace AZ if (imageViewDescriptor.m_depthSliceMax == RHI::ImageViewDescriptor::HighestSliceIndex) { - unorderedAccessView.Texture3D.WSize = -1; + unorderedAccessView.Texture3D.WSize = std::numeric_limits::max(); } else { diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp index 8635e8edcf..5d52dc8eeb 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp @@ -304,7 +304,7 @@ namespace AZ { uint32_t m_familyIndex = InvalidFamilyIndex; bool m_newQueue = false; - uint32_t m_remainingFlags = ~0; + uint32_t m_remainingFlags = std::numeric_limits::max(); bool operator>(const QueueSelection& other) const { diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp index 05ff8bb2a6..a3c762e327 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp @@ -69,7 +69,7 @@ namespace AZ BuildDeviceQueueInfo(physicalDevice); - m_supportedPipelineStageFlagsMask = ~0; + m_supportedPipelineStageFlagsMask = std::numeric_limits::max(); const auto& deviceFeatures = physicalDevice.GetPhysicalDeviceFeatures(); m_enabledDeviceFeatures.samplerAnisotropy = deviceFeatures.samplerAnisotropy; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h index 28e56d1fa9..14eda8381d 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h @@ -152,7 +152,7 @@ namespace AZ VkDevice m_nativeDevice = VK_NULL_HANDLE; VkPhysicalDeviceFeatures m_enabledDeviceFeatures{}; - VkPipelineStageFlags m_supportedPipelineStageFlagsMask = ~0; + VkPipelineStageFlags m_supportedPipelineStageFlagsMask = std::numeric_limits::max(); AZStd::vector m_queueFamilyProperties; RHI::Ptr m_asyncUploadQueue; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h index f285807210..649f9c3b80 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/MergedShaderResourceGroup.h @@ -53,7 +53,7 @@ namespace AZ // Helper struct for easy initialization of the frame iteration. struct FrameIteration { - uint64_t m_frameIteration = ~0; + uint64_t m_frameIteration = std::numeric_limits::max(); }; // Utility function that merges multiple ShaderResoruceGroup data into one. diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h index d3c4da27ad..085256f6d8 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyDescriptor.h @@ -103,7 +103,7 @@ namespace AZ AZ::TypeId GetStorageDataTypeId() const; //! Returns the value of the enum from its name. If this property is not an enum or the name is undefined, InvalidEnumValue is returned. - static constexpr uint32_t InvalidEnumValue = -1; + static constexpr uint32_t InvalidEnumValue = std::numeric_limits::max(); uint32_t GetEnumValue(const AZ::Name& enumName) const; //! Returns the unique name ID of this property diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h index e2e5b5c140..e010024fa3 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Shader/ShaderVariantTreeAsset.h @@ -75,7 +75,7 @@ namespace AZ private: - static constexpr uint32_t UnspecifiedIndex = -1; + static constexpr uint32_t UnspecifiedIndex = std::numeric_limits::max(); //! Returns the node associated with the provided index. const ShaderVariantTreeNode& GetNode(uint32_t index) const; diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h index 454a6d4086..58c2a59cbf 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h @@ -130,7 +130,7 @@ namespace AZ template struct StableDynamicArray::Page { - static constexpr size_t InvalidPage = -1; + static constexpr size_t InvalidPage = std::numeric_limits::max(); static constexpr uint64_t FullBits = 0xFFFFFFFFFFFFFFFFull; static constexpr size_t NumUint64_t = ElementsPerPage / 64;