From e648dbcf0811ecaaf9e19bef5053e81ff728fd50 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 24 Jun 2021 19:04:19 -0700 Subject: [PATCH 001/100] enabling the warning Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 118a515e30..161783caa1 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -38,7 +38,6 @@ ly_append_configurations_options( /wd4201 # nonstandard extension used: nameless struct/union. This actually became part of the C++11 std, MS has an open issue: https://developercommunity.visualstudio.com/t/warning-level-4-generates-a-bogus-warning-c4201-no/103064 # Disabling these warnings while they get fixed - /wd4244 # conversion, possible loss of data /wd4245 # conversion, signed/unsigned mismatch /wd4389 # comparison, signed/unsigned mismatch From 81d26d322dc568b275e7b69da8bac3290ef1e3d0 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 24 Jun 2021 19:05:30 -0700 Subject: [PATCH 002/100] Code/Framework fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Console/Console.cpp | 8 ++++---- Code/Framework/AzCore/AzCore/IO/Path/Path.inl | 2 +- .../AzCore/AzCore/IO/Streamer/BlockCache.cpp | 2 +- .../AzCore/AzCore/IO/Streamer/DedicatedCache.cpp | 2 +- .../Framework/AzCore/AzCore/StringFunc/StringFunc.cpp | 5 +++-- .../Tests/AZTestShared/Math/MathTestHelpers.cpp | 2 +- .../Tests/Serialization/Json/IntSerializerTests.cpp | 4 ++-- .../AzFramework/AzFramework/Archive/ZipDirCache.cpp | 2 +- .../AzFramework/Archive/ZipDirStructures.cpp | 10 +++++----- .../Windows/ScopedAutoTempDirectory_Windows.cpp | 2 +- Code/Framework/Crcfix/crcfix.cpp | 11 ++++++----- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Console/Console.cpp b/Code/Framework/AzCore/AzCore/Console/Console.cpp index 8bb50f77e0..0166e964b8 100644 --- a/Code/Framework/AzCore/AzCore/Console/Console.cpp +++ b/Code/Framework/AzCore/AzCore/Console/Console.cpp @@ -182,7 +182,7 @@ namespace AZ ConsoleFunctorBase* Console::FindCommand(const char* command) { CVarFixedString lowerName(command); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) @@ -270,7 +270,7 @@ namespace AZ } CVarFixedString lowerName = functor->GetName(); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) { @@ -313,7 +313,7 @@ namespace AZ } CVarFixedString lowerName = functor->GetName(); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) { @@ -389,7 +389,7 @@ namespace AZ ConsoleFunctorFlags flags = ConsoleFunctorFlags::Null; CVarFixedString lowerName(command); - AZStd::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), [](char value) { return std::tolower(value); }); + AZStd::to_lower(lowerName.begin(), lowerName.end()); CommandMap::iterator iter = m_commands.find(lowerName); if (iter != m_commands.end()) diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl index 4e8356b436..a6d41b0ef8 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl @@ -221,7 +221,7 @@ namespace AZ::IO::Internal ? strncmp(left.data(), right.data(), maxCharsToCompare) : azstrnicmp(left.data(), right.data(), maxCharsToCompare); return charCompareResult == 0 - ? aznumeric_cast(left.size()) - aznumeric_cast(right.size()) + ? aznumeric_cast(aznumeric_cast(left.size()) - aznumeric_cast(right.size())) : charCompareResult; } } diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index f358370be5..3d8cbc7480 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -38,7 +38,7 @@ namespace AZ break; } - u32 cacheSize = m_cacheSizeMib * 1_mib; + u32 cacheSize = static_cast(m_cacheSizeMib * 1_mib); if (blockSize * 2 > cacheSize) { AZ_Warning("Streamer", false, "Size (%u) for BlockCache isn't big enough to hold at least two cache blocks of size (%zu). " diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp index 6ec3fb295c..e0e512e21f 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/DedicatedCache.cpp @@ -36,7 +36,7 @@ namespace AZ break; } - u32 cacheSize = m_cacheSizeMib * 1_mib; + u32 cacheSize = static_cast(m_cacheSizeMib * 1_mib); if (blockSize > cacheSize) { AZ_Warning("Streamer", false, "Size (%u) for DedicatedCache isn't big enough to hold at least one cache blocks of size (%zu). " diff --git a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp index da7a78e1b3..d4f874c667 100644 --- a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp +++ b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -342,8 +343,8 @@ namespace AZ::StringFunc::Internal { for (const char stripCharacter : stripCharacters) { - const char lower = tolower(stripCharacter); - const char upper = toupper(stripCharacter); + const char lower = azlossy_cast(tolower(stripCharacter)); + const char upper = azlossy_cast(toupper(stripCharacter)); if (lower != upper) { combinedStripCharacters.push_back(lower); diff --git a/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp b/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp index bf0a1023ab..fc707c9751 100644 --- a/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp +++ b/Code/Framework/AzCore/Tests/AZTestShared/Math/MathTestHelpers.cpp @@ -95,7 +95,7 @@ namespace AZ auto printElement = [&os, &mat](int64_t row, int64_t col) -> std::ostream& { const std::streamsize width = 10; - os << std::setw(width) << std::fixed << mat.GetElement(row, col); + os << std::setw(width) << std::fixed << mat.GetElement(static_cast(row), static_cast(col)); return os; }; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp index be06e76f68..c971535f0b 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp @@ -32,12 +32,12 @@ namespace JsonSerializationTests AZStd::shared_ptr CreateDefaultInstance() override { - return AZStd::make_shared(0); + return AZStd::make_shared(NumberType(0)); } AZStd::shared_ptr CreateFullySetInstance() override { - return AZStd::make_shared(4); + return AZStd::make_shared(NumberType(4)); } AZStd::string_view GetJsonForFullySetInstance() override diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp index baabfb35cc..d74f69e27b 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp @@ -75,7 +75,7 @@ namespace AZ::IO::ZipDir for (i = 0; i < AZ_ARRAY_SIZE(szBuf) - 1; ++i) { int r = distrib(gen); - szBuf[i] = r > 9 ? (r - 10) + 'a' : '0' + r; + szBuf[i] = static_cast(r > 9 ? (r - 10) + 'a' : '0' + r); } szBuf[i] = '\0'; return szBuf; diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index 445bba63f4..b3b2328222 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -832,18 +832,18 @@ namespace AZ::IO::ZipDir // conversion routines for the date/time fields used in Zip uint16_t DOSDate(tm* t) { - return + return static_cast( ((t->tm_year - 80) << 9) | (t->tm_mon << 5) - | t->tm_mday; + | t->tm_mday); } uint16_t DOSTime(tm* t) { - return + return static_cast( ((t->tm_hour) << 11) | ((t->tm_min) << 5) - | ((t->tm_sec) >> 1); + | ((t->tm_sec) >> 1)); } // sets the current time to modification time @@ -872,7 +872,7 @@ namespace AZ::IO::ZipDir // we'll need CRC32 of the file to pack it this->desc.lCRC32 = AZ::Crc32(pUncompressed, nSize); - this->nMethod = nCompressionMethod; + this->nMethod = static_cast(nCompressionMethod); } uint64_t FileEntry::GetModificationTime() diff --git a/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp b/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp index dc4b31c9be..fcda5d351a 100644 --- a/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp +++ b/Code/Framework/AzTest/AzTest/Platform/Windows/ScopedAutoTempDirectory_Windows.cpp @@ -30,7 +30,7 @@ namespace AZ while (maxAttempts > 0) { // Use the system's tick count to base the folder name - DWORD currentTick = GetTickCount64(); + ULONGLONG currentTick = GetTickCount64(); azsnprintf(workingTempPathBuffer, bufferSize, "%sUnitTest-%X", tempDir, aznumeric_cast(currentTick)); // Check if the requested directory name is available and re-generate if it already exists diff --git a/Code/Framework/Crcfix/crcfix.cpp b/Code/Framework/Crcfix/crcfix.cpp index 778b9e2185..c788d2a0c6 100644 --- a/Code/Framework/Crcfix/crcfix.cpp +++ b/Code/Framework/Crcfix/crcfix.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -284,7 +285,7 @@ char* CRCfix::GetToken(FILE* infile, FILE* outfile) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '#' || c == '_') { - token[i++] = c; + token[i++] = azlossy_cast(c); continue; } else @@ -375,7 +376,7 @@ void CRCfix::GetPreviousCRC(char* token, FILE* infile) int c; while ((c = fgetc(infile)) != ')') { - *token++ = c; + *token++ = azlossy_cast(c); } *token = 0; } @@ -426,7 +427,7 @@ int CRCfix::Fix(Filename srce) if (strcmp(token, "AZ_CRC") == 0 && lastchar == '(') { size_t i = strlen(token); - token[i++] = lastchar; + token[i++] = azlossy_cast(lastchar); int c = fgetc(infile); if (c == '"') @@ -435,11 +436,11 @@ int CRCfix::Fix(Filename srce) do { - token[i++] = c; + token[i++] = azlossy_cast(c); c = fgetc(infile); } while (c != '"'); - token[i++] = c; + token[i++] = azlossy_cast(c); c = fgetc(infile); int oldcrc = 0, newcrc; From f6cdcddc522b20079f43f8c747c46fe3796671bc Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 13:28:51 -0700 Subject: [PATCH 003/100] =?UTF-8?q?=EF=BB=BFfixes=20for=20Code/CryEngine?= 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> --- .../AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp | 3 ++- Code/Legacy/CryCommon/ISplines.h | 2 +- Code/Legacy/CryCommon/PNoise3.h | 4 ++-- Code/Legacy/CryCommon/Vertex.h | 2 +- Code/Legacy/CrySystem/LocalizedStringManager.cpp | 2 +- Code/Legacy/CrySystem/Log.cpp | 2 +- Code/Legacy/CrySystem/XConsole.cpp | 5 +++-- Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp | 2 +- Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp | 2 +- Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp | 4 ++-- Code/Legacy/CrySystem/XML/xml.cpp | 2 +- .../SceneBuilder/Importers/AssImpAnimationImporter.cpp | 4 ++-- 12 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp index 3bda826313..2b0e7bee92 100644 --- a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp +++ b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace Internal @@ -297,7 +298,7 @@ AZ_POP_DISABLE_WARNING // the overflow guard is generated out of rand, so we set a fixed seed before doing the allocation // to get a deterministic guard srand(0); - const unsigned char expectedInitialGuard = rand(); + const unsigned char expectedInitialGuard = azlossy_cast(rand()); srand(0); TestClass<16>* someObject = aznew TestClass<16>(); diff --git a/Code/Legacy/CryCommon/ISplines.h b/Code/Legacy/CryCommon/ISplines.h index ad59f1328d..2353489163 100644 --- a/Code/Legacy/CryCommon/ISplines.h +++ b/Code/Legacy/CryCommon/ISplines.h @@ -466,7 +466,7 @@ namespace spline ILINE void flag_clr(int flag) { m_flags &= ~flag; }; ILINE int flag(int flag) { return m_flags & flag; }; - ILINE void ORT(int ort) { m_ORT = ort; }; + ILINE void ORT(int ort) { m_ORT = static_cast(ort); }; ILINE int ORT() const { return m_ORT; }; ILINE int isORT(int o) const { return (m_ORT == o); }; diff --git a/Code/Legacy/CryCommon/PNoise3.h b/Code/Legacy/CryCommon/PNoise3.h index 1cb7f0d65b..fe19997ef4 100644 --- a/Code/Legacy/CryCommon/PNoise3.h +++ b/Code/Legacy/CryCommon/PNoise3.h @@ -205,7 +205,7 @@ public: // Initialize the permutation table for(i = 0; i < NOISE_TABLE_SIZE; i++) - m_p[i] = i; + m_p[i] = static_cast(i); for(i = 0; i < NOISE_TABLE_SIZE; i++) { @@ -213,7 +213,7 @@ public: nSwap = m_p[i]; m_p[i] = m_p[j]; - m_p[j] = nSwap; + m_p[j] = static_cast(nSwap); } // Generate the gradient lookup tables diff --git a/Code/Legacy/CryCommon/Vertex.h b/Code/Legacy/CryCommon/Vertex.h index 2e61524cab..b9e0b25d38 100644 --- a/Code/Legacy/CryCommon/Vertex.h +++ b/Code/Legacy/CryCommon/Vertex.h @@ -1037,7 +1037,7 @@ namespace AZ } AZ_Assert(stride < (0x1 << (sizeof(m_stride) * 8)), "Vertex stride is larger than the maximum supported, update the type for m_stride in Vertex.h"); - m_stride = stride; + m_stride = static_cast(stride); } diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index 68a8a6659b..db77eda3e8 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -473,7 +473,7 @@ void CLocalizedStringsManager::ParseFirstLine(IXmlTableReader* pXmlTableReader, const char* pFind = strstr(sCellContent.c_str(), sLocalizedColumnNames[i]); if (pFind != 0) { - nCellIndexToType[nCellIndex] = i; + nCellIndexToType[nCellIndex] = static_cast(i); // find SoundMood if (i == ELOCALIZED_COLUMN_SOUNDMOOD) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index d248274b1d..32d5e995ab 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -1227,7 +1227,7 @@ void CLog::CreateBackupFile() const while (!fileSystem->Eof(inFileHandle)) { - uint8 c = AZ::IO::GetC(inFileHandle); + uint8 c = static_cast(AZ::IO::GetC(inFileHandle)); if (c == '\"') { diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 36443fb9ee..a69fd348f5 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -2464,8 +2464,9 @@ void CXConsole::DisplayVarValue(ICVar* pVar) sValue += " ("; if (nonAlphaBits != 0) { - char nonAlphaChars[3]; // 1..63 + '\0' - sValue += azitoa(nonAlphaBits, nonAlphaChars, AZ_ARRAY_SIZE(nonAlphaChars), 10); + char nonAlphaChars[3] = { 0 }; // 1..63 + '\0' + azitoa(nonAlphaBits, nonAlphaChars, AZ_ARRAY_SIZE(nonAlphaChars), 10); + sValue += nonAlphaChars; sValue += ", "; } sValue += alphaChars; diff --git a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp index e74b457191..841697ecdb 100644 --- a/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp +++ b/Code/Legacy/CrySystem/XML/SerializeXMLReader.cpp @@ -44,7 +44,7 @@ bool CSerializeXMLReaderImpl::Value(const char* name, int8& value) } else { - value = temp; + value = static_cast(temp); } return bResult; } diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp index 257fc3ca69..d209478957 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryNode.cpp @@ -320,7 +320,7 @@ bool CBinaryXmlNode::getAttr(const char* key, ColorB& value) const // If we only found 3 values, a should be unchanged, and still be 255 if (r < 256 && g < 256 && b < 256 && a < 256) { - value = ColorB(r, g, b, a); + value = ColorB(static_cast(r), static_cast(g), static_cast(b), static_cast(a)); return true; } } diff --git a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp index a2a35cfe8b..265953850f 100644 --- a/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp +++ b/Code/Legacy/CrySystem/XML/XMLBinaryWriter.cpp @@ -244,7 +244,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar nd.nContentStringOffset = nContentStringOffset; nd.nParentIndex = nParentIndex; nd.nFirstAttributeIndex = nFirstAttributeIndex; - nd.nAttributeCount = nAttributeCount; + nd.nAttributeCount = static_cast(nAttributeCount); m_nodes.push_back(nd); } @@ -271,7 +271,7 @@ bool XMLBinary::CXMLBinaryWriter::CompileTablesForNode(XmlNodeRef node, int nPar } } - m_nodes[nIndex].nChildCount = nChildCount; + m_nodes[nIndex].nChildCount = static_cast(nChildCount); return true; } diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index 7a9bb4bc36..adbfcc5f3e 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -641,7 +641,7 @@ bool CXmlNode::getAttr(const char* key, ColorB& value) const // If we only found 3 values, a should be unchanged, and still be 255 if (r < 256 && g < 256 && b < 256 && a < 256) { - value = ColorB(r, g, b, a); + value = ColorB(static_cast(r), static_cast(g), static_cast(b), static_cast(a)); return true; } } diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp index 97b5960a8d..a76cb3531d 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -49,7 +49,7 @@ namespace AZ double totalFramesAtDefaultTimeStep = totalTicks / AssImpAnimationImporter::s_defaultTimeStepBetweenFrames + 1; if (!AZ::IsClose(totalFramesAtDefaultTimeStep, numKeys, 1)) { - numKeys = AZStd::ceilf(totalFramesAtDefaultTimeStep); + numKeys = AZStd::ceilf(static_cast(totalFramesAtDefaultTimeStep)); } return numKeys; } @@ -620,7 +620,7 @@ namespace AZ for (unsigned int valIdx = 0; valIdx < key.mNumValuesAndWeights; ++valIdx) { int currentValue = key.mValues[valIdx]; - KeyData thisKey(key.mWeights[valIdx], key.mTime); + KeyData thisKey(static_cast(key.mWeights[valIdx]), key.mTime); valueToKeyDataMap[currentValue].insert( AZStd::upper_bound(valueToKeyDataMap[currentValue].begin(), valueToKeyDataMap[currentValue].end(),thisKey), thisKey); From 38fd7f0013f417cb2109cd9c77ccd4d36051df1a Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:07:36 -0700 Subject: [PATCH 004/100] fixing Atom Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Editor/AzslCompiler.cpp | 6 +- .../Source/AuxGeom/FixedShapeProcessor.cpp | 76 +++++++++---------- .../CoreLights/CascadedShadowmapsPass.cpp | 2 +- .../DirectionalLightFeatureProcessor.cpp | 4 +- .../Code/Source/Decals/DecalTextureArray.cpp | 2 +- .../DiffuseProbeGridBlendDistancePass.cpp | 6 +- .../DiffuseProbeGridBlendIrradiancePass.cpp | 6 +- .../DiffuseProbeGridBorderUpdatePass.cpp | 6 +- .../DiffuseProbeGridClassificationPass.cpp | 6 +- .../DiffuseProbeGridRelocationPass.cpp | 6 +- .../Common/Code/Source/ImGui/ImGuiPass.cpp | 16 ++-- .../Code/Source/Mesh/MeshFeatureProcessor.cpp | 10 +-- .../MorphTargets/MorphTargetDispatchItem.cpp | 6 +- .../Source/PostProcessing/BloomBlurPass.cpp | 4 +- .../PostProcessing/BloomCompositePass.cpp | 8 +- .../PostProcessing/BloomDownsamplePass.cpp | 2 +- .../Code/Source/PostProcessing/TaaPass.cpp | 2 +- .../ReflectionProbe/ReflectionProbe.cpp | 2 +- .../ReflectionScreenSpaceBlurChildPass.cpp | 2 +- .../ReflectionScreenSpaceBlurPass.cpp | 4 +- .../SkinnedMesh/SkinnedMeshDispatchItem.cpp | 6 +- .../SkinnedMesh/SkinnedMeshInputBuffers.cpp | 2 +- .../RHI/Code/Include/Atom/RHI/ImageProperty.h | 8 +- .../RHI/Code/Source/RHI/CpuProfilerImpl.cpp | 2 +- Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp | 2 +- Gems/Atom/RHI/Code/Source/RHI/Image.cpp | 2 +- .../RHI/Code/Tests/ImagePropertyTests.cpp | 2 +- .../RHI.Reflect/BufferPoolDescriptor.cpp | 2 +- .../RHI/DX12/Code/Source/RHI/BufferPool.cpp | 2 +- .../RHI/DX12/Code/Source/RHI/Conversions.cpp | 6 +- Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp | 4 +- .../DX12/Code/Source/RHI/PipelineLayout.cpp | 4 +- .../Code/Source/RHI/StreamingImagePool.cpp | 2 +- .../RHI.Reflect/BufferPoolDescriptor.cpp | 2 +- .../Code/Source/RHI/AsyncUploadQueue.cpp | 6 +- .../RHI/Vulkan/Code/Source/RHI/Conversion.cpp | 2 +- .../RHI/Vulkan/Code/Source/RHI/ImageView.cpp | 6 +- .../Vulkan/Code/Source/RHI/PipelineLayout.cpp | 2 +- .../Code/Source/RHI/StreamingImagePool.cpp | 8 +- .../RPI.Public/Image/StreamingImage.cpp | 2 +- .../Pass/FullscreenTrianglePass.cpp | 2 +- .../RPI/Code/Tests/Buffer/BufferTests.cpp | 3 +- Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp | 3 +- .../Utils/Code/Source/ImageComparison.cpp | 6 +- 44 files changed, 132 insertions(+), 130 deletions(-) diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp index cc42fac422..f5fb73182a 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslCompiler.cpp @@ -211,11 +211,11 @@ namespace AZ case rapidjson::kNumberType: if (name == "cols") { - inputStructParams.m_variable.m_cols = itr2->value.GetInt(); + inputStructParams.m_variable.m_cols = static_cast(itr2->value.GetInt()); } else if (name == "rows") { - inputStructParams.m_variable.m_rows = itr2->value.GetInt(); + inputStructParams.m_variable.m_rows = static_cast(itr2->value.GetInt()); } else if (name == "semanticIndex") { @@ -304,7 +304,7 @@ namespace AZ case rapidjson::kNumberType: if (name == "cols") { - outputStructParams.m_variable.m_cols = itr2->value.GetInt(); + outputStructParams.m_variable.m_cols = static_cast(itr2->value.GetInt()); } else if (name == "semanticIndex") { diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp index f2b3a93a53..8a274beb2f 100644 --- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp @@ -405,15 +405,15 @@ namespace AZ for (uint16_t ring = 0; ring < numRings - 2; ++ring) { - uint16_t firstVertOfThisRing = 1 + ring * numSections; - uint16_t firstVertOfNextRing = 1 + (ring + 1) * numSections; + uint16_t firstVertOfThisRing = static_cast(1 + ring * numSections); + uint16_t firstVertOfNextRing = static_cast(1 + (ring + 1) * numSections); for (uint16_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; // line around ring indices.push_back(firstVertOfThisRing + section); - indices.push_back(firstVertOfThisRing + nextSection); + indices.push_back(static_cast(firstVertOfThisRing + nextSection)); // line around section indices.push_back(firstVertOfThisRing + section); @@ -423,15 +423,15 @@ namespace AZ // build faces for end caps (to connect "inner" vertices with poles) uint16_t firstPoleVert = 0; - uint16_t firstVertOfFirstRing = 1 + (0) * numSections; + uint16_t firstVertOfFirstRing = static_cast(1 + (0) * numSections); for (uint16_t section = 0; section < numSections; ++section) { indices.push_back(firstPoleVert); indices.push_back(firstVertOfFirstRing + section); } - uint16_t lastPoleVert = (numRings - 1) * numSections + 1; - uint16_t firstVertOfLastRing = 1 + (numRings - 2) * numSections; + uint16_t lastPoleVert = static_cast((numRings - 1) * numSections + 1); + uint16_t firstVertOfLastRing = static_cast(1 + (numRings - 2) * numSections); for (uint16_t section = 0; section < numSections; ++section) { indices.push_back(firstVertOfLastRing + section); @@ -457,13 +457,13 @@ namespace AZ for (uint32_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; - indices.push_back((uint16_t)firstVertOfThisRing + nextSection); - indices.push_back((uint16_t)firstVertOfThisRing + section); - indices.push_back((uint16_t)firstVertOfNextRing + nextSection); + indices.push_back(static_cast(firstVertOfThisRing + nextSection)); + indices.push_back(static_cast(firstVertOfThisRing + section)); + indices.push_back(static_cast(firstVertOfNextRing + nextSection)); - indices.push_back((uint16_t)firstVertOfNextRing + section); - indices.push_back((uint16_t)firstVertOfNextRing + nextSection); - indices.push_back((uint16_t)firstVertOfThisRing + section); + indices.push_back(static_cast(firstVertOfNextRing + section)); + indices.push_back(static_cast(firstVertOfNextRing + nextSection)); + indices.push_back(static_cast(firstVertOfThisRing + section)); } } @@ -473,9 +473,9 @@ namespace AZ for (uint32_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; - indices.push_back((uint16_t)firstVertOfFirstRing + section); - indices.push_back((uint16_t)firstVertOfFirstRing + nextSection); - indices.push_back((uint16_t)firstPoleVert); + indices.push_back(static_cast(firstVertOfFirstRing + section)); + indices.push_back(static_cast(firstVertOfFirstRing + nextSection)); + indices.push_back(static_cast(firstPoleVert)); } uint32_t lastPoleVert = (numRings - 1) * numSections + 1; @@ -483,9 +483,9 @@ namespace AZ for (uint32_t section = 0; section < numSections; ++section) { uint32_t nextSection = (section + 1) % numSections; - indices.push_back((uint16_t)firstVertOfLastRing + nextSection); - indices.push_back((uint16_t)firstVertOfLastRing + section); - indices.push_back((uint16_t)lastPoleVert); + indices.push_back(static_cast(firstVertOfLastRing + nextSection)); + indices.push_back(static_cast(firstVertOfLastRing + section)); + indices.push_back(static_cast(lastPoleVert)); } } } @@ -637,12 +637,12 @@ namespace AZ { // Line from center of disk to outer edge meshData.m_lineIndices.push_back(centerIndex); - meshData.m_lineIndices.push_back(firstSection + section); + meshData.m_lineIndices.push_back(static_cast(firstSection + section)); // Line from outer edge to next edge - meshData.m_lineIndices.push_back(firstSection + section); + meshData.m_lineIndices.push_back(static_cast(firstSection + section)); uint32_t nextSection = (section + 1) % numSections; - meshData.m_lineIndices.push_back(firstSection + nextSection); + meshData.m_lineIndices.push_back(static_cast(firstSection + nextSection)); } // Create triangle indices @@ -652,13 +652,13 @@ namespace AZ meshData.m_triangleIndices.push_back(centerIndex); if (isUp) { - meshData.m_triangleIndices.push_back(firstSection + nextSection); - meshData.m_triangleIndices.push_back(firstSection + section); + meshData.m_triangleIndices.push_back(static_cast(firstSection + nextSection)); + meshData.m_triangleIndices.push_back(static_cast(firstSection + section)); } else { - meshData.m_triangleIndices.push_back(firstSection + section); - meshData.m_triangleIndices.push_back(firstSection + nextSection); + meshData.m_triangleIndices.push_back(static_cast(firstSection + section)); + meshData.m_triangleIndices.push_back(static_cast(firstSection + nextSection)); } } } @@ -776,7 +776,7 @@ namespace AZ normals.push_back(AuxGeomNormal(0.0f, 1.0f, 0.0f)); // vertex indexes for start of the cone sides and for the cone point - uint16_t indexOfSidesStart = numSections + 1; + uint16_t indexOfSidesStart = static_cast(numSections + 1); uint32_t indexOfConePoint = indexOfSidesStart + numRings * numSections; // indices for points @@ -795,8 +795,8 @@ namespace AZ // build lines between already completed cap for each section for (uint16_t section = 0; section < numSections; ++section) { - indices.push_back(indexOfSidesStart + numRings * section); - indices.push_back(indexOfConePoint); + indices.push_back(static_cast(indexOfSidesStart + numRings * section)); + indices.push_back(static_cast(indexOfConePoint)); } } @@ -812,19 +812,19 @@ namespace AZ // faces from end cap to close to point for (uint32_t ring = 0; ring < numRings - 1; ++ring) { - indices.push_back(indexOfSidesStart + numRings * nextSection + ring + 1); - indices.push_back(indexOfSidesStart + numRings * nextSection + ring); - indices.push_back(indexOfSidesStart + numRings * section + ring); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + ring + 1)); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + ring)); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + ring)); - indices.push_back(indexOfSidesStart + numRings * section + ring); - indices.push_back(indexOfSidesStart + numRings * section + ring + 1); - indices.push_back(indexOfSidesStart + numRings * nextSection + ring + 1); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + ring)); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + ring + 1)); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + ring + 1)); } // faces for point (from last ring of verts to point) - indices.push_back(indexOfConePoint); - indices.push_back(indexOfSidesStart + numRings * nextSection + numRings - 1); - indices.push_back(indexOfSidesStart + numRings * section + numRings - 1); + indices.push_back(static_cast(indexOfConePoint)); + indices.push_back(static_cast(indexOfSidesStart + numRings * nextSection + numRings - 1)); + indices.push_back(static_cast(indexOfSidesStart + numRings * section + numRings - 1)); } } } @@ -912,7 +912,7 @@ namespace AZ //uint16_t indexOfBottomStart = 1; //uint16_t indexOfTopCenter = numSections + 1; //uint16_t indexOfTopStart = numSections + 2; - uint16_t indexOfSidesStart = 2 * numSections + 2; + uint16_t indexOfSidesStart = static_cast(2 * numSections + 2); // build point indices { diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp index 33123d67a1..5529a2916b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/CascadedShadowmapsPass.cpp @@ -126,7 +126,7 @@ namespace AZ return; } - SetCascadesCount(m_arraySize); + SetCascadesCount(static_cast(m_arraySize)); const RHI::Size imageSize { aznumeric_cast(m_shadowmapSize), diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 4aa749f7d7..1fff70ce59 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -225,7 +225,7 @@ namespace AZ } if (segmentsNeedUpdate) { - UpdateViewsOfCascadeSegments(m_shadowingLightHandle, cascadeCount); + UpdateViewsOfCascadeSegments(m_shadowingLightHandle, static_cast(cascadeCount)); SetShadowmapImageSizeArraySize(m_shadowingLightHandle); } @@ -1216,7 +1216,7 @@ namespace AZ else { // If ESM is not used, set filter offsets and filter counts zero in ESM data. - for (uint32_t index = 0; index < GetCascadeCount(handle); ++index) + for (uint16_t index = 0; index < GetCascadeCount(handle); ++index) { EsmShadowmapsPass::FilterParameter& filterParameter = m_esmParameterData.at(cameraView).GetData(index); filterParameter.m_isEnabled = false; diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp index 6531a04e22..ebdc884ecf 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArray.cpp @@ -147,7 +147,7 @@ namespace AZ RPI::ImageMipChainAssetCreator assetCreator; const uint32_t mipLevels = GetNumMipLevels(); - assetCreator.Begin(Data::AssetId(AZ::Uuid::CreateRandom()), mipLevels, aznumeric_cast(numTexturesToCreate)); + assetCreator.Begin(Data::AssetId(AZ::Uuid::CreateRandom()), static_cast(mipLevels), aznumeric_cast(numTexturesToCreate)); for (uint32_t mipLevel = 0; mipLevel < mipLevels; ++mipLevel) { diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp index a3927b802d..69a4ecdee5 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistancePass.cpp @@ -72,9 +72,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp index 6ff8bdd867..83ef312bf4 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiancePass.cpp @@ -72,9 +72,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp index ddfe0f11b1..b251526cb4 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdatePass.cpp @@ -85,9 +85,9 @@ namespace AZ return; } - dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp index 4c6b07d780..2690f90a7d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridClassificationPass.cpp @@ -76,9 +76,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp index 54cf9783cd..67fb95a833 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridRelocationPass.cpp @@ -76,9 +76,9 @@ namespace AZ return; } - m_dispatchArgs.m_threadsPerGroupX = AZStd::any_cast(args[0]); - m_dispatchArgs.m_threadsPerGroupY = AZStd::any_cast(args[1]); - m_dispatchArgs.m_threadsPerGroupZ = AZStd::any_cast(args[2]); + m_dispatchArgs.m_threadsPerGroupX = static_cast(AZStd::any_cast(args[0])); + m_dispatchArgs.m_threadsPerGroupY = static_cast(AZStd::any_cast(args[1])); + m_dispatchArgs.m_threadsPerGroupZ = static_cast(AZStd::any_cast(args[2])); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp index cd781390a3..9f2a7303a5 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp @@ -396,12 +396,12 @@ namespace AZ { auto imguiContextScope = ImguiContextScope(m_imguiContext); - m_viewportWidth = params.m_viewportState.m_maxX - params.m_viewportState.m_minX; - m_viewportHeight = params.m_viewportState.m_maxY - params.m_viewportState.m_minY; + m_viewportWidth = static_cast(params.m_viewportState.m_maxX - params.m_viewportState.m_minX); + m_viewportHeight = static_cast(params.m_viewportState.m_maxY - params.m_viewportState.m_minY); auto& io = ImGui::GetIO(); - io.DisplaySize.x = AZStd::max(1.0f, m_viewportWidth); - io.DisplaySize.y = AZStd::max(1.0f, m_viewportHeight); + io.DisplaySize.x = AZStd::max(1.0f, static_cast(m_viewportWidth)); + io.DisplaySize.y = AZStd::max(1.0f, static_cast(m_viewportHeight)); Matrix4x4 projectionMatrix = Matrix4x4::CreateFromRows( @@ -547,8 +547,8 @@ namespace AZ for (const ImDrawCmd& drawCmd : drawList->CmdBuffer) { AZ_Assert(drawCmd.UserCallback == nullptr, "ImGui UserCallbacks are not supported by the ImGui Pass"); - uint32_t scissorMaxX = drawCmd.ClipRect.z; - uint32_t scissorMaxY = drawCmd.ClipRect.w; + uint32_t scissorMaxX = static_cast(drawCmd.ClipRect.z); + uint32_t scissorMaxY = static_cast(drawCmd.ClipRect.w); //scissorMaxX/scissorMaxY can be a frame stale from imgui (ImGui::NewFrame runs after this) hence we clamp it to viewport bounds //otherwise it is possible to have a frame where scissor bounds can be bigger than window's bounds if we resize the window @@ -559,8 +559,8 @@ namespace AZ { RHI::DrawIndexed(1, 0, vertexOffset, drawCmd.ElemCount, indexOffset), RHI::Scissor( - (drawCmd.ClipRect.x), - (drawCmd.ClipRect.y), + static_cast(drawCmd.ClipRect.x), + static_cast(drawCmd.ClipRect.y), scissorMaxX, scissorMaxY ) diff --git a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp index 8e2c6f2e9b..54ef40ce6c 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp @@ -800,19 +800,19 @@ namespace AZ // note that the element count is the size of the entire buffer, even though this mesh may only // occupy a portion of the vertex buffer. This is necessary since we are accessing it using // a ByteAddressBuffer in the raytracing shaders and passing the byte offset to the shader in a constant buffer. - uint32_t positionBufferByteCount = const_cast(streamBufferViews[0].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t positionBufferByteCount = static_cast(const_cast(streamBufferViews[0].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor positionBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, positionBufferByteCount); - uint32_t normalBufferByteCount = const_cast(streamBufferViews[1].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t normalBufferByteCount = static_cast(const_cast(streamBufferViews[1].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor normalBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, normalBufferByteCount); - uint32_t tangentBufferByteCount = const_cast(streamBufferViews[2].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t tangentBufferByteCount = static_cast(const_cast(streamBufferViews[2].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor tangentBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, tangentBufferByteCount); - uint32_t bitangentBufferByteCount = const_cast(streamBufferViews[3].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t bitangentBufferByteCount = static_cast(const_cast(streamBufferViews[3].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor bitangentBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, bitangentBufferByteCount); - uint32_t uvBufferByteCount = const_cast(streamBufferViews[4].GetBuffer())->GetDescriptor().m_byteCount; + uint32_t uvBufferByteCount = static_cast(const_cast(streamBufferViews[4].GetBuffer())->GetDescriptor().m_byteCount); RHI::BufferViewDescriptor uvBufferDescriptor = RHI::BufferViewDescriptor::CreateRaw(0, uvBufferByteCount); const RHI::IndexBufferView& indexBufferView = mesh.m_indexBufferView; diff --git a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp index 0f8a30d8aa..19f379b17d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/MorphTargets/MorphTargetDispatchItem.cpp @@ -85,9 +85,9 @@ namespace AZ { const auto& args = *numThreads; // Check that the arguments are valid integers, and fall back to 1,1,1 if there is an error - arguments.m_threadsPerGroupX = args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1; - arguments.m_threadsPerGroupY = args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1; - arguments.m_threadsPerGroupZ = args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1; + arguments.m_threadsPerGroupX = static_cast(args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1); + arguments.m_threadsPerGroupY = static_cast(args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1); + arguments.m_threadsPerGroupZ = static_cast(args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1); } arguments.m_totalNumberOfThreadsX = m_morphTargetMetaData.m_vertexCount; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp index b93e847fd2..3fcff54eaa 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp @@ -153,8 +153,8 @@ namespace AZ inBinding.m_connectedBinding = isHorizontalPass ? &parentInOutBinding : &parentInBinding; RHI::ImageViewDescriptor viewDesc; - viewDesc.m_mipSliceMin = mipLevel; - viewDesc.m_mipSliceMax = mipLevel; + viewDesc.m_mipSliceMin = static_cast(mipLevel); + viewDesc.m_mipSliceMax = static_cast(mipLevel); inBinding.m_unifiedScopeDesc.SetAsImage(viewDesc); pass->AddAttachmentBinding(inBinding); diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp index 11e53e8805..e9b428c877 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomCompositePass.cpp @@ -133,8 +133,8 @@ namespace AZ inBinding.m_connectedBinding = &parentInBinding; RHI::ImageViewDescriptor inViewDesc; - inViewDesc.m_mipSliceMin = mipLevel; - inViewDesc.m_mipSliceMax = mipLevel; + inViewDesc.m_mipSliceMin = static_cast(mipLevel); + inViewDesc.m_mipSliceMax = static_cast(mipLevel); inBinding.m_unifiedScopeDesc.SetAsImage(inViewDesc); pass->AddAttachmentBinding(inBinding); @@ -151,8 +151,8 @@ namespace AZ if (mipLevel != 0) { RHI::ImageViewDescriptor outViewDesc; - outViewDesc.m_mipSliceMin = mipLevel - 1; - outViewDesc.m_mipSliceMax = mipLevel - 1; + outViewDesc.m_mipSliceMin = static_cast(mipLevel - 1); + outViewDesc.m_mipSliceMax = static_cast(mipLevel - 1); outBinding.m_unifiedScopeDesc.SetAsImage(outViewDesc); } diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp index 1481a7999e..8b824a424d 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomDownsamplePass.cpp @@ -47,7 +47,7 @@ namespace AZ { RPI::Ptr outAttachment = m_ownedAttachments[0]; - for (uint32_t i = 0; i < Render::Bloom::MaxStageCount; ++i) + for (uint16_t i = 0; i < Render::Bloom::MaxStageCount; ++i) { // Create bindings diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp index d1f42069fb..779f02cba0 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/TaaPass.cpp @@ -76,7 +76,7 @@ namespace AZ::Render void TaaPass::FrameBeginInternal(FramePrepareParams params) { RHI::Size inputSize = m_inputColorBinding->m_attachment->m_descriptor.m_image.m_size; - Vector2 rcpInputSize = Vector2(1.0 / inputSize.m_width, 1.0 / inputSize.m_height); + Vector2 rcpInputSize = Vector2(1.0f / inputSize.m_width, 1.0f / inputSize.m_height); RPI::ViewPtr view = GetRenderPipeline()->GetDefaultView(); m_offsetIndex = (m_offsetIndex + 1) % m_subPixelOffsets.size(); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp index a6e41a3ce1..276ea7683f 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp @@ -361,7 +361,7 @@ namespace AZ drawRequest.m_listTag = drawListTag; drawRequest.m_pipelineState = pipelineState->GetRHIPipelineState(); drawRequest.m_streamBufferViews = m_reflectionRenderData->m_boxPositionBufferView; - drawRequest.m_stencilRef = stencilRef; + drawRequest.m_stencilRef = static_cast(stencilRef); drawRequest.m_sortKey = m_sortKey; drawPacketBuilder.AddDrawItem(drawRequest); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp index c3125e0bbe..fce32cf448 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp @@ -38,7 +38,7 @@ namespace AZ if (m_imageSize != size) { m_imageSize = size; - m_outputScale = (m_passType == PassType::Vertical) ? pow(2.0f, m_mipLevel) : 1.0f; + m_outputScale = (m_passType == PassType::Vertical) ? static_cast(pow(2.0f, m_mipLevel)) : 1.0f; m_updateSrg = true; } diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp index 4f5caca108..394a6fd406 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurPass.cpp @@ -190,8 +190,8 @@ namespace AZ RPI::PassAttachmentBinding& outputAttachmentBinding = horizontalBlurChildPass->GetInputOutputBinding(1); uint32_t mipLevel = attachmentIndex + 1; RHI::ImageViewDescriptor outputViewDesc; - outputViewDesc.m_mipSliceMin = mipLevel; - outputViewDesc.m_mipSliceMax = mipLevel; + outputViewDesc.m_mipSliceMin = static_cast(mipLevel); + outputViewDesc.m_mipSliceMax = static_cast(mipLevel); outputAttachmentBinding.m_unifiedScopeDesc.SetAsImage(outputViewDesc); outputAttachmentBinding.SetAttachment(reflectionImageAttachment); diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp index cd181f7011..bfc533763e 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshDispatchItem.cpp @@ -205,9 +205,9 @@ namespace AZ if (numThreads) { const auto& args = *numThreads; - arguments.m_threadsPerGroupX = args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1; - arguments.m_threadsPerGroupY = args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1; - arguments.m_threadsPerGroupZ = args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1; + arguments.m_threadsPerGroupX = static_cast(args[0].type() == azrtti_typeid() ? AZStd::any_cast(args[0]) : 1); + arguments.m_threadsPerGroupY = static_cast(args[1].type() == azrtti_typeid() ? AZStd::any_cast(args[1]) : 1); + arguments.m_threadsPerGroupZ = static_cast(args[2].type() == azrtti_typeid() ? AZStd::any_cast(args[2]) : 1); } arguments.m_totalNumberOfThreadsX = xThreads; diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp index af427eb554..2f40ea82d8 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp @@ -445,7 +445,7 @@ namespace AZ MorphTargetInstanceMetaData instanceMetaData; // Positions start at the beginning of the allocation - instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes = allocation->GetVirtualAddress().m_ptr; + instanceMetaData.m_accumulatedPositionDeltaOffsetInBytes = static_cast(allocation->GetVirtualAddress().m_ptr); uint32_t deltaStreamSizeInBytes = static_cast(vertexCount * MorphTargetConstants::s_unpackedMorphTargetDeltaSizeInBytes); // Followed by normals, tangents, and bitangents diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h index 00f329059c..23027083a4 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/ImageProperty.h @@ -183,7 +183,7 @@ namespace AZ else { // Insert intervals by mip level. - for (uint32_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) + for (uint16_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) { m_intervalMap.assign( ConvertSubresourceToIndex(aspect, mipLevel, subResourceRange.m_arraySliceMin), @@ -273,7 +273,7 @@ namespace AZ else { // Traverse one mip level at a time. - for (uint32_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) + for (uint16_t mipLevel = subResourceRange.m_mipSliceMin; mipLevel <= subResourceRange.m_mipSliceMax; ++mipLevel) { getIntervals( ConvertSubresourceToIndex(aspect, mipLevel, subResourceRange.m_arraySliceMin), @@ -332,8 +332,8 @@ namespace AZ { const uint32_t subresourcesPerAspect = m_imageDescriptor.m_mipLevels * m_imageDescriptor.m_arraySize; return ImageSubresource( - (index % subresourcesPerAspect) / m_imageDescriptor.m_arraySize, - (index % subresourcesPerAspect) % m_imageDescriptor.m_arraySize, + static_cast((index % subresourcesPerAspect) / m_imageDescriptor.m_arraySize), + static_cast((index % subresourcesPerAspect) % m_imageDescriptor.m_arraySize), static_cast(index/ subresourcesPerAspect)); } diff --git a/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp b/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp index d41b5d656e..8d6be17ad3 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/CpuProfilerImpl.cpp @@ -320,7 +320,7 @@ namespace AZ m_cachedTimeRegions.clear(); } - timeRegion.m_stackDepth = m_stackLevel; + timeRegion.m_stackDepth = static_cast(m_stackLevel); AZ_Assert(m_timeRegionStack.size() < TimeRegionStackSize, "Adding too many time regions to the stack. Increase the size of TimeRegionStackSize."); m_timeRegionStack.push_back(&timeRegion); diff --git a/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp b/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp index d2298cda3f..ff6ecb4df5 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/FrameGraph.cpp @@ -497,7 +497,7 @@ namespace AZ for (const uint32_t edgeIndex : graphEdges[producerIndex]) { const GraphEdge& graphEdge = m_graphEdges[edgeIndex]; - const uint16_t consumerIndex = graphEdge.m_consumerIndex; + const uint16_t consumerIndex = static_cast(graphEdge.m_consumerIndex); if (--m_graphNodes[consumerIndex].m_unsortedProducerCount == 0) { NodeId newNode; diff --git a/Gems/Atom/RHI/Code/Source/RHI/Image.cpp b/Gems/Atom/RHI/Code/Source/RHI/Image.cpp index acefcca9e7..e864849a30 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/Image.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/Image.cpp @@ -61,7 +61,7 @@ namespace AZ imageStats->m_bindFlags = descriptor.m_bindFlags; ImageSubresourceRange subresourceRange; - subresourceRange.m_mipSliceMin = GetResidentMipLevel(); + subresourceRange.m_mipSliceMin = static_cast(GetResidentMipLevel()); GetSubresourceLayouts(subresourceRange, nullptr, &imageStats->m_sizeInBytes); } diff --git a/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp b/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp index 60d6bfdf96..d53a9d31e6 100644 --- a/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/ImagePropertyTests.cpp @@ -106,7 +106,7 @@ namespace UnitTest range.m_arraySliceMax -= 1; auto overlapInterval = m_property.Get(range); EXPECT_EQ(overlapInterval.size(), m_imageDescriptor.m_mipLevels); - for (uint32_t i = 0; i < overlapInterval.size(); ++i) + for (uint16_t i = 0; i < overlapInterval.size(); ++i) { RHI::ImageSubresourceRange mipRange = range; mipRange.m_mipSliceMin = i; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp index 0cc8fd0202..5007b21976 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp @@ -26,7 +26,7 @@ namespace AZ BufferPoolDescriptor::BufferPoolDescriptor() { - m_bufferPoolPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + m_bufferPoolPageSizeInBytes = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes); } } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp index 680669776c..c7b78a3945 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/BufferPool.cpp @@ -203,7 +203,7 @@ namespace AZ RHI::HeapMemoryUsage& heapMemoryUsage = m_memoryUsage.GetHeapMemoryUsage(descriptorBase.m_heapMemoryLevel); - uint32_t bufferPageSize = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + uint32_t bufferPageSize = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes); // The DX12 descriptor provides an explicit buffer page size override. if (const DX12::BufferPoolDescriptor* descriptor = azrtti_cast(&descriptorBase)) diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp index 98dc2965fb..6018e180ef 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Conversions.cpp @@ -1264,7 +1264,7 @@ namespace AZ dst.BlendOpAlpha = ConvertBlendOp(src.m_blendAlphaOp); dst.DestBlend = ConvertBlendFactor(src.m_blendDest); dst.DestBlendAlpha = ConvertBlendFactor(src.m_blendAlphaDest); - dst.RenderTargetWriteMask = ConvertColorWriteMask(src.m_writeMask); + dst.RenderTargetWriteMask = ConvertColorWriteMask(static_cast(src.m_writeMask)); dst.SrcBlend = ConvertBlendFactor(src.m_blendSource); dst.SrcBlendAlpha = ConvertBlendFactor(src.m_blendAlphaSource); dst.LogicOp = D3D12_LOGIC_OP_CLEAR; @@ -1399,8 +1399,8 @@ namespace AZ desc.DepthFunc = ConvertComparisonFunc(depthStencil.m_depth.m_func); desc.DepthWriteMask = ConvertDepthWriteMask(depthStencil.m_depth.m_writeMask); desc.StencilEnable = depthStencil.m_stencil.m_enable; - desc.StencilReadMask = depthStencil.m_stencil.m_readMask; - desc.StencilWriteMask = depthStencil.m_stencil.m_writeMask; + desc.StencilReadMask = static_cast(depthStencil.m_stencil.m_readMask); + desc.StencilWriteMask = static_cast(depthStencil.m_stencil.m_writeMask); return desc; } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp index 9d23dfa43d..722952bc6d 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp @@ -80,8 +80,8 @@ namespace AZ StagingMemoryAllocator::Descriptor allocatorDesc; allocatorDesc.m_device = this; - allocatorDesc.m_mediumPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes; - allocatorDesc.m_largePageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes; + allocatorDesc.m_mediumPageSizeInBytes = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes); + allocatorDesc.m_largePageSizeInBytes = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes); allocatorDesc.m_collectLatency = descriptor.m_frameCountMax; m_stagingMemoryAllocator.Init(allocatorDesc); } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp index 1336642d8b..3fdeec1c51 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/PipelineLayout.cpp @@ -139,8 +139,8 @@ namespace AZ const RHI::ShaderResourceGroupLayout& groupLayout = *descriptor.GetShaderResourceGroupLayout(groupLayoutIndex); const uint32_t srgLayoutSlot = groupLayout.GetBindingSlot(); - m_slotToIndexTable[srgLayoutSlot] = groupLayoutIndex; - m_indexToSlotTable[groupLayoutIndex] = srgLayoutSlot; + m_slotToIndexTable[srgLayoutSlot] = static_cast(groupLayoutIndex); + m_indexToSlotTable[groupLayoutIndex] = static_cast(srgLayoutSlot); } // Construct a list of indexes sorted by frequency. diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp index 6f35bb32ae..b6c4c029cf 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp @@ -129,7 +129,7 @@ namespace AZ residentImageDescriptor.m_size = imageDescriptor.m_size.GetReducedMip(residentMipLevel); residentImageDescriptor.m_size.m_width = RHI::AlignUp(residentImageDescriptor.m_size.m_width, alignment); residentImageDescriptor.m_size.m_height = RHI::AlignUp(residentImageDescriptor.m_size.m_height, alignment); - residentImageDescriptor.m_mipLevels = imageDescriptor.m_mipLevels - residentMipLevel; + residentImageDescriptor.m_mipLevels = static_cast(imageDescriptor.m_mipLevels - residentMipLevel); D3D12_RESOURCE_ALLOCATION_INFO allocationInfo; GetDevice().GetImageAllocationInfo(residentImageDescriptor, allocationInfo); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp index 160dce12d5..c80b04bc73 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/BufferPoolDescriptor.cpp @@ -26,7 +26,7 @@ namespace AZ BufferPoolDescriptor::BufferPoolDescriptor() { - m_bufferPoolPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + m_bufferPoolPageSizeInBytes = static_cast(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes); } } } diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp index 18b5d83ed3..0d947085ba 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp @@ -173,7 +173,7 @@ namespace AZ auto* image = static_cast(request.m_image); auto& device = static_cast(GetDevice()); - const uint16_t startMip = residentMip - 1; + const uint16_t startMip = static_cast(residentMip - 1); const uint16_t endMip = static_cast(residentMip - request.m_mipSlices.size()); RHI::Ptr uploadFence = Fence::Create(); @@ -277,7 +277,7 @@ namespace AZ copyDescriptor.m_sourceSize.m_depth = 1; copyDescriptor.m_destinationImage = image; copyDescriptor.m_destinationSubresource.m_mipSlice = curMip; - copyDescriptor.m_destinationSubresource.m_arraySlice = arraySlice; + copyDescriptor.m_destinationSubresource.m_arraySlice = static_cast(arraySlice); copyDescriptor.m_destinationOrigin.m_left = 0; copyDescriptor.m_destinationOrigin.m_top = 0; copyDescriptor.m_destinationOrigin.m_front = depth; @@ -309,7 +309,7 @@ namespace AZ copyDescriptor.m_sourceSize.m_depth = 1; copyDescriptor.m_destinationImage = image; copyDescriptor.m_destinationSubresource.m_mipSlice = curMip; - copyDescriptor.m_destinationSubresource.m_arraySlice = arraySlice; + copyDescriptor.m_destinationSubresource.m_arraySlice = static_cast(arraySlice); copyDescriptor.m_destinationOrigin.m_left = 0; copyDescriptor.m_destinationOrigin.m_top = 0; copyDescriptor.m_destinationOrigin.m_front = depth; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp index 18ddc0f4df..d5671cff05 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Conversion.cpp @@ -257,7 +257,7 @@ namespace AZ state.srcAlphaBlendFactor = ConvertBlendFactor(targetBlendState.m_blendAlphaSource); state.dstAlphaBlendFactor = ConvertBlendFactor(targetBlendState.m_blendAlphaDest); state.alphaBlendOp = ConvertBlendOp(targetBlendState.m_blendAlphaOp); - state.colorWriteMask = ConvertComponentFlags(targetBlendState.m_writeMask); + state.colorWriteMask = ConvertComponentFlags(static_cast(targetBlendState.m_writeMask)); } VkBlendFactor ConvertBlendFactor(const RHI::BlendFactor& blendFactor) diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp index d4697cbd32..44c36f5c70 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp @@ -117,8 +117,8 @@ namespace AZ const auto& device = static_cast(GetDevice()); const auto& physicalDevice = static_cast(GetDevice().GetPhysicalDevice()); - const uint16_t width = imgDesc.m_size.m_width; - const uint16_t height = imgDesc.m_size.m_height; + const uint16_t width = static_cast(imgDesc.m_size.m_width); + const uint16_t height = static_cast(imgDesc.m_size.m_height); const uint16_t depth = AZStd::min(static_cast(imgViewDesc.m_depthSliceMax - imgViewDesc.m_depthSliceMin), static_cast(imgDesc.m_size.m_depth - 1)) + 1; const uint16_t samples = imgDesc.m_multisampleState.m_samples; const uint16_t arrayLayers = AZStd::min(static_cast(imgViewDesc.m_arraySliceMax - imgViewDesc.m_arraySliceMin), static_cast(imgDesc.m_arraySize - 1)) + 1; @@ -233,7 +233,7 @@ namespace AZ // https://www.khronos.org/registry/vulkan/specs/1.1/html/chap11.html#VkImageSubresourceRange { range.m_arraySliceMin = descriptor.m_depthSliceMin; - range.m_arraySliceMax = AZStd::GetMin(descriptor.m_depthSliceMax, imageDesc.m_size.m_depth - 1); + range.m_arraySliceMax = AZStd::GetMin(descriptor.m_depthSliceMax, static_cast(imageDesc.m_size.m_depth - 1)); break; } case VK_IMAGE_VIEW_TYPE_3D: diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp index 5c7a78fd89..f627ddf2cc 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PipelineLayout.cpp @@ -134,7 +134,7 @@ namespace AZ uint32_t bindingSlot = srgLayout->GetBindingSlot(); m_indexToSlot[bindingInfo.m_spaceId].set(bindingSlot); - m_slotToIndex[bindingSlot] = bindingInfo.m_spaceId; + m_slotToIndex[bindingSlot] = static_cast(bindingInfo.m_spaceId); } m_descriptorSetLayouts.reserve(srgCount); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp index 9189c2e177..586470da0a 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp @@ -108,7 +108,7 @@ namespace AZ WaitFinishUploading(image); - const uint16_t residentMipLevelBefore = image.GetResidentMipLevel(); + const uint16_t residentMipLevelBefore = static_cast(image.GetResidentMipLevel()); const uint16_t residentMipLevelAfter = residentMipLevelBefore - static_cast(request.m_mipSlices.size()); const VkMemoryRequirements memoryRequirements = GetMemoryRequirements(image.GetDescriptor(), residentMipLevelAfter); @@ -149,11 +149,11 @@ namespace AZ // Set streamed mip level to target mip level. if (image.GetStreamedMipLevel() < targetMipLevel) { - image.SetStreamedMipLevel(targetMipLevel); + image.SetStreamedMipLevel(static_cast(targetMipLevel)); } const VkMemoryRequirements memoryRequirements = GetMemoryRequirements(image.GetDescriptor(), targetMipLevel); - const uint16_t residentMipLevelBefore = image.GetResidentMipLevel(); + const uint16_t residentMipLevelBefore = static_cast(image.GetResidentMipLevel()); RHI::HeapMemoryUsage& memoryUsage = m_memoryUsage.GetHeapMemoryUsage(RHI::HeapMemoryLevel::Device); const size_t imageSizeBefore = image.GetResidentSizeInBytes(); @@ -203,7 +203,7 @@ namespace AZ residentImageDescriptor.m_size = imageDescriptor.m_size.GetReducedMip(residentMipLevel); residentImageDescriptor.m_size.m_width = RHI::AlignUp(residentImageDescriptor.m_size.m_width, alignment); residentImageDescriptor.m_size.m_height = RHI::AlignUp(residentImageDescriptor.m_size.m_height, alignment); - residentImageDescriptor.m_mipLevels = imageDescriptor.m_mipLevels - residentMipLevel; + residentImageDescriptor.m_mipLevels = imageDescriptor.m_mipLevels - static_cast(residentMipLevel); return device.GetImageMemoryRequirements(imageDescriptor); } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp index 45070371d6..8629588ea2 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Image/StreamingImage.cpp @@ -247,7 +247,7 @@ namespace AZ uint16_t StreamingImage::GetResidentMipLevel() { - return m_image->GetResidentMipLevel(); + return static_cast(m_image->GetResidentMipLevel()); } RHI::ResultCode StreamingImage::TrimToMipChainLevel(size_t mipChainIndex) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp index 94421e2ca4..8a4206f0d8 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp @@ -155,7 +155,7 @@ namespace AZ m_item.m_arguments = RHI::DrawArguments(draw); m_item.m_pipelineState = m_shader->AcquirePipelineState(pipelineStateDescriptor); - m_item.m_stencilRef = m_stencilRef; + m_item.m_stencilRef = static_cast(m_stencilRef); } void FullscreenTrianglePass::FrameBeginInternal(FramePrepareParams params) diff --git a/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp b/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp index 3b113b78f8..f648de6997 100644 --- a/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp @@ -67,7 +67,8 @@ namespace UnitTest bufferData.resize(bufferSize); // The actual data doesn't matter - for (uint32_t i = 0; i < bufferData.size(); ++i) + const uint8_t bufferDataSize = static_cast(bufferData.size()); + for (uint8_t i = 0; i < bufferDataSize; ++i) { bufferData[i] = i; } diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp index 21f3239698..ff998ad4d3 100644 --- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp @@ -38,7 +38,8 @@ namespace UnitTest bufferData.resize(bufferSize); //The actual data doesn't matter - for (uint32_t i = 0; i < bufferData.size(); ++i) + const uint8_t bufferDataSize = static_cast(bufferData.size()); + for (uint8_t i = 0; i < bufferDataSize; ++i) { bufferData[i] = i; } diff --git a/Gems/Atom/Utils/Code/Source/ImageComparison.cpp b/Gems/Atom/Utils/Code/Source/ImageComparison.cpp index e226d0b2b4..a17d07ed3f 100644 --- a/Gems/Atom/Utils/Code/Source/ImageComparison.cpp +++ b/Gems/Atom/Utils/Code/Source/ImageComparison.cpp @@ -67,9 +67,9 @@ namespace AZ { // We use the max error from a single channel instead of accumulating the error from each channel. // This normalizes differences so that for example black vs red has the same weight as black vs yellow. - const int16_t diffR = abs(aznumeric_cast(bufferA[i]) - aznumeric_cast(bufferB[i])); - const int16_t diffG = abs(aznumeric_cast(bufferA[i + 1]) - aznumeric_cast(bufferB[i + 1])); - const int16_t diffB = abs(aznumeric_cast(bufferA[i + 2]) - aznumeric_cast(bufferB[i + 2])); + const int16_t diffR = static_cast(abs(aznumeric_cast(bufferA[i]) - aznumeric_cast(bufferB[i]))); + const int16_t diffG = static_cast(abs(aznumeric_cast(bufferA[i + 1]) - aznumeric_cast(bufferB[i + 1]))); + const int16_t diffB = static_cast(abs(aznumeric_cast(bufferA[i + 2]) - aznumeric_cast(bufferB[i + 2]))); const int16_t maxDiff = AZ::GetMax(AZ::GetMax(diffR, diffG), diffB); const float finalDiffNormalized = maxDiff / 255.0f; From b3e895d10c697354ee6a9580f533494a722b3a1f Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:21:12 -0700 Subject: [PATCH 005/100] =?UTF-8?q?=EF=BB=BFfixed=20AtomLyIntegration?= 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> --- Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp | 6 +++--- .../AtomFont/Code/Source/FontRenderer.cpp | 4 ++-- .../AtomFont/Code/Source/FontTexture.cpp | 10 +++++----- .../AtomFont/Code/Source/GlyphBitmap.cpp | 2 +- .../Source/AtomViewportDisplayInfoSystemComponent.cpp | 2 +- .../Source/CoreLights/AreaLightComponentController.cpp | 4 ++-- .../CoreLights/DirectionalLightComponentController.cpp | 3 ++- .../Code/Source/CoreLights/DiskLightDelegate.cpp | 4 ++-- .../Code/Source/Mesh/MeshComponentController.cpp | 2 +- 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index 9317cae846..a29815f08c 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -1070,7 +1070,7 @@ int AZ::FFont::CreateQuadsForText(const RHI::Viewport& viewport, float x, float uint32_t packedColor = 0xffffffff; { ColorB tempColor = color; - tempColor.a = ((uint32_t) tempColor.a * alphaBlend) >> 8; + tempColor.a = static_cast(((uint32_t) tempColor.a * alphaBlend) >> 8); packedColor = tempColor.pack_argb8888(); //note: this ends up in r,g,b,a order on little-endian machines } @@ -1220,7 +1220,7 @@ void AZ::FFont::WrapText(AZStd::string& result, float maxWidth, const char* str, if (ctx.m_processSpecialChars && ch == '$') { ++pChar; - char nextChar = *pChar; + char nextChar = static_cast(*pChar); if (isdigit(nextChar) || nextChar == 'O' || nextChar == 'o') { @@ -1516,7 +1516,7 @@ bool AZ::FFont::InitCache() char* p = buf; // precache all [normal] printable characters to the string (missing ones are updated on demand) - for (int i = first; i <= last; ++i) + for (char i = first; i <= last; ++i) { *p++ = i; } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp index 8c023f9353..053a2eb419 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp @@ -235,12 +235,12 @@ int AZ::FontRenderer::GetGlyph(GlyphBitmap* glyphBitmap, int* horizontalAdvance, if (glyphWidth) { - *glyphWidth = m_glyph->bitmap.width; + *glyphWidth = static_cast(m_glyph->bitmap.width); } if (glyphHeight) { - *glyphHeight = m_glyph->bitmap.rows; + *glyphHeight = static_cast(m_glyph->bitmap.rows); } unsigned char* buffer = glyphBitmap->GetBuffer(); diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp index 1ee7f80eda..773b19e740 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontTexture.cpp @@ -496,8 +496,8 @@ int AZ::FontTexture::UpdateSlot(int slotIndex, uint16_t slotUsage, uint32_t char return 0; } - slot->m_characterWidth = width; - slot->m_characterHeight = height; + slot->m_characterWidth = static_cast(width); + slot->m_characterHeight = static_cast(height); // Add a pixel along width and height to avoid artifacts being rendered // from a previous glyph in this slot due to bilinear filtering. The source @@ -519,8 +519,8 @@ void AZ::FontTexture::CreateGradientSlot() assert(slot->m_currentCharacter == (uint32_t)~0); // 0 needs to be unused spot slot->Reset(); - slot->m_characterWidth = m_cellWidth - 2; - slot->m_characterHeight = m_cellHeight - 2; + slot->m_characterWidth = static_cast(m_cellWidth - 2); + slot->m_characterHeight = static_cast(m_cellHeight - 2); slot->SetNotReusable(); int x = slot->m_textureSlot % m_widthCellCount; @@ -533,7 +533,7 @@ void AZ::FontTexture::CreateGradientSlot() { for (uint32_t dwX = 0; dwX < slot->m_characterWidth; ++dwX) { - buffer[dwX + dwY * m_width] = dwY * 255 / (slot->m_characterHeight - 1); + buffer[dwX + dwY * m_width] = static_cast(dwY * 255 / (slot->m_characterHeight - 1)); } } } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp index 09bc27783b..395a161b83 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/GlyphBitmap.cpp @@ -118,7 +118,7 @@ int AZ::GlyphBitmap::Blur(AZ::FontSmoothAmount smoothAmount) colorSum += m_buffer[yOffset + x]; } - m_buffer[yOffset + x] = colorSum >> 2; + m_buffer[yOffset + x] = static_cast(colorSum >> 2); } } } diff --git a/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp b/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp index 40c4f8e48f..c1f459e1ee 100644 --- a/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp +++ b/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp @@ -135,7 +135,7 @@ namespace AZ::Render return; } - m_fpsInterval = AZStd::chrono::seconds(r_fpsCalcInterval); + m_fpsInterval = AZStd::chrono::seconds(static_cast(r_fpsCalcInterval)); UpdateFramerate(); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp index b90b145320..0a5598a74a 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentController.cpp @@ -535,7 +535,7 @@ namespace AZ::Render void AreaLightComponentController::SetPredictionSampleCount(uint32_t count) { - m_configuration.m_predictionSampleCount = count; + m_configuration.m_predictionSampleCount = static_cast(count); if (m_lightShapeDelegate) { m_lightShapeDelegate->SetPredictionSampleCount(count); @@ -549,7 +549,7 @@ namespace AZ::Render void AreaLightComponentController::SetFilteringSampleCount(uint32_t count) { - m_configuration.m_filteringSampleCount = count; + m_configuration.m_filteringSampleCount = static_cast(count); if (m_lightShapeDelegate) { m_lightShapeDelegate->SetFilteringSampleCount(count); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp index 031d935513..642e50d104 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentController.cpp @@ -259,7 +259,8 @@ namespace AZ void DirectionalLightComponentController::SetCascadeCount(uint32_t cascadeCount) { - const uint16_t cascadeCount16 = cascadeCount = GetMin(Shadow::MaxNumberOfCascades, GetMax(1, aznumeric_cast(cascadeCount))); + const uint16_t cascadeCount16 = GetMin(static_cast(Shadow::MaxNumberOfCascades), GetMax(1, aznumeric_cast(cascadeCount))); + cascadeCount = cascadeCount16; m_configuration.m_cascadeCount = cascadeCount16; if (m_featureProcessor) { diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp index c6e4441d57..91856f7ee5 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DiskLightDelegate.cpp @@ -159,7 +159,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast(count)); } } @@ -167,7 +167,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), static_cast(count)); } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp index 68276a7320..bb38f932fb 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Mesh/MeshComponentController.cpp @@ -442,7 +442,7 @@ namespace AZ RPI::Cullable::LodOverride MeshComponentController::GetLodOverride() const { - return m_meshFeatureProcessor->GetSortKey(m_meshHandle); + return static_cast(m_meshFeatureProcessor->GetSortKey(m_meshHandle)); } void MeshComponentController::SetVisibility(bool visible) From 0fae5d0aa0c3c4a99213cf1f3b1a509739a7aa3d Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:27:59 -0700 Subject: [PATCH 006/100] =?UTF-8?q?=EF=BB=BFAWSGameLift?= 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> --- .../Source/Activity/AWSGameLiftCreateSessionActivity.cpp | 2 +- .../Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp | 2 +- .../Source/Activity/AWSGameLiftJoinSessionActivity.cpp | 2 +- .../Source/Activity/AWSGameLiftSearchSessionsActivity.cpp | 2 +- .../Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp index 667a8de679..16d0cf4241 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp @@ -48,7 +48,7 @@ namespace AWSGameLift { request.SetFleetId(createSessionRequest.m_fleetId.c_str()); } - request.SetMaximumPlayerSessionCount(createSessionRequest.m_maxPlayer); + request.SetMaximumPlayerSessionCount(static_cast(createSessionRequest.m_maxPlayer)); AZ_TracePrintf(AWSGameLiftCreateSessionActivityName, "Built CreateGameSessionRequest with CreatorId=%s, Name=%s, IdempotencyToken=%s, GameProperties=%s, AliasId=%s, FleetId=%s and MaximumPlayerSessionCount=%d", diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp index a8a393aa18..1ac9c7db1c 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp @@ -33,7 +33,7 @@ namespace AWSGameLift // Required attributes request.SetGameSessionQueueName(createSessionOnQueueRequest.m_queueName.c_str()); - request.SetMaximumPlayerSessionCount(createSessionOnQueueRequest.m_maxPlayer); + request.SetMaximumPlayerSessionCount(static_cast(createSessionOnQueueRequest.m_maxPlayer)); request.SetPlacementId(createSessionOnQueueRequest.m_placementId.c_str()); AZ_TracePrintf(AWSGameLiftCreateSessionOnQueueActivityName, diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp index d54907aa71..a47e59255f 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftJoinSessionActivity.cpp @@ -47,7 +47,7 @@ namespace AWSGameLift //sessionConnectionConfig.m_dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str(); sessionConnectionConfig.m_ipAddress = createPlayerSessionResult.GetPlayerSession().GetIpAddress().c_str(); sessionConnectionConfig.m_playerSessionId = createPlayerSessionResult.GetPlayerSession().GetPlayerSessionId().c_str(); - sessionConnectionConfig.m_port = createPlayerSessionResult.GetPlayerSession().GetPort(); + sessionConnectionConfig.m_port = static_cast(createPlayerSessionResult.GetPlayerSession().GetPort()); AZ_TracePrintf(AWSGameLiftJoinSessionActivityName, "Built SessionConnectionConfig with IpAddress=%s, PlayerSessionId=%s and Port=%d", diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp index ec592735ae..3d29fa2b71 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftSearchSessionsActivity.cpp @@ -99,7 +99,7 @@ namespace AWSGameLift session.m_currentPlayer = gameSession.GetCurrentPlayerSessionCount(); session.m_ipAddress = gameSession.GetIpAddress().c_str(); session.m_maxPlayer = gameSession.GetMaximumPlayerSessionCount(); - session.m_port = gameSession.GetPort(); + session.m_port = static_cast(gameSession.GetPort()); session.m_sessionId = gameSession.GetGameSessionId().c_str(); session.m_sessionName = gameSession.GetName().c_str(); session.m_status = AWSGameLiftSessionStatusNames[(int)gameSession.GetStatus()]; diff --git a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp index f98ae7b6f1..94d6a7dac1 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/AWSGameLiftServerManager.cpp @@ -70,7 +70,7 @@ namespace AWSGameLift sessionConfig.m_ipAddress = gameSession.GetIpAddress().c_str(); sessionConfig.m_maxPlayer = gameSession.GetMaximumPlayerSessionCount(); sessionConfig.m_sessionName = gameSession.GetName().c_str(); - sessionConfig.m_port = gameSession.GetPort(); + sessionConfig.m_port = static_cast(gameSession.GetPort()); sessionConfig.m_status = AWSGameLiftSessionStatusNames[(int)gameSession.GetStatus()]; AZ_TracePrintf(AWSGameLiftServerManagerName, From c14c23c9c76f63e59d5bcf3d0c86af4ab74872fa Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:28:13 -0700 Subject: [PATCH 007/100] AWSMetrics Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp b/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp index eabac5a5c3..13cbf924c3 100644 --- a/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp +++ b/Gems/AWSMetrics/Code/Source/ClientConfiguration.cpp @@ -99,7 +99,7 @@ namespace AWSMetrics AZ::s64 ClientConfiguration::GetMaxQueueSizeInBytes() const { - return m_maxQueueSizeInMb * 1000000; + return static_cast(m_maxQueueSizeInMb * 1000000); } AZ::s64 ClientConfiguration::GetQueueFlushPeriodInSeconds() const From bed57208da52648913cd7442f5cb9b12213ca208 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:29:00 -0700 Subject: [PATCH 008/100] =?UTF-8?q?=EF=BB=BFEMotionFX?= 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> --- .../EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h | 4 ++-- Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h | 4 ++-- .../Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h | 4 ++-- Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h | 4 ++-- .../Code/EMotionFX/Source/BlendTreeFloatConditionNode.h | 4 ++-- .../Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h | 4 ++-- .../StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp | 2 +- Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp | 6 +++--- Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp | 6 +++--- Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp | 2 +- Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp | 4 ++-- .../Code/Tests/Vector2ToVector3CompatibilityTests.cpp | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h index 042799192d..2d83d21d0d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.h @@ -28,12 +28,12 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_DECL // - enum + enum : uint16 { OUTPUTPORT_RESULT = 0 }; - enum + enum : uint16 { PORTID_OUTPUT_POSE = 0 }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h index a07bbc625c..692b81b70e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h @@ -32,7 +32,7 @@ namespace EMotionFX AZ_RTTI(AnimGraphMotionNode, "{B8B8AAE6-E532-4BF8-898F-3D40AA41BC82}", AnimGraphNode) AZ_CLASS_ALLOCATOR_DECL - enum + enum : uint16 { INPUTPORT_PLAYSPEED = 0, INPUTPORT_INPLACE = 1, @@ -41,7 +41,7 @@ namespace EMotionFX OUTPUTPORT_MOTION = 1 }; - enum + enum : uint16 { PORTID_INPUT_PLAYSPEED = 0, PORTID_INPUT_INPLACE = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h index 9a9b51b5d1..991fb03472 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h @@ -26,7 +26,7 @@ namespace EMotionFX using WeightedMaskEntry = AZStd::pair; - enum + enum : uint16 { INPUTPORT_POSE_A = 0, INPUTPORT_POSE_B = 1, @@ -34,7 +34,7 @@ namespace EMotionFX OUTPUTPORT_POSE = 0 }; - enum + enum : uint16 { PORTID_INPUT_POSE_A = 0, PORTID_INPUT_POSE_B = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h index 72d6ad120c..4f4b8a7ac3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h @@ -49,7 +49,7 @@ namespace EMotionFX AZ_RTTI(BlendTreeBlendNNode, "{CBFFDE41-008D-45A1-AC2A-E9A25C8CE62A}", AnimGraphNode) AZ_CLASS_ALLOCATOR_DECL - enum + enum : uint16 { INPUTPORT_POSE_0 = 0, INPUTPORT_POSE_1 = 1, @@ -65,7 +65,7 @@ namespace EMotionFX OUTPUTPORT_POSE = 0 }; - enum + enum : uint16 { PORTID_INPUT_POSE_0 = 0, PORTID_INPUT_POSE_1 = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h index 756f6a4bab..fc922934ed 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.h @@ -26,7 +26,7 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_DECL // - enum + enum : uint16 { INPUTPORT_X = 0, INPUTPORT_Y = 1, @@ -34,7 +34,7 @@ namespace EMotionFX OUTPUTPORT_BOOL = 1 }; - enum + enum : uint16 { PORTID_INPUT_X = 0, PORTID_INPUT_Y = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h index e39cd7258e..29b497457e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h @@ -27,7 +27,7 @@ namespace EMotionFX AZ_RTTI(BlendTreeTwoLinkIKNode, "{0C3E8B7F-F810-47A6-B1A9-27BD4E4B5500}", AnimGraphNode) AZ_CLASS_ALLOCATOR_DECL - enum + enum : uint16 { INPUTPORT_POSE = 0, INPUTPORT_GOALPOS = 1, @@ -37,7 +37,7 @@ namespace EMotionFX OUTPUTPORT_POSE = 0 }; - enum + enum : uint16 { PORTID_INPUT_POSE = 0, PORTID_INPUT_GOALPOS = 1, diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp index f25158ae0d..06b87c2bc2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeGroupInfo.cpp @@ -26,7 +26,7 @@ namespace EMStudio const size_t numGroupNodes = nodeGroup->GetNumNodes(); for (size_t j = 0; j < numGroupNodes; ++j) { - const uint16 nodeIndex = nodeGroup->GetNode(j); + const uint16 nodeIndex = nodeGroup->GetNode(static_cast(j)); const EMotionFX::Node* node = actor->GetSkeleton()->GetNode(nodeIndex); m_nodes.emplace_back(node->GetNameString()); } diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp index aa1bde295a..710cfb790e 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp @@ -126,8 +126,8 @@ namespace EMotionFX blendNNode->SetName(blendNNodeName); blendTree->AddChildNode(blendNNode); - const int motionNodeCount = 5; - for (AZ::u32 i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 5; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); motionNode->SetName(AZStd::string::format("Motion %i (%s)", i, blendNNodeName).c_str()); @@ -172,7 +172,7 @@ namespace EMotionFX finalNode->AddConnection(blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); // Creates 5x blend N nodes as input for the blend N node created here. Each of these five blend N nodes have 5x input motions. - for (AZ::u32 i = 0; i < 5; ++i) + for (uint16 i = 0; i < 5; ++i) { BlendTreeBlendNNode* inputNode = CreateBlendNNode(testBlendTree, parameterNode, AZStd::string::format("InputBlendNode%i", i).c_str()); blendNNode->AddConnection(inputNode, AnimGraphMotionNode::PORTID_OUTPUT_POSE, i); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp index 1f9fb9cae3..1f5fb9a512 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp @@ -51,8 +51,8 @@ namespace EMotionFX m_blendTree->AddChildNode(finalNode); finalNode->AddConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); - const int motionNodeCount = 3; - for (int i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 3; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); @@ -213,7 +213,7 @@ namespace EMotionFX finalNode->AddConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); ASSERT_TRUE(param.m_motionNodeCount <= 10) << "The blend N node only has 10 pose inputs."; - for (AZ::u32 i = 0; i < param.m_motionNodeCount; ++i) + for (uint16 i = 0; i < param.m_motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp index b86041c7aa..8bd66ced88 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp @@ -173,7 +173,7 @@ namespace EMotionFX m_blendTree->AddChildNode(m_basePoseNode); m_maskNode->AddConnection(m_basePoseNode, BlendTreeTestInputNode::OUTPUTPORT_RESULT, BlendTreeMaskNode::INPUTPORT_BASEPOSE); - for (AZ::u32 i = 0; i < m_numMaskInputNodes; ++i) + for (uint16 i = 0; i < m_numMaskInputNodes; ++i) { BlendTreeTestInputNode* inputNode = aznew BlendTreeTestInputNode(static_cast(i)); m_blendTree->AddChildNode(inputNode); diff --git a/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp index 6214005a71..dbf9f18e9e 100644 --- a/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp @@ -53,8 +53,8 @@ namespace EMotionFX m_blendTree->AddChildNode(finalNode); finalNode->AddConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); - const int motionNodeCount = 2; - for (int i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 2; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); diff --git a/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp b/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp index 26702af550..d5ce41cfeb 100644 --- a/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp +++ b/Gems/EMotionFX/Code/Tests/Vector2ToVector3CompatibilityTests.cpp @@ -46,8 +46,8 @@ namespace EMotionFX m_blendTree->AddChildNode(finalNode); finalNode->AddUnitializedConnection(m_blendNNode, BlendTreeBlendNNode::PORTID_OUTPUT_POSE, BlendTreeFinalNode::PORTID_INPUT_POSE); - const int motionNodeCount = 3; - for (int i = 0; i < motionNodeCount; ++i) + const uint16 motionNodeCount = 3; + for (uint16 i = 0; i < motionNodeCount; ++i) { AnimGraphMotionNode* motionNode = aznew AnimGraphMotionNode(); m_blendTree->AddChildNode(motionNode); From 48fcd462c69114e3f5bc92265b35325284651b58 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:29:20 -0700 Subject: [PATCH 009/100] FastNoise Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp b/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp index 51980ca08a..443fe0ce72 100644 --- a/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp +++ b/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp @@ -201,14 +201,14 @@ void FastNoise::SetSeed(int seed) std::mt19937_64 gen(seed); - for (int i = 0; i < 256; i++) + for (unsigned char i = 0; i < 256; i++) m_perm[i] = i; for (int j = 0; j < 256; j++) { int rng = (int)(gen() % (256 - j)); int k = rng + j; - int l = m_perm[j]; + unsigned char l = m_perm[j]; m_perm[j] = m_perm[j + 256] = m_perm[k]; m_perm[k] = l; m_perm12[j] = m_perm12[j + 256] = m_perm[j] % 12; From 4ee9adf522de2dfde166beb51498d8647d2d93f8 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:34:20 -0700 Subject: [PATCH 010/100] GraphCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Nodes/Group/NodeGroupFrameComponent.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp b/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp index fa265ad644..c317e8044a 100644 --- a/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp @@ -2493,18 +2493,18 @@ namespace GraphCanvas { if (growOnly) { - int left = blockBoundingRect.left(); + int left = static_cast(blockBoundingRect.left()); if (left >= calculatedBounds.left()) { - left = calculatedBounds.left() - gridStep.GetX(); + left = static_cast(calculatedBounds.left() - gridStep.GetX()); } - int right = blockBoundingRect.right(); + int right = static_cast(blockBoundingRect.right()); if (right <= calculatedBounds.right()) { - right = calculatedBounds.right() + gridStep.GetX(); + right = static_cast(calculatedBounds.right() + gridStep.GetX()); } blockBoundingRect.setX(left); @@ -2521,18 +2521,18 @@ namespace GraphCanvas { if (growOnly) { - int top = blockBoundingRect.top(); + int top = static_cast(blockBoundingRect.top()); if (top >= calculatedBounds.top()) { - top = calculatedBounds.top() - gridStep.GetY(); + top = static_cast(calculatedBounds.top() - gridStep.GetY()); } - int bottom = blockBoundingRect.bottom(); + int bottom = static_cast(blockBoundingRect.bottom()); if (bottom <= calculatedBounds.bottom()) { - bottom = calculatedBounds.bottom() + gridStep.GetY(); + bottom = static_cast(calculatedBounds.bottom() + gridStep.GetY()); } blockBoundingRect.setY(top); From 23b2a51757b1a96fd2d57ab74f639033b16ad0b9 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:34:48 -0700 Subject: [PATCH 011/100] ImGui Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp index 8e0e23652c..7f4877347f 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp @@ -770,8 +770,8 @@ namespace ImGui { AZStd::string name1 = com1->RTTI_GetTypeName(); AZStd::string name2 = com2->RTTI_GetTypeName(); - AZStd::transform(name1.begin(), name1.end(), name1.begin(), ::tolower); - AZStd::transform(name2.begin(), name2.end(), name2.begin(), ::tolower); + AZStd::to_lower(name1.begin(), name1.end()); + AZStd::to_lower(name2.begin(), name2.end()); return name1 < name2; }; AZStd::sort(components.begin(), components.end(), sortByComponentName); @@ -1017,8 +1017,8 @@ namespace ImGui AZStd::string name1, name2; AZ::ComponentApplicationBus::BroadcastResult(name1, &AZ::ComponentApplicationBus::Events::GetEntityName, ent1->m_entityId); AZ::ComponentApplicationBus::BroadcastResult(name2, &AZ::ComponentApplicationBus::Events::GetEntityName, ent2->m_entityId); - AZStd::transform(name1.begin(), name1.end(), name1.begin(), ::tolower); - AZStd::transform(name2.begin(), name2.end(), name2.begin(), ::tolower); + AZStd::to_lower(name1.begin(), name1.end()); + AZStd::to_lower(name2.begin(), name2.end()); return name1 < name2; }; AZStd::sort(entityInfo->m_children.begin(), entityInfo->m_children.end(), sortByEntityName); From 4a3d438c22dae4ca5d209753a73a7b2ae3e73f1c Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:35:06 -0700 Subject: [PATCH 012/100] =?UTF-8?q?=EF=BB=BFLyShine?= 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> --- Gems/LyShine/Code/Source/Animation/2DSpline.h | 2 +- Gems/LyShine/Code/Source/LyShineDebug.cpp | 2 +- Gems/LyShine/Code/Source/RenderGraph.cpp | 6 +++--- Gems/LyShine/Code/Source/Sprite.cpp | 2 +- Gems/LyShine/Code/Source/UiImageComponent.cpp | 20 +++++++++---------- .../Source/UiParticleEmitterComponent.cpp | 4 ++-- Gems/LyShine/Code/Source/UiTextComponent.cpp | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Gems/LyShine/Code/Source/Animation/2DSpline.h b/Gems/LyShine/Code/Source/Animation/2DSpline.h index 60589e1344..b831bd669a 100644 --- a/Gems/LyShine/Code/Source/Animation/2DSpline.h +++ b/Gems/LyShine/Code/Source/Animation/2DSpline.h @@ -62,7 +62,7 @@ namespace UiSpline ILINE void flag_clr(int flag) { m_flags &= ~flag; }; ILINE int flag(int flag) { return m_flags & flag; }; - ILINE void ORT(int ort) { m_ORT = ort; }; + ILINE void ORT(int ort) { m_ORT = static_cast(ort); }; ILINE int ORT() const { return m_ORT; }; ILINE int isORT(int o) const { return (m_ORT == o); }; diff --git a/Gems/LyShine/Code/Source/LyShineDebug.cpp b/Gems/LyShine/Code/Source/LyShineDebug.cpp index c7dccc162f..a30f816c73 100644 --- a/Gems/LyShine/Code/Source/LyShineDebug.cpp +++ b/Gems/LyShine/Code/Source/LyShineDebug.cpp @@ -115,7 +115,7 @@ static int Create2DTexture(int width, int height, byte* data, ETEX_Format format static AZ::Vector2 GetTextureSize(AZ::Data::Instance image) { AZ::RHI::Size size = image->GetDescriptor().m_size; - return AZ::Vector2(size.m_width, size.m_height); + return AZ::Vector2(static_cast(size.m_width), static_cast(size.m_height)); } #endif diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index b07aab78c7..85f9c7deb5 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -386,7 +386,7 @@ namespace LyShine curBaseState.m_stencilState.m_backFace = stencilOpState; // set up for stencil write - dynamicDraw->SetStencilReference(uiRenderer->GetStencilRef()); + dynamicDraw->SetStencilReference(static_cast(uiRenderer->GetStencilRef())); curBaseState.m_stencilState.m_enable = true; curBaseState.m_stencilState.m_writeMask = 0xFF; } @@ -420,7 +420,7 @@ namespace LyShine uiRenderer->DecrementStencilRef(); } - dynamicDraw->SetStencilReference(uiRenderer->GetStencilRef()); + dynamicDraw->SetStencilReference(static_cast(uiRenderer->GetStencilRef())); if (firstPass) { @@ -790,7 +790,7 @@ namespace LyShine { for (int i = 0; i < primitive->m_numVertices; ++i) { - primitive->m_vertices[i].texIndex = texUnit; + primitive->m_vertices[i].texIndex = static_cast(texUnit); } } diff --git a/Gems/LyShine/Code/Source/Sprite.cpp b/Gems/LyShine/Code/Source/Sprite.cpp index a097e23dfe..7f293e57a3 100644 --- a/Gems/LyShine/Code/Source/Sprite.cpp +++ b/Gems/LyShine/Code/Source/Sprite.cpp @@ -368,7 +368,7 @@ AZ::Vector2 CSprite::GetSize() } AZ::RHI::Size size = image->GetRHIImage()->GetDescriptor().m_size; - return AZ::Vector2(size.m_width, size.m_height); + return AZ::Vector2(static_cast(size.m_width), static_cast(size.m_height)); } else { diff --git a/Gems/LyShine/Code/Source/UiImageComponent.cpp b/Gems/LyShine/Code/Source/UiImageComponent.cpp index 83c184cfc8..d279beeee9 100644 --- a/Gems/LyShine/Code/Source/UiImageComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageComponent.cpp @@ -1666,7 +1666,7 @@ void UiImageComponent::RenderRadialFilledQuad(const AZ::Vector2* positions, cons const int numIndices = 15; uint16 indices[numIndices]; - for (int ix = 0; ix < 5; ++ix) + for (uint16 ix = 0; ix < 5; ++ix) { indices[ix * 3 + firstIndexOffset] = ix + 1; indices[ix * 3 + secondIndexOffset] = ix + 2; @@ -2268,20 +2268,20 @@ int UiImageComponent::ClipToLine(const SVF_P2F_C4B_T2F_F4B* vertices, const uint int indicesAdded = 0; if (verticesAdded == 3) { - renderIndices[renderIndexOffset] = vertexOffset - 3; - renderIndices[renderIndexOffset + 1] = vertexOffset - 2; - renderIndices[renderIndexOffset + 2] = vertexOffset - 1; + renderIndices[renderIndexOffset] = static_cast(vertexOffset - 3); + renderIndices[renderIndexOffset + 1] = static_cast(vertexOffset - 2); + renderIndices[renderIndexOffset + 2] = static_cast(vertexOffset - 1); indicesAdded = 3; } else if (verticesAdded == 4) { - renderIndices[renderIndexOffset] = vertexOffset - 4; - renderIndices[renderIndexOffset + 1] = vertexOffset - 3; - renderIndices[renderIndexOffset + 2] = vertexOffset - 2; + renderIndices[renderIndexOffset] = static_cast(vertexOffset - 4); + renderIndices[renderIndexOffset + 1] = static_cast(vertexOffset - 3); + renderIndices[renderIndexOffset + 2] = static_cast(vertexOffset - 2); - renderIndices[renderIndexOffset + 3] = vertexOffset - 4; - renderIndices[renderIndexOffset + 4] = vertexOffset - 2; - renderIndices[renderIndexOffset + 5] = vertexOffset - 1; + renderIndices[renderIndexOffset + 3] = static_cast(vertexOffset - 4); + renderIndices[renderIndexOffset + 4] = static_cast(vertexOffset - 2); + renderIndices[renderIndexOffset + 5] = static_cast(vertexOffset - 1); indicesAdded = 6; } diff --git a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp index a8b678947b..0adf2fb2de 100644 --- a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp +++ b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp @@ -1825,8 +1825,8 @@ void UiParticleEmitterComponent::ResetParticleBuffers() } m_cachedPrimitive.m_indices = new uint16[numIndices]; - const int verticesPerParticle = 4; - int baseIndex = 0; + const uint16 verticesPerParticle = 4; + uint16 baseIndex = 0; for (AZ::u32 i = 0; i < numIndices; i += indicesPerParticle) { m_cachedPrimitive.m_indices[i + 0] = 0 + baseIndex; diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index 35f351a9e6..a996a489cc 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -1096,7 +1096,7 @@ UiTextComponent::InlineImage::InlineImage(const AZStd::string& texturePathname, if (m_texture) { AZ::RHI::Size size = m_texture->GetDescriptor().m_size; - m_size = AZ::Vector2(size.m_width, size.m_height); + m_size = AZ::Vector2(static_cast(size.m_width), static_cast(size.m_height)); } } From 90527649801736ac8830a5faae9a025179f8a1f0 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:35:25 -0700 Subject: [PATCH 013/100] =?UTF-8?q?=EF=BB=BFMultiplayer?= 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> --- .../Source/Components/LocalPredictionPlayerInputComponent.cpp | 2 +- Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp index 72f5aa8e1c..de4ea67467 100644 --- a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp @@ -464,7 +464,7 @@ namespace Multiplayer { // Clamp to oldest element if history is too small const int64_t historyIndex = AZStd::max(inputHistorySize - 1 - i, 0); - inputArray[i] = m_inputHistory[historyIndex]; + inputArray[static_cast(i)] = m_inputHistory[historyIndex]; } #ifndef AZ_RELEASE_BUILD diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index 61dbf9289f..497d35db7e 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -1006,7 +1006,7 @@ namespace Multiplayer const char* addressStr = mutableAddress; const char* portStr = &(mutableAddress[portSeparator + 1]); int32_t portNumber = atol(portStr); - AZ::Interface::Get()->Connect(addressStr, portNumber); + AZ::Interface::Get()->Connect(addressStr, static_cast(portNumber)); } } AZ_CONSOLEFREEFUNC(connect, AZ::ConsoleFunctorFlags::DontReplicate, "Opens a multiplayer connection to a remote host"); From 2943f16d111f2e5c49f5701e22fb71fb8de60d7a Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:37:59 -0700 Subject: [PATCH 014/100] PhysX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysX/Code/Source/System/PhysXSystem.cpp | 4 ++-- Gems/PhysX/Code/Source/SystemComponent.cpp | 2 +- Gems/PhysX/Code/Tests/PhysXSceneTests.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp index cc55255e24..0c3e6d0b31 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp @@ -251,7 +251,7 @@ namespace PhysX if (sceneItr != m_sceneList.end()) { - return AzPhysics::SceneHandle((*sceneItr)->GetId(), AZStd::distance(m_sceneList.begin(), sceneItr)); + return AzPhysics::SceneHandle((*sceneItr)->GetId(), static_cast(AZStd::distance(m_sceneList.begin(), sceneItr))); } return AzPhysics::InvalidSceneHandle; } @@ -312,7 +312,7 @@ namespace PhysX { m_sceneRemovedEvent.Signal(handle); m_sceneList[index].reset(); - m_freeSceneSlots.push(index); + m_freeSceneSlots.push(static_cast(index)); } } } diff --git a/Gems/PhysX/Code/Source/SystemComponent.cpp b/Gems/PhysX/Code/Source/SystemComponent.cpp index d8c4b47a2a..42c78d2c1d 100644 --- a/Gems/PhysX/Code/Source/SystemComponent.cpp +++ b/Gems/PhysX/Code/Source/SystemComponent.cpp @@ -396,7 +396,7 @@ namespace PhysX void SystemComponent::SetCollisionLayerName(int index, const AZStd::string& layerName) { - m_physXSystem->SetCollisionLayerName(aznumeric_cast(index), layerName); + m_physXSystem->SetCollisionLayerName(aznumeric_cast(index), layerName); } void SystemComponent::CreateCollisionGroup(const AZStd::string& groupName, const AzPhysics::CollisionGroup& group) diff --git a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp index ff112a75dd..5b90ef0004 100644 --- a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp @@ -94,7 +94,7 @@ namespace PhysX //invalid scene handle returns empty AzPhysics::SimulatedBodyHandleList emptyBodies = sceneInterface->AddSimulatedBodies(AzPhysics::InvalidSceneHandle, configs); EXPECT_TRUE(emptyBodies.empty()); - emptyBodies = sceneInterface->AddSimulatedBodies(AzPhysics::SceneHandle(2347892347890, 7), configs); + emptyBodies = sceneInterface->AddSimulatedBodies(AzPhysics::SceneHandle(static_cast(2347892347890), AzPhysics::SceneIndex(7)), configs); EXPECT_TRUE(emptyBodies.empty()); //add some rigid bodies @@ -165,7 +165,7 @@ namespace PhysX //invalid scene handle returns null AzPhysics::SimulatedBody* nullBody = sceneInterface->GetSimulatedBodyFromHandle(AzPhysics::InvalidSceneHandle, newBodies[0]); EXPECT_TRUE(nullBody == nullptr); - nullBody = sceneInterface->GetSimulatedBodyFromHandle(AzPhysics::SceneHandle(2347892347890, 7), newBodies[0]); + nullBody = sceneInterface->GetSimulatedBodyFromHandle(AzPhysics::SceneHandle(static_cast(2347892347890), AzPhysics::SceneIndex(7)), newBodies[0]); EXPECT_TRUE(nullBody == nullptr); //invalid simulated body handle returns null From b52516cdecd91f1717c57a24eafea95eaa5f85ef Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:40:27 -0700 Subject: [PATCH 015/100] =?UTF-8?q?=EF=BB=BFScripCanvas?= 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> --- Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp | 2 +- .../Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp | 4 ++-- .../Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h | 2 +- .../Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h | 4 ++-- .../Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp | 2 +- .../Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp | 4 ++-- .../Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp | 2 +- .../Code/Tests/ScriptCanvas_NodeGenerics.cpp | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp index e4569af820..4dae63d71b 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Datum.cpp @@ -2219,7 +2219,7 @@ namespace ScriptCanvas const_cast(this)->InitializeOverloadedStorage(Data::FromAZType(description.m_typeId), eOriginality::Copy); - if (!Data::IsValueType(m_type) && !SatisfiesTraits(description.m_traits)) + if (!Data::IsValueType(m_type) && !SatisfiesTraits(static_cast(description.m_traits))) { return AZ::Failure(AZStd::string("Attempting to convert null value to BehaviorValueParameter that expects reference or value")); } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp index 64553ed5e0..d33f78c8b4 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedEBusAPI.cpp @@ -116,7 +116,7 @@ namespace ScriptCanvas auto nodeable = AZ::ScriptValue::StackRead(lua, k_nodeableIndex); AZ_Assert(nodeable, "Failed to read EBusHandler"); - const int eventIndex = lua_tointeger(lua, k_eventNameIndex); + const int eventIndex = static_cast(lua_tointeger(lua, k_eventNameIndex)); AZ_Assert(eventIndex != -1, "Event index was not found for %s", nodeable->GetEBusName().data()); // install the generic hook for the event nodeable->HandleEvent(eventIndex); @@ -143,7 +143,7 @@ namespace ScriptCanvas auto nodeable = AZ::ScriptValue::StackRead(lua, k_nodeableIndex); AZ_Assert(nodeable, "Failed to read EBusHandler"); - const int eventIndex = lua_tointeger(lua, k_eventNameIndex); + const int eventIndex = static_cast(lua_tointeger(lua, k_eventNameIndex)); AZ_Assert(eventIndex != -1, "Event index was not found for %s", nodeable->GetEBusName().data()); // install the generic hook for the event nodeable->HandleEvent(eventIndex); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h index ec44953ba9..198ff0c421 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/AABBNodes.h @@ -92,7 +92,7 @@ namespace ScriptCanvas AZ_INLINE AABBType FromCenterRadius(const Vector3Type center, const NumberType radius) { - return AABBType::CreateCenterRadius(center, radius); + return AABBType::CreateCenterRadius(center, static_cast(radius)); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(FromCenterRadius, k_categoryName, "{5FEFD1BF-DC5B-4AFA-892F-082D92492548}", "returns the AABB with Min = Center - Vector3(radius, radius, radius), Max = Center + Vector3(radius, radius, radius)", "Center", "Radius"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h index f2088dbf6d..8af9ee8ca2 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/TransformNodes.h @@ -55,7 +55,7 @@ namespace ScriptCanvas AZ_INLINE TransformType FromScale(NumberType scale) { - return TransformType::CreateUniformScale(scale); + return TransformType::CreateUniformScale(static_cast(scale)); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(FromScale, k_categoryName, "{4B6454BC-015C-41BB-9C78-34ADBCF70187}", "returns a transform which applies the specified uniform Scale, but no rotation or translation", "Scale"); @@ -143,7 +143,7 @@ namespace ScriptCanvas AZ_INLINE TransformType MultiplyByUniformScale(TransformType source, NumberType scale) { - source.MultiplyByUniformScale(scale); + source.MultiplyByUniformScale(static_cast(scale)); return source; } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(MultiplyByUniformScale, k_categoryName, "{90472D62-65A8-40C1-AB08-FA66D793F689}", "returns Source multiplied uniformly by Scale", "Source", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp index 4c92c9408a..d11e916d42 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp @@ -114,7 +114,7 @@ namespace ScriptCanvas::Nodeables::Spawning AZ::Vector3 rotationCopy = rotation; AZ::Quaternion rotationQuat = AZ::Quaternion::CreateFromEulerAnglesDegrees(rotationCopy); - entityTransform->SetWorldTM(AZ::Transform(translation, rotationQuat, scale)); + entityTransform->SetWorldTM(AZ::Transform(translation, rotationQuat, static_cast(scale))); } }; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp index 168b6d825a..179c5b008a 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp @@ -82,12 +82,12 @@ namespace ScriptCanvas void DelayNodeable::Reset(Data::NumberType countdownSeconds, Data::BooleanType looping, Data::NumberType holdTime) { - InitiateCountdown(true, countdownSeconds, looping, holdTime); + InitiateCountdown(true, static_cast(countdownSeconds), looping, static_cast(holdTime)); } void DelayNodeable::Start(Data::NumberType countdownSeconds, Data::BooleanType looping, Data::NumberType holdTime) { - InitiateCountdown(false, countdownSeconds, looping, holdTime); + InitiateCountdown(false, static_cast(countdownSeconds), looping, static_cast(holdTime)); } } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp index 942271ad3a..5c281c55fe 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp @@ -47,7 +47,7 @@ namespace ScriptCanvas void DurationNodeable::Start(Data::NumberType duration) { m_elapsedTime = 0.0f; - m_duration = duration; + m_duration = static_cast(duration); AZ::TickBus::Handler::BusConnect(); } } diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp index 09ebd3d360..f6e5b361f4 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp @@ -110,7 +110,7 @@ namespace ScriptCanvas AZ_INLINE AZ::Vector3 NormalizeWithDefault(const AZ::Vector3& source, const Data::NumberType tolerance, [[maybe_unused]] const Data::BooleanType fakeValueForTestingDefault) { AZ_TracePrintf("SC", "The fake value for testing default is %s\n", fakeValueForTestingDefault ? "True" : "False"); - return source.GetNormalizedSafe(tolerance); + return source.GetNormalizedSafe(static_cast(tolerance)); } void NormalizeWithDefaultInputOverrides(Node& node) { SetDefaultValuesByIndex< 1, 2 >::_(node, 3.3, true); } From 63f36dfe706362af781799bf9adcafeb082ad3a8 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:44:13 -0700 Subject: [PATCH 016/100] LauncherUnified Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp b/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp index 44426f6d01..d1e6a69e5e 100644 --- a/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp +++ b/Code/LauncherUnified/Platform/Windows/Launcher_Windows.cpp @@ -73,8 +73,8 @@ void CVar_OnViewportPosition(const AZ::Vector2& value) if (HWND windowHandle = GetActiveWindow()) { SetWindowPos(windowHandle, nullptr, - value.GetX(), - value.GetY(), + static_cast(value.GetX()), + static_cast(value.GetY()), 0, 0, SWP_NOOWNERZORDER | SWP_NOSIZE); } } From b0456691c7517db5d5c21abfb89d5d695cd15c37 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:44:29 -0700 Subject: [PATCH 017/100] FbxSceneBuilder Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../SceneBuilder/Importers/AssImpAnimationImporter.cpp | 6 +++--- .../SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp index a76cb3531d..16f8d85509 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -49,7 +49,7 @@ namespace AZ double totalFramesAtDefaultTimeStep = totalTicks / AssImpAnimationImporter::s_defaultTimeStepBetweenFrames + 1; if (!AZ::IsClose(totalFramesAtDefaultTimeStep, numKeys, 1)) { - numKeys = AZStd::ceilf(static_cast(totalFramesAtDefaultTimeStep)); + numKeys = static_cast(AZStd::ceilf(static_cast(totalFramesAtDefaultTimeStep))); } return numKeys; } @@ -122,7 +122,7 @@ namespace AZ if (keys[lastIndex + 1].mTime != keys[lastIndex].mTime) { normalizedTimeBetweenFrames = - (time - keys[lastIndex].mTime) / (keys[lastIndex + 1].mTime - keys[lastIndex].mTime); + static_cast((time - keys[lastIndex].mTime) / (keys[lastIndex + 1].mTime - keys[lastIndex].mTime)); } else { @@ -620,7 +620,7 @@ namespace AZ for (unsigned int valIdx = 0; valIdx < key.mNumValuesAndWeights; ++valIdx) { int currentValue = key.mValues[valIdx]; - KeyData thisKey(static_cast(key.mWeights[valIdx]), key.mTime); + KeyData thisKey(static_cast(key.mWeights[valIdx]), static_cast(key.mTime)); valueToKeyDataMap[currentValue].insert( AZStd::upper_bound(valueToKeyDataMap[currentValue].begin(), valueToKeyDataMap[currentValue].end(),thisKey), thisKey); diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp index 1e298aca5c..014d1bc5bf 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpSkinWeightsImporter.cpp @@ -97,7 +97,7 @@ namespace AZ } Pending pending; pending.m_bone = bone; - pending.m_numVertices = totalVertices; + pending.m_numVertices = static_cast(totalVertices); pending.m_skinWeightData = skinWeightData; pending.m_vertOffset = vertexCount; m_pendingSkinWeights.push_back(pending); From 52cba32bedca3e844f8318e055094960fa6e3892 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 16:44:49 -0700 Subject: [PATCH 018/100] TestImpactFramework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Source/TestImpactConsoleTestSequenceEventHandler.cpp | 4 ++-- .../Artifact/Factory/TestImpactTestRunSuiteFactory.cpp | 2 +- .../Source/TestEngine/Run/TestImpactTestRunSerializer.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp b/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp index e7430fe90b..a90f2cf4a2 100644 --- a/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp +++ b/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleTestSequenceEventHandler.cpp @@ -26,8 +26,8 @@ namespace TestImpact void ImpactAnalysisTestSelection(size_t numSelectedTests, size_t numDiscardedTests, size_t numExcludedTests, size_t numDraftedTests) { - const float totalTests = numSelectedTests + numDiscardedTests; - const float saving = (1.0 - (numSelectedTests / totalTests)) * 100.0f; + const float totalTests = static_cast(numSelectedTests + numDiscardedTests); + const float saving = (1.0f - (numSelectedTests / totalTests)) * 100.0f; std::cout << numSelectedTests << " tests selected, " << numDiscardedTests << " tests discarded (" << saving << "% test saving)\n"; std::cout << "Of which " << numExcludedTests << " tests have been excluded and " << numDraftedTests << " tests have been drafted.\n"; diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp index aa03292047..5fe7c08535 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp @@ -67,7 +67,7 @@ namespace TestImpact const auto getDuration = [&Keys](const AZ::rapidxml::xml_node<>* node) { const AZStd::string duration = node->first_attribute(Keys[DurationKey])->value(); - return AZStd::chrono::milliseconds(AZStd::stof(duration) * 1000.f); + return AZStd::chrono::milliseconds(static_cast(AZStd::stof(duration) * 1000.f)); }; TestRunSuite testSuite; diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp index 62d251c074..c0ca2caeae 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp @@ -52,7 +52,7 @@ namespace TestImpact // Run duration writer.Key(TestRunFields::Keys[TestRunFields::DurationKey]); - writer.Uint(testRun.GetDuration().count()); + writer.Uint(static_cast(testRun.GetDuration().count())); // Suites writer.Key(TestRunFields::Keys[TestRunFields::SuitesKey]); @@ -69,7 +69,7 @@ namespace TestImpact // Suite duration writer.Key(TestRunFields::Keys[TestRunFields::DurationKey]); - writer.Uint(suite.m_duration.count()); + writer.Uint(static_cast(suite.m_duration.count())); // Suite enabled writer.Key(TestRunFields::Keys[TestRunFields::EnabledKey]); @@ -93,7 +93,7 @@ namespace TestImpact // Test duration writer.Key(TestRunFields::Keys[TestRunFields::DurationKey]); - writer.Uint(test.m_duration.count()); + writer.Uint(static_cast(test.m_duration.count())); // Test status writer.Key(TestRunFields::Keys[TestRunFields::StatusKey]); From 8ba0807cfc793ddc711f4ee5fe2419b8dba81881 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:06:42 -0700 Subject: [PATCH 019/100] Code/Framework/AzCore Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp | 2 +- Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp b/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp index eabfcd8cf0..edf481a590 100644 --- a/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Math/MatrixUtils.cpp @@ -57,7 +57,7 @@ namespace AZ float GetPerspectiveMatrixFOV(const Matrix4x4& m) { - return 2.0 * AZStd::atan(1.0f / m.GetElement(1, 1)); + return 2.0f * AZStd::atan(1.0f / m.GetElement(1, 1)); } Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth) diff --git a/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp b/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp index 13db590291..5edb09edf0 100644 --- a/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp +++ b/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp @@ -41,7 +41,7 @@ namespace AZ { Task& task = m_tasks[i]; task.m_graph = this; - task.m_successorOffset = cursor - m_successors.data(); + task.m_successorOffset = static_cast(cursor - m_successors.data()); cursor += task.m_outboundLinkCount; AZ_Assert(task.m_outboundLinkCount == links[i].size(), "Task outbound link information mismatch"); From 90cad016de438e3fe23f631d969c6b462f5e3ff3 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:07:02 -0700 Subject: [PATCH 020/100] Gems/Atom Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Converters/ColorChart.cpp | 6 +++--- .../Code/Source/Processing/ImageAssetProducer.cpp | 6 +++--- .../Code/Source/Processing/PixelFormatInfo.h | 2 +- .../ReflectionScreenSpaceBlurChildPass.cpp | 4 ++-- .../RPI.Builders/Model/ModelAssetBuilderComponent.cpp | 2 +- .../Source/RPI.Public/Pass/FullscreenTrianglePass.cpp | 8 ++++---- .../Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl | 2 +- .../Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl | 4 ++-- .../Source/AtomViewportDisplayInfoSystemComponent.cpp | 2 +- .../Code/Source/CoreLights/SphereLightDelegate.cpp | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp index c6046bb5a2..f50ae41c8a 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp @@ -76,9 +76,9 @@ namespace ImageProcessingAtom for (int r = 0; r < ePS_Red; ++r) { SColor col; - col.r = 255 * r / (ePS_Red); - col.g = 255 * g / (ePS_Green); - col.b = 255 * b / (ePS_Blue); + col.r = aznumeric_cast(255 * r / (ePS_Red)); + col.g = aznumeric_cast(255 * g / (ePS_Green)); + col.b = aznumeric_cast(255 * b / (ePS_Blue)); int l = 255 - (col.r * 3 + col.g * 6 + col.b) / 10; col.r = col.g = col.b = (unsigned char)l; m_mapping.push_back(col); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp index 0b0a241d40..1e4133b5b2 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp @@ -97,8 +97,8 @@ namespace ImageProcessingAtom RHI::Format format = Utils::PixelFormatToRHIFormat(m_imageObject->GetPixelFormat(), m_imageObject->HasImageFlags(EIF_SRGBRead)); RHI::ImageBindFlags bindFlag = RHI::ImageBindFlags::ShaderRead; - RHI::ImageDescriptor imageDesc = RHI::ImageDescriptor::Create2DArray(bindFlag, imageWidth, imageHeight, arraySize, format); - imageDesc.m_mipLevels = m_imageObject->GetMipCount(); + RHI::ImageDescriptor imageDesc = RHI::ImageDescriptor::Create2DArray(bindFlag, imageWidth, imageHeight, aznumeric_cast(arraySize), format); + imageDesc.m_mipLevels = aznumeric_cast(m_imageObject->GetMipCount()); if (m_imageObject->HasImageFlags(EIF_Cubemap)) { imageDesc.m_isCubemap = true; @@ -227,7 +227,7 @@ namespace ImageProcessingAtom { RPI::ImageMipChainAssetCreator builder; uint32_t arraySize = m_imageObject->HasImageFlags(EIF_Cubemap) ? 6 : 1; - builder.Begin(chainAssetId, mipLevels, arraySize); + builder.Begin(chainAssetId, aznumeric_cast(mipLevels), aznumeric_cast(arraySize)); for (uint32_t mip = startMip; mip < startMip + mipLevels; mip++) { diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h index 5f1cbf938a..50d7ea137f 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/PixelFormatInfo.h @@ -52,7 +52,7 @@ namespace ImageProcessingAtom Result = ((intValue + 0x0FFFU + ((intValue >> 13U) & 1U)) >> 13U) & 0x7FFFU; } - h = (Result | Sign); + h = static_cast(Result | Sign); } operator float() const diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp index fce32cf448..3e97277594 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionScreenSpace/ReflectionScreenSpaceBlurChildPass.cpp @@ -44,8 +44,8 @@ namespace AZ } float inverseScale = 1.0f / m_outputScale; - uint32_t outputWidth = m_imageSize.m_width * inverseScale; - uint32_t outputHeight = m_imageSize.m_height * inverseScale; + uint32_t outputWidth = static_cast(m_imageSize.m_width * inverseScale); + uint32_t outputHeight = static_cast(m_imageSize.m_height * inverseScale); params.m_viewportState = RHI::Viewport(0, static_cast(outputWidth), 0, static_cast(outputHeight)); params.m_scissorState = RHI::Scissor(0, 0, outputWidth, outputHeight); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp index fb8708fb88..db0eff5fc1 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp @@ -1807,7 +1807,7 @@ namespace AZ if (iter != materialAssetsByUid.end()) { ModelMaterialSlot materialSlot; - materialSlot.m_stableId = meshView.m_materialUid; + materialSlot.m_stableId = static_cast(meshView.m_materialUid); materialSlot.m_displayName = iter->second.m_name; materialSlot.m_defaultMaterialAsset = iter->second.m_asset; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp index 8a4206f0d8..7a9481a45c 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp @@ -179,10 +179,10 @@ namespace AZ RHI::Size targetImageSize = outputAttachment->m_descriptor.m_image.m_size; - m_viewportState.m_maxX = AZStd::min(static_cast(params.m_viewportState.m_maxX), targetImageSize.m_width); - m_viewportState.m_maxY = AZStd::min(static_cast(params.m_viewportState.m_maxY), targetImageSize.m_height); - m_viewportState.m_minX = AZStd::min(params.m_viewportState.m_minX, m_viewportState.m_maxX); - m_viewportState.m_minY = AZStd::min(params.m_viewportState.m_minY, m_viewportState.m_maxY); + m_viewportState.m_maxX = aznumeric_cast(AZStd::min(static_cast(params.m_viewportState.m_maxX), targetImageSize.m_width)); + m_viewportState.m_maxY = aznumeric_cast(AZStd::min(static_cast(params.m_viewportState.m_maxY), targetImageSize.m_height)); + m_viewportState.m_minX = aznumeric_cast(AZStd::min(params.m_viewportState.m_minX, m_viewportState.m_maxX)); + m_viewportState.m_minY = aznumeric_cast(AZStd::min(params.m_viewportState.m_minY, m_viewportState.m_maxY)); m_scissorState.m_maxX = AZStd::min(static_cast(params.m_scissorState.m_maxX), targetImageSize.m_width); m_scissorState.m_maxY = AZStd::min(static_cast(params.m_scissorState.m_maxY), targetImageSize.m_height); diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl index a24fdbf1d8..4e28658cc0 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl @@ -618,7 +618,7 @@ namespace AZ else // We have enough space to draw the entire label, draw and center text. { const float remainingWidth = regionPixelWidth - textWidth; - const float offset = remainingWidth * .5; + const float offset = remainingWidth * .5f; drawList->AddText({ startPoint.x + offset, startPoint.y }, IM_COL32_WHITE, label.c_str()); } diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index ec7b30cd3e..47a9fa6772 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -1092,8 +1092,8 @@ namespace AZ AZStd::sort(m_tableRows.begin(), m_tableRows.end(), [ascending](const TableRow& lhs, const TableRow& rhs) { - const float lhsSize = lhs.m_sizeInBytes; - const float rhsSize = rhs.m_sizeInBytes; + const float lhsSize = aznumeric_cast(lhs.m_sizeInBytes); + const float rhsSize = aznumeric_cast(rhs.m_sizeInBytes); return ascending ? lhsSize < rhsSize : lhsSize > rhsSize; }); break; diff --git a/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp b/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp index c1f459e1ee..45757c2c6c 100644 --- a/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp +++ b/Gems/AtomLyIntegration/AtomViewportDisplayInfo/Code/Source/AtomViewportDisplayInfoSystemComponent.cpp @@ -156,7 +156,7 @@ namespace AZ::Render m_drawParams.m_drawViewportId = viewportContext->GetId(); auto viewportSize = viewportContext->GetViewportSize(); - m_drawParams.m_position = AZ::Vector3(viewportSize.m_width, 0.0f, 1.0f) + AZ::Vector3(r_topRightBorderPadding) * viewportContext->GetDpiScalingFactor(); + m_drawParams.m_position = AZ::Vector3(static_cast(viewportSize.m_width), 0.0f, 1.0f) + AZ::Vector3(r_topRightBorderPadding) * viewportContext->GetDpiScalingFactor(); m_drawParams.m_color = AZ::Colors::White; m_drawParams.m_scale = AZ::Vector2(BaseFontSize); m_drawParams.m_hAlign = AzFramework::TextHorizontalAlignment::Right; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp index edf08ba8c9..b48098819b 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp @@ -104,7 +104,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), aznumeric_cast(count)); } } @@ -112,7 +112,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count); + GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), aznumeric_cast(count)); } } From a6cdb1e58c2b626863ce027ef81812c8e0c900e0 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:07:26 -0700 Subject: [PATCH 021/100] Gems/EMotionFX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Tests/AnimGraphDeferredInitTests.cpp | 2 +- .../Code/Tests/AnimGraphMotionNodeTests.cpp | 2 +- .../Tests/BlendTreeFloatMath1NodeTests.cpp | 2 +- .../Tests/BlendTreeTwoLinkIKNodeTests.cpp | 30 +++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp index 710cfb790e..0449005659 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp @@ -36,7 +36,7 @@ namespace EMotionFX m_blendTree->AddChildNode(paramNode); paramNode->InitAfterLoading(m_animGraph.get()); paramNode->InvalidateUniqueData(m_animGraphInstance); - m_blend2Node->AddConnection(paramNode, paramNode->FindOutputPortByName("weightParam")->m_portId, BlendTreeBlend2Node::PORTID_INPUT_WEIGHT); + m_blend2Node->AddConnection(paramNode, static_cast(paramNode->FindOutputPortByName("weightParam")->m_portId), BlendTreeBlend2Node::PORTID_INPUT_WEIGHT); } void ConstructGraph() diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp index 121f438d82..a377495d6c 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp @@ -303,7 +303,7 @@ namespace EMotionFX TEST_F(AnimGraphMotionNodeFixture, InPlaceInputAndNoEffectOutputsCorrectMotionAndPose) { - m_motionNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("InPlace")->m_portId, AnimGraphMotionNode::INPUTPORT_INPLACE); + m_motionNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("InPlace")->m_portId), AnimGraphMotionNode::INPUTPORT_INPLACE); ParamSetValue("InPlace", true); m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp index 3ece046845..5827c5f186 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp @@ -98,7 +98,7 @@ namespace EMotionFX void TestInput(const AZStd::string& paramName, std::vector xInputs) { BlendTreeConnection* connection = m_floatMath1Node->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName(paramName)->m_portId, BlendTreeFloatMath1Node::PORTID_INPUT_X); + aznumeric_cast(m_paramNode->FindOutputPortByName(paramName)->m_portId), BlendTreeFloatMath1Node::PORTID_INPUT_X); for (inputType i : xInputs) { diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp index d68bf9db83..ede6f5dcbe 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp @@ -137,9 +137,9 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachablePositionsOutputCorrectPose) { // Set values for vector3 and twoLinkIKNode weight parameter - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); + m_twoLinkIKNode->AddConnection(m_paramNode, aznumeric_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + aznumeric_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -179,7 +179,7 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachableAlignToNodeOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, aznumeric_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); GetEMotionFX().Update(1.0f / 60.0f); @@ -224,10 +224,10 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, UnreachablePositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, aznumeric_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -272,12 +272,12 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, RotatedPositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + aznumeric_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("RotationParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); + static_cast(m_paramNode->FindOutputPortByName("RotationParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->SetRotationEnabled(true); GetEMotionFX().Update(1.0f / 60.0f); @@ -315,12 +315,12 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, BendDirectionOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("BendDirParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); + static_cast(m_paramNode->FindOutputPortByName("BendDirParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); m_twoLinkIKNode->SetRelativeBendDir(true); GetEMotionFX().Update(1.0f / 60.0f); @@ -382,14 +382,14 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, CombinedFunctionsOutputCorrectPose) { // Two Link IK Node should not break when using all of its functions at the same time - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("RotationParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); + static_cast(m_paramNode->FindOutputPortByName("RotationParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("BendDirParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); + static_cast(m_paramNode->FindOutputPortByName("BendDirParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); m_twoLinkIKNode->SetRotationEnabled(true); m_twoLinkIKNode->SetRelativeBendDir(true); GetEMotionFX().Update(1.0f / 60.0f); From 500f84d4697cda65a0ac8e63ff65660c638c928e Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:07:42 -0700 Subject: [PATCH 022/100] Gems/LyShine Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/LyShine/Code/Source/LyShinePass.cpp | 2 +- Gems/LyShine/Code/Source/RenderGraph.cpp | 4 ++-- Gems/LyShine/Code/Source/UiFaderComponent.cpp | 2 +- Gems/LyShine/Code/Source/UiMaskComponent.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gems/LyShine/Code/Source/LyShinePass.cpp b/Gems/LyShine/Code/Source/LyShinePass.cpp index fbf7f34e14..8245294696 100644 --- a/Gems/LyShine/Code/Source/LyShinePass.cpp +++ b/Gems/LyShine/Code/Source/LyShinePass.cpp @@ -135,7 +135,7 @@ namespace LyShine passData->m_pipelineViewTag = AZ::Name("MainCamera"); auto size = attachmentImage->GetRHIImage()->GetDescriptor().m_size; passData->m_overrideScissor = AZ::RHI::Scissor(0, 0, size.m_width, size.m_height); - passData->m_overrideViewport = AZ::RHI::Viewport(0, size.m_width, 0, size.m_height); + passData->m_overrideViewport = AZ::RHI::Viewport(0, static_cast(size.m_width), 0, static_cast(size.m_height)); passTemplate->m_passData = AZStd::move(passData); // Create a pass descriptor for the new child pass AZ::RPI::PassDescriptor childDesc; diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index 85f9c7deb5..51f62fc7ad 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -881,8 +881,8 @@ namespace LyShine { for (int i = 0; i < primitive->m_numVertices; ++i) { - primitive->m_vertices[i].texIndex = texUnit0; - primitive->m_vertices[i].texIndex2 = texUnit1; + primitive->m_vertices[i].texIndex = aznumeric_cast(texUnit0); + primitive->m_vertices[i].texIndex2 = aznumeric_cast(texUnit1); } } diff --git a/Gems/LyShine/Code/Source/UiFaderComponent.cpp b/Gems/LyShine/Code/Source/UiFaderComponent.cpp index f195689a43..acdf462df7 100644 --- a/Gems/LyShine/Code/Source/UiFaderComponent.cpp +++ b/Gems/LyShine/Code/Source/UiFaderComponent.cpp @@ -463,7 +463,7 @@ void UiFaderComponent::CreateOrResizeRenderTarget(const AZ::Vector2& pixelAligne // Create a render target that this element and its children will be rendered to AZ::EntityId canvasEntityId; EBUS_EVENT_ID_RESULT(canvasEntityId, GetEntityId(), UiElementBus, GetCanvasEntityId); - AZ::RHI::Size imageSize(renderTargetSize.GetX(), renderTargetSize.GetY(), 1); + AZ::RHI::Size imageSize(aznumeric_cast(renderTargetSize.GetX()), aznumeric_cast(renderTargetSize.GetY()), 1); EBUS_EVENT_ID_RESULT(m_attachmentImageId, canvasEntityId, LyShine::RenderToTextureRequestBus, UseRenderTarget, AZ::Name(m_renderTargetName.c_str()), imageSize); if (m_attachmentImageId.IsEmpty()) { diff --git a/Gems/LyShine/Code/Source/UiMaskComponent.cpp b/Gems/LyShine/Code/Source/UiMaskComponent.cpp index 2c1763e4ec..869529560f 100644 --- a/Gems/LyShine/Code/Source/UiMaskComponent.cpp +++ b/Gems/LyShine/Code/Source/UiMaskComponent.cpp @@ -564,7 +564,7 @@ void UiMaskComponent::CreateOrResizeRenderTarget(const AZ::Vector2& pixelAligned // Create a render target that this element and its children will be rendered to AZ::EntityId canvasEntityId; EBUS_EVENT_ID_RESULT(canvasEntityId, GetEntityId(), UiElementBus, GetCanvasEntityId); - AZ::RHI::Size imageSize(renderTargetSize.GetX(), renderTargetSize.GetY(), 1); + AZ::RHI::Size imageSize(aznumeric_cast(renderTargetSize.GetX()), aznumeric_cast(renderTargetSize.GetY()), 1); EBUS_EVENT_ID_RESULT(m_contentAttachmentImageId, canvasEntityId, LyShine::RenderToTextureRequestBus, UseRenderTarget, AZ::Name(m_renderTargetName.c_str()), imageSize); if (m_contentAttachmentImageId.IsEmpty()) { @@ -762,7 +762,7 @@ void UiMaskComponent::RenderUsingGradientMask(LyShine::IRenderGraph* renderGraph { // go through all the cached vertices and update the alpha values UCol desiredPackedColor = m_cachedPrimitive.m_vertices[0].color; - desiredPackedColor.a = desiredPackedAlpha; + desiredPackedColor.a = aznumeric_cast(desiredPackedAlpha); for (int i = 0; i < m_cachedPrimitive.m_numVertices; ++i) { m_cachedPrimitive.m_vertices[i].color = desiredPackedColor; From f914f7680a22b5e2225d26e3b4b1d39ef380c000 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:07:57 -0700 Subject: [PATCH 023/100] Gems/ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h | 2 +- .../Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h | 2 +- .../Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h index 670c9f31a1..c815470540 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector2Nodes.h @@ -254,7 +254,7 @@ namespace ScriptCanvas { Vector2Type r = to - from; float length = r.NormalizeWithLength(); - r.SetLength(optionalScale); + r.SetLength(static_cast(optionalScale)); return std::make_tuple(r, length); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h index 492bc83e33..3e70d1fed7 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector3Nodes.h @@ -340,7 +340,7 @@ namespace ScriptCanvas { Vector3Type r = to - from; float length = r.NormalizeWithLength(); - r.SetLength(optionalScale); + r.SetLength(static_cast(optionalScale)); return std::make_tuple(r, length); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h index 14256fc969..d7bee1f940 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Vector4Nodes.h @@ -225,7 +225,7 @@ namespace ScriptCanvas { Vector4Type r = to - from; float length = r.NormalizeWithLength(); - r.SetLength(optionalScale); + r.SetLength(static_cast(optionalScale)); return std::make_tuple(r, length); } SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale"); From 37663910c14dc400fb544e90d0d5beb111e1c23b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:08:10 -0700 Subject: [PATCH 024/100] Others Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Objects/DisplayContext.h | 10 +++--- Code/Editor/Util/GuidUtil.h | 16 ++++----- Code/Editor/Util/Variable.h | 2 +- .../Code/Source/BarrierInputClient.cpp | 34 ++++++++++++++++--- .../Source/ViewportCameraSelectorWindow.cpp | 2 +- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/Code/Editor/Objects/DisplayContext.h b/Code/Editor/Objects/DisplayContext.h index 4b09d4afe9..6459497199 100644 --- a/Code/Editor/Objects/DisplayContext.h +++ b/Code/Editor/Objects/DisplayContext.h @@ -83,12 +83,12 @@ struct SANDBOX_API DisplayContext // Draw functions ////////////////////////////////////////////////////////////////////////// //! Set current materialc color. - void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f)); }; - void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(int(color.x * 255.0f), int(color.y * 255.0f), int(color.z * 255.0f), int(a * 255.0f)); }; - void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(rgb.red(), rgb.green(), rgb.blue(), int(a * 255.0f)); }; - void SetColor(const QColor& color) { m_color4b = ColorB(color.red(), color.green(), color.blue(), color.alpha()); }; + void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(aznumeric_cast(r * 255.0f), aznumeric_cast(g * 255.0f), aznumeric_cast(b * 255.0f), aznumeric_cast(a * 255.0f)); }; + void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(aznumeric_cast(color.x * 255.0f), aznumeric_cast(color.y * 255.0f), aznumeric_cast(color.z * 255.0f), aznumeric_cast(a * 255.0f)); }; + void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(aznumeric_cast(rgb.red()), aznumeric_cast(rgb.green()), aznumeric_cast(rgb.blue()), aznumeric_cast(a * 255.0f)); }; + void SetColor(const QColor& color) { m_color4b = ColorB(aznumeric_cast(color.red()), aznumeric_cast(color.green()), aznumeric_cast(color.blue()), aznumeric_cast(color.alpha())); }; void SetColor(const ColorB& color) { m_color4b = color; }; - void SetAlpha(float a = 1) { m_color4b.a = int(a * 255.0f); }; + void SetAlpha(float a = 1) { m_color4b.a = aznumeric_cast(a * 255.0f); }; ColorB GetColor() const { return m_color4b; } void SetSelectedColor(float fAlpha = 1); diff --git a/Code/Editor/Util/GuidUtil.h b/Code/Editor/Util/GuidUtil.h index 2a82e3682b..138b221c70 100644 --- a/Code/Editor/Util/GuidUtil.h +++ b/Code/Editor/Util/GuidUtil.h @@ -64,14 +64,14 @@ inline GUID GuidUtil::FromString(const char* guidString) guid.Data3 = 0; azsscanf(guidString, "{%8" SCNx32 "-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", &guid.Data1, &guid.Data2, &guid.Data3, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]); - guid.Data4[0] = d[0]; - guid.Data4[1] = d[1]; - guid.Data4[2] = d[2]; - guid.Data4[3] = d[3]; - guid.Data4[4] = d[4]; - guid.Data4[5] = d[5]; - guid.Data4[6] = d[6]; - guid.Data4[7] = d[7]; + guid.Data4[0] = aznumeric_cast(d[0]); + guid.Data4[1] = aznumeric_cast(d[1]); + guid.Data4[2] = aznumeric_cast(d[2]); + guid.Data4[3] = aznumeric_cast(d[3]); + guid.Data4[4] = aznumeric_cast(d[4]); + guid.Data4[5] = aznumeric_cast(d[5]); + guid.Data4[6] = aznumeric_cast(d[6]); + guid.Data4[7] = aznumeric_cast(d[7]); return guid; } diff --git a/Code/Editor/Util/Variable.h b/Code/Editor/Util/Variable.h index da506b9db0..6cd69a8cb1 100644 --- a/Code/Editor/Util/Variable.h +++ b/Code/Editor/Util/Variable.h @@ -405,7 +405,7 @@ public: unsigned char GetDataType() const { return m_dataType; }; void SetDataType(unsigned char dataType) { m_dataType = dataType; } - void SetFlags(int flags) { m_flags = flags; } + void SetFlags(int flags) { m_flags = aznumeric_cast(flags); } int GetFlags() const { return m_flags; } void SetFlagRecursive(EFlags flag) { m_flags |= flag; } diff --git a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp index 495ef88467..25a95752ac 100644 --- a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp +++ b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp @@ -55,11 +55,35 @@ namespace BarrierInput void Eat(int len) { data += len; } void InsertString(const char* str) { int len = static_cast(strlen(str)); memcpy(end, str, len); end += len; } - void InsertU32(int a) { end[0] = a >> 24; end[1] = a >> 16; end[2] = a >> 8; end[3] = a; end += 4; } - void InsertU16(int a) { end[0] = a >> 8; end[1] = a; end += 2; } - void InsertU8(int a) { end[0] = a; end += 1; } + void InsertU32(int a) + { + end[0] = aznumeric_cast(a >> 24); + end[1] = aznumeric_cast(a >> 16); + end[2] = aznumeric_cast(a >> 8); + end[3] = aznumeric_cast(a); + end += 4; + } + void InsertU16(int a) + { + end[0] = aznumeric_cast(a >> 8); + end[1] = aznumeric_cast(a); + end += 2; + } + void InsertU8(int a) + { + end[0] = aznumeric_cast(a); + end += 1; + } void OpenPacket() { packet = end; end += 4; } - void ClosePacket() { int len = GetLength() - sizeof(AZ::u32); packet[0] = len >> 24; packet[1] = len >> 16; packet[2] = len >> 8; packet[3] = len; packet = NULL; } + void ClosePacket() + { + int len = GetLength() - sizeof(AZ::u32); + packet[0] = aznumeric_cast(len >> 24); + packet[1] = aznumeric_cast(len >> 16); + packet[2] = aznumeric_cast(len >> 8); + packet[3] = aznumeric_cast(len); + packet = nullptr; + } }; enum ArgType @@ -381,7 +405,7 @@ namespace BarrierInput if (AZ::AzSock::IsAzSocketValid(m_socket)) { AZ::AzSock::AzSocketAddress socketAddress; - if (socketAddress.SetAddress(m_serverHostName.c_str(), m_connectionPort)) + if (socketAddress.SetAddress(m_serverHostName.c_str(), aznumeric_cast(m_connectionPort))) { const int result = AZ::AzSock::Connect(m_socket, socketAddress); if (!AZ::AzSock::SocketErrorOccured(result)) diff --git a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp index 87624b1c8d..828601c5d6 100644 --- a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp +++ b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp @@ -125,7 +125,7 @@ namespace Camera }); if (cameraIt != m_cameraItems.end()) { - int listIndex = cameraIt - m_cameraItems.begin(); + int listIndex = aznumeric_cast(cameraIt - m_cameraItems.begin()); beginRemoveRows(QModelIndex(), listIndex, listIndex); m_cameraItems.erase(cameraIt); endRemoveRows(); From 27c0ed987891b8ab9e0e6da689314474d668de67 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 11 Aug 2021 12:39:16 -0700 Subject: [PATCH 025/100] warning fixes for new code Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CrySystem/XConsole.cpp | 2 +- Gems/LyShine/Code/Source/StringUtfUtils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index a69fd348f5..2293352f7e 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -2857,7 +2857,7 @@ void CXConsole::Paste() Utf8::Unchecked::octet_iterator end(data.end()); for (Utf8::Unchecked::octet_iterator it(data.begin()); it != end; ++it) { - const wchar_t cp = *it; + const wchar_t cp = static_cast(*it); if (cp != '\r') { // Convert UCS code-point into UTF-8 string diff --git a/Gems/LyShine/Code/Source/StringUtfUtils.h b/Gems/LyShine/Code/Source/StringUtfUtils.h index 40dd22dd33..247eb07bca 100644 --- a/Gems/LyShine/Code/Source/StringUtfUtils.h +++ b/Gems/LyShine/Code/Source/StringUtfUtils.h @@ -31,7 +31,7 @@ namespace LyShine // work for cases tested but may not in general. // In the long run it would be better to eliminate // this function and use some sequence_lenght function that is not internal. - return Utf8::Internal::sequence_length(&multiByteChar); + return aznumeric_cast(Utf8::Internal::sequence_length(&multiByteChar)); } inline int GetByteLengthOfUtf8Chars(const char* utf8String, int numUtf8Chars) From 75c388b746501fb610c8e2ac3672ebe5bfc1696c Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 11 Aug 2021 17:03:54 -0700 Subject: [PATCH 026/100] change conversions to static_cast Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Objects/DisplayContext.h | 10 ++++---- Code/Editor/Util/GuidUtil.h | 16 ++++++------- Code/Editor/Util/Variable.h | 2 +- Code/Framework/AzCore/AzCore/IO/Path/Path.inl | 2 +- .../AzCore/AzCore/StringFunc/StringFunc.cpp | 5 ++-- .../Tests/Memory/HphaSchemaErrorDetection.cpp | 3 +-- Code/Framework/Crcfix/crcfix.cpp | 11 ++++----- .../Code/Source/Converters/ColorChart.cpp | 6 ++--- .../Source/Processing/ImageAssetProducer.cpp | 6 ++--- .../Pass/FullscreenTrianglePass.cpp | 8 +++---- .../Include/Atom/Utils/ImGuiGpuProfiler.inl | 4 ++-- .../Source/CoreLights/SphereLightDelegate.cpp | 4 ++-- .../Code/Source/BarrierInputClient.cpp | 24 +++++++++---------- .../Source/ViewportCameraSelectorWindow.cpp | 2 +- .../Tests/BlendTreeFloatMath1NodeTests.cpp | 2 +- .../Tests/BlendTreeTwoLinkIKNodeTests.cpp | 10 ++++---- Gems/LyShine/Code/Source/StringUtfUtils.h | 2 +- Gems/LyShine/Code/Source/UiFaderComponent.cpp | 2 +- Gems/LyShine/Code/Source/UiMaskComponent.cpp | 4 ++-- 19 files changed, 60 insertions(+), 63 deletions(-) diff --git a/Code/Editor/Objects/DisplayContext.h b/Code/Editor/Objects/DisplayContext.h index 6459497199..47fd450220 100644 --- a/Code/Editor/Objects/DisplayContext.h +++ b/Code/Editor/Objects/DisplayContext.h @@ -83,12 +83,12 @@ struct SANDBOX_API DisplayContext // Draw functions ////////////////////////////////////////////////////////////////////////// //! Set current materialc color. - void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(aznumeric_cast(r * 255.0f), aznumeric_cast(g * 255.0f), aznumeric_cast(b * 255.0f), aznumeric_cast(a * 255.0f)); }; - void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(aznumeric_cast(color.x * 255.0f), aznumeric_cast(color.y * 255.0f), aznumeric_cast(color.z * 255.0f), aznumeric_cast(a * 255.0f)); }; - void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(aznumeric_cast(rgb.red()), aznumeric_cast(rgb.green()), aznumeric_cast(rgb.blue()), aznumeric_cast(a * 255.0f)); }; - void SetColor(const QColor& color) { m_color4b = ColorB(aznumeric_cast(color.red()), aznumeric_cast(color.green()), aznumeric_cast(color.blue()), aznumeric_cast(color.alpha())); }; + void SetColor(float r, float g, float b, float a = 1) { m_color4b = ColorB(static_cast(r * 255.0f), static_cast(g * 255.0f), static_cast(b * 255.0f), static_cast(a * 255.0f)); }; + void SetColor(const Vec3& color, float a = 1) { m_color4b = ColorB(static_cast(color.x * 255.0f), static_cast(color.y * 255.0f), static_cast(color.z * 255.0f), static_cast(a * 255.0f)); }; + void SetColor(const QColor& rgb, float a) { m_color4b = ColorB(static_cast(rgb.red()), static_cast(rgb.green()), static_cast(rgb.blue()), static_cast(a * 255.0f)); }; + void SetColor(const QColor& color) { m_color4b = ColorB(static_cast(color.red()), static_cast(color.green()), static_cast(color.blue()), static_cast(color.alpha())); }; void SetColor(const ColorB& color) { m_color4b = color; }; - void SetAlpha(float a = 1) { m_color4b.a = aznumeric_cast(a * 255.0f); }; + void SetAlpha(float a = 1) { m_color4b.a = static_cast(a * 255.0f); }; ColorB GetColor() const { return m_color4b; } void SetSelectedColor(float fAlpha = 1); diff --git a/Code/Editor/Util/GuidUtil.h b/Code/Editor/Util/GuidUtil.h index 138b221c70..9952d6b4ed 100644 --- a/Code/Editor/Util/GuidUtil.h +++ b/Code/Editor/Util/GuidUtil.h @@ -64,14 +64,14 @@ inline GUID GuidUtil::FromString(const char* guidString) guid.Data3 = 0; azsscanf(guidString, "{%8" SCNx32 "-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", &guid.Data1, &guid.Data2, &guid.Data3, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]); - guid.Data4[0] = aznumeric_cast(d[0]); - guid.Data4[1] = aznumeric_cast(d[1]); - guid.Data4[2] = aznumeric_cast(d[2]); - guid.Data4[3] = aznumeric_cast(d[3]); - guid.Data4[4] = aznumeric_cast(d[4]); - guid.Data4[5] = aznumeric_cast(d[5]); - guid.Data4[6] = aznumeric_cast(d[6]); - guid.Data4[7] = aznumeric_cast(d[7]); + guid.Data4[0] = static_cast(d[0]); + guid.Data4[1] = static_cast(d[1]); + guid.Data4[2] = static_cast(d[2]); + guid.Data4[3] = static_cast(d[3]); + guid.Data4[4] = static_cast(d[4]); + guid.Data4[5] = static_cast(d[5]); + guid.Data4[6] = static_cast(d[6]); + guid.Data4[7] = static_cast(d[7]); return guid; } diff --git a/Code/Editor/Util/Variable.h b/Code/Editor/Util/Variable.h index 6cd69a8cb1..9c3f96a3f6 100644 --- a/Code/Editor/Util/Variable.h +++ b/Code/Editor/Util/Variable.h @@ -405,7 +405,7 @@ public: unsigned char GetDataType() const { return m_dataType; }; void SetDataType(unsigned char dataType) { m_dataType = dataType; } - void SetFlags(int flags) { m_flags = aznumeric_cast(flags); } + void SetFlags(int flags) { m_flags = static_cast(flags); } int GetFlags() const { return m_flags; } void SetFlagRecursive(EFlags flag) { m_flags |= flag; } diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl index a6d41b0ef8..d0bf4c1dbe 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl @@ -221,7 +221,7 @@ namespace AZ::IO::Internal ? strncmp(left.data(), right.data(), maxCharsToCompare) : azstrnicmp(left.data(), right.data(), maxCharsToCompare); return charCompareResult == 0 - ? aznumeric_cast(aznumeric_cast(left.size()) - aznumeric_cast(right.size())) + ? static_cast(aznumeric_cast(left.size()) - aznumeric_cast(right.size())) : charCompareResult; } } diff --git a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp index d4f874c667..ff30291a70 100644 --- a/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp +++ b/Code/Framework/AzCore/AzCore/StringFunc/StringFunc.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -343,8 +342,8 @@ namespace AZ::StringFunc::Internal { for (const char stripCharacter : stripCharacters) { - const char lower = azlossy_cast(tolower(stripCharacter)); - const char upper = azlossy_cast(toupper(stripCharacter)); + const char lower = static_cast(tolower(stripCharacter)); + const char upper = static_cast(toupper(stripCharacter)); if (lower != upper) { combinedStripCharacters.push_back(lower); diff --git a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp index 2b0e7bee92..44c1b1641d 100644 --- a/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp +++ b/Code/Framework/AzCore/Tests/Memory/HphaSchemaErrorDetection.cpp @@ -17,7 +17,6 @@ #include #include #include -#include namespace Internal @@ -298,7 +297,7 @@ AZ_POP_DISABLE_WARNING // the overflow guard is generated out of rand, so we set a fixed seed before doing the allocation // to get a deterministic guard srand(0); - const unsigned char expectedInitialGuard = azlossy_cast(rand()); + const unsigned char expectedInitialGuard = static_cast(rand()); srand(0); TestClass<16>* someObject = aznew TestClass<16>(); diff --git a/Code/Framework/Crcfix/crcfix.cpp b/Code/Framework/Crcfix/crcfix.cpp index c788d2a0c6..a07054998b 100644 --- a/Code/Framework/Crcfix/crcfix.cpp +++ b/Code/Framework/Crcfix/crcfix.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -285,7 +284,7 @@ char* CRCfix::GetToken(FILE* infile, FILE* outfile) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '#' || c == '_') { - token[i++] = azlossy_cast(c); + token[i++] = static_cast(c); continue; } else @@ -376,7 +375,7 @@ void CRCfix::GetPreviousCRC(char* token, FILE* infile) int c; while ((c = fgetc(infile)) != ')') { - *token++ = azlossy_cast(c); + *token++ = static_cast(c); } *token = 0; } @@ -427,7 +426,7 @@ int CRCfix::Fix(Filename srce) if (strcmp(token, "AZ_CRC") == 0 && lastchar == '(') { size_t i = strlen(token); - token[i++] = azlossy_cast(lastchar); + token[i++] = static_cast(lastchar); int c = fgetc(infile); if (c == '"') @@ -436,11 +435,11 @@ int CRCfix::Fix(Filename srce) do { - token[i++] = azlossy_cast(c); + token[i++] = static_cast(c); c = fgetc(infile); } while (c != '"'); - token[i++] = azlossy_cast(c); + token[i++] = static_cast(c); c = fgetc(infile); int oldcrc = 0, newcrc; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp index f50ae41c8a..0b06e00a9f 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp @@ -76,9 +76,9 @@ namespace ImageProcessingAtom for (int r = 0; r < ePS_Red; ++r) { SColor col; - col.r = aznumeric_cast(255 * r / (ePS_Red)); - col.g = aznumeric_cast(255 * g / (ePS_Green)); - col.b = aznumeric_cast(255 * b / (ePS_Blue)); + col.r = static_cast(255 * r / (ePS_Red)); + col.g = static_cast(255 * g / (ePS_Green)); + col.b = static_cast(255 * b / (ePS_Blue)); int l = 255 - (col.r * 3 + col.g * 6 + col.b) / 10; col.r = col.g = col.b = (unsigned char)l; m_mapping.push_back(col); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp index 1e4133b5b2..c254d172ad 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageAssetProducer.cpp @@ -97,8 +97,8 @@ namespace ImageProcessingAtom RHI::Format format = Utils::PixelFormatToRHIFormat(m_imageObject->GetPixelFormat(), m_imageObject->HasImageFlags(EIF_SRGBRead)); RHI::ImageBindFlags bindFlag = RHI::ImageBindFlags::ShaderRead; - RHI::ImageDescriptor imageDesc = RHI::ImageDescriptor::Create2DArray(bindFlag, imageWidth, imageHeight, aznumeric_cast(arraySize), format); - imageDesc.m_mipLevels = aznumeric_cast(m_imageObject->GetMipCount()); + RHI::ImageDescriptor imageDesc = RHI::ImageDescriptor::Create2DArray(bindFlag, imageWidth, imageHeight, static_cast(arraySize), format); + imageDesc.m_mipLevels = static_cast(m_imageObject->GetMipCount()); if (m_imageObject->HasImageFlags(EIF_Cubemap)) { imageDesc.m_isCubemap = true; @@ -227,7 +227,7 @@ namespace ImageProcessingAtom { RPI::ImageMipChainAssetCreator builder; uint32_t arraySize = m_imageObject->HasImageFlags(EIF_Cubemap) ? 6 : 1; - builder.Begin(chainAssetId, aznumeric_cast(mipLevels), aznumeric_cast(arraySize)); + builder.Begin(chainAssetId, static_cast(mipLevels), static_cast(arraySize)); for (uint32_t mip = startMip; mip < startMip + mipLevels; mip++) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp index 7a9481a45c..40dce7d138 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/FullscreenTrianglePass.cpp @@ -179,10 +179,10 @@ namespace AZ RHI::Size targetImageSize = outputAttachment->m_descriptor.m_image.m_size; - m_viewportState.m_maxX = aznumeric_cast(AZStd::min(static_cast(params.m_viewportState.m_maxX), targetImageSize.m_width)); - m_viewportState.m_maxY = aznumeric_cast(AZStd::min(static_cast(params.m_viewportState.m_maxY), targetImageSize.m_height)); - m_viewportState.m_minX = aznumeric_cast(AZStd::min(params.m_viewportState.m_minX, m_viewportState.m_maxX)); - m_viewportState.m_minY = aznumeric_cast(AZStd::min(params.m_viewportState.m_minY, m_viewportState.m_maxY)); + m_viewportState.m_maxX = static_cast(AZStd::min(static_cast(params.m_viewportState.m_maxX), targetImageSize.m_width)); + m_viewportState.m_maxY = static_cast(AZStd::min(static_cast(params.m_viewportState.m_maxY), targetImageSize.m_height)); + m_viewportState.m_minX = static_cast(AZStd::min(params.m_viewportState.m_minX, m_viewportState.m_maxX)); + m_viewportState.m_minY = static_cast(AZStd::min(params.m_viewportState.m_minY, m_viewportState.m_maxY)); m_scissorState.m_maxX = AZStd::min(static_cast(params.m_scissorState.m_maxX), targetImageSize.m_width); m_scissorState.m_maxY = AZStd::min(static_cast(params.m_scissorState.m_maxY), targetImageSize.m_height); diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index 47a9fa6772..e6bde136f8 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -1092,8 +1092,8 @@ namespace AZ AZStd::sort(m_tableRows.begin(), m_tableRows.end(), [ascending](const TableRow& lhs, const TableRow& rhs) { - const float lhsSize = aznumeric_cast(lhs.m_sizeInBytes); - const float rhsSize = aznumeric_cast(rhs.m_sizeInBytes); + const float lhsSize = static_cast(lhs.m_sizeInBytes); + const float rhsSize = static_cast(rhs.m_sizeInBytes); return ascending ? lhsSize < rhsSize : lhsSize > rhsSize; }); break; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp index b48098819b..b4728c0c38 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/SphereLightDelegate.cpp @@ -104,7 +104,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), aznumeric_cast(count)); + GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast(count)); } } @@ -112,7 +112,7 @@ namespace AZ::Render { if (GetShadowsEnabled() && GetLightHandle().IsValid()) { - GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), aznumeric_cast(count)); + GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), static_cast(count)); } } diff --git a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp index 25a95752ac..e6d5399561 100644 --- a/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp +++ b/Gems/BarrierInput/Code/Source/BarrierInputClient.cpp @@ -57,31 +57,31 @@ namespace BarrierInput void InsertString(const char* str) { int len = static_cast(strlen(str)); memcpy(end, str, len); end += len; } void InsertU32(int a) { - end[0] = aznumeric_cast(a >> 24); - end[1] = aznumeric_cast(a >> 16); - end[2] = aznumeric_cast(a >> 8); - end[3] = aznumeric_cast(a); + end[0] = static_cast(a >> 24); + end[1] = static_cast(a >> 16); + end[2] = static_cast(a >> 8); + end[3] = static_cast(a); end += 4; } void InsertU16(int a) { - end[0] = aznumeric_cast(a >> 8); - end[1] = aznumeric_cast(a); + end[0] = static_cast(a >> 8); + end[1] = static_cast(a); end += 2; } void InsertU8(int a) { - end[0] = aznumeric_cast(a); + end[0] = static_cast(a); end += 1; } void OpenPacket() { packet = end; end += 4; } void ClosePacket() { int len = GetLength() - sizeof(AZ::u32); - packet[0] = aznumeric_cast(len >> 24); - packet[1] = aznumeric_cast(len >> 16); - packet[2] = aznumeric_cast(len >> 8); - packet[3] = aznumeric_cast(len); + packet[0] = static_cast(len >> 24); + packet[1] = static_cast(len >> 16); + packet[2] = static_cast(len >> 8); + packet[3] = static_cast(len); packet = nullptr; } }; @@ -405,7 +405,7 @@ namespace BarrierInput if (AZ::AzSock::IsAzSocketValid(m_socket)) { AZ::AzSock::AzSocketAddress socketAddress; - if (socketAddress.SetAddress(m_serverHostName.c_str(), aznumeric_cast(m_connectionPort))) + if (socketAddress.SetAddress(m_serverHostName.c_str(), static_cast(m_connectionPort))) { const int result = AZ::AzSock::Connect(m_socket, socketAddress); if (!AZ::AzSock::SocketErrorOccured(result)) diff --git a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp index 828601c5d6..7a8d6be020 100644 --- a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp +++ b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow.cpp @@ -125,7 +125,7 @@ namespace Camera }); if (cameraIt != m_cameraItems.end()) { - int listIndex = aznumeric_cast(cameraIt - m_cameraItems.begin()); + int listIndex = static_cast(cameraIt - m_cameraItems.begin()); beginRemoveRows(QModelIndex(), listIndex, listIndex); m_cameraItems.erase(cameraIt); endRemoveRows(); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp index 5827c5f186..f4b11a3f8a 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp @@ -98,7 +98,7 @@ namespace EMotionFX void TestInput(const AZStd::string& paramName, std::vector xInputs) { BlendTreeConnection* connection = m_floatMath1Node->AddConnection(m_paramNode, - aznumeric_cast(m_paramNode->FindOutputPortByName(paramName)->m_portId), BlendTreeFloatMath1Node::PORTID_INPUT_X); + static_cast(m_paramNode->FindOutputPortByName(paramName)->m_portId), BlendTreeFloatMath1Node::PORTID_INPUT_X); for (inputType i : xInputs) { diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp index ede6f5dcbe..eab445ddfe 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp @@ -137,9 +137,9 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachablePositionsOutputCorrectPose) { // Set values for vector3 and twoLinkIKNode weight parameter - m_twoLinkIKNode->AddConnection(m_paramNode, aznumeric_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - aznumeric_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -179,7 +179,7 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachableAlignToNodeOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, aznumeric_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); GetEMotionFX().Update(1.0f / 60.0f); @@ -224,7 +224,7 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, UnreachablePositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, aznumeric_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), + m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); @@ -275,7 +275,7 @@ namespace EMotionFX m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("WeightParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - aznumeric_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + static_cast(m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, static_cast(m_paramNode->FindOutputPortByName("RotationParam")->m_portId), BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->SetRotationEnabled(true); diff --git a/Gems/LyShine/Code/Source/StringUtfUtils.h b/Gems/LyShine/Code/Source/StringUtfUtils.h index 247eb07bca..9c185d48ef 100644 --- a/Gems/LyShine/Code/Source/StringUtfUtils.h +++ b/Gems/LyShine/Code/Source/StringUtfUtils.h @@ -31,7 +31,7 @@ namespace LyShine // work for cases tested but may not in general. // In the long run it would be better to eliminate // this function and use some sequence_lenght function that is not internal. - return aznumeric_cast(Utf8::Internal::sequence_length(&multiByteChar)); + return static_cast(Utf8::Internal::sequence_length(&multiByteChar)); } inline int GetByteLengthOfUtf8Chars(const char* utf8String, int numUtf8Chars) diff --git a/Gems/LyShine/Code/Source/UiFaderComponent.cpp b/Gems/LyShine/Code/Source/UiFaderComponent.cpp index acdf462df7..e7eca04c59 100644 --- a/Gems/LyShine/Code/Source/UiFaderComponent.cpp +++ b/Gems/LyShine/Code/Source/UiFaderComponent.cpp @@ -463,7 +463,7 @@ void UiFaderComponent::CreateOrResizeRenderTarget(const AZ::Vector2& pixelAligne // Create a render target that this element and its children will be rendered to AZ::EntityId canvasEntityId; EBUS_EVENT_ID_RESULT(canvasEntityId, GetEntityId(), UiElementBus, GetCanvasEntityId); - AZ::RHI::Size imageSize(aznumeric_cast(renderTargetSize.GetX()), aznumeric_cast(renderTargetSize.GetY()), 1); + AZ::RHI::Size imageSize(static_cast(renderTargetSize.GetX()), static_cast(renderTargetSize.GetY()), 1); EBUS_EVENT_ID_RESULT(m_attachmentImageId, canvasEntityId, LyShine::RenderToTextureRequestBus, UseRenderTarget, AZ::Name(m_renderTargetName.c_str()), imageSize); if (m_attachmentImageId.IsEmpty()) { diff --git a/Gems/LyShine/Code/Source/UiMaskComponent.cpp b/Gems/LyShine/Code/Source/UiMaskComponent.cpp index 869529560f..d6ed468deb 100644 --- a/Gems/LyShine/Code/Source/UiMaskComponent.cpp +++ b/Gems/LyShine/Code/Source/UiMaskComponent.cpp @@ -564,7 +564,7 @@ void UiMaskComponent::CreateOrResizeRenderTarget(const AZ::Vector2& pixelAligned // Create a render target that this element and its children will be rendered to AZ::EntityId canvasEntityId; EBUS_EVENT_ID_RESULT(canvasEntityId, GetEntityId(), UiElementBus, GetCanvasEntityId); - AZ::RHI::Size imageSize(aznumeric_cast(renderTargetSize.GetX()), aznumeric_cast(renderTargetSize.GetY()), 1); + AZ::RHI::Size imageSize(static_cast(renderTargetSize.GetX()), static_cast(renderTargetSize.GetY()), 1); EBUS_EVENT_ID_RESULT(m_contentAttachmentImageId, canvasEntityId, LyShine::RenderToTextureRequestBus, UseRenderTarget, AZ::Name(m_renderTargetName.c_str()), imageSize); if (m_contentAttachmentImageId.IsEmpty()) { @@ -762,7 +762,7 @@ void UiMaskComponent::RenderUsingGradientMask(LyShine::IRenderGraph* renderGraph { // go through all the cached vertices and update the alpha values UCol desiredPackedColor = m_cachedPrimitive.m_vertices[0].color; - desiredPackedColor.a = aznumeric_cast(desiredPackedAlpha); + desiredPackedColor.a = static_cast(desiredPackedAlpha); for (int i = 0; i < m_cachedPrimitive.m_numVertices; ++i) { m_cachedPrimitive.m_vertices[i].color = desiredPackedColor; From 52068911bb7c9ff39126dca6bdbc3ec2576a48bc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 11 Aug 2021 19:35:13 -0700 Subject: [PATCH 027/100] More fixes that are failing on Jenkins but not locally Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzToolsFramework/Input/QtEventToAzInputManager.cpp | 4 ++-- .../AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index f8665d583e..feb7a35433 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -307,9 +307,9 @@ namespace AzToolsFramework // Generate movement events based on the pixel delta divided by the DPI scaling factor, to calculate a rough approximation // of cursor movement velocity. movementXChannel->ProcessRawInputEvent( - m_cursorPosition->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / m_sourceWidget->devicePixelRatioF()); + static_cast(m_cursorPosition->m_normalizedPositionDelta.GetX()) * aznumeric_cast(m_sourceWidget->width()) / m_sourceWidget->devicePixelRatioF()); movementYChannel->ProcessRawInputEvent( - m_cursorPosition->m_normalizedPositionDelta.GetY() * aznumeric_cast(m_sourceWidget->height()) / m_sourceWidget->devicePixelRatioF()); + static_cast(m_cursorPosition->m_normalizedPositionDelta.GetY()) * aznumeric_cast(m_sourceWidget->height()) / m_sourceWidget->devicePixelRatioF()); mouseWheelChannel->ProcessRawInputEvent(0.f); NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index 4115fe409e..44dbbee025 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -2180,7 +2180,7 @@ namespace AzToolsFramework QPainterPath path; auto newRect = option.rect; - newRect.setHeight(newRect.height() - 1.0); + newRect.setHeight(newRect.height() - 1); path.addRect(newRect); // Get the foreground color of the current object to draw our sub-object-selected box From 8b3ab8eb0bb5c6c535c9b0b49df0d1bbc5c5e599 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 12 Aug 2021 17:26:56 -0700 Subject: [PATCH 028/100] fixing warning issued in Jenkins Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzToolsFramework/Input/QtEventToAzInputManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index feb7a35433..4f238ac336 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -307,9 +307,9 @@ namespace AzToolsFramework // Generate movement events based on the pixel delta divided by the DPI scaling factor, to calculate a rough approximation // of cursor movement velocity. movementXChannel->ProcessRawInputEvent( - static_cast(m_cursorPosition->m_normalizedPositionDelta.GetX()) * aznumeric_cast(m_sourceWidget->width()) / m_sourceWidget->devicePixelRatioF()); + m_cursorPosition->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / static_cast(m_sourceWidget->devicePixelRatioF())); movementYChannel->ProcessRawInputEvent( - static_cast(m_cursorPosition->m_normalizedPositionDelta.GetY()) * aznumeric_cast(m_sourceWidget->height()) / m_sourceWidget->devicePixelRatioF()); + m_cursorPosition->m_normalizedPositionDelta.GetY() * aznumeric_cast(m_sourceWidget->height()) / static_cast(m_sourceWidget->devicePixelRatioF())); mouseWheelChannel->ProcessRawInputEvent(0.f); NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr); From 3522f622f38d7fe8f5bdb3e274583e31e3528a57 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 12 Aug 2021 18:37:59 -0700 Subject: [PATCH 029/100] more castings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Objects/DisplayContextShared.inl | 7 +++++-- Code/Editor/editor_lib_files.cmake | 1 + .../Tests/EditorTransformComponentSelectionTests.cpp | 2 +- .../Prefab/Benchmark/PrefabCreateBenchmarks.cpp | 8 ++++---- .../Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp | 2 +- .../Benchmark/PrefabUpdateInstancesBenchmarks.cpp | 10 +++++----- .../Prefab/Benchmark/SpawnableCreateBenchmarks.cpp | 2 +- .../Code/Source/Converters/FIR-Weights.cpp | 10 +++++----- .../Source/ActionHistory/ActionHistoryPlugin.cpp | 2 +- .../Source/AnimGraph/GameControllerWindow.cpp | 8 ++++---- .../Code/Tests/PythonDictionaryTests.cpp | 4 ++-- .../Code/Tests/SceneBuilder/SceneBuilderTests.cpp | 12 ++++++------ .../Editor/View/Windows/ScriptCanvasContextMenus.cpp | 2 +- 13 files changed, 37 insertions(+), 33 deletions(-) diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl index a602d8eca9..5af04d821e 100644 --- a/Code/Editor/Objects/DisplayContextShared.inl +++ b/Code/Editor/Objects/DisplayContextShared.inl @@ -63,7 +63,7 @@ void DisplayContext::InternalDrawLine(const Vec3& v0, const ColorB& colV0, const ////////////////////////////////////////////////////////////////////////// void DisplayContext::DrawPoint(const Vec3& p, int nSize) { - pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, nSize); + pRenderAuxGeom->DrawPoint(ToWorldSpacePosition(p), m_color4b, static_cast(nSize)); } ////////////////////////////////////////////////////////////////////////// @@ -856,7 +856,10 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const ColorF& col1 ////////////////////////////////////////////////////////////////////////// void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1, const QColor& rgb2) { - InternalDrawLine(ToWorldSpacePosition(p1), ColorB(rgb1.red(), rgb1.green(), rgb1.blue(), 255), ToWorldSpacePosition(p2), ColorB(rgb2.red(), rgb2.green(), rgb2.blue(), 255)); + InternalDrawLine(ToWorldSpacePosition(p1), + ColorB(static_cast(rgb1.red()), static_cast(rgb1.green()), static_cast(rgb1.blue()), 255), + ToWorldSpacePosition(p2), + ColorB(static_cast(rgb2.red()), static_cast(rgb2.green()), static_cast(rgb2.blue()), 255)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake index c10db3bac5..6c5096a8f5 100644 --- a/Code/Editor/editor_lib_files.cmake +++ b/Code/Editor/editor_lib_files.cmake @@ -503,6 +503,7 @@ set(FILES LogFileImpl.h Objects/ClassDesc.cpp Objects/ClassDesc.h + Objects/DisplayContextShared.inl Objects/IEntityObjectListener.h Objects/SelectionGroup.cpp Objects/SelectionGroup.h diff --git a/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp b/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp index 895c91b0a4..e95f7aa271 100644 --- a/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp @@ -583,7 +583,7 @@ namespace UnitTest AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::EventResult( m_mouseInteractionResult, AzToolsFramework::GetEntityContextId(), &AzToolsFramework::EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleAllMouseInteractions, - vi::MouseInteractionEvent(mouseInteraction, ev->angleDelta().y())); + vi::MouseInteractionEvent(mouseInteraction, static_cast(ev->angleDelta().y()))); } MouseInteractionResult m_mouseInteractionResult; diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp index 12efea1cc8..64c4058a47 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabCreateBenchmarks.cpp @@ -16,7 +16,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefabs_SingleEntityEach)(::benchmark::State& state) { - const unsigned int numEntities = state.range(); + const unsigned int numEntities = static_cast(state.range()); const unsigned int numInstances = numEntities; CreateFakePaths(numInstances); @@ -58,7 +58,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromEntities)(::benchmark::State& state) { - const unsigned int numEntities = state.range(); + const unsigned int numEntities = static_cast(state.range()); for (auto _ : state) { @@ -93,7 +93,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromSingleDepthInstances)(::benchmark::State& state) { - const unsigned int numInstancesToAdd = state.range(); + const unsigned int numInstancesToAdd = static_cast(state.range()); const unsigned int numEntities = numInstancesToAdd; // Create fake paths for all the nested instances @@ -144,7 +144,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabCreate, CreatePrefab_FromLinearNestingOfInstances)(::benchmark::State& state) { - const unsigned int numInstances = state.range(); + const unsigned int numInstances = static_cast(state.range()); // Create fake paths for all the nested instances // plus the root instance diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp index 90ff30a30e..f2f3cf82b0 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabInstantiateBenchmarks.cpp @@ -16,7 +16,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabInstantiate, InstantiatePrefab_SingleEntityInstance)(::benchmark::State& state) { - const unsigned int numInstances = state.range(); + const unsigned int numInstances = static_cast(state.range()); AZStd::unique_ptr firstInstance = m_prefabSystemComponent->CreatePrefab( { CreateEntity("Entity1") }, diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp index f1e319b28a..0d95049e76 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabUpdateInstancesBenchmarks.cpp @@ -18,7 +18,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingeEntityInstances)(::benchmark::State& state) { - const unsigned int numInstances = state.range(); + const unsigned int numInstances = static_cast(state.range()); CreateFakePaths(2); const auto& nestedTemplatePath = m_paths.front(); @@ -80,7 +80,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_SingleLinearNestingOfInstances)(::benchmark::State& state) { - const unsigned int maxDepth = state.range(); + const unsigned int maxDepth = static_cast(state.range()); CreateFakePaths(maxDepth); const unsigned int numInstances = maxDepth; @@ -131,8 +131,8 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_MultipleLinearNestingOfInstances)(::benchmark::State& state) { - const unsigned int numRootInstances = state.range(); - const unsigned int maxDepth = state.range(); + const unsigned int numRootInstances = static_cast(state.range()); + const unsigned int maxDepth = static_cast(state.range()); CreateFakePaths(maxDepth); const unsigned int numInstances = numRootInstances * maxDepth; @@ -192,7 +192,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabUpdateInstances, UpdateInstances_BinaryTreeNestedInstanceHierarchy)(::benchmark::State& state) { - const unsigned int maxDepth = state.range(); + const unsigned int maxDepth = static_cast(state.range()); CreateFakePaths(maxDepth); const unsigned int numInstances = (1 << maxDepth) - 1; diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp index 54e53a6ebc..d9024114a5 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/SpawnableCreateBenchmarks.cpp @@ -18,7 +18,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_SpawnableCreate, CreateSpawnable_SingleEntityInstance)(::benchmark::State& state) { - const unsigned int numSpawnables = state.range(); + const unsigned int numSpawnables = static_cast(state.range()); AZStd::unique_ptr instance(m_prefabSystemComponent->CreatePrefab( { CreateEntity("Entity1") }, diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp index a7689a86ba..170805aa57 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Weights.cpp @@ -17,7 +17,7 @@ namespace ImageProcessingAtom { float round(float x) { - return ((x) >= 0) ? floor((x) + 0.5) : ceil((x)-0.5); + return ((x) >= 0.f) ? floor((x) + 0.5f) : ceil((x) - 0.5f); } void calculateFilterRange(unsigned int srcFactor, int& srcFirst, int& srcLast, @@ -220,7 +220,7 @@ namespace ImageProcessingAtom /* normalize against the peak sumWeights, because the sums are not allowed to leave -32768/32767 */ fWeight = fWeight * nrmWeights; - iWeight = int(round(fWeight)); + iWeight = int(round(static_cast(fWeight))); /* find first nonzero */ if (stillzero && (iWeight == 0)) @@ -246,7 +246,7 @@ namespace ImageProcessingAtom /* add weight to table, interleaved sign */ for (n = 0; n < -numRepetitions; n++) { - *weightsPtr++ = sgnextend(n, -iWeight); + *weightsPtr++ = static_cast(sgnextend(n, -iWeight)); } } else @@ -254,7 +254,7 @@ namespace ImageProcessingAtom /* add weight to table */ for (n = 0; n < numRepetitions; n++) { - *weightsPtr++ = -iWeight; + *weightsPtr++ = static_cast(-iWeight); } } @@ -311,7 +311,7 @@ namespace ImageProcessingAtom for (n = 0, weightsPtr = weightsMem + (i - i0) * numRepetitions; n < numRepetitions; n++) { - *weightsPtr++ -= iWeight; + *weightsPtr++ -= static_cast(iWeight); } } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp index d84bbebbc6..728ceb059b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp @@ -114,7 +114,7 @@ namespace EMStudio } // Set the current history index in case the user called undo. - m_list->setCurrentRow(commandManager->GetHistoryIndex()); + m_list->setCurrentRow(static_cast(commandManager->GetHistoryIndex())); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp index c17ff12947..6434799773 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp @@ -1176,7 +1176,7 @@ namespace EMStudio } else { - settingsInfo->m_axis = elementID; + settingsInfo->m_axis = static_cast(elementID); } } else @@ -1188,7 +1188,7 @@ namespace EMStudio } else { - settingsInfo->m_axis = value - 1; + settingsInfo->m_axis = static_cast(value - 1); } } #else @@ -1619,7 +1619,7 @@ namespace EMStudio const uint32 numButtons = m_gameController->GetNumButtons(); for (uint32 i = 0; i < numButtons; ++i) { - const bool isPressed = m_gameController->GetIsButtonPressed(i); + const bool isPressed = m_gameController->GetIsButtonPressed(static_cast(i)); // get the game controller settings info for the given button EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(i); @@ -1792,7 +1792,7 @@ namespace EMStudio m_string.clear(); for (uint32 i = 0; i < numButtons; ++i) { - if (m_gameController->GetIsButtonPressed(i)) + if (m_gameController->GetIsButtonPressed(static_cast(i))) { m_string += AZStd::string::format("%s%d ", (i < 10) ? "0" : "", i); } diff --git a/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp b/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp index 8f6abd5a17..24689bbfe3 100644 --- a/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp +++ b/Gems/EditorPythonBindings/Code/Tests/PythonDictionaryTests.cpp @@ -52,8 +52,8 @@ namespace UnitTest } }; - MapOf m_indexOfu8tou32 { {1, 4}, {2, 5}, {3, 6}, {4, 7} }; - MapOf m_indexOfu16toFloat { {1, 0.4f}, {2, 0.5f}, {3, 0.6f}, {4, 0.7f} }; + MapOf m_indexOfu8tou32 { {AZ::u8(1), 4u}, {AZ::u8(2), 5u}, {AZ::u8(3), 6u}, {AZ::u8(4), 7u} }; + MapOf m_indexOfu16toFloat { {AZ::u16(1u), 0.4f}, {AZ::u16(2u), 0.5f}, {AZ::u16(3u), 0.6f}, {AZ::u16(4u), 0.7f} }; MapOf m_indexOfStringTos32 { {"1", -4}, {"2", 5}, {"3", -6}, {"4", 7} }; MapOf m_indexOfStringToString { {"hello", "foo"}, {"world", "bar"}, {"bye", "baz"}, {"sky", "qux"} }; MapOf m_indexOfStringToVec3{ {"up", AZ::Vector3{ 0, 1.0, 0 }}, {"down", AZ::Vector3{0, -1.0, 0}}, diff --git a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp index 4d34725e36..46e14e6985 100644 --- a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp +++ b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp @@ -109,7 +109,7 @@ protected: TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_NoDependencies) { - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); TestSuccessCaseNoDependencies(exportProduct); } @@ -122,7 +122,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen #endif // AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS AssetBuilderSDK::ProductPathDependency expectedPathDependency(absolutePathToFile, AssetBuilderSDK::ProductPathDependencyType::SourceFile); - SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); product.m_legacyPathDependencies.push_back(absolutePathToFile); TestSuccessCase(product, &expectedPathDependency); @@ -134,7 +134,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen AssetBuilderSDK::ProductPathDependency expectedPathDependency(relativeDependencyPathToFile, AssetBuilderSDK::ProductPathDependencyType::ProductFile); - SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct product("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); product.m_legacyPathDependencies.push_back(relativeDependencyPathToFile); TestSuccessCase(product, &expectedPathDependency); @@ -150,7 +150,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen const char* absolutePathToFile = "/some/test/file.mtl"; #endif // AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); exportProduct.m_legacyPathDependencies.push_back(absolutePathToFile); exportProduct.m_legacyPathDependencies.push_back(relativeDependencyPathToFile); @@ -164,7 +164,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDependency) { AZ::Uuid dependencyId = AZ::Uuid::CreateRandom(); - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt)); TestSuccessCase(exportProduct, nullptr, &dependencyId); @@ -173,7 +173,7 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDe TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductAndPathDependencies) { AZ::Uuid dependencyId = AZ::Uuid::CreateRandom(); - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt)); const char* relativeDependencyPathToFile = "some/test/file.mtl"; diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp index b789c2e675..e4a95d7d19 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/ScriptCanvasContextMenus.cpp @@ -568,7 +568,7 @@ namespace ScriptCanvasEditor // Show the selection dialog bool createSlot = false; VariablePaletteRequests::SlotSetup selectedSlotSetup; - QPoint scenePoint(scenePos.GetX(), scenePos.GetY()); + QPoint scenePoint(static_cast(scenePos.GetX()), static_cast(scenePos.GetY())); VariablePaletteRequestBus::BroadcastResult(createSlot, &VariablePaletteRequests::ShowSlotTypeSelector, slot, scenePoint, selectedSlotSetup); bool changed = false; From e9b4f48f71c870c0374eca90aee2bef37ff41606 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:29:24 -0700 Subject: [PATCH 030/100] more fixes, will merge fixes for w4245 and w4389 Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/BaseLibraryItem.cpp | 4 ++-- .../ReflectedPropertyCtrl.cpp | 6 +++--- Code/Editor/EditorDefs.h | 12 ------------ Code/Editor/EditorViewportWidget.cpp | 4 ++-- Code/Editor/Objects/BaseObject.cpp | 4 ++-- .../UI/Outliner/OutlinerListModel.cpp | 2 +- Code/Editor/Plugins/EditorCommon/QtViewPane.cpp | 5 ----- Code/Editor/TrackView/TrackViewDopeSheetBase.cpp | 2 +- Code/Editor/Util/AffineParts.cpp | 2 -- Code/Editor/Util/GdiUtil.cpp | 12 ++++-------- Code/Editor/Util/ImageTIF.cpp | 4 ++-- Code/Editor/Util/Util.h | 3 --- .../AzFramework/Script/ScriptComponent.cpp | 4 ---- .../Source/GemCatalog/GemItemDelegate.cpp | 2 +- .../Include/Public/Framework/AWSApiClientJobConfig.h | 11 ----------- .../Include/Public/Framework/HttpRequestJobConfig.h | 11 ----------- .../Public/Framework/ServiceClientJobConfig.h | 10 ---------- .../Code/Include/Public/Framework/ServiceJobConfig.h | 11 ----------- .../Public/Framework/ServiceRequestJobConfig.h | 9 --------- .../Editor/Attribution/AWSCoreAttributionMetric.cpp | 2 -- .../Source/GameLiftServerSDKWrapper.cpp | 2 -- Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp | 3 --- .../External/CubeMapGen/VectorMacros.h | 3 --- .../Window/AtomToolsMainWindowRequestBus.h | 3 --- .../Platform/Windows/GameCrashUploader_windows.cpp | 2 -- .../Editor/Animation/UiAnimViewDopeSheetBase.cpp | 2 +- Gems/LyShine/Code/Editor/EditorCommon.h | 2 -- .../Include/ScriptCanvas/Core/NodeFunctionGeneric.h | 5 ----- .../Include/ScriptCanvas/Libraries/Math/Math.cpp | 2 -- .../ScriptCanvasActions/CreateElementsActions.cpp | 4 ++-- .../Code/Tests/ScriptCanvas_NodeGenerics.cpp | 6 ------ 31 files changed, 21 insertions(+), 133 deletions(-) diff --git a/Code/Editor/BaseLibraryItem.cpp b/Code/Editor/BaseLibraryItem.cpp index 252510c951..b1fba91fad 100644 --- a/Code/Editor/BaseLibraryItem.cpp +++ b/Code/Editor/BaseLibraryItem.cpp @@ -43,7 +43,7 @@ public: //evaluate size XmlString xmlStr = m_undoCtx.node->getXML(); m_size = sizeof(CUndoBaseLibraryItem); - m_size += xmlStr.GetAllocatedMemory(); + m_size += static_cast(xmlStr.GetAllocatedMemory()); m_size += m_itemPath.length(); m_size += m_description.length(); } @@ -87,7 +87,7 @@ protected: libItem->Serialize(m_redoCtx); XmlString xmlStr = m_redoCtx.node->getXML(); - m_size += xmlStr.GetAllocatedMemory(); + m_size += static_cast(xmlStr.GetAllocatedMemory()); } //load previous saved data diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp index 1a7060aa8d..cf80d56962 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp @@ -560,7 +560,7 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst // Popup Menu with Event selection. QMenu menu; - UINT i = 0; + unsigned int i = 0; const int ePPA_CustomItemBase = 10; // reserved from 10 to 99 const int ePPA_CustomPopupBase = 100; // reserved from 100 to x*100+100 where x is size of m_customPopupMenuPopups @@ -595,12 +595,12 @@ void ReflectedPropertyControl::RequestPropertyContextMenu(AzToolsFramework::Inst action->setData(ePPA_CustomItemBase + i); } - for (UINT j = 0; j < m_customPopupMenuPopups.size(); ++j) + for (unsigned int j = 0; j < m_customPopupMenuPopups.size(); ++j) { SCustomPopupMenu* pMenuInfo = &m_customPopupMenuPopups[j]; QMenu* pSubMenu = menu.addMenu(pMenuInfo->m_text); - for (UINT k = 0; k < pMenuInfo->m_subMenuText.size(); ++k) + for (UINT k = 0; k < static_cast(pMenuInfo->m_subMenuText.size()); ++k) { const UINT uID = ePPA_CustomPopupBase + ePPA_CustomPopupBase * j + k; QAction *action = pSubMenu->addAction(pMenuInfo->m_subMenuText[k]); diff --git a/Code/Editor/EditorDefs.h b/Code/Editor/EditorDefs.h index 6614fa4d72..423f4c5f73 100644 --- a/Code/Editor/EditorDefs.h +++ b/Code/Editor/EditorDefs.h @@ -33,18 +33,6 @@ #include #include -// Warnings in STL -#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information. -#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data -#pragma warning (disable : 4018) // signed/unsigned mismatch - -// Disable warning when a function returns a value inside an __asm block -#pragma warning (disable : 4035) - -////////////////////////////////////////////////////////////////////////// -// 64-bits related warnings. -#pragma warning (disable : 4267) // conversion from 'size_t' to 'int', possible loss of data - ////////////////////////////////////////////////////////////////////////// // Simple type definitions. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 28e8cce33e..c7b1976432 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1915,8 +1915,8 @@ Vec3 EditorViewportWidget::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nF { out.x = (x / 100) * m_rcClient.width(); out.y = (y / 100) * m_rcClient.height(); - out.x /= QHighDpiScaling::factor(windowHandle()->screen()); - out.y /= QHighDpiScaling::factor(windowHandle()->screen()); + out.x /= static_cast(QHighDpiScaling::factor(windowHandle()->screen())); + out.y /= static_cast(QHighDpiScaling::factor(windowHandle()->screen())); out.z = z; } return out; diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index 482055d7ed..f40363ba98 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -1978,8 +1978,8 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos) { float fScreenScale = hc.view->GetScreenScaleFactor(pos); - iconSizeX *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale; - iconSizeY *= OBJECT_TEXTURE_ICON_SCALE / fScreenScale; + iconSizeX = static_cast(static_cast(iconSizeX) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale); + iconSizeY = static_cast(static_cast(iconSizeY) * OBJECT_TEXTURE_ICON_SCALE / fScreenScale); } // Hit Test icon of this object. diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index 02d2174fb8..c1938184db 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -2597,7 +2597,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& QString htmlStripped = layerInfoString; htmlStripped.remove(htmlMarkupRegex); const float layerInfoPadding = 1.2f; - textWidthAvailable -= fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding; + textWidthAvailable -= static_cast(fontMetrics.horizontalAdvance(htmlStripped) * layerInfoPadding); } entityNameRichText = fontMetrics.elidedText(optionV4.text, Qt::TextElideMode::ElideRight, textWidthAvailable); diff --git a/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp b/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp index 7d97e6f580..3deef7e503 100644 --- a/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp +++ b/Code/Editor/Plugins/EditorCommon/QtViewPane.cpp @@ -9,8 +9,6 @@ #include "platform.h" -#pragma warning(disable: 4266) // disabled warning from afk overrides - #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS #include #include @@ -30,13 +28,10 @@ #include "QtUtil.h" // ugly dependencies: -#pragma warning(push) -#pragma warning(disable: 4244) // warning C4244: 'argument' : conversion from 'A' to 'B', possible loss of data #include "Functor.h" class CXmlArchive; #include #include "Util/PathUtil.h" -#pragma warning(pop) // ^^^ // --------------------------------------------------------------------------- diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index aa4ef94e9e..c784142b3c 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -258,7 +258,7 @@ void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) while (fPixelsPerTick >= 12.0 && steps < 100); float fCurrentOffset = -fAnchorTime * m_timeScale; - m_scrollOffset.rx() += fOldOffset - fCurrentOffset; + m_scrollOffset.rx() += static_cast(fOldOffset - fCurrentOffset); m_scrollBar->setValue(m_scrollOffset.x()); update(); diff --git a/Code/Editor/Util/AffineParts.cpp b/Code/Editor/Util/AffineParts.cpp index 7e6a1be35b..c80ceb3ffa 100644 --- a/Code/Editor/Util/AffineParts.cpp +++ b/Code/Editor/Util/AffineParts.cpp @@ -9,8 +9,6 @@ #include "EditorDefs.h" -#pragma warning ( disable : 4244 ) // conversion from 'double' to 'float', possible loss of data. - /**** Decompose.h - Basic declarations ****/ typedef struct { diff --git a/Code/Editor/Util/GdiUtil.cpp b/Code/Editor/Util/GdiUtil.cpp index eba5ac8579..8565aabf9d 100644 --- a/Code/Editor/Util/GdiUtil.cpp +++ b/Code/Editor/Util/GdiUtil.cpp @@ -61,15 +61,11 @@ QColor ScaleColor(const QColor& c, float aScale) aColor = QColor(1, 1, 1); } - int r = aColor.red(); - int g = aColor.green(); - int b = aColor.blue(); + const float r = static_cast(aColor.red()) * aScale; + const float g = static_cast(aColor.green()) * aScale; + const float b = static_cast(aColor.blue()) * aScale; - r *= aScale; - g *= aScale; - b *= aScale; - - return QColor(CLAMP(r, 0, 255), CLAMP(g, 0, 255), CLAMP(b, 0, 255)); + return QColor(CLAMP(static_cast(r), 0, 255), CLAMP(static_cast(g), 0, 255), CLAMP(static_cast(b), 0, 255)); } CAlphaBitmap::CAlphaBitmap() diff --git a/Code/Editor/Util/ImageTIF.cpp b/Code/Editor/Util/ImageTIF.cpp index 25e4296154..654b24f857 100644 --- a/Code/Editor/Util/ImageTIF.cpp +++ b/Code/Editor/Util/ImageTIF.cpp @@ -60,7 +60,7 @@ libtiffDummyReadProc (thandle_t fd, tdata_t buf, tsize_t size) memcpy(buf, &memImage->buffer[memImage->offset], size); - memImage->offset += size; + memImage->offset += static_cast(size); // Return the amount of data read return size; @@ -83,7 +83,7 @@ libtiffDummySeekProc (thandle_t fd, toff_t off, int i) break; case SEEK_CUR: - memImage->offset += off; + memImage->offset += static_cast(off); break; case SEEK_END: diff --git a/Code/Editor/Util/Util.h b/Code/Editor/Util/Util.h index b0ec0db818..61bb0eed09 100644 --- a/Code/Editor/Util/Util.h +++ b/Code/Editor/Util/Util.h @@ -137,8 +137,6 @@ namespace Util { x = x - 1; -#pragma warning(push) -#pragma warning(disable : 4293) if (sizeof(TInteger) > 0) { x |= x >> 1; @@ -163,7 +161,6 @@ namespace Util { x |= x >> 32; } -#pragma warning(pop) return x + 1; } diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index 6b25c49b88..fb8ca8b892 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -357,8 +357,6 @@ namespace AzFramework } } - #pragma warning( push ) - #pragma warning( disable : 4505 ) // StackDump is useful to debug the lua stack. Disable warning about this method being unused. //========================================================================= // DebugPrintStack // Prints the Lua stack starting from the bottom. @@ -375,8 +373,6 @@ namespace AzFramework AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str()); } - #pragma warning( pop ) - //========================================================================= // Properties__IndexFindSubtable diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp index d5a213e80f..08e08afdd5 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp @@ -208,7 +208,7 @@ namespace O3DE::ProjectManager const QPixmap& pixmap = iterator.value(); painter->drawPixmap(contentRect.left() + startX, contentRect.bottom() - s_platformIconSize, pixmap); qreal aspectRatio = static_cast(pixmap.width()) / pixmap.height(); - startX += s_platformIconSize * aspectRatio + s_platformIconSize / 2.5; + startX += static_cast(s_platformIconSize * aspectRatio + s_platformIconSize / 2.5); } } } diff --git a/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h index 2070bab4b6..800edffd41 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h @@ -45,15 +45,9 @@ namespace AWSCore virtual std::shared_ptr GetClient() = 0; }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::AwsApiClientJobConfig': inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - /// Configuration for AWS jobs using a specific client type. template class AwsApiClientJobConfig @@ -126,9 +120,4 @@ namespace AWSCore /// Set by ApplySettings std::shared_ptr m_client; }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif - } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h index 9018c167f6..f5a089b5ca 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h @@ -27,15 +27,9 @@ namespace AWSCore }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::HttpRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - //! Provides service job configuration using settings properties. class HttpRequestJobConfig : public AwsApiJobConfig @@ -98,9 +92,4 @@ namespace AWSCore std::shared_ptr m_httpClient{ nullptr }; Aws::String m_userAgent{}; }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif - } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h index 239fdfdbc0..c78fc41617 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h @@ -60,15 +60,10 @@ namespace AWSCore static const char* GetRESTApiStageKeyName() { return RESTAPI_STAGE; } \ }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::ServiceClientJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. -#endif - /// Provides service job configuration using settings properties. template class ServiceClientJobConfig @@ -132,11 +127,6 @@ namespace AWSCore } }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif - } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h index 0e2e2de96d..8632db7d9f 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h @@ -19,15 +19,9 @@ namespace AWSCore { }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::ServiceJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -#endif - /// Provides service job configuration using settings properties. class ServiceJobConfig : public HttpRequestJobConfig @@ -63,9 +57,4 @@ namespace AWSCore private: }; - -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif - } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h index 8395384427..660b4f2537 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h @@ -25,15 +25,10 @@ namespace AWSCore virtual bool IsValid() const = 0; }; -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4250 ) // warning C4250: 'AWSCore::ServiceRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. -#endif - template class ServiceRequestJobConfig : public ServiceClientJobConfig @@ -106,8 +101,4 @@ namespace AWSCore }; -#ifdef _MSC_VER -#pragma warning( pop ) // C4250 -#endif - } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp index f54d7f71af..c4f51fcb6f 100644 --- a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp +++ b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp @@ -12,8 +12,6 @@ #include #include -#pragma warning(disable : 4996) - namespace AWSCore { constexpr char AWSAttributionMetricDefaultO3DEVersion[] = "1.1"; diff --git a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp index ae9b868f42..ae4fe7b0f4 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp @@ -10,8 +10,6 @@ #include -#pragma warning(disable : 4996) - namespace AWSGameLift { Aws::GameLift::GenericOutcome GameLiftServerSDKWrapper::AcceptPlayerSession(const std::string& playerSessionId) diff --git a/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp b/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp index b7d9163fa9..043af2ef09 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp @@ -15,9 +15,6 @@ #include -#pragma warning(disable : 4996) - - namespace AWSMetrics { MetricsEventBuilder::MetricsEventBuilder() diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h index c293cf1ac7..0db22d03d6 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h @@ -18,9 +18,6 @@ //-------------------------------------------------------------------------------------- // Modified from original -//disable warning about doubles being converted down to float -#pragma warning (disable : 4244 ) - #define VM_LARGE_FLOAT 3.7e37f #define VM_MIN(a, b) (((a) < (b)) ? (a) : (b)) diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h index 6edb44bc5c..647082f553 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h @@ -8,9 +8,6 @@ #pragma once -//! Disables "unreferenced formal parameter" warning -#pragma warning(disable : 4100) - #include #include #include diff --git a/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp b/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp index f65d98d7da..d8def1885e 100644 --- a/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp +++ b/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp @@ -15,8 +15,6 @@ #include #include -#pragma warning(disable : 4996) - namespace O3de { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index a38736ff67..bd5c82fc9e 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -251,7 +251,7 @@ void CUiAnimViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) while (fPixelsPerTick >= 12.0 && steps < 100); float fCurrentOffset = -fAnchorTime * m_timeScale; - m_scrollOffset.rx() += fOldOffset - fCurrentOffset; + m_scrollOffset.rx() += static_cast(fOldOffset - fCurrentOffset); update(); diff --git a/Gems/LyShine/Code/Editor/EditorCommon.h b/Gems/LyShine/Code/Editor/EditorCommon.h index ebe5b89cfc..9af5958c67 100644 --- a/Gems/LyShine/Code/Editor/EditorCommon.h +++ b/Gems/LyShine/Code/Editor/EditorCommon.h @@ -34,8 +34,6 @@ #include #include -#pragma warning(disable: 4355) // 'this' : used in base member initializer list - class CanvasSizeToolbarSection; class CommandCanvasPropertiesChange; class CommandCanvasSizeToolbarIndex; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h index 9cf5d04167..41a674536b 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h @@ -21,9 +21,6 @@ #include "Node.h" #include "Attributes.h" -#pragma warning( push ) -#pragma warning( disable : 5046) // 'function' : Symbol involving type with internal linkage not defined - /** * NodeFunctionGeneric.h * @@ -372,5 +369,3 @@ namespace ScriptCanvas } } - -#pragma warning( pop ) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp index 67c79aaa05..62ca21f1b6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Math/Math.cpp @@ -10,8 +10,6 @@ #include -#pragma warning (disable:4503) // decorated name length exceeded, name was truncated - namespace ScriptCanvas { namespace Nodes diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp index 71b157e0a9..0fa3765ac3 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.cpp @@ -539,8 +539,8 @@ namespace ScriptCanvasDeveloper AZ::Vector2 stepDirection = AZ::Vector2::CreateZero(); - stepDirection.SetX(jutDirection.x() * stepSize.GetX()); - stepDirection.SetY(jutDirection.y() * stepSize.GetY()); + stepDirection.SetX(static_cast(jutDirection.x() * stepSize.GetX())); + stepDirection.SetY(static_cast(jutDirection.y() * stepSize.GetY())); m_scenePoint.setX(m_scenePoint.x() + stepDirection.GetX() * 2); } diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp index f6e5b361f4..cbbe77fbba 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_NodeGenerics.cpp @@ -13,9 +13,6 @@ #include -#pragma warning( push ) -#pragma warning( disable : 5046) //'function' : Symbol involving type with internal linkage not defined - using namespace ScriptCanvasTests; namespace @@ -163,6 +160,3 @@ TEST_F(ScriptCanvasTestFixture, NodeGenerics) delete graph->GetEntity(); } - - -#pragma warning( pop ) From 33cbc2db219cb77d088cb15c1774c86d9b1be9aa Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:46:04 -0700 Subject: [PATCH 031/100] =?UTF-8?q?=EF=BB=BFAtomLyIntegration?= 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> --- .../EMotionFXAtom/Code/Source/AtomActorInstance.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp index d5a48b900d..e85c2b92e7 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp @@ -161,7 +161,7 @@ namespace AZ const AZ::Color skeletonColor(0.604f, 0.804f, 0.196f, 1.0f); RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = aznumeric_caster(m_auxVertices.size()); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); lineArgs.m_colors = &skeletonColor; lineArgs.m_colorCount = 1; lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; @@ -202,9 +202,9 @@ namespace AZ RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; lineArgs.m_verts = m_auxVertices.data(); - lineArgs.m_vertCount = aznumeric_caster(m_auxVertices.size()); + lineArgs.m_vertCount = static_cast(m_auxVertices.size()); lineArgs.m_colors = m_auxColors.data(); - lineArgs.m_colorCount = aznumeric_caster(m_auxColors.size()); + lineArgs.m_colorCount = static_cast(m_auxColors.size()); lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; auxGeom->DrawLines(lineArgs); } @@ -861,7 +861,7 @@ namespace AZ // Set the weights for any active masks for (size_t i = 0; i < m_wrinkleMaskWeights.size(); ++i) { - wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], aznumeric_caster(i)); + wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], static_cast(i)); } AZ_Error("AtomActorInstance", m_wrinkleMaskWeights.size() <= s_maxActiveWrinkleMasks, "The skinning shader supports no more than %d active morph targets with wrinkle masks.", s_maxActiveWrinkleMasks); } From 4247f32eca9f9efa70941d971c22a32b82fd3f58 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 17 Jun 2021 16:52:06 -0700 Subject: [PATCH 032/100] =?UTF-8?q?=EF=BB=BFAWSMetrics?= 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> --- Gems/AWSMetrics/Code/Source/MetricsManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp index 03e31770ee..c8c352f17d 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp @@ -256,7 +256,7 @@ namespace AWSMetrics } m_globalStats.m_numSuccesses++; - m_globalStats.m_sendSizeInBytes += static_cast(metricsEvent.GetSizeInBytes()); + m_globalStats.m_sendSizeInBytes += static_cast::value_type>(metricsEvent.GetSizeInBytes()); } else { From aecb4a4eea393eb45671e9eee9429f4525ab711a Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:20:59 -0700 Subject: [PATCH 033/100] =?UTF-8?q?=EF=BB=BFVegetation?= 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> --- Gems/Vegetation/Code/Source/AreaSystemComponent.cpp | 6 +++--- Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp index 7ce1a2c0a3..f5153a37b2 100644 --- a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp @@ -1010,7 +1010,7 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); } } @@ -1025,8 +1025,8 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); - m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); } } diff --git a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp index 74fb2696ea..efdebcaff8 100644 --- a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp @@ -483,7 +483,7 @@ namespace Vegetation AZStd::lock_guard scopedLock(m_instanceMapMutex); AZ_Assert(m_instanceMap.find(instanceData.m_instanceId) == m_instanceMap.end(), "InstanceId %llu is already in use!", instanceData.m_instanceId); m_instanceMap[instanceData.m_instanceId] = AZStd::make_pair(instanceData.m_descriptorPtr, opaqueInstanceData); - m_instanceCount = static_cast(m_instanceMap.size()); + m_instanceCount = static_cast(m_instanceMap.size()); } } @@ -503,7 +503,7 @@ namespace Vegetation opaqueInstanceData = instanceItr->second.second; m_instanceMap.erase(instanceItr); } - m_instanceCount = static_cast(m_instanceMap.size()); + m_instanceCount = static_cast(m_instanceMap.size()); } if (opaqueInstanceData) From f6679cc05f11b3bd19e70c30f1fd912181c49470 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 18 Jun 2021 16:36:30 -0700 Subject: [PATCH 034/100] =?UTF-8?q?=EF=BB=BFSandbox?= 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/Editor/ViewportTitleDlg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp index f5515b9c18..b54ce54ddd 100644 --- a/Code/Editor/ViewportTitleDlg.cpp +++ b/Code/Editor/ViewportTitleDlg.cpp @@ -462,7 +462,7 @@ void CViewportTitleDlg::AddFOVMenus(QMenu* menu, std::function call { fov = std::max(1.0f, f); fov = std::min(120.0f, f); - QAction* action = menu->addAction(customPreset); + QAction* action = menu->addAction(customPresets[i]); connect(action, &QAction::triggered, action, [fov, callback](){ callback(fov); }); } } @@ -536,7 +536,7 @@ void CViewportTitleDlg::AddAspectRatioMenus(QMenu* menu, std::functionaddAction(customPreset); + QAction* action = menu->addAction(customPresets[i]); connect(action, &QAction::triggered, action, [width, height, callback]() {callback(width, height); }); } } From f02957c140dccf2ebf9f9e51f3159739eb629f95 Mon Sep 17 00:00:00 2001 From: pappeste Date: Thu, 24 Jun 2021 18:10:14 -0700 Subject: [PATCH 035/100] merging from development + fixing linux Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AWSMetrics/Code/Source/MetricsManager.cpp | 2 +- Gems/Vegetation/Code/Source/AreaSystemComponent.cpp | 6 +++--- Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp index c8c352f17d..03e31770ee 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsManager.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsManager.cpp @@ -256,7 +256,7 @@ namespace AWSMetrics } m_globalStats.m_numSuccesses++; - m_globalStats.m_sendSizeInBytes += static_cast::value_type>(metricsEvent.GetSizeInBytes()); + m_globalStats.m_sendSizeInBytes += static_cast(metricsEvent.GetSizeInBytes()); } else { diff --git a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp index f5153a37b2..7ce1a2c0a3 100644 --- a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp @@ -1010,7 +1010,7 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); } } @@ -1025,8 +1025,8 @@ namespace Vegetation if (m_debugData) { - m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); - m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskQueueCount.store(static_cast(m_vegetationThreadTasks.size()), AZStd::memory_order_relaxed); + m_debugData->m_areaTaskActiveCount.store(static_cast(tasks.size()), AZStd::memory_order_relaxed); } } diff --git a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp index efdebcaff8..74fb2696ea 100644 --- a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp @@ -483,7 +483,7 @@ namespace Vegetation AZStd::lock_guard scopedLock(m_instanceMapMutex); AZ_Assert(m_instanceMap.find(instanceData.m_instanceId) == m_instanceMap.end(), "InstanceId %llu is already in use!", instanceData.m_instanceId); m_instanceMap[instanceData.m_instanceId] = AZStd::make_pair(instanceData.m_descriptorPtr, opaqueInstanceData); - m_instanceCount = static_cast(m_instanceMap.size()); + m_instanceCount = static_cast(m_instanceMap.size()); } } @@ -503,7 +503,7 @@ namespace Vegetation opaqueInstanceData = instanceItr->second.second; m_instanceMap.erase(instanceItr); } - m_instanceCount = static_cast(m_instanceMap.size()); + m_instanceCount = static_cast(m_instanceMap.size()); } if (opaqueInstanceData) From 58f8b563d073d36ef5a02ff48901fd5473d9bf1d Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 18:33:22 -0700 Subject: [PATCH 036/100] =?UTF-8?q?=EF=BB=BFfix=20them=20all?= 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/Editor/Geometry/TriMesh.cpp | 10 +++++----- Code/Editor/Objects/EntityObject.cpp | 2 +- Code/Editor/TrackView/TrackViewDialog.cpp | 2 +- Code/Editor/TrackView/TrackViewNodes.cpp | 2 +- .../Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp | 2 +- Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp | 2 +- .../AzFramework/AzFramework/Archive/Archive.cpp | 6 +++--- .../AzFramework/Archive/ZipDirStructures.cpp | 2 +- .../SceneBuilder/Importers/AssImpUvMapImporter.cpp | 2 +- .../Code/Source/ImageLoader/DdsLoader.cpp | 4 ++-- .../PostProcessing/BlendColorGradingLutsPass.cpp | 2 +- .../Code/Source/Window/MaterialEditorWindow.cpp | 2 +- Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp | 2 +- .../Code/Source/Editor/QConnectionsWidget.cpp | 2 +- .../Code/Source/PythonMarshalComponent.cpp | 2 +- .../Code/Tests/GradientSignalImageTests.cpp | 2 +- Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp | 2 +- Gems/LyShine/Code/Source/UiTextComponent.cpp | 2 +- Gems/LyShine/Code/Source/UiTextInputComponent.cpp | 2 +- .../ClothComponentMesh/ClothComponentMesh.cpp | 2 +- .../Code/Source/ScriptedEntityTweenerTask.h | 2 +- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 1 - 22 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp index 737886cabc..8e85de3904 100644 --- a/Code/Editor/Geometry/TriMesh.cpp +++ b/Code/Editor/Geometry/TriMesh.cpp @@ -677,11 +677,11 @@ void CTriMesh::GetEdgesByVertex(MeshElementsArray& inVertices, MeshElementsArray std::sort(inVertices.begin(), inVertices.end()); for (int i = 0; i < GetEdgeCount(); i++) { - if (stl::binary_find(inVertices.begin(), inVertices.end(), pEdges[i].v[0]) != inVertices.end()) + if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pEdges[i].v[0])) != inVertices.end()) { outEdges.push_back(i); } - else if (stl::binary_find(inVertices.begin(), inVertices.end(), pEdges[i].v[1]) != inVertices.end()) + else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pEdges[i].v[1])) != inVertices.end()) { outEdges.push_back(i); } @@ -696,15 +696,15 @@ void CTriMesh::GetFacesByVertex(MeshElementsArray& inVertices, MeshElementsArray std::sort(inVertices.begin(), inVertices.end()); for (int i = 0; i < GetFacesCount(); i++) { - if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[0]) != inVertices.end()) + if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pFaces[i].v[0])) != inVertices.end()) { outFaces.push_back(i); } - else if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[1]) != inVertices.end()) + else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pFaces[i].v[1])) != inVertices.end()) { outFaces.push_back(i); } - else if (stl::binary_find(inVertices.begin(), inVertices.end(), pFaces[i].v[2]) != inVertices.end()) + else if (stl::binary_find(inVertices.begin(), inVertices.end(), static_cast(pFaces[i].v[2])) != inVertices.end()) { outFaces.push_back(i); } diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index 0f4a17f3ba..77fab543f9 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -1283,7 +1283,7 @@ void CEntityObject::UpdateVisibility(bool bVisible) CBaseObject::UpdateVisibility(bVisible); bool bVisibleWithSpec = bVisible && !IsHiddenBySpec(); - if (bVisibleWithSpec != m_bVisible) + if (bVisibleWithSpec != static_cast(m_bVisible)) { m_bVisible = bVisibleWithSpec; } diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index 331daf6730..309d776b81 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -1559,7 +1559,7 @@ void CTrackViewDialog::OnAddSelectedNode() selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount); // check to make sure all nodes were added and notify user if they weren't - if (addedNodes.GetCount() != selectedEntitiesCount) + if (addedNodes.GetCount() != static_cast(selectedEntitiesCount)) { IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem(); diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index 16baa72709..550d36af83 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -1113,7 +1113,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount); // check to make sure all nodes were added and notify user if they weren't - if (addedNodes.GetCount() != selectedEntitiesCount) + if (addedNodes.GetCount() != static_cast(selectedEntitiesCount)) { IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem(); diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index 3d8cbc7480..bbb54abb48 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -188,7 +188,7 @@ namespace AZ s32 numAvailableSlots = CalculateAvailableRequestSlots(); status.m_numAvailableSlots = AZStd::min(status.m_numAvailableSlots, numAvailableSlots); status.m_isIdle = status.m_isIdle && - numAvailableSlots == m_numBlocks && + static_cast(numAvailableSlots) == m_numBlocks && m_delayedSections.empty(); } diff --git a/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp b/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp index b05a95dbce..4570d79b83 100644 --- a/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp @@ -94,7 +94,7 @@ namespace UnitTest float testStoreValues[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; VectorType::StoreUnaligned(testStoreValues, result); - for (int32_t i = 0; i < VectorType::ElementCount; ++i) + for (uint32_t i = 0; i < VectorType::ElementCount; ++i) { if (i == replaceIndex) { diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index a3d2103650..a0dda9f692 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -235,7 +235,7 @@ namespace AZ::IO::ArchiveInternal return 0; } - if (nReadBytes != nTotal) + if (static_cast(nReadBytes) != nTotal) { AZ_Warning("Archive", false, "FRead did not read expected number of byte from file, only %zu of %lld bytes read", nTotal, nReadBytes); nTotal = (size_t)nReadBytes; @@ -1791,11 +1791,11 @@ namespace AZ::IO AZ_Assert(m_pZip, "ZipFile is nullptr"); AZ_Assert(m_pFileEntry && m_pZip->IsOwnerOf(m_pFileEntry), "ZipFile is not owner of m_pFileEntry"); - if (nDataSize != m_pFileEntry->desc.lSizeUncompressed && bDecompress) + if (static_cast(nDataSize) != m_pFileEntry->desc.lSizeUncompressed && bDecompress) { return false; } - else if (nDataSize != m_pFileEntry->desc.lSizeCompressed && !bDecompress) + else if (static_cast(nDataSize) != m_pFileEntry->desc.lSizeCompressed && !bDecompress) { return false; } diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index b3b2328222..4111328224 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -104,7 +104,7 @@ namespace AZ::IO::ZipDir::ZipDirStructuresInternal if (*pReturnCode == Z_BUF_ERROR) { // As long as we consumed something, keep going. Only fail permanently if we've stalled. - if (nAvailIn != pZStream->avail_in || nAvailOut != pZStream->avail_out) + if (nAvailIn != static_cast(pZStream->avail_in) || nAvailOut != static_cast(pZStream->avail_out)) { *pReturnCode = Z_OK; } diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp index fc0ac15244..9e0d788896 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpUvMapImporter.cpp @@ -88,7 +88,7 @@ namespace AZ AZ_Error( Utilities::ErrorWindow, meshesPerTextureCoordinateIndex[texCoordIndex] == 0 || - meshesPerTextureCoordinateIndex[texCoordIndex] == currentNode->mNumMeshes, + meshesPerTextureCoordinateIndex[texCoordIndex] == static_cast(currentNode->mNumMeshes), "Texture coordinate index %d for node %s is not on all meshes on this node. " "Placeholder arbitrary texture values will be generated to allow the data to process, but the source art " "needs to be fixed to correct this. All meshes on this node should have the same number of texture coordinate channels.", diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp index c1d2d7bf19..b9054a9911 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp @@ -90,7 +90,7 @@ namespace ImageProcessingAtom for (i; i < ePixelFormat_Count; i++) { const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo((EPixelFormat)i); - if (info->d3d10Format == dxgiFormat) + if (static_cast(info->d3d10Format) == dxgiFormat) { eFormat = (EPixelFormat)i; break; @@ -509,7 +509,7 @@ namespace ImageProcessingAtom for (i; i < ePixelFormat_Count; i++) { const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo((EPixelFormat)i); - if (info->d3d10Format == dxgiFormat) + if (static_cast(info->d3d10Format) == dxgiFormat) { format = (EPixelFormat)i; break; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp index da680d80cf..fe5db0b441 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp @@ -353,7 +353,7 @@ namespace AZ } // If the number of source LUTs have changed, the shader variant will need to be updated - if (m_numSourceLuts != current) + if (m_numSourceLuts != static_cast(current)) { m_numSourceLuts = current; m_needToUpdateShaderVariant = true; diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp index ffe5ec408a..1bd6067116 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp @@ -132,7 +132,7 @@ namespace MaterialEditor QSize newDeviceSize = m_materialViewport->size(); AZ_Warning( - "Material Editor", newDeviceSize.width() == width && newDeviceSize.height() == height, + "Material Editor", static_cast(newDeviceSize.width()) == width && static_cast(newDeviceSize.height()) == height, "Resizing the window did not give the expected frame size. Requested %d x %d but got %d x %d.", width, height, newDeviceSize.width(), newDeviceSize.height()); } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index a29815f08c..b10edfae2e 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -1480,7 +1480,7 @@ bool AZ::FFont::UpdateTexture() return false; } - if (m_fontTexture->GetWidth() != m_fontImage->GetDescriptor().m_size.m_width || m_fontTexture->GetHeight() != m_fontImage->GetDescriptor().m_size.m_height) + if (m_fontTexture->GetWidth() != static_cast(m_fontImage->GetDescriptor().m_size.m_width) || m_fontTexture->GetHeight() != static_cast(m_fontImage->GetDescriptor().m_size.m_height)) { AZ_Assert(false, "AtomFont::FFont:::UpdateTexture size mismatch between texture and image!"); return false; diff --git a/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp b/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp index b65e690f1b..cdd7d937e3 100644 --- a/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp +++ b/Gems/AudioSystem/Code/Source/Editor/QConnectionsWidget.cpp @@ -138,7 +138,7 @@ namespace AudioControls for (int i = 0; i < size; ++i) { QListWidgetItem* listItem = m_connectionList->item(i); - if (listItem && listItem->data(eMDR_ID).toInt() == middlewareControl->GetId()) + if (listItem && listItem->data(eMDR_ID).toInt() == static_cast(middlewareControl->GetId())) { m_connectionList->clearSelection(); listItem->setSelected(true); diff --git a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp index d1b59e7ecc..af21420b62 100644 --- a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp +++ b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp @@ -795,7 +795,7 @@ namespace EditorPythonBindings } } - AZ_Warning("python", PyDict_Size(pyObj.ptr()) == mapDataContainer->Size(mapInstance.m_address), "Python Dict size:%d does not match the size of the unordered_map:%d", pos, mapDataContainer->Size(mapInstance.m_address)); + AZ_Warning("python", static_cast(PyDict_Size(pyObj.ptr())) == mapDataContainer->Size(mapInstance.m_address), "Python Dict size:%d does not match the size of the unordered_map:%d", pos, mapDataContainer->Size(mapInstance.m_address)); outValue.m_value = mapInstance.m_address; outValue.m_typeId = mapInstance.m_typeId; outValue.m_traits = traits; diff --git a/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp b/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp index ea9a1d380f..4c22afac76 100644 --- a/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp +++ b/Gems/GradientSignal/Code/Tests/GradientSignalImageTests.cpp @@ -145,7 +145,7 @@ namespace UnitTest { for (AZ::u32 x = 0; x < width; ++x) { - if ((x == pixelX) && (y == pixelY)) + if ((x == static_cast(pixelX)) && (y == static_cast(pixelY))) { m_imageData->m_imageData.push_back(pixelValue); } diff --git a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp index f53da64110..04f655123c 100644 --- a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp +++ b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp @@ -310,7 +310,7 @@ void SpriteBorderEditor::AddConfigureSection(QGridLayout* gridLayout, int& rowNu int newNumCols = numColsLineEdit->text().toInt(&colConversionSuccess); const bool positiveInputs = newNumRows > 0 && newNumCols > 0; - const bool valueChanged = m_numRows != newNumRows || m_numCols != newNumCols; + const bool valueChanged = m_numRows != static_cast(newNumRows) || m_numCols != static_cast(newNumCols); // This number of cells is just nearly unusable in the sprite editor UI. Supporting // more would likely require reworking of UX/UI and even implementation. diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index a996a489cc..ef9c3d4bb7 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -2068,7 +2068,7 @@ int UiTextComponent::GetFontEffect() //////////////////////////////////////////////////////////////////////////////////////////////////// void UiTextComponent::SetFontEffect(int effectIndex) { - if (m_fontEffectIndex != effectIndex) + if (m_fontEffectIndex != static_cast(effectIndex)) { m_fontEffectIndex = effectIndex; diff --git a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp index 0d9fc09063..df2d85eb74 100644 --- a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp @@ -63,7 +63,7 @@ namespace //! \brief Given a UTF8 string and index, return the raw string buffer index that maps to the UTF8 index. int GetCharArrayIndexFromUtf8CharIndex(const AZStd::string& utf8String, const uint utf8Index) { - int utfIndexIter = 0; + uint utfIndexIter = 0; int rawIndex = 0; const AZStd::string::size_type stringLength = utf8String.length(); diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp index 5a7564d72a..3d291e2e85 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp @@ -525,7 +525,7 @@ namespace NvCloth const int numVertices = subMeshInfo.m_numVertices; const int firstVertex = subMeshInfo.m_verticesFirstIndex; - if (subMesh.GetVertexCount() != numVertices) + if (subMesh.GetVertexCount() != static_cast(numVertices)) { AZ_Error("ClothComponentMesh", false, "Render mesh to be modified doesn't have the same number of vertices (%d) as the cloth's submesh (%d).", diff --git a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h index 91528c08c0..a0d453c593 100644 --- a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h +++ b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.h @@ -150,7 +150,7 @@ namespace ScriptedEntityTweener bool IsTimelineIdValid(int timelineId) { - return timelineId != AnimationProperties::InvalidTimelineId; + return timelineId != static_cast(AnimationProperties::InvalidTimelineId); } bool InitializeSubtask(ScriptedEntityTweenerSubtask& subtask, const AZStd::pair initData, AnimationParameters params); diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 161783caa1..12bd2fb8f2 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -39,7 +39,6 @@ ly_append_configurations_options( # Disabling these warnings while they get fixed /wd4245 # conversion, signed/unsigned mismatch - /wd4389 # comparison, signed/unsigned mismatch # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 From f99a21e733f0e00edc470cc76d878ee3eb232f67 Mon Sep 17 00:00:00 2001 From: pappeste Date: Fri, 25 Jun 2021 18:40:01 -0700 Subject: [PATCH 037/100] last one! Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 12bd2fb8f2..4e2ec5a852 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -37,9 +37,6 @@ ly_append_configurations_options( # Disabling some warnings /wd4201 # nonstandard extension used: nameless struct/union. This actually became part of the C++11 std, MS has an open issue: https://developercommunity.visualstudio.com/t/warning-level-4-generates-a-bogus-warning-c4201-no/103064 - # Disabling these warnings while they get fixed - /wd4245 # conversion, signed/unsigned mismatch - # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 # /we4296 # 'operator': expression is always false From 75dc3e5836eecd8f183e396a07c6a8020eb0cbe5 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 14:09:39 -0700 Subject: [PATCH 038/100] =?UTF-8?q?=EF=BB=BFCryEngine?= 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/Legacy/CryCommon/CryHeaders.h | 2 +- Code/Legacy/CryCommon/ISerialize.h | 2 +- Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Legacy/CryCommon/CryHeaders.h b/Code/Legacy/CryCommon/CryHeaders.h index 4d037b52d9..49ea28ee0e 100644 --- a/Code/Legacy/CryCommon/CryHeaders.h +++ b/Code/Legacy/CryCommon/CryHeaders.h @@ -395,7 +395,7 @@ struct MotionParams905 MotionParams905() { m_nAssetFlags = 0; - m_nCompression = -1; + m_nCompression = std::numeric_limits::max(); m_nTicksPerFrame = 0; m_fSecsPerTick = 0; m_nStart = 0; diff --git a/Code/Legacy/CryCommon/ISerialize.h b/Code/Legacy/CryCommon/ISerialize.h index d427e222bb..b153a52487 100644 --- a/Code/Legacy/CryCommon/ISerialize.h +++ b/Code/Legacy/CryCommon/ISerialize.h @@ -31,7 +31,7 @@ class InterpolatedValue_tpl; // Unfortunately this needs to be here - should be in CryNetwork somewhere. struct SNetObjectID { - static const uint16 InvalidId = ~uint16(0); + static const uint16 InvalidId = std::numeric_limits::max(); SNetObjectID() : id(InvalidId) diff --git a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp index c5df4f6570..e478ba4d36 100644 --- a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp +++ b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp @@ -339,7 +339,7 @@ void CViewSystem::SetActiveView(IView* pView) } else { - m_activeViewId = ~0; + m_activeViewId = ~0u; } m_bActiveViewFromSequence = false; From 3172a82937e8414c428bccbd7d9b52eff78d23a2 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 14:10:01 -0700 Subject: [PATCH 039/100] Code/Framework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzFramework/AzFramework/Archive/ZipDirStructures.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index 4111328224..1748d1578b 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -338,14 +338,13 @@ namespace AZ::IO::ZipDir else { AZ::IO::HandleType realFileHandle = m_fileHandle; - size_t nFileSize = ~0; AZ::u64 fileSize = 0; if (!m_fileIOBase->Size(realFileHandle, fileSize)) { goto error; } - nFileSize = static_cast(fileSize); + const size_t nFileSize = static_cast(fileSize); m_pInMemoryData = ZipDirStructuresInternal::CreateMemoryBlock(nFileSize, szUsage); From dcab2751ded72dbdb066e51eabc8fb7d931a704b Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 14:40:29 -0700 Subject: [PATCH 040/100] =?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; From d5ed0cc3858645dd0f1e11198843999fd02039e4 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 14:40:46 -0700 Subject: [PATCH 041/100] AtomLyIntegration Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Include/AtomLyIntegration/AtomFont/FontTexture.h | 2 +- .../Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h | 2 +- .../Code/Source/Material/EditorMaterialComponentSlot.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h index b9bdce6810..f20b0463d9 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FontTexture.h @@ -39,7 +39,7 @@ namespace AZ void Reset() { m_slotUsage = 0; - m_currentCharacter = ~0; + m_currentCharacter = std::numeric_limits::max(); m_horizontalAdvance = 0; m_characterWidth = 0; m_characterHeight = 0; diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h index 8c6cf721b3..271b6810d3 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/GlyphCache.h @@ -46,7 +46,7 @@ namespace AZ void Reset() { m_usage = 0; - m_currentCharacter = ~0; + m_currentCharacter = std::numeric_limits::max(); m_characterWidth = 0; m_characterHeight = 0; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h index 79fddf2611..58d6fa9ab0 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentSlot.h @@ -19,7 +19,7 @@ namespace AZ { namespace Render { - static const size_t DefaultMaterialSlotIndex = -1; + static const size_t DefaultMaterialSlotIndex = std::numeric_limits::max(); //! Details for a single editable material assignment struct EditorMaterialComponentSlot final From 80199b2ae1fc585429e94976dfef0680ebadfc60 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:04:43 -0700 Subject: [PATCH 042/100] Audio Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp b/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp index 70d9dec330..ba1603d2e2 100644 --- a/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp +++ b/Gems/AudioSystem/Code/Tests/AudioSystemTest.cpp @@ -589,7 +589,7 @@ TEST(AudioFlagsTest, AudioFlags_OneFlag_OneFlagIsSet) { const AZ::u8 flagBit = 1 << 4; Audio::Flags testFlags(flagBit); - EXPECT_FALSE(testFlags.AreAnyFlagsActive(~flagBit)); + EXPECT_FALSE(testFlags.AreAnyFlagsActive(static_cast(~flagBit))); EXPECT_TRUE(testFlags.AreAnyFlagsActive(flagBit)); EXPECT_TRUE(testFlags.AreAnyFlagsActive(flagBit | 1)); EXPECT_TRUE(testFlags.AreAllFlagsActive(flagBit)); @@ -603,7 +603,7 @@ TEST(AudioFlagsTest, AudioFlags_MultipleFlags_MultipleFlagsAreSet) { const AZ::u8 flagBits = (1 << 5) | (1 << 2) | (1 << 3); Audio::Flags testFlags(flagBits); - EXPECT_FALSE(testFlags.AreAnyFlagsActive(~flagBits)); + EXPECT_FALSE(testFlags.AreAnyFlagsActive(static_cast(~flagBits))); EXPECT_TRUE(testFlags.AreAnyFlagsActive(flagBits)); EXPECT_TRUE(testFlags.AreAllFlagsActive(flagBits)); EXPECT_FALSE(testFlags.AreAllFlagsActive(flagBits | 1)); From 83e1615686b25ff050391489e625451b1a4003e5 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:05:10 -0700 Subject: [PATCH 043/100] AWSGameLift Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp | 2 +- .../Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp index b1601e248a..70dcdba1af 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionActivityTest.cpp @@ -44,7 +44,7 @@ TEST_F(AWSGameLiftCreateSessionActivityTest, ValidateCreateSessionRequest_CallWi TEST_F(AWSGameLiftCreateSessionActivityTest, ValidateCreateSessionRequest_CallWithNegativeMaxPlayer_GetFalseResult) { AWSGameLiftCreateSessionRequest request; - request.m_maxPlayer = -1; + request.m_maxPlayer = std::numeric_limits::max(); auto result = CreateSessionActivity::ValidateCreateSessionRequest(request); EXPECT_FALSE(result); diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp index 529179b1fb..8a785d8007 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Tests/Activity/AWSGameLiftCreateSessionOnQueueActivityTest.cpp @@ -40,7 +40,7 @@ TEST_F(AWSGameLiftCreateSessionOnQueueActivityTest, ValidateCreateSessionOnQueue TEST_F(AWSGameLiftCreateSessionOnQueueActivityTest, ValidateCreateSessionOnQueueRequest_CallWithNegativeMaxPlayer_GetFalseResult) { AWSGameLiftCreateSessionOnQueueRequest request; - request.m_maxPlayer = -1; + request.m_maxPlayer = std::numeric_limits::max(); auto result = CreateSessionOnQueueActivity::ValidateCreateSessionOnQueueRequest(request); EXPECT_FALSE(result); From 9b7dea6703ee0bbf71649b769147b215715bf5e0 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:05:25 -0700 Subject: [PATCH 044/100] EMotionFX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h | 2 +- .../Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h | 2 +- .../Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h b/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h index c6b18745e6..658f15786f 100644 --- a/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h +++ b/Gems/EMotionFX/Code/Include/Integration/ActorComponentBus.h @@ -95,7 +95,7 @@ namespace EMotionFX /// Returns skinning method used by the actor. virtual SkinningMethod GetSkinningMethod() const = 0; - static const size_t s_invalidJointIndex = ~0; + static const size_t s_invalidJointIndex = std::numeric_limits::max(); }; using ActorComponentRequestBus = AZ::EBus; diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h b/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h index ac35a6dfcd..6a920fa10d 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.h @@ -28,7 +28,7 @@ namespace EMotionFX Q_OBJECT //AUTOMOC public: - enum + enum : uint32 { CLASS_ID = 0x8efd2bee }; diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h index f5ef1ffed5..6ea49bf9ef 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/MotionSetMotionIdHandler.h @@ -59,7 +59,7 @@ namespace EMotionFX static void ResetDisplayedRoundingError(); private: - size_t m_id = -1; + size_t m_id = std::numeric_limits::max(); bool m_displayMotionSelectionWeight = false; const IRandomMotionSelectionDataContainer* m_dataContainer = nullptr; static float s_displayedRoundingError; From 4598ec4a500ff718a106f1467c914dacd6ce1ebe Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:05:42 -0700 Subject: [PATCH 045/100] GraphModel Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/GraphModel/Code/Include/GraphModel/Model/Common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h b/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h index 17ce8e8471..ec5901a4b5 100644 --- a/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h +++ b/Gems/GraphModel/Code/Include/GraphModel/Model/Common.h @@ -66,6 +66,6 @@ namespace GraphModel using ModuleGraphManagerPtr = AZStd::shared_ptr; using ConstModuleGraphManagerPtr = AZStd::shared_ptr; - static const AZ::u32 DefaultWrappedNodeLayoutOrder = -1; + static const AZ::u32 DefaultWrappedNodeLayoutOrder = std::numeric_limits::max(); } // namespace GraphModel From 8fd75a340fdd819fc74e13999b07979f6b0d03b3 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:06:10 -0700 Subject: [PATCH 046/100] GraphCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h index a30915917f..0d45cbe536 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Components/Nodes/Wrapper/WrapperNodeBus.h @@ -34,14 +34,14 @@ namespace GraphCanvas AZ_CLASS_ALLOCATOR(WrappedNodeConfiguration, AZ::SystemAllocator, 0); WrappedNodeConfiguration() - : m_layoutOrder(-1) - , m_elementOrdering(-1) + : m_layoutOrder(std::numeric_limits::max()) + , m_elementOrdering(std::numeric_limits::max()) { } WrappedNodeConfiguration(AZ::u32 layoutOrder) : m_layoutOrder(layoutOrder) - , m_elementOrdering(-1) + , m_elementOrdering(std::numeric_limits::max()) { } From 859c5f8004394d6051e118b6453fdf0ac7742e76 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:06:27 -0700 Subject: [PATCH 047/100] LyShine Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp | 8 ++++---- Gems/LyShine/Code/Source/Animation/AnimTrack.h | 6 +++--- Gems/LyShine/Code/Source/UiTextComponent.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp index cd7cb56421..8bfb3f955d 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp @@ -325,7 +325,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) { continue; } - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); childNode->getAttr("color", color); m_colorButtons[entryIndex]->SetColor(color); } @@ -333,7 +333,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) XmlNodeRef othersNode = customTrackColorsNode->findChild("others"); if (othersNode) { - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); othersNode->getAttr("color", color); m_colorButtons[kOthersEntryIndex]->SetColor(color); } @@ -341,7 +341,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) XmlNodeRef disabledNode = customTrackColorsNode->findChild("disabled"); if (disabledNode) { - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); disabledNode->getAttr("color", color); m_colorButtons[kDisabledEntryIndex]->SetColor(color); } @@ -349,7 +349,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) XmlNodeRef mutedNode = customTrackColorsNode->findChild("muted"); if (mutedNode) { - COLORREF color = -1; + COLORREF color = std::numeric_limits::max(); mutedNode->getAttr("color", color); m_colorButtons[kMutedEntryIndex]->SetColor(color); } diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index f73cd7ede7..97a251ebfa 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -521,7 +521,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) if (nkeys == 0) { m_lastTime = time; - m_currKey = -1; + m_currKey = std::numeric_limits::max(); return m_currKey; } @@ -554,7 +554,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) } else { - m_currKey = -1; + m_currKey = std::numeric_limits::max(); } return m_currKey; } @@ -600,6 +600,6 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) break; } } - m_currKey = -1; + m_currKey = std::numeric_limits::max(); return m_currKey; } diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index ef9c3d4bb7..f9544a9954 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -4149,7 +4149,7 @@ void UiTextComponent::RenderDrawBatchLines( imageQuad[i] = transformToViewport * imageQuad[i]; } - static const uint32 packedColor = (255 << 24) | (255 << 16) | (255 << 8) | 255; + static const uint32 packedColor = (255u << 24) | (255u << 16) | (255u << 8) | 255u; RenderCacheImageBatch* cacheImageBatch = new RenderCacheImageBatch; From 977107e59646d4d0c0574a1185ef392176f1a8c8 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:07:11 -0700 Subject: [PATCH 048/100] Maestro Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp | 2 +- Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp index e7736cd30b..2e6491db5b 100644 --- a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp +++ b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.cpp @@ -29,7 +29,7 @@ namespace Maestro { /*static*/ AZ::ScriptTimePoint EditorSequenceComponent::s_lastPropertyRefreshTime; /*static*/ const double EditorSequenceComponent::s_refreshPeriodMilliseconds = 200.0; // 5 Hz refresh rate - /*static*/ const int EditorSequenceComponent::s_invalidSequenceId = -1; + /*static*/ const uint32 EditorSequenceComponent::s_invalidSequenceId = std::numeric_limits::max(); namespace ClassConverters { diff --git a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h index 597cd30912..83caaeea19 100644 --- a/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h +++ b/Gems/Maestro/Code/Source/Components/EditorSequenceComponent.h @@ -110,6 +110,6 @@ namespace Maestro static AZ::ScriptTimePoint s_lastPropertyRefreshTime; static const double s_refreshPeriodMilliseconds; // property refresh period for SetAnimatedPropertyValue events - static const int s_invalidSequenceId; + static const uint32 s_invalidSequenceId; }; } // namespace Maestro From 2a20231e101800d5b963e309256d032a2b87776a Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:07:26 -0700 Subject: [PATCH 049/100] MessagePopup Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h b/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h index e6f31ec08d..7dfa2ba5a8 100644 --- a/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h +++ b/Gems/MessagePopup/Code/Include/MessagePopup/MessagePopupBus.h @@ -25,7 +25,7 @@ namespace MessagePopup EPopupKind_Toaster }; - static const AZ::u32 InvalidId = -1; + static const AZ::u32 InvalidId = std::numeric_limits::max(); ////////////////////////////////////////////////////////////////////////// struct MessagePopupInfo From e24bb8fa5b125a708a3929fd33e53cc7d1c30b4a Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:07:42 -0700 Subject: [PATCH 050/100] MultiplayerCompression Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Tests/MultiplayerCompressionTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp index 91839b1e23..bc154d24b2 100644 --- a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp +++ b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp @@ -42,9 +42,9 @@ TEST_F(MultiplayerCompressionTest, MultiplayerCompression_CompressTest) memset(buffer.GetBuffer(), 255, buffer.GetCapacity()); size_t maxCompressedSize = buffer.GetSize() + 32U; - size_t compressedSize = -1; - size_t uncompressedSize = -1; - size_t consumedSize = -1; + size_t compressedSize = std::numeric_limits::max(); + size_t uncompressedSize = std::numeric_limits::max(); + size_t consumedSize = std::numeric_limits::max(); char* pCompressedBuffer = new char[maxCompressedSize]; char* pDecompressedBuffer = new char[buffer.GetSize()]; From 82b359e80d0fdcc9544add3bf6cd889cb8c2873f Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:07:56 -0700 Subject: [PATCH 051/100] PhysX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysX/Code/Source/Material.h | 2 +- .../Code/Source/SystemComponent.cpp | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Gems/PhysX/Code/Source/Material.h b/Gems/PhysX/Code/Source/Material.h index 8613be7461..b30b7402c8 100644 --- a/Gems/PhysX/Code/Source/Material.h +++ b/Gems/PhysX/Code/Source/Material.h @@ -89,7 +89,7 @@ namespace PhysX PxMaterialUniquePtr m_pxMaterial; AZ::Crc32 m_surfaceType = 0; - AZ::u32 m_cryEngineSurfaceId = -1; + AZ::u32 m_cryEngineSurfaceId = std::numeric_limits::max(); AZStd::string m_surfaceString; float m_density = 1000.0f; AZ::Color m_debugColor = AZ::Colors::White; diff --git a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp index 831a7fdf1d..e9948d2eb0 100644 --- a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp +++ b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp @@ -879,18 +879,18 @@ namespace PhysXDebug void SystemComponent::InitPhysXColorMappings() { AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); - m_colorMappings.m_defaultColor.FromU32(physx::PxDebugColor::eARGB_GREEN); - m_colorMappings.m_black.FromU32(physx::PxDebugColor::eARGB_BLACK); - m_colorMappings.m_red.FromU32(physx::PxDebugColor::eARGB_RED); - m_colorMappings.m_green.FromU32(physx::PxDebugColor::eARGB_GREEN); - m_colorMappings.m_blue.FromU32(physx::PxDebugColor::eARGB_BLUE); - m_colorMappings.m_yellow.FromU32(physx::PxDebugColor::eARGB_YELLOW); - m_colorMappings.m_magenta.FromU32(physx::PxDebugColor::eARGB_MAGENTA); - m_colorMappings.m_cyan.FromU32(physx::PxDebugColor::eARGB_CYAN); - m_colorMappings.m_white.FromU32(physx::PxDebugColor::eARGB_WHITE); - m_colorMappings.m_grey.FromU32(physx::PxDebugColor::eARGB_GREY); - m_colorMappings.m_darkRed.FromU32(physx::PxDebugColor::eARGB_DARKRED); - m_colorMappings.m_darkGreen.FromU32(physx::PxDebugColor::eARGB_DARKGREEN); - m_colorMappings.m_darkBlue.FromU32(physx::PxDebugColor::eARGB_DARKBLUE); + m_colorMappings.m_defaultColor.FromU32(static_cast(physx::PxDebugColor::eARGB_GREEN)); + m_colorMappings.m_black.FromU32(static_cast(physx::PxDebugColor::eARGB_BLACK)); + m_colorMappings.m_red.FromU32(static_cast(physx::PxDebugColor::eARGB_RED)); + m_colorMappings.m_green.FromU32(static_cast(physx::PxDebugColor::eARGB_GREEN)); + m_colorMappings.m_blue.FromU32(static_cast(physx::PxDebugColor::eARGB_BLUE)); + m_colorMappings.m_yellow.FromU32(static_cast(physx::PxDebugColor::eARGB_YELLOW)); + m_colorMappings.m_magenta.FromU32(static_cast(physx::PxDebugColor::eARGB_MAGENTA)); + m_colorMappings.m_cyan.FromU32(static_cast(physx::PxDebugColor::eARGB_CYAN)); + m_colorMappings.m_white.FromU32(static_cast(physx::PxDebugColor::eARGB_WHITE)); + m_colorMappings.m_grey.FromU32(static_cast(physx::PxDebugColor::eARGB_GREY)); + m_colorMappings.m_darkRed.FromU32(static_cast(physx::PxDebugColor::eARGB_DARKRED)); + m_colorMappings.m_darkGreen.FromU32(static_cast(physx::PxDebugColor::eARGB_DARKGREEN)); + m_colorMappings.m_darkBlue.FromU32(static_cast(physx::PxDebugColor::eARGB_DARKBLUE)); } } From 67a5bc98ceaa49925843f9a627e791d50025cef3 Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:08:14 -0700 Subject: [PATCH 052/100] ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp index 6e87e52f87..ff1fadb8c2 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp @@ -1981,7 +1981,7 @@ namespace ScriptCanvas if (slotIter == m_slots.end()) { - retVal = -1; + retVal = std::numeric_limits::max(); } return retVal; From 9c5b2768e2fd57c1a8741874c87e44e6a8ed2ada Mon Sep 17 00:00:00 2001 From: pappeste Date: Mon, 28 Jun 2021 15:13:11 -0700 Subject: [PATCH 053/100] =?UTF-8?q?=EF=BB=BFEditor?= 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/Editor/CryEdit.cpp | 2 +- Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 8444f81317..80b5b091c6 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -3380,7 +3380,7 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* lpszFileName) void CCryEditApp::OnResourcesReduceworkingset() { #ifdef WIN32 // no such thing on macOS - SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); + SetProcessWorkingSetSize(GetCurrentProcess(), std::numeric_limits::max(), std::numeric_limits::max()); #endif } diff --git a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h index 23401453d6..d3017d8e83 100644 --- a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h +++ b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.h @@ -56,7 +56,7 @@ private: inline void GetQColorFromXmlNode(QColor& colorOut, const XmlNodeRef& xmlNode) const { - QRgb rgb = -1; + QRgb rgb = std::numeric_limits::max(); xmlNode->getAttr("color", rgb); colorOut.setRgb(rgb); }; From e7f07147cb432473ca71a0fc3790ff21235d8f05 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 16:04:31 -0700 Subject: [PATCH 054/100] More fixes for Code/Framework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzCore/AzCore/Task/TaskExecutor.cpp | 4 +-- .../AzFramework/Script/ScriptComponent.cpp | 25 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp b/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp index 5edb09edf0..2bb88fbfa2 100644 --- a/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp +++ b/Code/Framework/AzCore/AzCore/Task/TaskExecutor.cpp @@ -78,7 +78,7 @@ namespace AZ return remaining; } - if (m_waitEvent && remaining == (m_parent ? 1 : 0)) + if (m_waitEvent && remaining == (m_parent ? 1u : 0u)) { m_waitEvent->Signal(); } @@ -259,7 +259,7 @@ namespace AZ } bool isRetained = task->m_graph->m_parent != nullptr; - if (task->m_graph->Release() == (isRetained ? 1 : 0)) + if (task->m_graph->Release() == (isRetained ? 1u : 0u)) { m_executor->ReleaseGraph(); } diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index fb8ca8b892..6db205795e 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -361,18 +361,19 @@ namespace AzFramework // DebugPrintStack // Prints the Lua stack starting from the bottom. //========================================================================= - static void DebugPrintStack(lua_State* lua, const AZStd::string& prefix = "") - { - AZStd::string dump = prefix; - const int stackSize = lua_gettop(lua); - for (int stackIdx = 1; stackIdx <= stackSize; ++stackIdx) - { - dump += PrintLuaValue(lua, stackIdx); - dump += " "; // add separator - } - - AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str()); - } + // DO NOT DELETE StackDump is useful to debug the lua stack. + //static void DebugPrintStack(lua_State* lua, const AZStd::string& prefix = "") + //{ + // AZStd::string dump = prefix; + // const int stackSize = lua_gettop(lua); + // for (int stackIdx = 1; stackIdx <= stackSize; ++stackIdx) + // { + // dump += PrintLuaValue(lua, stackIdx); + // dump += " "; // add separator + // } + // + // AZ_Warning("ScriptComponent", false, "Stack Dump: '%s'", dump.c_str()); + //} //========================================================================= // Properties__IndexFindSubtable From 1d4c53a77713193ee01a71f274f36befb0e317d3 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 16:04:46 -0700 Subject: [PATCH 055/100] More fixes for Gems Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Include/Public/Framework/AWSApiClientJobConfig.h | 3 +++ .../Include/Public/Framework/HttpRequestJobConfig.h | 3 +++ .../Public/Framework/ServiceClientJobConfig.h | 6 ++++-- .../Code/Include/Public/Framework/ServiceJobConfig.h | 10 ++++------ .../Public/Framework/ServiceRequestJobConfig.h | 3 ++- .../Editor/Attribution/AWSCoreAttributionMetric.cpp | 8 +++++++- Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp | 8 +++++++- .../Source/RPI.Reflect/Model/ModelMaterialSlot.cpp | 2 +- .../Window/AtomToolsMainWindowRequestBus.h | 4 ++-- Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h | 2 +- .../Code/MCore/Source/MCoreCommandManager.cpp | 2 +- .../Code/Editor/Animation/UiAnimViewCurveEditor.cpp | 2 +- .../Code/Editor/Animation/UiAnimViewDialog.cpp | 2 +- .../Editor/Animation/UiAnimViewDopeSheetBase.cpp | 12 ++++++------ .../Code/Editor/Animation/UiAnimViewSplineCtrl.cpp | 10 +++++----- 15 files changed, 48 insertions(+), 29 deletions(-) diff --git a/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h index 800edffd41..e991b2af7e 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/AWSApiClientJobConfig.h @@ -48,6 +48,7 @@ namespace AWSCore // warning C4250: 'AWSCore::AwsApiClientJobConfig': inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") /// Configuration for AWS jobs using a specific client type. template class AwsApiClientJobConfig @@ -120,4 +121,6 @@ namespace AWSCore /// Set by ApplySettings std::shared_ptr m_client; }; + AZ_POP_DISABLE_WARNING + } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h index f5a089b5ca..5b348d8630 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/HttpRequestJobConfig.h @@ -30,6 +30,7 @@ namespace AWSCore // warning C4250: 'AWSCore::HttpRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") //! Provides service job configuration using settings properties. class HttpRequestJobConfig : public AwsApiJobConfig @@ -92,4 +93,6 @@ namespace AWSCore std::shared_ptr m_httpClient{ nullptr }; Aws::String m_userAgent{}; }; + AZ_POP_DISABLE_WARNING + } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h index c78fc41617..9082498e96 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceClientJobConfig.h @@ -63,8 +63,8 @@ namespace AWSCore // warning C4250: 'AWSCore::ServiceClientJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - -/// Provides service job configuration using settings properties. + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") + /// Provides service job configuration using settings properties. template class ServiceClientJobConfig : public ServiceJobConfig @@ -127,6 +127,8 @@ namespace AWSCore } }; + AZ_POP_DISABLE_WARNING + } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h index 8632db7d9f..f1a01cfb7b 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceJobConfig.h @@ -12,7 +12,6 @@ namespace AWSCore { - /// Provides configuration needed by service jobs. class IServiceJobConfig : public virtual IHttpRequestJobConfig @@ -22,12 +21,12 @@ namespace AWSCore // warning C4250: 'AWSCore::ServiceJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. -/// Provides service job configuration using settings properties. + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") + /// Provides service job configuration using settings properties. class ServiceJobConfig : public HttpRequestJobConfig , public virtual IServiceJobConfig { - public: AZ_CLASS_ALLOCATOR(ServiceJobConfig, AZ::SystemAllocator, 0); @@ -53,8 +52,7 @@ namespace AWSCore } void ApplySettings() override; - - private: - }; + AZ_POP_DISABLE_WARNING + } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h index 660b4f2537..240331496e 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/ServiceRequestJobConfig.h @@ -28,7 +28,7 @@ namespace AWSCore // warning C4250: 'AWSCore::ServiceRequestJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation // This is the expected and desired behavior. The warning is superfluous. - + AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option") template class ServiceRequestJobConfig : public ServiceClientJobConfig @@ -100,5 +100,6 @@ namespace AWSCore std::shared_ptr m_credentialsProvider; }; + AZ_POP_DISABLE_WARNING } // namespace AWSCore diff --git a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp index c4f51fcb6f..aee766d355 100644 --- a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp +++ b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionMetric.cpp @@ -95,7 +95,13 @@ namespace AWSCore time_t now; time(&now); char buffer[50]; - strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&now)); + tm time; +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + gmtime_s(&time, &now); +#else + time = *gmtime(&now); +#endif + strftime(buffer, sizeof(buffer), "%FT%TZ", &time); return buffer; } diff --git a/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp b/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp index 043af2ef09..743a8c5849 100644 --- a/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp +++ b/Gems/AWSMetrics/Code/Source/MetricsEventBuilder.cpp @@ -55,7 +55,13 @@ namespace AWSMetrics time_t now; time(&now); char buffer[50]; - strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&now)); + tm time; +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + gmtime_s(&time, &now); +#else + time = *gmtime(&now); +#endif + strftime(buffer, sizeof(buffer), "%FT%TZ", &time); m_currentMetricsEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventTimestamp, AZStd::string(buffer))); } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp index 0900949625..b9d9200aaf 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelMaterialSlot.cpp @@ -15,7 +15,7 @@ namespace AZ { // Normally this would be defined in the header file and substituted by the compiler, but for // some reason clang doesn't accept it. - const ModelMaterialSlot::StableId ModelMaterialSlot::InvalidStableId = -1; + const ModelMaterialSlot::StableId ModelMaterialSlot::InvalidStableId = std::numeric_limits::max(); void ModelMaterialSlot::Reflect(AZ::ReflectContext* context) { diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h index 647082f553..cb63ff295c 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Window/AtomToolsMainWindowRequestBus.h @@ -50,10 +50,10 @@ namespace AtomToolsFramework //! Resizes the main window to achieve a requested size for the viewport render target. //! (This indicates the size of the render target, not the desktop-scaled QT widget size). - virtual void ResizeViewportRenderTarget(uint32_t width, uint32_t height) {}; + virtual void ResizeViewportRenderTarget([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height) {}; //! Forces the viewport's render target to use the given resolution, ignoring the size of the viewport widget. - virtual void LockViewportRenderTargetSize(uint32_t width, uint32_t height) {}; + virtual void LockViewportRenderTargetSize([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height) {}; //! Releases the viewport's render target resolution lock, allowing it to match the viewport widget again. virtual void UnlockViewportRenderTargetSize() {}; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h index c2d776bcdb..ebd65f833a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h @@ -64,7 +64,7 @@ namespace EMotionFX * VertexAttributeLayerAbstractData::GetType() values for the vertex data * Use these with the Mesh::FindVertexData() and Mesh::FindOriginalVertexData() methods. */ - enum + enum : uint32 { ATTRIB_POSITIONS = 0, /**< Vertex positions. Typecast to AZ::Vector3. Positions are always exist. */ ATTRIB_NORMALS = 1, /**< Vertex normals. Typecast to AZ::Vector3. Normals are always exist. */ diff --git a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp index 5cdd9c2600..b59f2b69a0 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp @@ -1123,7 +1123,7 @@ namespace MCore for (size_t i = 0; i < numHistoryEntries; ++i) { AZStd::string text = AZStd::string::format("%.3zu: name='%s', num parameters=%zu", i, m_commandHistory[i].m_executedCommand->GetName(), m_commandHistory[i].m_parameters.GetNumParameters()); - if (i == m_historyIndex) + if (i == static_cast(m_historyIndex)) { LogDetailedInfo("-> %s", text.c_str()); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp index 339cb4b5bc..51209c7f02 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewCurveEditor.cpp @@ -177,7 +177,7 @@ void CUiAnimViewCurveEditor::UpdateSplines() std::set newTracks; if (selectedTracks.AreAllOfSameType()) { - for (int i = 0; i < selectedTracks.GetCount(); i++) + for (unsigned int i = 0; i < selectedTracks.GetCount(); i++) { CUiAnimViewTrack* pTrack = selectedTracks.GetTrack(i); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index ac210ba2f2..97f21e9bab 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -989,7 +989,7 @@ void CUiAnimViewDialog::ReloadSequencesComboBox() CUiAnimViewSequenceManager* pSequenceManager = CUiAnimViewSequenceManager::GetSequenceManager(); const unsigned int numSequences = pSequenceManager->GetCount(); - for (int k = 0; k < numSequences; ++k) + for (unsigned int k = 0; k < numSequences; ++k) { CUiAnimViewSequence* pSequence = pSequenceManager->GetSequenceByIndex(k); QString fullname = pSequence->GetName(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index bd5c82fc9e..12f1eeac4d 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -925,12 +925,12 @@ void CUiAnimViewDopeSheetBase::SelectAllKeysWithinTimeFrame(const QRect& rc, con CUiAnimViewTrackBundle tracks = pSequence->GetAllTracks(); CUiAnimViewSequenceNotificationContext context(pSequence); - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CUiAnimViewTrack* pTrack = tracks.GetTrack(i); // Check which keys we intersect. - for (int j = 0; j < pTrack->GetKeyCount(); j++) + for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++) { CUiAnimViewKeyHandle keyHandle = pTrack->GetKey(j); const float time = keyHandle.GetTime(); @@ -1311,7 +1311,7 @@ bool CUiAnimViewDopeSheetBase::IsOkToAddKeyHere(const CUiAnimViewTrack* pTrack, { const float timeEpsilon = 0.05f; - for (int i = 0; i < pTrack->GetKeyCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = const_cast(pTrack)->GetKey(i); @@ -1425,10 +1425,10 @@ void CUiAnimViewDopeSheetBase::MouseMoveMove(const QPoint& p, [[maybe_unused]] Q const TrackMemento& trackMemento = iter->second; pTrack->RestoreFromMemento(trackMemento.m_memento); - const unsigned int numKeys = trackMemento.m_keySelectionStates.size(); - for (unsigned int i = 0; i < numKeys; ++i) + const size_t numKeys = trackMemento.m_keySelectionStates.size(); + for (size_t i = 0; i < numKeys; ++i) { - pTrack->GetKey(i).Select(trackMemento.m_keySelectionStates[i]); + pTrack->GetKey(static_cast(i)).Select(trackMemento.m_keySelectionStates[i]); } } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp index ba4893abb4..8edd13f8cc 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp @@ -667,7 +667,7 @@ void CUiAnimViewSplineCtrl::mouseMoveEvent(QMouseEvent* event) QString tipText; bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; CUiAnimViewTrack* pTrack = m_tracks[splineIndex]; @@ -757,7 +757,7 @@ void CUiAnimViewSplineCtrl::AdjustTCB(float d_tension, float d_continuity, float SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; CUiAnimViewTrack* pTrack = m_tracks[splineIndex]; @@ -866,16 +866,16 @@ void CUiAnimViewSplineCtrl::OnUserCommand(UINT cmd) bool CUiAnimViewSplineCtrl::IsUnifiedKeyCurrentlySelected() const { - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; - if (pSpline == NULL) + if (!pSpline) { continue; } - for (int i = 0; i < (int)pSpline->GetKeyCount(); i++) + for (int i = 0; i < pSpline->GetKeyCount(); i++) { // If the key is selected in any dimension... for ( From 5f7b534afd3ae3b925981140e3e8125ecb58febf Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 16:05:20 -0700 Subject: [PATCH 056/100] More fixes for Code/Editor Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/BaseLibraryManager.h | 2 +- Code/Editor/Commands/CommandManager.cpp | 4 +- Code/Editor/ConfigGroup.cpp | 2 +- Code/Editor/Controls/ConsoleSCB.cpp | 2 +- Code/Editor/Controls/ImageHistogramCtrl.cpp | 6 +-- .../PropertyAnimationCtrl.cpp | 4 +- .../ReflectedPropertyCtrl.cpp | 2 +- Code/Editor/Controls/SplineCtrlEx.cpp | 38 +++++++++---------- Code/Editor/Controls/SplineCtrlEx.h | 2 +- Code/Editor/Controls/TextEditorCtrl.cpp | 2 +- Code/Editor/CryEdit.cpp | 4 +- Code/Editor/CryEditDoc.cpp | 2 +- Code/Editor/EditorViewportWidget.cpp | 2 +- Code/Editor/ErrorReportTableModel.cpp | 2 +- Code/Editor/Export/ExportManager.cpp | 6 +-- Code/Editor/Export/ExportManager.h | 24 ++++++------ Code/Editor/Export/OBJExporter.cpp | 4 +- Code/Editor/Export/OCMExporter.cpp | 12 +++--- Code/Editor/GameExporter.cpp | 14 +++---- Code/Editor/GameResourcesExporter.cpp | 21 +--------- Code/Editor/Geometry/TriMesh.cpp | 2 +- Code/Editor/LevelFileDialog.cpp | 2 +- Code/Editor/MainWindow.cpp | 2 +- Code/Editor/Objects/BaseObject.cpp | 18 ++++----- Code/Editor/Objects/EntityObject.cpp | 26 ++++++------- Code/Editor/Objects/ObjectLoader.cpp | 8 ++-- Code/Editor/Objects/ObjectManager.cpp | 14 +++---- Code/Editor/Objects/SelectionGroup.cpp | 4 +- .../UI/AssetCatalogModel.cpp | 2 +- .../ComponentPalette/ComponentDataModel.cpp | 2 +- Code/Editor/PreferencesStdPages.cpp | 2 +- Code/Editor/QtViewPaneManager.cpp | 2 +- Code/Editor/Settings.cpp | 2 +- Code/Editor/ToolBox.cpp | 4 +- Code/Editor/ToolbarManager.cpp | 2 +- Code/Editor/ToolsConfigPage.cpp | 2 +- .../Editor/TrackView/CommentKeyUIControls.cpp | 2 +- .../TrackView/ScreenFaderKeyUIControls.cpp | 2 +- .../TrackView/SequenceBatchRenderDialog.cpp | 6 +-- .../TrackView/SequenceKeyUIControls.cpp | 2 +- Code/Editor/TrackView/TVEventsDialog.cpp | 2 +- Code/Editor/TrackView/TrackViewAnimNode.cpp | 2 +- .../Editor/TrackView/TrackViewCurveEditor.cpp | 2 +- Code/Editor/TrackView/TrackViewDialog.cpp | 6 +-- .../TrackView/TrackViewDopeSheetBase.cpp | 8 ++-- Code/Editor/TrackView/TrackViewNode.cpp | 2 +- Code/Editor/TrackView/TrackViewNodes.cpp | 2 +- .../Editor/TrackView/TrackViewPythonFuncs.cpp | 4 +- Code/Editor/TrackView/TrackViewSequence.cpp | 4 +- .../TrackView/TrackViewSequenceManager.cpp | 8 ++-- Code/Editor/TrackView/TrackViewSplineCtrl.cpp | 6 +-- Code/Editor/TrackView/TrackViewUndo.cpp | 2 +- Code/Editor/TrackViewNewSequenceDialog.cpp | 2 +- Code/Editor/Undo/Undo.cpp | 8 ++-- Code/Editor/UndoDropDown.cpp | 6 +-- Code/Editor/Util/FileUtil.cpp | 26 ++++++------- Code/Editor/Util/ImageASC.cpp | 4 +- Code/Editor/Util/ImageGif.cpp | 2 +- Code/Editor/Util/ImageTIF.cpp | 6 +-- Code/Editor/Util/ImageUtil.cpp | 6 +-- Code/Editor/Util/KDTree.cpp | 4 +- Code/Editor/Util/NamedData.cpp | 6 +-- Code/Editor/Util/Variable.cpp | 2 +- Code/Editor/Util/XmlArchive.cpp | 2 +- Code/Editor/WipFeatureManager.cpp | 2 +- Code/Editor/WipFeaturesDlg.cpp | 2 +- 66 files changed, 185 insertions(+), 202 deletions(-) diff --git a/Code/Editor/BaseLibraryManager.h b/Code/Editor/BaseLibraryManager.h index 05f370e632..6f0b905760 100644 --- a/Code/Editor/BaseLibraryManager.h +++ b/Code/Editor/BaseLibraryManager.h @@ -73,7 +73,7 @@ public: virtual IDataBaseLibrary* AddLibrary(const QString& library, bool bIsLevelLibrary = false, bool bIsLoading = true) override; virtual void DeleteLibrary(const QString& library, bool forceDeleteLevel = false) override; //! Get number of libraries. - virtual int GetLibraryCount() const override { return m_libs.size(); }; + virtual int GetLibraryCount() const override { return static_cast(m_libs.size()); }; //! Get number of modified libraries. virtual int GetModifiedLibraryCount() const override; diff --git a/Code/Editor/Commands/CommandManager.cpp b/Code/Editor/Commands/CommandManager.cpp index f28ca96ac8..5f194971f5 100644 --- a/Code/Editor/Commands/CommandManager.cpp +++ b/Code/Editor/Commands/CommandManager.cpp @@ -529,8 +529,8 @@ QString CEditorCommandManager::ExecuteAndLogReturn(CCommand* pCommand, const CCo void CEditorCommandManager::GetArgsFromString(const AZStd::string& argsTxt, CCommand::CArgs& argList) { const char quoteSymbol = '\''; - int curPos = 0; - int prevPos = 0; + size_t curPos = 0; + size_t prevPos = 0; AZStd::vector tokens; AZ::StringFunc::Tokenize(argsTxt, tokens, ' '); for(AZStd::string& arg : tokens) diff --git a/Code/Editor/ConfigGroup.cpp b/Code/Editor/ConfigGroup.cpp index b18edf1142..74fe6f7b5c 100644 --- a/Code/Editor/ConfigGroup.cpp +++ b/Code/Editor/ConfigGroup.cpp @@ -33,7 +33,7 @@ namespace Config uint32 CConfigGroup::GetVarCount() { - return m_vars.size(); + return static_cast(m_vars.size()); } IConfigVar* CConfigGroup::GetVar(const char* szName) diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index 093575d445..acbd75444c 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -220,7 +220,7 @@ void ConsoleLineEdit::keyPressEvent(QKeyEvent* ev) } // If a history command was reused directly via up arrow enter, do not reset history index - if (m_history.size() > 0 && m_historyIndex < m_history.size() && m_history[m_historyIndex] == str) + if (m_history.size() > 0 && m_historyIndex < static_cast(m_history.size()) && m_history[m_historyIndex] == str) { m_bReusedHistory = true; } diff --git a/Code/Editor/Controls/ImageHistogramCtrl.cpp b/Code/Editor/Controls/ImageHistogramCtrl.cpp index 7218c0cd38..22223a3251 100644 --- a/Code/Editor/Controls/ImageHistogramCtrl.cpp +++ b/Code/Editor/Controls/ImageHistogramCtrl.cpp @@ -244,7 +244,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) } } - crtX = rcGraph.left() + x + 1; + crtX = static_cast(rcGraph.left() + x + 1); painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight); } } @@ -260,7 +260,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) { i = ((float)x / graphWidth) * (kNumColorLevels - 1); i = CLAMP(i, 0, kNumColorLevels - 1); - crtX = rcGraph.left() + x + 1; + crtX = static_cast(rcGraph.left() + x + 1); scaleR = scaleG = scaleB = scaleA = 0; if (m_maxCount[0]) @@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) } painter.setPen(pPen); - painter.drawLine(rcGraph.left() + x + 1, graphBottom, rcGraph.left() + x + 1, graphBottom - scale * graphHeight); + painter.drawLine(rcGraph.left() + static_cast(x) + 1, graphBottom, rcGraph.left() + static_cast(x) + 1, graphBottom - scale * graphHeight); } // then draw 3 lines so we separate the channels diff --git a/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp index fde5642b05..4fb18e438c 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp @@ -56,8 +56,8 @@ CReflectedVarAnimation AnimationPropertyCtrl::value() const void AnimationPropertyCtrl::OnApplyClicked() { QStringList cSelectedAnimations; - size_t nTotalAnimations(0); - size_t nCurrentAnimation(0); + int nTotalAnimations(0); + int nCurrentAnimation(0); QString combinedString = GetIEditor()->GetResourceSelectorHost()->GetGlobalSelection("animation"); SplitString(combinedString, cSelectedAnimations, ','); diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp index cf80d56962..3c7bda21d9 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp @@ -203,7 +203,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo outBlockPtr = new CVarBlock; for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i) { - XmlNodeRef groupNode = node->getChild(i); + XmlNodeRef groupNode = node->getChild(static_cast(i)); if (groupNode->haveAttr("hidden")) { diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index 5977aff105..9eb0098762 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -1583,7 +1583,7 @@ bool AbstractSplineWidget::IsKeySelected(ISplineInterpolator* pSpline, int nKey, int AbstractSplineWidget::GetNumSelected() { int nSelected = 0; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { if (ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline) { @@ -1818,7 +1818,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point } // For each Spline... - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline; @@ -1973,7 +1973,7 @@ void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, floa m_nHitKeyIndex = -1; m_nHitDimension = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2077,7 +2077,7 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT float affectedRangeMin = FLT_MAX; float affectedRangeMax = -FLT_MAX; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2184,7 +2184,7 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue) m_nHitKeyIndex = -1; m_nHitDimension = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2223,7 +2223,7 @@ void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys) } // For each spline... - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2298,7 +2298,7 @@ void AbstractSplineWidget::RemoveSelectedKeys() m_pHitDetailSpline = nullptr; m_nHitKeyIndex = -1; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2338,7 +2338,7 @@ void AbstractSplineWidget::RemoveSelectedKeyTimesImpl() StoreUndo(); SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex) + for (size_t splineIndex = 0, end = m_splines.size(); splineIndex < end; ++splineIndex) { std::vector::iterator itTime = m_keyTimes.begin(), endTime = m_keyTimes.end(); for (int keyIndex = 0, endIndex = m_splines[splineIndex].pSpline->GetKeyCount(); keyIndex < endIndex; ) @@ -2376,9 +2376,9 @@ void AbstractSplineWidget::RedrawWindowAroundMarker() { UpdateKeyTimes(); std::vector::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0)); - int keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); + size_t keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); int redrawRangeStart = (keyTimeIndex >= 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time) : m_rcSpline.left()); - int redrawRangeEnd = (keyTimeIndex < int(m_keyTimes.size()) - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1); + int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1); QRect rc(QPoint(redrawRangeStart, m_rcSpline.top()), QPoint(redrawRangeEnd, m_rcSpline.bottom() + 1) - QPoint(1, 1)); rc = rc.normalized().intersected(m_rcSpline); @@ -2478,7 +2478,7 @@ void AbstractSplineWidget::ClearSelection() { ConditionalStoreUndo(); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2521,7 +2521,7 @@ void AbstractSplineWidget::StoreUndo() if (CUndo::IsRecording() && !m_pCurrentUndo) { std::vector splines(m_splines.size()); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { splines[splineIndex] = m_splines[splineIndex].pSpline; } @@ -2564,7 +2564,7 @@ void AbstractSplineWidget::DuplicateSelectedKeys() using KeysToAddContainer = std::vector; KeysToAddContainer keysToInsert; - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2664,7 +2664,7 @@ void AbstractSplineWidget::KeyAll() ////////////////////////////////////////////////////////////////////////// void AbstractSplineWidget::SelectAll() { - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -2815,7 +2815,7 @@ void AbstractSplineWidget::SelectRectangle(const QRect& rc, bool bSelect) { std::swap(t0, t1); } - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; ISplineInterpolator* pDetailSpline = m_splines[splineIndex].pDetailSpline; @@ -3031,7 +3031,7 @@ void AbstractSplineWidget::ModifySelectedKeysFlags(int nRemoveFlags, int nAddFla SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -3188,7 +3188,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey) { bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; for (int i = 0; i < pSpline->GetKeyCount(); i++) @@ -3230,7 +3230,7 @@ void AbstractSplineWidget::GotoNextKey(bool previousKey) } else { - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; @@ -3281,7 +3281,7 @@ void AbstractSplineWidget::RemoveAllKeysButThis() { std::vector keys; - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; diff --git a/Code/Editor/Controls/SplineCtrlEx.h b/Code/Editor/Controls/SplineCtrlEx.h index add4bcb0a9..711cbcf8d4 100644 --- a/Code/Editor/Controls/SplineCtrlEx.h +++ b/Code/Editor/Controls/SplineCtrlEx.h @@ -98,7 +98,7 @@ public: void AddSpline(ISplineInterpolator * pSpline, ISplineInterpolator * pDetailSpline, QColor anColorArray[4]); void RemoveSpline(ISplineInterpolator* pSpline); void RemoveAllSplines(); - int GetSplineCount() const { return m_splines.size(); } + int GetSplineCount() const { return static_cast(m_splines.size()); } ISplineInterpolator* GetSpline(int nIndex) const { return m_splines[nIndex].pSpline; } void SetTimeMarker(float fTime); diff --git a/Code/Editor/Controls/TextEditorCtrl.cpp b/Code/Editor/Controls/TextEditorCtrl.cpp index 5961c9d9a3..c372138d80 100644 --- a/Code/Editor/Controls/TextEditorCtrl.cpp +++ b/Code/Editor/Controls/TextEditorCtrl.cpp @@ -53,7 +53,7 @@ void CTextEditorCtrl::LoadFile(const QString& sFileName) size_t length = file.GetLength(); QByteArray text; - text.resize(length); + text.resize(static_cast(length)); file.ReadRaw(text.data(), length); setPlainText(text); diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 80b5b091c6..cbc4b89d0a 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -613,7 +613,7 @@ public: } // Get boolean options - const int numOptions = options.size(); + const int numOptions = static_cast(options.size()); for (int i = 0; i < numOptions; ++i) { options[i].second = parser.isSet(options[i].first); @@ -3240,7 +3240,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled) { QFileInfo info(fullyQualifiedLevelName); const AZStd::string rawProjectDirectory = Path::GetEditingGameDataFolder(); - const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), rawProjectDirectory.size())); + const QString projectDirectory = QDir::toNativeSeparators(QString::fromUtf8(rawProjectDirectory.data(), static_cast(rawProjectDirectory.size()))); const QString elidedLevelName = QStringLiteral("%1...%2").arg(levelName.left(10)).arg(levelName.right(10)); const QString elidedLevelFileName = QStringLiteral("%1...%2").arg(info.fileName().left(10)).arg(info.fileName().right(10)); const QString message = QObject::tr( diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index c720299ce8..789aa1bdb9 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -1260,7 +1260,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) if (savedEntities) { AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml"); - pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), entitySaveBuffer.size()); + pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), static_cast(entitySaveBuffer.size())); // Save XML archive to pak file. bool bSaved = xmlAr.SaveToPak(Path::GetPath(tempSaveFile), pakFile); diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c7b1976432..50e6e5d67d 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1477,7 +1477,7 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu) Camera::CameraBus::BroadcastResult(getCameraResults, &Camera::CameraRequests::GetCameras); QVector additionalCameras; - additionalCameras.reserve(getCameraResults.values.size()); + additionalCameras.reserve(static_cast(getCameraResults.values.size())); for (const AZ::EntityId& entityId : getCameraResults.values) { diff --git a/Code/Editor/ErrorReportTableModel.cpp b/Code/Editor/ErrorReportTableModel.cpp index c0c24bb7ce..2da3110e37 100644 --- a/Code/Editor/ErrorReportTableModel.cpp +++ b/Code/Editor/ErrorReportTableModel.cpp @@ -119,7 +119,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report) int CErrorReportTableModel::rowCount(const QModelIndex& parent) const { - return parent.isValid() ? 0 : m_errorRecords.size(); + return parent.isValid() ? 0 : static_cast(m_errorRecords.size()); } int CErrorReportTableModel::columnCount(const QModelIndex& parent) const diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 5abd3ab5d0..8c90d7322d 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -302,7 +302,7 @@ void CExportManager::ProcessEntityAnimationTrack( return; } - for (int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber) + for (unsigned int trackNumber = 0; trackNumber < pEntityTrack->GetChildCount(); ++trackNumber) { CTrackViewTrack* pSubTrack = static_cast(pEntityTrack->GetChild(trackNumber)); @@ -964,7 +964,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo } const uint numKeys = pSequenceTrack->GetKeyCount(); - for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) + for (uint keyIndex = 0; keyIndex < numKeys; ++keyIndex) { const CTrackViewKeyHandle& keyHandle = pSequenceTrack->GetKey(keyIndex); ISequenceKey sequenceKey; @@ -1043,7 +1043,7 @@ bool CExportManager::AddSelectedRegionObjects() std::vector objects; GetIEditor()->GetObjectManager()->FindObjectsInAABB(box, objects); - int numObjects = objects.size(); + const size_t numObjects = objects.size(); if (numObjects > m_data.m_objects.size()) { m_data.m_objects.reserve(numObjects + 1); // +1 for terrain diff --git a/Code/Editor/Export/ExportManager.h b/Code/Editor/Export/ExportManager.h index 698ad3ad5d..be81591e56 100644 --- a/Code/Editor/Export/ExportManager.h +++ b/Code/Editor/Export/ExportManager.h @@ -36,7 +36,7 @@ namespace Export public: CMesh(); - virtual int GetFaceCount() const { return m_faces.size(); } + virtual int GetFaceCount() const { return static_cast(m_faces.size()); } virtual const Face* GetFaceBuffer() const { return m_faces.size() ? &m_faces[0] : 0; } private: @@ -53,22 +53,22 @@ namespace Export public: CObject(const char* pName); - virtual int GetVertexCount() const { return m_vertices.size(); } - virtual const Vector3D* GetVertexBuffer() const{ return m_vertices.size() ? &m_vertices[0] : 0; } + int GetVertexCount() const override { return static_cast(m_vertices.size()); } + const Vector3D* GetVertexBuffer() const override { return m_vertices.size() ? &m_vertices[0] : nullptr; } - virtual int GetNormalCount() const { return m_normals.size(); } - virtual const Vector3D* GetNormalBuffer() const { return m_normals.size() ? &m_normals[0] : 0; } + int GetNormalCount() const override { return static_cast(m_normals.size()); } + const Vector3D* GetNormalBuffer() const override { return m_normals.size() ? &m_normals[0] : nullptr; } - virtual int GetTexCoordCount() const { return m_texCoords.size(); } - virtual const UV* GetTexCoordBuffer() const { return m_texCoords.size() ? &m_texCoords[0] : 0; } + int GetTexCoordCount() const override { return static_cast(m_texCoords.size()); } + const UV* GetTexCoordBuffer() const override { return m_texCoords.size() ? &m_texCoords[0] : nullptr; } - virtual int GetMeshCount() const { return m_meshes.size(); } - virtual Mesh* GetMesh(int index) const { return m_meshes[index]; } + int GetMeshCount() const override { return static_cast(m_meshes.size()); } + Mesh* GetMesh(int index) const override { return m_meshes[index]; } - virtual size_t MeshHash() const{return m_MeshHash; } + size_t MeshHash() const override{return m_MeshHash; } void SetMaterialName(const char* pName); - virtual int GetEntityAnimationDataCount() const {return m_entityAnimData.size(); } + virtual int GetEntityAnimationDataCount() const {return static_cast(m_entityAnimData.size()); } virtual const EntityAnimData* GetEntityAnimationData(int index) const {return &m_entityAnimData[index]; } virtual void SetEntityAnimationData(EntityAnimData entityData){ m_entityAnimData.push_back(entityData); }; void SetLastPtr(CBaseObject* pObject){m_pLastObject = pObject; }; @@ -92,7 +92,7 @@ namespace Export : public IData { public: - virtual int GetObjectCount() const { return m_objects.size(); } + virtual int GetObjectCount() const { return static_cast(m_objects.size()); } virtual Object* GetObject(int index) const { return m_objects[index]; } virtual Object* AddObject(const char* objectName); void Clear(); diff --git a/Code/Editor/Export/OBJExporter.cpp b/Code/Editor/Export/OBJExporter.cpp index bd2696090e..6ce40f8cd3 100644 --- a/Code/Editor/Export/OBJExporter.cpp +++ b/Code/Editor/Export/OBJExporter.cpp @@ -227,7 +227,7 @@ QString COBJExporter::MakeRelativePath(const char* pMainFileName, const char* pF const char* ch = strrchr(pMainFileName, '\\'); if (ch) { - if (strlen(pFileName) > ch - pMainFileName && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName)) + if (strlen(pFileName) > static_cast(ch - pMainFileName) && !_strnicmp(pMainFileName, pFileName, ch - pMainFileName)) { return QString(pFileName + (ch - pMainFileName) + 1); } @@ -256,7 +256,7 @@ const char* COBJExporter::TrimFloat(float fValue) const ++nCurBuf; sprintf_s(pBuf, bufSize, "%f", fValue); - for (int i = strlen(pBuf) - 1; i > 0; --i) + for (int i = static_cast(strlen(pBuf)) - 1; i > 0; --i) { if (pBuf[i] == '0') { diff --git a/Code/Editor/Export/OCMExporter.cpp b/Code/Editor/Export/OCMExporter.cpp index 653dc28dd3..ba5c343d0d 100644 --- a/Code/Editor/Export/OCMExporter.cpp +++ b/Code/Editor/Export/OCMExporter.cpp @@ -215,7 +215,7 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo for (size_t a = 0; a < MeshCount; a++) { SOCMeshInfo MeshInfo; - MeshInfo.m_MeshHash = pExportData->GetObject(a)->MeshHash(); + MeshInfo.m_MeshHash = pExportData->GetObject(static_cast(a))->MeshHash(); const tdMeshOffset::iterator it = std::find(MeshOffsets.begin(), MeshOffsets.end(), MeshInfo); if (it != MeshOffsets.end()) { @@ -223,15 +223,15 @@ bool COCMExporter::ExportToFile(const char* filename, const Export::IData* pExpo } else { - MeshInfo.m_Offset = Offset; - Offset += SaveMesh(Writer, pExportData->GetObject(a), MeshInfo.m_OBBMat); + MeshInfo.m_Offset = static_cast(Offset); + Offset += SaveMesh(Writer, pExportData->GetObject(static_cast(a)), MeshInfo.m_OBBMat); } MeshOffsets.push_back(MeshInfo); } - OffsetInstances = Offset; + OffsetInstances = static_cast(Offset); for (size_t a = 0; a < InstCount; a++) { - SaveInstance(Writer, pExportData->GetObject(a), MeshOffsets[a]); + SaveInstance(Writer, pExportData->GetObject(static_cast(a)), MeshOffsets[a]); } Writer.Seek(4); Writer.Write(static_cast(MeshOffsets.size())); @@ -263,7 +263,7 @@ const char* COCMExporter::TrimFloat(float fValue) const ++nCurBuf; sprintf_s(pBuf, bufSize, "%f", fValue); - for (int i = strlen(pBuf) - 1; i > 0; --i) + for (int i = static_cast(strlen(pBuf)) - 1; i > 0; --i) { if (pBuf[i] == '0') { diff --git a/Code/Editor/GameExporter.cpp b/Code/Editor/GameExporter.cpp index 415103e10d..1fc980fdac 100644 --- a/Code/Editor/GameExporter.cpp +++ b/Code/Editor/GameExporter.cpp @@ -252,11 +252,11 @@ void CGameExporter::ExportOcclusionMesh(const char* pszGamePath) { CMemoryBlock Temp; const size_t Size = FileIn.size(); - Temp.Allocate(Size); + Temp.Allocate(static_cast(Size)); FileIn.read(reinterpret_cast(Temp.GetBuffer()), Size); FileIn.close(); CCryMemFile FileOut; - FileOut.Write(Temp.GetBuffer(), Size); + FileOut.Write(Temp.GetBuffer(), static_cast(Size)); m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), FileOut); } } @@ -281,13 +281,13 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/ QString levelDataFile = path + "LevelData.xml"; XmlString xmlData = root->getXML(); CCryMemFile file; - file.Write(xmlData.c_str(), xmlData.length()); + file.Write(xmlData.c_str(), static_cast(xmlData.length())); m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), file); QString levelDataActionFile = path + "LevelDataAction.xml"; XmlString xmlDataAction = rootAction->getXML(); CCryMemFile fileAction; - fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length()); + fileAction.Write(xmlDataAction.c_str(), static_cast(xmlDataAction.length())); m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction); AZStd::vector entitySaveBuffer; @@ -298,7 +298,7 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/ { QString entitiesFile; entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0"); - m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size()); + m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), static_cast(entitySaveBuffer.size())); } } @@ -329,7 +329,7 @@ void CGameExporter::ExportLevelInfo(const QString& path) XmlString xmlData = root->getXML(); CCryMemFile file; - file.Write(xmlData.c_str(), xmlData.length()); + file.Write(xmlData.c_str(), static_cast(xmlData.length())); m_levelPak.m_pakFile.UpdateFile(filename.toUtf8().data(), file); } @@ -342,7 +342,7 @@ void CGameExporter::ExportLevelResourceList(const QString& path) CCryMemFile memFile; for (const char* filename = pResList->GetFirst(); filename; filename = pResList->GetNext()) { - memFile.Write(filename, strlen(filename)); + memFile.Write(filename, static_cast(strlen(filename))); memFile.Write("\n", 1); } diff --git a/Code/Editor/GameResourcesExporter.cpp b/Code/Editor/GameResourcesExporter.cpp index dd16b2eca1..b47f8c63a6 100644 --- a/Code/Editor/GameResourcesExporter.cpp +++ b/Code/Editor/GameResourcesExporter.cpp @@ -97,7 +97,7 @@ void CGameResourcesExporter::Save(const QString& outputDirectory) { // Save this file in target folder. QString trgFilename = Path::Make(outputDirectory, srcFilename); - int fsize = file.GetLength(); + int fsize = static_cast(file.GetLength()); if (fsize > data.GetSize()) { data.Allocate(fsize + 16); @@ -123,23 +123,6 @@ void CGameResourcesExporter::Save(const QString& outputDirectory) m_files.clear(); } -#if defined(WIN64) || defined(APPLE) || defined(AZ_PLATFORM_LINUX) -template -void Append(Container1& a, const Container2& b) -{ - a.reserve (a.size() + b.size()); - for (auto it = b.begin(); it != b.end(); ++it) - { - a.insert(a.end(), *it); - } -} -#else -template -void Append(Container1& a, const Container2& b) -{ - a.insert (a.end(), b.begin(), b.end()); -} -#endif ////////////////////////////////////////////////////////////////////////// // // Go through all editor objects and gathers files from thier properties. @@ -150,5 +133,5 @@ void CGameResourcesExporter::GetFilesFromObjects() CUsedResources rs; GetIEditor()->GetObjectManager()->GatherUsedResources(rs); - Append(m_files, rs.files); + AZStd::copy(rs.files.begin(), rs.files.end(), AZStd::back_inserter(m_files)); } diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp index 8e85de3904..2106265aca 100644 --- a/Code/Editor/Geometry/TriMesh.cpp +++ b/Code/Editor/Geometry/TriMesh.cpp @@ -420,7 +420,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const pIndexedMesh->SetBBox(bb); - pIndexedMesh->SetSubSetCount(usedMaterialIds.size()); + pIndexedMesh->SetSubSetCount(static_cast(usedMaterialIds.size())); for (int i = 0; i < usedMaterialIds.size(); i++) { pIndexedMesh->SetSubsetMaterialId(i, usedMaterialIds[i]); diff --git a/Code/Editor/LevelFileDialog.cpp b/Code/Editor/LevelFileDialog.cpp index cefa1330eb..c0c2b96c59 100644 --- a/Code/Editor/LevelFileDialog.cpp +++ b/Code/Editor/LevelFileDialog.cpp @@ -477,7 +477,7 @@ bool CLevelFileDialog::ValidateLevelPath(const QString& levelPath) const QString currentPath = (Path::GetEditingGameDataFolder() + "/" + kLevelsFolder).c_str(); for (size_t i = 0; i < splittedPath.size() - 1; ++i) { - currentPath += "/" + splittedPath[i]; + currentPath += "/" + splittedPath[static_cast(i)]; if (CFileUtil::FileExists(currentPath) || CheckLevelFolder(currentPath)) { diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index bb246c2337..8c466c47c2 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -1674,7 +1674,7 @@ void MainWindow::OnUpdateConnectionStatus() tooltip += m_connectionListener->LastAssetProcessorTask().c_str(); tooltip += "\n"; AZStd::set failedJobs = m_connectionListener->FailedJobsList(); - int failureCount = failedJobs.size(); + int failureCount = static_cast(failedJobs.size()); if (failureCount) { tooltip += "\n Failed Jobs\n"; diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index f40363ba98..e68b17b99f 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -840,8 +840,8 @@ void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor) { dc.DrawLine(GetParentAttachPointWorldTM().GetTranslation(), wp, IsFrozen() ? kLinkColorGray : kLinkColorParent, IsFrozen() ? kLinkColorGray : kLinkColorChild); } - int nChildCount = GetChildCount(); - for (int i = 0; i < nChildCount; ++i) + size_t nChildCount = GetChildCount(); + for (size_t i = 0; i < nChildCount; ++i) { const CBaseObject* pChild = GetChild(i); dc.DrawLine(pChild->GetParentAttachPointWorldTM().GetTranslation(), pChild->GetWorldPos(), pChild->IsFrozen() ? kLinkColorGray : kLinkColorParent, pChild->IsFrozen() ? kLinkColorGray : kLinkColorChild); @@ -1375,7 +1375,7 @@ bool CBaseObject::IsHiddenBySpec() const return false; } - return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > gSettings.editorConfigSpec); + return (m_nMinSpec != 0 && gSettings.editorConfigSpec != 0 && m_nMinSpec > static_cast(gSettings.editorConfigSpec)); } ////////////////////////////////////////////////////////////////////////// @@ -1893,7 +1893,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box) std::vector convexHullForRegion1; ConvexHull2D(convexHullForRegion1, pointsForRegion1); - nEdgeList1Count = convexHullForRegion1.size(); + nEdgeList1Count = static_cast(convexHullForRegion1.size()); if (nEdgeList1Count < 3 || nEdgeList1Count > kMaxSizeOfEdgeList1) { return true; @@ -2062,7 +2062,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj { const CBaseObject* pBaseObj = pObj ? pObj : this; - for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) + for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) { CBaseObject* pChild = pBaseObj->GetChild(i); if (pChild == nullptr) @@ -2078,7 +2078,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr >& outAllChil { const CBaseObject* pBaseObj = pObj ? pObj : this; - for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) + for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) { CBaseObject* pChild = pBaseObj->GetChild(i); if (pChild == nullptr) @@ -2094,7 +2094,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p { const CBaseObject* pBaseObj = pObj ? pObj : this; - for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) + for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i) { CBaseObject* pChild = pBaseObj->GetChild(i); if (pChild == nullptr) @@ -2114,7 +2114,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject) return; } - for (int i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i) + for (size_t i = 0, nChildCount(pFromObject->GetChildCount()); i < nChildCount; ++i) { CBaseObject* pFromChildObject = pFromObject->GetChild(i); @@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren) // Set min spec for all childs. if (bSetChildren) { - for (int i = m_childs.size() - 1; i >= 0; --i) + for (size_t i = m_childs.size() - 1; i >= 0; --i) { m_childs[i]->SetMinSpec(nSpec, true); } diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index 77fab543f9..02f89c268f 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -63,7 +63,7 @@ protected: void Undo([[maybe_unused]] bool bUndo) override { - for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i) + for (int i = 0, iLinkSize = static_cast(m_Links.size()); i < iLinkSize; ++i) { SLink& link = m_Links[i]; CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID); @@ -1217,7 +1217,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN if (!m_links.empty()) { XmlNodeRef linksNode = objNode->newChild("EntityLinks"); - for (int i = 0, num = m_links.size(); i < num; i++) + for (size_t i = 0, num = m_links.size(); i < num; i++) { if (m_links[i].target) { @@ -1368,8 +1368,8 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx // Clone event targets. if (!pFromEntity->m_eventTargets.empty()) { - int numTargets = pFromEntity->m_eventTargets.size(); - for (int i = 0; i < numTargets; i++) + size_t numTargets = pFromEntity->m_eventTargets.size(); + for (size_t i = 0; i < numTargets; i++) { CEntityEventTarget& et = pFromEntity->m_eventTargets[i]; CBaseObject* pClonedTarget = ctx.FindClone(et.target); @@ -1386,7 +1386,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx // Clone links. if (!pFromEntity->m_links.empty()) { - int numTargets = pFromEntity->m_links.size(); + int numTargets = static_cast(pFromEntity->m_links.size()); for (int i = 0; i < numTargets; i++) { CEntityLink& et = pFromEntity->m_links[i]; @@ -1437,7 +1437,7 @@ void CEntityObject::RemoveAllEntityLinks() { while (!m_links.empty()) { - RemoveEntityLink(m_links.size() - 1); + RemoveEntityLink(static_cast(m_links.size() - 1)); } m_links.clear(); SetModified(false); @@ -1448,7 +1448,7 @@ void CEntityObject::ReleaseEventTargets() { while (!m_eventTargets.empty()) { - RemoveEventTarget(m_eventTargets.size() - 1, false); + RemoveEventTarget(static_cast(m_eventTargets.size() - 1), false); } m_eventTargets.clear(); SetModified(false); @@ -1518,7 +1518,7 @@ void CEntityObject::SaveLink(XmlNodeRef xmlNode) } XmlNodeRef linksNode = xmlNode->newChild("EntityLinks"); - for (int i = 0, num = m_links.size(); i < num; i++) + for (size_t i = 0, num = m_links.size(); i < num; i++) { XmlNodeRef linkNode = linksNode->newChild("Link"); linkNode->setAttr("TargetId", m_links[i].targetId); @@ -1534,7 +1534,7 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event) if (event == CBaseObject::ON_DELETE) { // Find this target in events list and remove. - int numTargets = m_eventTargets.size(); + int numTargets = static_cast(m_eventTargets.size()); for (int i = 0; i < numTargets; i++) { if (m_eventTargets[i].target == target) @@ -1547,7 +1547,7 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event) } else if (event == CBaseObject::ON_PREDELETE) { - int numTargets = m_links.size(); + int numTargets = static_cast(m_links.size()); for (int i = 0; i < numTargets; i++) { if (m_links[i].target == target) @@ -1589,7 +1589,7 @@ int CEntityObject::AddEventTarget(CBaseObject* target, const QString& event, con m_eventTargets.push_back(et); SetModified(false); - return m_eventTargets.size() - 1; + return static_cast(m_eventTargets.size() - 1); } ////////////////////////////////////////////////////////////////////////// @@ -1659,13 +1659,13 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId) SetModified(false); - return m_links.size() - 1; + return static_cast(m_links.size() - 1); } ////////////////////////////////////////////////////////////////////////// bool CEntityObject::EntityLinkExists(const QString& name, GUID targetEntityId) { - for (int i = 0, num = m_links.size(); i < num; ++i) + for (size_t i = 0, num = m_links.size(); i < num; ++i) { if (m_links[i].targetId == targetEntityId && name.compare(m_links[i].name, Qt::CaseInsensitive) == 0) { diff --git a/Code/Editor/Objects/ObjectLoader.cpp b/Code/Editor/Objects/ObjectLoader.cpp index 2583eb6230..9596265bb9 100644 --- a/Code/Editor/Objects/ObjectLoader.cpp +++ b/Code/Editor/Objects/ObjectLoader.cpp @@ -126,7 +126,7 @@ void CObjectArchive::ResolveObjects() ////////////////////////////////////////////////////////////////////////// // Serialize All Objects from XML. ////////////////////////////////////////////////////////////////////////// - int numObj = m_loadedObjects.size(); + int numObj = static_cast(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { if (m_bProgressBarEnabled) @@ -143,7 +143,7 @@ void CObjectArchive::ResolveObjects() m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr); // Objects can be added to the list here (from Groups). - numObj = m_loadedObjects.size(); + numObj = static_cast(m_loadedObjects.size()); } m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr); ////////////////////////////////////////////////////////////////////////// @@ -221,7 +221,7 @@ void CObjectArchive::ResolveObjects() ////////////////////////////////////////////////////////////////////////// // Serialize All Objects from XML. ////////////////////////////////////////////////////////////////////////// - int numObj = m_loadedObjects.size(); + int numObj = static_cast(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { if (m_bProgressBarEnabled) @@ -246,7 +246,7 @@ void CObjectArchive::ResolveObjects() // Call PostLoad on all these objects. ////////////////////////////////////////////////////////////////////////// { - int numObj = m_loadedObjects.size(); + int numObj = static_cast(m_loadedObjects.size()); for (i = 0; i < numObj; i++) { SLoadedObjectInfo& obj = m_loadedObjects[i]; diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index fbdd56f080..3e2a1c0d2c 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -746,7 +746,7 @@ void CObjectManager::ChangeObjectName(CBaseObject* obj, const QString& newName) ////////////////////////////////////////////////////////////////////////// int CObjectManager::GetObjectCount() const { - return m_objects.size(); + return static_cast(m_objects.size()); } ////////////////////////////////////////////////////////////////////////// @@ -765,7 +765,7 @@ void CObjectManager::GetObjects(DynArray& objects) const CBaseObjectsArray objectArray; GetObjects(objectArray); objects.clear(); - for (int i = 0, iCount(objectArray.size()); i < iCount; ++i) + for (size_t i = 0, iCount(objectArray.size()); i < iCount; ++i) { objects.push_back(objectArray[i]); } @@ -1336,11 +1336,11 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]] bbox.max.zero(); pDispayedViewObjects->ClearObjects(); - pDispayedViewObjects->Reserve(m_visibleObjects.size()); + pDispayedViewObjects->Reserve(static_cast(m_visibleObjects.size())); if (dc.flags & DISPLAY_2D) { - int numVis = m_visibleObjects.size(); + int numVis = static_cast(m_visibleObjects.size()); for (int i = 0; i < numVis; i++) { CBaseObject* obj = m_visibleObjects[i]; @@ -1374,7 +1374,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]] pSelection->GetObject(0)->CBaseObject::DrawDimensions(dc, &mergedAABB); } - int numVis = m_visibleObjects.size(); + int numVis = static_cast(m_visibleObjects.size()); for (int i = 0; i < numVis; i++) { CBaseObject* obj = m_visibleObjects[i]; @@ -2016,7 +2016,7 @@ void CObjectManager::GetClassCategories(QStringList& categories) } } categories.clear(); - categories.reserve(cset.size()); + categories.reserve(static_cast(cset.size())); for (std::set::iterator cit = cset.begin(); cit != cset.end(); ++cit) { categories.push_back(*cit); @@ -2629,7 +2629,7 @@ void CObjectManager::EnteredComponentMode(const AZStd::vector& /*compo const size_t gizmoCount = static_cast(gizmoManager->GetGizmoCount()); for (size_t i = 0; i < gizmoCount; ++i) { - gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(i)); + gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast(i))); } } diff --git a/Code/Editor/Objects/SelectionGroup.cpp b/Code/Editor/Objects/SelectionGroup.cpp index 027c88172e..57a86262aa 100644 --- a/Code/Editor/Objects/SelectionGroup.cpp +++ b/Code/Editor/Objects/SelectionGroup.cpp @@ -109,7 +109,7 @@ bool CSelectionGroup::SameObjectType() ////////////////////////////////////////////////////////////////////////// int CSelectionGroup::GetCount() const { - return m_objects.size(); + return static_cast(m_objects.size()); } ////////////////////////////////////////////////////////////////////////// @@ -632,7 +632,7 @@ void CSelectionGroup::IndicateSnappingVertex(DisplayContext& dc) const void CSelectionGroup::FinishChanges() { Objects selectedObjects(m_objects); - int iObjectSize(selectedObjects.size()); + int iObjectSize = static_cast(selectedObjects.size()); for (int i = 0; i < iObjectSize; ++i) { CBaseObject* pObject = selectedObjects[i]; diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp index 0d661349a9..d0091f968e 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/AssetCatalogModel.cpp @@ -472,7 +472,7 @@ void AssetCatalogModel::LoadDatabase() { m_fileCacheCurrentIndex = 0; Q_EMIT UpdateProgress(0); - Q_EMIT SetTotalProgress(m_fileCache.size()); + Q_EMIT SetTotalProgress(static_cast(m_fileCache.size())); }; EBUS_EVENT(AZ::Data::AssetCatalogRequestBus, EnumerateAssets, startCB, enumerateCB, endCB); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp index f7f2b721b7..cd0fba350f 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/ComponentPalette/ComponentDataModel.cpp @@ -262,7 +262,7 @@ QModelIndex ComponentDataModel::parent([[maybe_unused]] const QModelIndex &child int ComponentDataModel::rowCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const { - return m_componentList.size(); + return static_cast(m_componentList.size()); } int ComponentDataModel::columnCount([[maybe_unused]] const QModelIndex &parent /*= QModelIndex()*/) const diff --git a/Code/Editor/PreferencesStdPages.cpp b/Code/Editor/PreferencesStdPages.cpp index a4b3ee8ba4..b593541a07 100644 --- a/Code/Editor/PreferencesStdPages.cpp +++ b/Code/Editor/PreferencesStdPages.cpp @@ -89,7 +89,7 @@ REFGUID CStdPreferencesClassDesc::ClassID() ////////////////////////////////////////////////////////////////////////// int CStdPreferencesClassDesc::GetPagesCount() { - return m_pageCreators.size(); + return static_cast(m_pageCreators.size()); } IPreferencesPage* CStdPreferencesClassDesc::CreateEditorPreferencesPage(int index) diff --git a/Code/Editor/QtViewPaneManager.cpp b/Code/Editor/QtViewPaneManager.cpp index f4f18fde83..d8111aa09c 100644 --- a/Code/Editor/QtViewPaneManager.cpp +++ b/Code/Editor/QtViewPaneManager.cpp @@ -184,7 +184,7 @@ bool QtViewPane::CloseInstance(QDockWidget* dockWidget, CloseModes closeModes) const int numTopLevel = topLevelWidgets.size(); for (size_t i = 0; i < numTopLevel; ++i) { - QWidget* widget = topLevelWidgets[i]; + QWidget* widget = topLevelWidgets[static_cast(i)]; if (widget->isModal() && widget->isVisible()) { widget->activateWindow(); diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index 09b0d0f4f4..259f71b69b 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -1061,7 +1061,7 @@ void SEditorSettings::ConvertPath(const AZStd::string_view sourcePath, AZStd::st // The reason for the difference is to have this API be consistent with the path syntax in Open 3D Engine Python APIs. // Find the last pipe separator ("|") in the path - int lastSeparator = sourcePath.find_last_of("|"); + size_t lastSeparator = sourcePath.find_last_of("|"); // Everything before the last separator is the category (since only the category is hierarchical) category = sourcePath.substr(0, lastSeparator); diff --git a/Code/Editor/ToolBox.cpp b/Code/Editor/ToolBox.cpp index d784bc2083..1f08bd74fc 100644 --- a/Code/Editor/ToolBox.cpp +++ b/Code/Editor/ToolBox.cpp @@ -237,7 +237,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in { if (bToolbox) { - const int macroCount = m_macros.size(); + const int macroCount = static_cast(m_macros.size()); if (macroCount > ID_TOOL_LAST - ID_TOOL_FIRST + 1) { return nullptr; @@ -261,7 +261,7 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in } else { - const int shelveMacroCount = m_shelveMacros.size(); + const int shelveMacroCount = static_cast(m_shelveMacros.size()); if (shelveMacroCount > ID_TOOL_SHELVE_LAST - ID_TOOL_SHELVE_FIRST + 1) { return nullptr; diff --git a/Code/Editor/ToolbarManager.cpp b/Code/Editor/ToolbarManager.cpp index d44e794b6a..1831fe6a55 100644 --- a/Code/Editor/ToolbarManager.cpp +++ b/Code/Editor/ToolbarManager.cpp @@ -503,7 +503,7 @@ void ToolbarManager::InitializeStandardToolbars() { auto macroToolbars = GetIEditor()->GetToolBoxManager()->GetToolbars(); - m_standardToolbars.reserve(5 + macroToolbars.size()); + m_standardToolbars.reserve(static_cast(5 + macroToolbars.size())); m_standardToolbars.push_back(GetEditModeToolbar()); m_standardToolbars.push_back(GetObjectToolbar()); m_standardToolbars.push_back(GetPlayConsoleToolbar()); diff --git a/Code/Editor/ToolsConfigPage.cpp b/Code/Editor/ToolsConfigPage.cpp index 965c862554..1871dc763f 100644 --- a/Code/Editor/ToolsConfigPage.cpp +++ b/Code/Editor/ToolsConfigPage.cpp @@ -840,7 +840,7 @@ void CToolsConfigPage::FillScriptCmds() { EditorPythonConsoleInterface::GlobalFunctionCollection globalFunctionCollection; editorPythonConsoleInterface->GetGlobalFunctionList(globalFunctionCollection); - commands.reserve(globalFunctionCollection.size()); + commands.reserve(static_cast(globalFunctionCollection.size())); for (const EditorPythonConsoleInterface::GlobalFunction& globalFunction : globalFunctionCollection) { const QString fullCmd = QString("%1.%2()").arg(globalFunction.m_moduleName.data()).arg(globalFunction.m_functionName.data()); diff --git a/Code/Editor/TrackView/CommentKeyUIControls.cpp b/Code/Editor/TrackView/CommentKeyUIControls.cpp index c7c5f83cbf..6b52efd8f1 100644 --- a/Code/Editor/TrackView/CommentKeyUIControls.cpp +++ b/Code/Editor/TrackView/CommentKeyUIControls.cpp @@ -122,7 +122,7 @@ void CCommentKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& sel for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; keyIndex++) { - CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex); + CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(static_cast(keyIndex)); CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType(); if (paramType == AnimParamType::CommentText) diff --git a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp index a62ab17cbf..d8b3a2bdf7 100644 --- a/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp +++ b/Code/Editor/TrackView/ScreenFaderKeyUIControls.cpp @@ -128,7 +128,7 @@ void CScreenFaderKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& for (size_t keyIndex = 0, num = selectedKeys.GetKeyCount(); keyIndex < num; ++keyIndex) { - CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(keyIndex); + CTrackViewKeyHandle selectedKey = selectedKeys.GetKey(static_cast(keyIndex)); CAnimParamType paramType = selectedKey.GetTrack()->GetParameterType(); if (paramType == AnimParamType::ScreenFader) diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp index 66c4f63d35..aea655e9d3 100644 --- a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp +++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp @@ -357,7 +357,7 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange() QString cvarsText; for (size_t i = 0; i < item.cvars.size(); ++i) { - cvarsText += item.cvars[i]; + cvarsText += item.cvars[static_cast(i)]; cvarsText += "\r\n"; } m_ui->m_cvarsEdit->setPlainText(cvarsText); @@ -894,7 +894,7 @@ void CSequenceBatchRenderDialog::CaptureItemStart() // Set up the custom config cvars for this item. for (size_t i = 0; i < renderItem.cvars.size(); ++i) { - GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[i].toUtf8().data()); + GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(renderItem.cvars[static_cast(i)].toUtf8().data()); } // Set specific capture options for this item. @@ -1519,7 +1519,7 @@ void CSequenceBatchRenderDialog::OnSaveBatch() // cvars for (size_t k = 0; k < item.cvars.size(); ++k) { - itemNode->newChild("cvar")->setContent(item.cvars[k].toUtf8().data()); + itemNode->newChild("cvar")->setContent(item.cvars[static_cast(k)].toUtf8().data()); } } diff --git a/Code/Editor/TrackView/SequenceKeyUIControls.cpp b/Code/Editor/TrackView/SequenceKeyUIControls.cpp index c3bc39d65d..4199563e10 100644 --- a/Code/Editor/TrackView/SequenceKeyUIControls.cpp +++ b/Code/Editor/TrackView/SequenceKeyUIControls.cpp @@ -84,7 +84,7 @@ bool CSequenceKeyUIControls::OnKeySelectionChange(CTrackViewKeyBundle& selectedK mv_sequence->AddEnumItem(QObject::tr(""), CTrackViewDialog::GetEntityIdAsString(AZ::EntityId(AZ::EntityId::InvalidEntityId))); const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); - for (int i = 0; i < pSequenceManager->GetCount(); ++i) + for (unsigned int i = 0; i < pSequenceManager->GetCount(); ++i) { CTrackViewSequence* pCurrentSequence = pSequenceManager->GetSequenceByIndex(i); bool bNotMe = pCurrentSequence != pSequence; diff --git a/Code/Editor/TrackView/TVEventsDialog.cpp b/Code/Editor/TrackView/TVEventsDialog.cpp index c8221b38cd..86b4c1f6bc 100644 --- a/Code/Editor/TrackView/TVEventsDialog.cpp +++ b/Code/Editor/TrackView/TVEventsDialog.cpp @@ -363,7 +363,7 @@ int TVEventsModel::GetNumberOfUsageAndFirstTimeUsed(const char* eventName, float { CTrackViewTrack* pTrack = tracks.GetTrack(currentTrack); - for (int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey) + for (unsigned int currentKey = 0; currentKey < pTrack->GetKeyCount(); ++currentKey) { CTrackViewKeyHandle keyHandle = pTrack->GetKey(currentKey); diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 9edac32da0..dd6fb8f936 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -452,7 +452,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( { // Check for a duplicates CTrackViewAnimNodeBundle azEntityNodesFound = director2->GetAnimNodesByType(AnimNodeType::AzEntity); - for (int x = 0; x < azEntityNodesFound.GetCount(); x++) + for (unsigned int x = 0; x < azEntityNodesFound.GetCount(); x++) { if (azEntityNodesFound.GetNode(x)->GetAzEntityId() == owner) { diff --git a/Code/Editor/TrackView/TrackViewCurveEditor.cpp b/Code/Editor/TrackView/TrackViewCurveEditor.cpp index 83204f76a6..a757387563 100644 --- a/Code/Editor/TrackView/TrackViewCurveEditor.cpp +++ b/Code/Editor/TrackView/TrackViewCurveEditor.cpp @@ -145,7 +145,7 @@ void CTrackViewCurveEditor::UpdateSplines() std::set newTracks; if (selectedTracks.AreAllOfSameType()) { - for (int i = 0; i < selectedTracks.GetCount(); i++) + for (unsigned int i = 0; i < selectedTracks.GetCount(); i++) { CTrackViewTrack* pTrack = selectedTracks.GetTrack(i); diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index 309d776b81..bdec68e928 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -782,7 +782,7 @@ void CTrackViewDialog::UpdateActions() } bool allSelectedTracksUseMute = true; - for (int i = 0; i < selectedTrackCount; i++) + for (unsigned int i = 0; i < selectedTrackCount; i++) { CTrackViewTrack* pTrack = selectedTracks.GetTrack(i); if (pTrack && !pTrack->UsesMute()) @@ -1121,7 +1121,7 @@ void CTrackViewDialog::ReloadSequencesComboBox() CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); const unsigned int numSequences = pSequenceManager->GetCount(); - for (int k = 0; k < numSequences; ++k) + for (unsigned int k = 0; k < numSequences; ++k) { CTrackViewSequence* sequence = pSequenceManager->GetSequenceByIndex(k); QString entityIdString = GetEntityIdAsString(sequence->GetSequenceComponentEntityId()); @@ -1799,7 +1799,7 @@ void CTrackViewDialog::SaveMiscSettings() const settings.setValue(s_kFrameSnappingFPSEntry, fps); settings.setValue(s_kTickDisplayModeEntry, static_cast(m_wndDopeSheet->GetTickDisplayMode())); settings.setValue(s_kDefaultTracksEntry, QByteArray(reinterpret_cast(m_defaultTracksForEntityNode.data()), - m_defaultTracksForEntityNode.size() * sizeof(AnimParamType))); + static_cast(m_defaultTracksForEntityNode.size() * sizeof(AnimParamType)))); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index c784142b3c..0ff7cc6ca9 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -1028,12 +1028,12 @@ void CTrackViewDopeSheetBase::SelectAllKeysWithinTimeFrame(const QRect& rc, cons CTrackViewTrackBundle tracks = sequence->GetAllTracks(); CTrackViewSequenceNotificationContext context(sequence); - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CTrackViewTrack* pTrack = tracks.GetTrack(i); // Check which keys we intersect. - for (int j = 0; j < pTrack->GetKeyCount(); j++) + for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++) { CTrackViewKeyHandle keyHandle = pTrack->GetKey(j); const float time = keyHandle.GetTime(); @@ -1429,7 +1429,7 @@ bool CTrackViewDopeSheetBase::IsOkToAddKeyHere(const CTrackViewTrack* pTrack, fl { const float timeEpsilon = 0.05f; - for (int i = 0; i < pTrack->GetKeyCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { const CTrackViewKeyConstHandle& keyHandle = pTrack->GetKey(i); @@ -1764,7 +1764,7 @@ float CTrackViewDopeSheetBase::MagnetSnap(float newTime, const CTrackViewAnimNod newTime = keys.GetKey(0).GetTime(); // But if there is an in-range key in a sibling track, use it instead. // Here a 'sibling' means a track that belongs to a same node. - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CTrackViewKeyHandle keyHandle = keys.GetKey(i); if (keyHandle.GetTrack()->GetAnimNode() == pNode) diff --git a/Code/Editor/TrackView/TrackViewNode.cpp b/Code/Editor/TrackView/TrackViewNode.cpp index 882a23f6b0..d8507d9b0a 100644 --- a/Code/Editor/TrackView/TrackViewNode.cpp +++ b/Code/Editor/TrackView/TrackViewNode.cpp @@ -86,7 +86,7 @@ void CTrackViewKeyHandle::SetTime(float time, bool notifyListeners) if (!m_pTrack->IsSortMarkerKey(m_keyIndex)) { CTrackViewKeyBundle allKeys = m_pTrack->GetAllKeys(); - for (int x = 0; x < allKeys.GetKeyCount(); x++) + for (unsigned int x = 0; x < allKeys.GetKeyCount(); x++) { unsigned int curIndex = allKeys.GetKey(x).GetIndex(); if (m_pTrack->IsSortMarkerKey(curIndex)) diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index 550d36af83..4d6249288e 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -2306,7 +2306,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con &Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent, animatableProperties, azEntityId, animNode->GetComponentId()); - paramCount = animatableProperties.size(); + paramCount = static_cast(animatableProperties.size()); } } else diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp index acabff6827..d50060269b 100644 --- a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp +++ b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp @@ -113,7 +113,7 @@ namespace AZStd::string PyTrackViewGetSequenceName(unsigned int index) { - if (index < PyTrackViewGetNumSequences()) + if (static_cast(index) < PyTrackViewGetNumSequences()) { const CTrackViewSequenceManager* pSequenceManager = GetIEditor()->GetSequenceManager(); return pSequenceManager->GetSequenceByIndex(index)->GetName(); @@ -378,7 +378,7 @@ namespace } CTrackViewAnimNodeBundle foundNodes = pParentDirector->GetAllAnimNodes(); - if (index < 0 || index >= foundNodes.GetCount()) + if (index < 0 || index >= static_cast(foundNodes.GetCount())) { throw std::runtime_error("Invalid node index"); } diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index 3647c554dc..28279be0e3 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -455,7 +455,7 @@ void CTrackViewSequence::OnNodeChanged(CTrackViewNode* node, ITrackViewSequenceL // Make sure to deselect any keys CTrackViewKeyBundle keys = node->GetAllKeys(); - for (int key = 0; key < keys.GetKeyCount(); key++) + for (unsigned int key = 0; key < keys.GetKeyCount(); key++) { CTrackViewKeyHandle keyHandle = keys.GetKey(key); if (keyHandle.IsSelected()) @@ -1249,7 +1249,7 @@ void CTrackViewSequence::DeselectAllKeys() CTrackViewSequenceNotificationContext context(this); CTrackViewKeyBundle selectedKeys = GetSelectedKeys(); - for (int i = 0; i < selectedKeys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < selectedKeys.GetKeyCount(); ++i) { CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(i); keyHandle.Select(false); diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.cpp b/Code/Editor/TrackView/TrackViewSequenceManager.cpp index 277483691a..780c8f04ce 100644 --- a/Code/Editor/TrackView/TrackViewSequenceManager.cpp +++ b/Code/Editor/TrackView/TrackViewSequenceManager.cpp @@ -227,7 +227,7 @@ void CTrackViewSequenceManager::AddTrackViewSequence(CTrackViewSequence* sequenc //////////////////////////////////////////////////////////////////////////// void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence) { - const int numSequences = m_sequences.size(); + const int numSequences = static_cast(m_sequences.size()); for (int sequenceIndex = 0; sequenceIndex < numSequences; ++sequenceIndex) { if (m_sequences[sequenceIndex].get() == sequence) @@ -246,7 +246,7 @@ void CTrackViewSequenceManager::DeleteSequence(CTrackViewSequence* sequence) { AZ::ComponentTypeList requiredComponents; AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(requiredComponents, &AzToolsFramework::EditorEntityContextRequestBus::Events::GetRequiredComponentTypes); - const int numComponentToDeleteEntity = requiredComponents.size() + 1; + const int numComponentToDeleteEntity = static_cast(requiredComponents.size() + 1); AZ::Entity::ComponentArrayType entityComponents = entity->GetComponents(); if (entityComponents.size() == numComponentToDeleteEntity) @@ -413,9 +413,9 @@ void CTrackViewSequenceManager::OnDataBaseItemEvent([[maybe_unused]] IDataBaseIt { if (event != EDataBaseItemEvent::EDB_ITEM_EVENT_ADD) { - const uint numSequences = m_sequences.size(); + const size_t numSequences = m_sequences.size(); - for (uint i = 0; i < numSequences; ++i) + for (size_t i = 0; i < numSequences; ++i) { m_sequences[i]->UpdateDynamicParams(); } diff --git a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp index c21403d1f5..4911297985 100644 --- a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp +++ b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp @@ -706,7 +706,7 @@ void CTrackViewSplineCtrl::mouseMoveEvent(QMouseEvent* event) QString tipText; bool boFoundTheSelectedKey(false); - for (int splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) + for (size_t splineIndex = 0, endSpline = m_splines.size(); splineIndex < endSpline; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; CTrackViewTrack* pTrack = m_tracks[splineIndex]; @@ -796,7 +796,7 @@ void CTrackViewSplineCtrl::AdjustTCB(float d_tension, float d_continuity, float SendNotifyEvent(SPLN_BEFORE_CHANGE); - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; CTrackViewTrack* pTrack = m_tracks[splineIndex]; @@ -892,7 +892,7 @@ void CTrackViewSplineCtrl::OnUserCommand(UINT cmd) bool CTrackViewSplineCtrl::IsUnifiedKeyCurrentlySelected() const { - for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) + for (size_t splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex) { ISplineInterpolator* pSpline = m_splines[splineIndex].pSpline; diff --git a/Code/Editor/TrackView/TrackViewUndo.cpp b/Code/Editor/TrackView/TrackViewUndo.cpp index d0b85762a2..c9cdc62bc3 100644 --- a/Code/Editor/TrackView/TrackViewUndo.cpp +++ b/Code/Editor/TrackView/TrackViewUndo.cpp @@ -70,7 +70,7 @@ CTrackViewTrack* CUndoComponentEntityTrackObject::FindTrack(CTrackViewSequence* CTrackViewTrack* track = nullptr; CTrackViewTrackBundle allTracks = sequence->GetAllTracks(); - for (int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++) + for (unsigned int trackIndex = 0; trackIndex < allTracks.GetCount(); trackIndex++) { CTrackViewTrack* curTrack = allTracks.GetTrack(trackIndex); if (curTrack->GetAnimNode() && curTrack->GetAnimNode()->GetComponentId() == m_trackComponentId) diff --git a/Code/Editor/TrackViewNewSequenceDialog.cpp b/Code/Editor/TrackViewNewSequenceDialog.cpp index 0efc7a932e..287f69df47 100644 --- a/Code/Editor/TrackViewNewSequenceDialog.cpp +++ b/Code/Editor/TrackViewNewSequenceDialog.cpp @@ -78,7 +78,7 @@ void CTVNewSequenceDialog::OnOK() return; } - for (int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k) + for (unsigned int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k) { CTrackViewSequence* pSequence = GetIEditor()->GetSequenceManager()->GetSequenceByIndex(k); QString fullname = pSequence->GetName(); diff --git a/Code/Editor/Undo/Undo.cpp b/Code/Editor/Undo/Undo.cpp index 6af141b9e7..b49c6ea567 100644 --- a/Code/Editor/Undo/Undo.cpp +++ b/Code/Editor/Undo/Undo.cpp @@ -49,7 +49,7 @@ public: } void Undo(bool bUndo) override { - for (int i = m_undoSteps.size() - 1; i >= 0; i--) + for (size_t i = m_undoSteps.size() - 1; i >= 0; i--) { m_undoSteps[i]->Undo(bUndo); } @@ -624,13 +624,13 @@ void CUndoManager::SuperCancel() ////////////////////////////////////////////////////////////////////////// int CUndoManager::GetUndoStackLen() const { - return m_undoStack.size(); + return static_cast(m_undoStack.size()); } ////////////////////////////////////////////////////////////////////////// int CUndoManager::GetRedoStackLen() const { - return m_redoStack.size(); + return static_cast(m_redoStack.size()); } ////////////////////////////////////////////////////////////////////////// @@ -817,7 +817,7 @@ void CUndoManager::SignalNumUndoRedoToListeners() { for (IUndoManagerListener* listener : m_listeners) { - listener->SignalNumUndoRedo(m_undoStack.size(), m_redoStack.size()); + listener->SignalNumUndoRedo(static_cast(m_undoStack.size()), static_cast(m_redoStack.size())); } } diff --git a/Code/Editor/UndoDropDown.cpp b/Code/Editor/UndoDropDown.cpp index fbe18d5d52..6bf807ebf4 100644 --- a/Code/Editor/UndoDropDown.cpp +++ b/Code/Editor/UndoDropDown.cpp @@ -68,7 +68,7 @@ public: return 0; } - return m_stackNames.size(); + return static_cast(m_stackNames.size()); } QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override @@ -101,13 +101,13 @@ public: if (fresh.size() < m_stackNames.size()) { - beginRemoveRows(createIndex(-1, -1), fresh.size(), m_stackNames.size() - 1); + beginRemoveRows(createIndex(-1, -1), static_cast(fresh.size()), static_cast(m_stackNames.size() - 1)); m_stackNames = fresh; endRemoveRows(); } else { - beginInsertRows(createIndex(-1, -1), m_stackNames.size(), fresh.size() - 1); + beginInsertRows(createIndex(-1, -1), static_cast(m_stackNames.size()), static_cast(fresh.size() - 1)); m_stackNames = fresh; endInsertRows(); } diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index f26ffa60ec..e39adcca82 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -1228,7 +1228,7 @@ bool CFileUtil::CreatePath(const QString& strPath) nTotalPathQueueElements = cstrDirectoryQueue.size(); for (nCurrentPathQueue = 0; nCurrentPathQueue < nTotalPathQueueElements; ++nCurrentPathQueue) { - strCurrentDirectoryPath += cstrDirectoryQueue[nCurrentPathQueue]; + strCurrentDirectoryPath += cstrDirectoryQueue[static_cast(nCurrentPathQueue)]; strCurrentDirectoryPath += "\\"; // The value which will go out of this loop is the result of the attempt to create the // last directory, only. @@ -1368,8 +1368,8 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory return eCopyResult; } - QString sourceName = sourceDir.absoluteFilePath(cFiles[nCurrent]); - QString targetName = targetDir.absoluteFilePath(cFiles[nCurrent]); + QString sourceName = sourceDir.absoluteFilePath(cFiles[static_cast(nCurrent)]); + QString targetName = targetDir.absoluteFilePath(cFiles[static_cast(nCurrent)]); if (boConfirmOverwrite) { @@ -1387,7 +1387,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm file overwrite?"), QObject::tr("There is already a file named \"%1\" in the target folder. Do you want to move this file anyway replacing the old one?") - .arg(cFiles[nCurrent]), + .arg(cFiles[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1448,8 +1448,8 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory bool bnLastDirectoryWasCreated(false); - QString sourceName = sourceDir.absoluteFilePath(cDirectories[nCurrent]); - QString targetName = targetDir.absoluteFilePath(cDirectories[nCurrent]); + QString sourceName = sourceDir.absoluteFilePath(cDirectories[static_cast(nCurrent)]); + QString targetName = targetDir.absoluteFilePath(cDirectories[static_cast(nCurrent)]); bnLastDirectoryWasCreated = QDir().mkpath(targetName); @@ -1473,7 +1473,7 @@ IFileUtil::ECopyTreeResult CFileUtil::CopyTree(const QString& strSourceDirectory const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm directory overwrite?"), QObject::tr("There is already a folder named \"%1\" in the target folder. Do you want to move this folder anyway?") - .arg(cDirectories[nCurrent]), + .arg(cDirectories[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1742,8 +1742,8 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto } bool bnLastFileWasCopied(false); - QString sourceName(sourceDir.absoluteFilePath(cFiles[nCurrent])); - QString targetName(targetDir.absoluteFilePath(cFiles[nCurrent])); + QString sourceName(sourceDir.absoluteFilePath(cFiles[static_cast(nCurrent)])); + QString targetName(targetDir.absoluteFilePath(cFiles[static_cast(nCurrent)])); if (boConfirmOverwrite) { @@ -1761,7 +1761,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm file overwrite?"), QObject::tr("There is already a file named \"%1\" in the target folder. Do you want to move this file anyway replacing the old one?") - .arg(cFiles[nCurrent]), + .arg(cFiles[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { @@ -1822,8 +1822,8 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto return eCopyResult; } - QString sourceName(sourceDir.absoluteFilePath(cDirectories[nCurrent])); - QString targetName(targetDir.absoluteFilePath(cDirectories[nCurrent])); + QString sourceName(sourceDir.absoluteFilePath(cDirectories[static_cast(nCurrent)])); + QString targetName(targetDir.absoluteFilePath(cDirectories[static_cast(nCurrent)])); bnLastDirectoryWasCreated = QDir().mkdir(targetName); @@ -1847,7 +1847,7 @@ IFileUtil::ECopyTreeResult CFileUtil::MoveTree(const QString& strSourceDirecto const int ret = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QObject::tr("Confirm directory overwrite?"), QObject::tr("There is already a folder named \"%1\" in the target folder. Do you want to move this folder anyway?") - .arg(cDirectories[nCurrent]), + .arg(cDirectories[static_cast(nCurrent)]), QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); switch (ret) { diff --git a/Code/Editor/Util/ImageASC.cpp b/Code/Editor/Util/ImageASC.cpp index 11dad7b696..8a63ebdc6a 100644 --- a/Code/Editor/Util/ImageASC.cpp +++ b/Code/Editor/Util/ImageASC.cpp @@ -55,9 +55,9 @@ bool CImageASC::Save(const QString& fileName, const CFloatImage& image) fprintf(file, fileHeader.c_str()); // Then print all the pixels. - for (int y = 0; y < height; y++) + for (uint32 y = 0; y < height; y++) { - for (int x = 0; x < width; x++) + for (uint32 x = 0; x < width; x++) { fprintf(file, "%.7f ", pixels[x + y * width]); } diff --git a/Code/Editor/Util/ImageGif.cpp b/Code/Editor/Util/ImageGif.cpp index 2c07fc9acb..383319a666 100644 --- a/Code/Editor/Util/ImageGif.cpp +++ b/Code/Editor/Util/ImageGif.cpp @@ -185,7 +185,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) CLogFile::FormatLine("File not found %s", fileName.toUtf8().data()); return false; } - long filesize = file.GetLength(); + long filesize = static_cast(file.GetLength()); data.resize(filesize); uint8* ptr = &data[0]; diff --git a/Code/Editor/Util/ImageTIF.cpp b/Code/Editor/Util/ImageTIF.cpp index 654b24f857..6544b93c6a 100644 --- a/Code/Editor/Util/ImageTIF.cpp +++ b/Code/Editor/Util/ImageTIF.cpp @@ -119,7 +119,7 @@ bool CImageTIF::Load(const QString& fileName, CImageEx& outImage) std::vector data; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; @@ -210,7 +210,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) std::vector data; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; @@ -460,7 +460,7 @@ const char* CImageTIF::GetPreset(const QString& fileName) MemImage memImage; - memImage.size = file.GetLength(); + memImage.size = static_cast(file.GetLength()); data.resize(memImage.size); memImage.buffer = &data[0]; diff --git a/Code/Editor/Util/ImageUtil.cpp b/Code/Editor/Util/ImageUtil.cpp index 5753e0a138..00e33162cf 100644 --- a/Code/Editor/Util/ImageUtil.cpp +++ b/Code/Editor/Util/ImageUtil.cpp @@ -106,9 +106,9 @@ bool CImageUtil::SavePGM(const QString& fileName, const CImageEx& image) fprintf(file, fileHeader.c_str()); // Then print all the pixels. - for (int32 y = 0; y < height; y++) + for (uint32 y = 0; y < height; y++) { - for (int32 x = 0; x < width; x++) + for (uint32 x = 0; x < width; x++) { fprintf(file, "%d ", pixels[x + (y * width)]); } @@ -478,7 +478,7 @@ unsigned char CImageUtil::GetBilinearFilteredAt(const int iniX256, const int ini DWORD x = (DWORD)(iniX256) >> 8; DWORD y = (DWORD)(iniY256) >> 8; - if (x >= image.GetWidth() - 1 || y >= image.GetHeight() - 1) + if (x >= static_cast(image.GetWidth() - 1) || y >= static_cast(image.GetHeight() - 1)) { return image.ValueAt(x, y); // border is not filtered, 255 to get in range 0..1 } diff --git a/Code/Editor/Util/KDTree.cpp b/Code/Editor/Util/KDTree.cpp index 4547149e9b..182b9b8eb1 100644 --- a/Code/Editor/Util/KDTree.cpp +++ b/Code/Editor/Util/KDTree.cpp @@ -190,7 +190,7 @@ bool SearchForBestSplitPos(CKDTree::ESplitAxis axis, const std::vector(indices.size()); for (int i = 0; i < nSizeOfIndices; ++i) { @@ -329,7 +329,7 @@ bool CKDTree::Build(IStatObj* pStatObj) entireBoundBox.Reset(); std::vector indices; - for (int i = 0, iStatObjSize(m_StatObjectList.size()); i < iStatObjSize; ++i) + for (int i = 0, iStatObjSize = static_cast(m_StatObjectList.size()); i < iStatObjSize; ++i) { IIndexedMesh* pMesh = m_StatObjectList[i].pStatObj->GetIndexedMesh(true); if (pMesh == nullptr) diff --git a/Code/Editor/Util/NamedData.cpp b/Code/Editor/Util/NamedData.cpp index 240d71f58d..67e69a0392 100644 --- a/Code/Editor/Util/NamedData.cpp +++ b/Code/Editor/Util/NamedData.cpp @@ -158,7 +158,7 @@ bool CNamedData::Serialize(CArchive& ar) { if (ar.IsStoring()) { - int iSize = m_blocks.size(); + int iSize = static_cast(m_blocks.size()); ar << iSize; for (TBlocks::iterator it = m_blocks.begin(); it != m_blocks.end(); it++) @@ -286,7 +286,7 @@ bool CNamedData::Load(const QString& levelPath, [[maybe_unused]] CPakFile& pakFi CCryFile cfile; if (cfile.Open(Path::Make(levelPath, filename).toUtf8().data(), "rb")) { - int fileSize = cfile.GetLength(); + int fileSize = static_cast(cfile.GetLength()); if (fileSize > 0) { QString key = Path::GetFileName(filename); @@ -307,7 +307,7 @@ bool CNamedData::Load(const QString& levelPath, [[maybe_unused]] CPakFile& pakFi CCryFile cfile; if (cfile.Open(Path::Make(levelPath, filename).toUtf8().data(), "rb")) { - int fileSize = cfile.GetLength(); + int fileSize = static_cast(cfile.GetLength()); if (fileSize > 0) { // Read uncompressed data size. diff --git a/Code/Editor/Util/Variable.cpp b/Code/Editor/Util/Variable.cpp index 97c2a1e8af..3d7c35ac1c 100644 --- a/Code/Editor/Util/Variable.cpp +++ b/Code/Editor/Util/Variable.cpp @@ -511,7 +511,7 @@ CVarGlobalEnumList::CVarGlobalEnumList(const QString& enumName) //! Get the name of specified value in enumeration. QString CVarGlobalEnumList::GetItemName(uint index) { - if (!m_pEnum || index >= m_pEnum->strings.size()) + if (!m_pEnum || index >= static_cast(m_pEnum->strings.size())) { return QString(); } diff --git a/Code/Editor/Util/XmlArchive.cpp b/Code/Editor/Util/XmlArchive.cpp index ca399632d4..e6bc93fdf4 100644 --- a/Code/Editor/Util/XmlArchive.cpp +++ b/Code/Editor/Util/XmlArchive.cpp @@ -120,7 +120,7 @@ bool CXmlArchive::SaveToPak([[maybe_unused]] const QString& levelPath, CPakFile& // Save xml file. QString xmlFilename = "Level.editor_xml"; - pakFile.UpdateFile(xmlFilename.toUtf8().data(), (void*)pXmlStrData->GetString(), pXmlStrData->GetStringLength()); + pakFile.UpdateFile(xmlFilename.toUtf8().data(), (void*)pXmlStrData->GetString(), static_cast(pXmlStrData->GetStringLength())); if (pakFile.GetArchive()) { diff --git a/Code/Editor/WipFeatureManager.cpp b/Code/Editor/WipFeatureManager.cpp index f6fbc7ac93..4fb9ed1d93 100644 --- a/Code/Editor/WipFeatureManager.cpp +++ b/Code/Editor/WipFeatureManager.cpp @@ -189,7 +189,7 @@ bool CWipFeatureManager::Load(const char* pFilename, bool bClearExisting) for (size_t i = 0, iCount = root->getChildCount(); i < iCount; ++i) { SWipFeatureInfo wf; - XmlNodeRef node = root->getChild(i); + XmlNodeRef node = root->getChild(static_cast(i)); XmlString str; node->getAttr("id", wf.m_id); diff --git a/Code/Editor/WipFeaturesDlg.cpp b/Code/Editor/WipFeaturesDlg.cpp index 0d0a179539..bc4372d7fb 100644 --- a/Code/Editor/WipFeaturesDlg.cpp +++ b/Code/Editor/WipFeaturesDlg.cpp @@ -35,7 +35,7 @@ public: int rowCount(const QModelIndex& parent = QModelIndex()) const override { - return parent.isValid() ? 0 : CWipFeatureManager::Instance()->GetFeatures().size(); + return parent.isValid() ? 0 : static_cast(CWipFeatureManager::Instance()->GetFeatures().size()); } int columnCount(const QModelIndex& parent = QModelIndex()) const override From 1f5dddcca6f6b01f991d8b76c4e09ea23ccf8bbf Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 17:13:14 -0700 Subject: [PATCH 057/100] Code compiles Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Controls/SplineCtrlEx.cpp | 2 +- Code/Editor/CryEdit.cpp | 2 +- Code/Editor/EditorViewportWidget.cpp | 2 +- Code/Editor/Objects/EntityObject.cpp | 4 ++-- Code/Editor/TrackView/TrackViewAnimNode.cpp | 4 ++-- Code/Editor/TrackView/TrackViewDialog.cpp | 4 ++-- .../TrackView/TrackViewDopeSheetBase.cpp | 22 +++++++++---------- Code/Editor/TrackView/TrackViewNodes.cpp | 6 ++--- Code/Editor/TrackView/TrackViewSequence.cpp | 6 ++--- Code/Editor/Util/MemoryBlock.cpp | 2 +- .../Animation/UiAnimViewDopeSheetBase.cpp | 18 +++++++-------- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index 9eb0098762..5bba14f0d6 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -1856,7 +1856,7 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point // Check tangent handles first. { QPoint incomingHandlePt, outgoingHandlePt, pt; - if (GetTangentHandlePts(incomingHandlePt, pt, outgoingHandlePt, splineIndex, i, nCurrentDimension)) + if (GetTangentHandlePts(incomingHandlePt, pt, outgoingHandlePt, static_cast(splineIndex), static_cast(i), nCurrentDimension)) { // For the incoming handle if (abs(incomingHandlePt.x() - point.x()) < 4 && abs(incomingHandlePt.y() - point.y()) < 4) diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index cbc4b89d0a..280613815e 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -3922,7 +3922,7 @@ void CCryEditApp::OpenLUAEditor(const char* files) void CCryEditApp::PrintAlways(const AZStd::string& output) { - m_stdoutRedirection.WriteBypassingRedirect(output.c_str(), output.size()); + m_stdoutRedirection.WriteBypassingRedirect(output.c_str(), static_cast(output.size())); } QString CCryEditApp::GetRootEnginePath() const diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 50e6e5d67d..701386951a 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1899,7 +1899,7 @@ void EditorViewportWidget::RenderSelectedRegion() // Draw volume dc.DepthWriteOff(); dc.CullOff(); - dc.pRenderAuxGeom->DrawTriangles(&verts[0], verts.size(), &inds[0], numInds, &colors[0]); + dc.pRenderAuxGeom->DrawTriangles(&verts[0], static_cast(verts.size()), &inds[0], numInds, &colors[0]); dc.CullOn(); dc.DepthWriteOn(); } diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index 02f89c268f..afbf370ca8 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -1540,7 +1540,7 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event) if (m_eventTargets[i].target == target) { RemoveEventTarget(i); - numTargets = m_eventTargets.size(); + numTargets = static_cast(m_eventTargets.size()); i--; } } @@ -1553,7 +1553,7 @@ void CEntityObject::OnObjectEvent(CBaseObject* target, int event) if (m_links[i].target == target) { RemoveEntityLink(i); - numTargets = m_eventTargets.size(); + numTargets = static_cast(m_eventTargets.size()); i--; } } diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index dd6fb8f936..4b599859e9 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -1477,7 +1477,7 @@ bool CTrackViewAnimNode::PasteNodesFromClipboard(QWidget* context) AZStd::map copiedIdToNodeMap; const unsigned int numNodes = animNodesRoot->getChildCount(); - for (int i = 0; i < numNodes; ++i) + for (unsigned int i = 0; i < numNodes; ++i) { XmlNodeRef xmlNode = animNodesRoot->getChild(i); @@ -2123,7 +2123,7 @@ bool CTrackViewAnimNode::ContainsComponentWithId(AZ::ComponentId componentId) co if (GetType() == AnimNodeType::AzEntity) { // search for a matching componentId on all children - for (int i = 0; i < GetChildCount(); i++) + for (unsigned int i = 0; i < GetChildCount(); i++) { CTrackViewNode* childNode = GetChild(i); if (childNode->GetNodeType() == eTVNT_AnimNode) diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index bdec68e928..da3e7cebe2 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -1991,7 +1991,7 @@ void CTrackViewDialog::UpdateTracksToolBar() &Maestro::EditorSequenceComponentRequestBus::Events::GetAllAnimatablePropertiesForComponent, animatableProperties, azEntityId, pAnimNode->GetComponentId()); - paramCount = animatableProperties.size(); + paramCount = static_cast(animatableProperties.size()); } } else @@ -2317,7 +2317,7 @@ void CTrackViewDialog::SaveCurrentSequenceToFBX() CTrackViewTrackBundle allTracks = sequence->GetAllTracks(); - for (int trackID = 0; trackID < allTracks.GetCount(); ++trackID) + for (unsigned int trackID = 0; trackID < allTracks.GetCount(); ++trackID) { CTrackViewTrack* pCurrentTrack = allTracks.GetTrack(trackID); diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index 0ff7cc6ca9..f74d51c421 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -1556,7 +1556,7 @@ void CTrackViewDopeSheetBase::MouseMoveMove(const QPoint& p, [[maybe_unused]] Qt const TrackMemento& trackMemento = iter->second; pTrack->RestoreFromMemento(trackMemento.m_memento); - const unsigned int numKeys = trackMemento.m_keySelectionStates.size(); + const unsigned int numKeys = static_cast(trackMemento.m_keySelectionStates.size()); for (unsigned int i = 0; i < numKeys; ++i) { pTrack->GetKey(i).Select(trackMemento.m_keySelectionStates[i]); @@ -1946,7 +1946,7 @@ void CTrackViewDopeSheetBase::ChangeSequenceTrackSelection(CTrackViewSequence* s CTrackViewTrackBundle prevSelectedTracks; prevSelectedTracks = sequenceWithTrack->GetSelectedTracks(); - for (int i = 0; i < prevSelectedTracks.GetCount(); i++) + for (unsigned int i = 0; i < prevSelectedTracks.GetCount(); i++) { CTrackViewTrack* prevSelectedTrack = prevSelectedTracks.GetTrack(i); if (prevSelectedTrack != trackToSelect) @@ -2023,7 +2023,7 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT AzToolsFramework::ScopedUndoBatch undoBatch("Set Key"); const unsigned int numChildNodes = pTrack->GetChildCount(); - for (int i = 0; i < numChildNodes; ++i) + for (unsigned int i = 0; i < numChildNodes; ++i) { CTrackViewTrack* subTrack = static_cast(pTrack->GetChild(i)); if (IsOkToAddKeyHere(subTrack, keyTime)) @@ -2083,7 +2083,7 @@ void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo void CTrackViewDopeSheetBase::UpdateColorKeyHelper(const ColorF& color) { const unsigned int numChildNodes = m_colorUpdateTrack->GetChildCount(); - for (int i = 0; i < numChildNodes; ++i) + for (unsigned int i = 0; i < numChildNodes; ++i) { CTrackViewTrack* subTrack = static_cast(m_colorUpdateTrack->GetChild(i)); CTrackViewKeyHandle subTrackKey = subTrack->GetKeyByTime(m_colorUpdateKeyTime); @@ -2258,7 +2258,7 @@ void CTrackViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKey } else // A compound track { - for (int k = 0; k < pCurrTrack->GetChildCount(); ++k) + for (unsigned int k = 0; k < pCurrTrack->GetChildCount(); ++k) { CTrackViewTrack* pSubTrack = static_cast(pCurrTrack->GetChild(k)); if (IsOkToAddKeyHere(pSubTrack, keyTime)) @@ -2293,7 +2293,7 @@ void CTrackViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKey else { AzToolsFramework::ScopedUndoBatch undoBatch("Create Key"); - for (int i = 0; i < pTrack->GetChildCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetChildCount(); ++i) { CTrackViewTrack* pSubTrack = static_cast(pTrack->GetChild(i)); if (IsOkToAddKeyHere(pSubTrack, keyTime)) @@ -3094,7 +3094,7 @@ void CTrackViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSelec // note the tracks to select for the keyHandles selected CTrackViewTrackBundle tracksToSelect; - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CTrackViewTrack* pTrack = tracks.GetTrack(i); @@ -3108,7 +3108,7 @@ void CTrackViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSelec (rc.bottom() >= trackRect.top() && rc.bottom() <= trackRect.bottom())) { // Check which keys we intersect. - for (int j = 0; j < pTrack->GetKeyCount(); j++) + for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++) { CTrackViewKeyHandle keyHandle = pTrack->GetKey(j); @@ -3175,7 +3175,7 @@ void CTrackViewDopeSheetBase::DrawSelectedKeyIndicators(QPainter* painter) painter->setPen(Qt::green); CTrackViewKeyBundle keys = pSequence->GetSelectedKeys(); - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { const CTrackViewKeyHandle& keyHandle = keys.GetKey(i); int x = TimeToClient(keyHandle.GetTime()); @@ -3423,7 +3423,7 @@ void CTrackViewDopeSheetBase::DrawSummary(QPainter* painter, const QRect& rcUpda // Draw a short thick line at each place where there is a key in any tracks. CTrackViewKeyBundle keys = pSequence->GetAllKeys(); - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { const CTrackViewKeyHandle& keyHandle = keys.GetKey(i); int x = TimeToClient(keyHandle.GetTime()); @@ -3635,7 +3635,7 @@ void CTrackViewDopeSheetBase::StoreMementoForTracksWithSelectedKeys() std::set tracks; const unsigned int numKeys = selectedKeys.GetKeyCount(); - for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) + for (unsigned int keyIndex = 0; keyIndex < numKeys; ++keyIndex) { CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex); tracks.insert(keyHandle.GetTrack()); diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index 4d6249288e..b64df7e2eb 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -1765,7 +1765,7 @@ void CTrackViewNodesCtrl::ImportFromFBX() pSpline->SetKeyInTangent(keyIndex, inTangent); } - if (keyIndex < (pTrack->GetKeyCount() - 1)) + if (keyIndex < static_cast(pTrack->GetKeyCount() - 1)) { CTrackViewKeyHandle nextKey = key.GetNextKey(); if (nextKey.IsValid()) @@ -2352,7 +2352,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con QStringList splittedName = name.split("/", Qt::SkipEmptyParts); STrackMenuTreeNode* pCurrentNode = &menuAddTrack; - for (unsigned int j = 0; j < splittedName.size() - 1; ++j) + for (int j = 0; j < splittedName.size() - 1; ++j) { const QString& segment = splittedName[j]; auto findIter = pCurrentNode->children.find(segment); @@ -2652,7 +2652,7 @@ void CTrackViewNodesCtrl::CreateSetAnimationLayerPopupMenu(QMenu& menuSetLayer, CTrackViewTrackBundle animationTracks = pTrack->GetAnimNode()->GetTracksByParam(AnimParamType::Animation); const unsigned int numAnimationTracks = animationTracks.GetCount(); - for (int i = 0; i < numAnimationTracks; ++i) + for (unsigned int i = 0; i < numAnimationTracks; ++i) { CTrackViewTrack* pAnimationTrack = animationTracks.GetTrack(i); if (pAnimationTrack) diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index 28279be0e3..f66e5276cd 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -1403,7 +1403,7 @@ float CTrackViewSequence::ClipTimeOffsetForSliding(const float timeOffset) for (pTrackIter = tracks.begin(); pTrackIter != tracks.end(); ++pTrackIter) { CTrackViewTrack* pTrack = *pTrackIter; - for (int i = 0; i < pTrack->GetKeyCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { const CTrackViewKeyHandle& keyHandle = pTrack->GetKey(i); @@ -1486,7 +1486,7 @@ void CTrackViewSequence::CloneSelectedKeys() std::vector selectedKeyTimes; for (size_t k = 0; k < selectedKeys.GetKeyCount(); ++k) { - CTrackViewKeyHandle skey = selectedKeys.GetKey(k); + CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast(k)); if (pTrack != skey.GetTrack()) { pTrack = skey.GetTrack(); @@ -1498,7 +1498,7 @@ void CTrackViewSequence::CloneSelectedKeys() // Now, do the actual cloning. for (size_t k = 0; k < selectedKeyTimes.size(); ++k) { - CTrackViewKeyHandle skey = selectedKeys.GetKey(k); + CTrackViewKeyHandle skey = selectedKeys.GetKey(static_cast(k)); skey = skey.GetTrack()->GetKeyByTime(selectedKeyTimes[k]); assert(skey.IsValid()); diff --git a/Code/Editor/Util/MemoryBlock.cpp b/Code/Editor/Util/MemoryBlock.cpp index 03d432762d..e840a1735e 100644 --- a/Code/Editor/Util/MemoryBlock.cpp +++ b/Code/Editor/Util/MemoryBlock.cpp @@ -175,7 +175,7 @@ void CMemoryBlock::Uncompress(CMemoryBlock& toBlock) const #endif uncompress((unsigned char*)toBlock.GetBuffer(), &destSize, (unsigned char*)GetBuffer(), GetSize()); assert(result == Z_OK); - assert(destSize == m_uncompressedSize); + assert(destSize == static_cast(m_uncompressedSize)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index 12f1eeac4d..82d05a6f67 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -1632,7 +1632,7 @@ float CUiAnimViewDopeSheetBase::MagnetSnap(float newTime, const CUiAnimViewAnimN newTime = keys.GetKey(0).GetTime(); // But if there is an in-range key in a sibling track, use it instead. // Here a 'sibling' means a track that belongs to a same node. - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = keys.GetKey(i); if (keyHandle.GetTrack()->GetAnimNode() == pNode) @@ -1770,7 +1770,7 @@ bool CUiAnimViewDopeSheetBase::CreateColorKey(CUiAnimViewTrack* pTrack, float ke CUiAnimViewSequenceNotificationContext context(pTrack->GetSequence()); const unsigned int numChildNodes = pTrack->GetChildCount(); - for (int i = 0; i < numChildNodes; ++i) + for (unsigned int i = 0; i < numChildNodes; ++i) { CUiAnimViewTrack* subTrack = static_cast(pTrack->GetChild(i)); if (IsOkToAddKeyHere(subTrack, keyTime)) @@ -1890,7 +1890,7 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe } else // A compound track { - for (int k = 0; k < pCurrTrack->GetChildCount(); ++k) + for (unsigned int k = 0; k < pCurrTrack->GetChildCount(); ++k) { CUiAnimViewTrack* pSubTrack = static_cast(pCurrTrack->GetChild(k)); if (IsOkToAddKeyHere(pSubTrack, keyTime)) @@ -1921,7 +1921,7 @@ void CUiAnimViewDopeSheetBase::AddKeys(const QPoint& point, const bool bTryAddKe else { RecordTrackUndo(pTrack); - for (int i = 0; i < pTrack->GetChildCount(); ++i) + for (unsigned int i = 0; i < pTrack->GetChildCount(); ++i) { CUiAnimViewTrack* pSubTrack = static_cast(pTrack->GetChild(i)); if (IsOkToAddKeyHere(pSubTrack, keyTime)) @@ -2619,7 +2619,7 @@ void CUiAnimViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSele CUiAnimViewTrackBundle tracks = pSequence->GetAllTracks(); - for (int i = 0; i < tracks.GetCount(); ++i) + for (unsigned int i = 0; i < tracks.GetCount(); ++i) { CUiAnimViewTrack* pTrack = tracks.GetTrack(i); @@ -2633,7 +2633,7 @@ void CUiAnimViewDopeSheetBase::SelectKeys(const QRect& rc, const bool bMultiSele (rc.bottom() >= trackRect.top() && rc.bottom() <= trackRect.bottom())) { // Check which keys we intersect. - for (int j = 0; j < pTrack->GetKeyCount(); j++) + for (unsigned int j = 0; j < pTrack->GetKeyCount(); j++) { CUiAnimViewKeyHandle keyHandle = pTrack->GetKey(j); @@ -2700,7 +2700,7 @@ void CUiAnimViewDopeSheetBase::DrawSelectedKeyIndicators(QPainter* painter) painter->setPen(Qt::green); CUiAnimViewKeyBundle keys = pSequence->GetSelectedKeys(); - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = keys.GetKey(i); int x = TimeToClient(keyHandle.GetTime()); @@ -2951,7 +2951,7 @@ void CUiAnimViewDopeSheetBase::DrawSummary(QPainter* painter, const QRect& rcUpd // Draw a short thick line at each place where there is a key in any tracks. CUiAnimViewKeyBundle keys = pSequence->GetAllKeys(); - for (int i = 0; i < keys.GetKeyCount(); ++i) + for (unsigned int i = 0; i < keys.GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = keys.GetKey(i); int x = TimeToClient(keyHandle.GetTime()); @@ -3112,7 +3112,7 @@ void CUiAnimViewDopeSheetBase::StoreMementoForTracksWithSelectedKeys() std::set tracks; const unsigned int numKeys = selectedKeys.GetKeyCount(); - for (int keyIndex = 0; keyIndex < numKeys; ++keyIndex) + for (unsigned int keyIndex = 0; keyIndex < numKeys; ++keyIndex) { CUiAnimViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex); tracks.insert(keyHandle.GetTrack()); From 14e77543348bbdbd6edc05379759bee797b9c994 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 17:46:37 -0700 Subject: [PATCH 058/100] More fixes for warnings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Tools/Uploader/ToolsCrashUploader.cpp | 9 +++++-- .../Source/GameLiftServerSDKWrapper.cpp | 8 ++++++- .../Windows/GameCrashUploader_windows.cpp | 24 ++++++++++--------- ...AnimGraphStateMachineInterruptionTests.cpp | 2 +- .../ScriptCanvas/Core/NodeFunctionGeneric.h | 3 +++ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp b/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp index b33aa183f3..3247e8d2bf 100644 --- a/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp +++ b/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp @@ -72,10 +72,15 @@ namespace O3de return true; } #if !AZ_TRAIT_OS_PLATFORM_APPLE - AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option") + #if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + char noConfirmation[64]{}; + size_t variableSize = 0; + auto err = getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM"); + if (variableSize == 0) + #else const char* noConfirmation = getenv("LY_NO_CONFIRM"); - AZ_POP_DISABLE_WARNING if (noConfirmation == nullptr) + #endif { int argCount = 0; diff --git a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp index ae4fe7b0f4..7e216f33be 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftServer/Source/GameLiftServerSDKWrapper.cpp @@ -54,7 +54,13 @@ namespace AWSGameLift } char buffer[50]; - strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&terminationTime)); + tm time; +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + gmtime_s(&time, &terminationTime); +#else + time = *gmtime(&terminationTime); +#endif + strftime(buffer, sizeof(buffer), "%FT%TZ", &time); return AZStd::string(buffer); } diff --git a/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp b/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp index d8def1885e..c4ddb50c53 100644 --- a/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp +++ b/Gems/CrashReporting/Code/Platform/Windows/GameCrashUploader_windows.cpp @@ -7,14 +7,11 @@ */ #include +#include #include #include -#include -#include -#include - namespace O3de { @@ -22,21 +19,26 @@ namespace O3de { if (!m_noConfirmation) { +#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS + char noConfirmation[64]{}; + size_t variableSize = 0; + getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM"); + if (variableSize == 0) +#else const char* noConfirmation = getenv("LY_NO_CONFIRM"); if (noConfirmation == nullptr) +#endif + { - - std::wstring sendDialogMessage; - - std::wstring_convert> converter; - sendDialogMessage = converter.from_bytes(m_executableName); + AZStd::wstring sendDialogMessage; + AZStd::to_wstring(sendDialogMessage, m_executableName.c_str()); sendDialogMessage += L" has encountered a fatal error. We're sorry for the inconvenience.\n\nA crash debugging file has been created at:\n"; - sendDialogMessage += report.file_path.value(); + sendDialogMessage += report.file_path.value().c_str(); sendDialogMessage += L"\n\nIf you are willing to submit this file to Amazon it will help us improve the Lumberyard experience. We will treat this report as confidential.\n\nWould you like to send the error report?"; int msgboxID = MessageBoxW( - NULL, + nullptr, sendDialogMessage.data(), L"Send Error Report", (MB_ICONEXCLAMATION | MB_YESNO | MB_SYSTEMMODAL) diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp index 1f700129c0..39fc296d9f 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp @@ -165,7 +165,7 @@ namespace EMotionFX for (const auto& activeObjects : activeObjectsAtFrame) { - if (activeObjects.m_frameNr == frame) + if (activeObjects.m_frameNr == static_cast(frame)) { // Check which states and transitions are active and compare it to the expected ones. EXPECT_EQ(activeObjects.m_stateA, compareAgainst.m_stateA) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h index 41a674536b..e9586ac83a 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h @@ -181,9 +181,12 @@ namespace ScriptCanvas : public Node { public: + AZ_PUSH_DISABLE_WARNING(5046, "-Wunknown-warning-option") // 'function' : Symbol involving type with internal linkage not defined AZ_RTTI(((NodeFunctionGenericMultiReturn), "{DC5B1799-6C5B-4190-8D90-EF0C2D1BCE4E}", t_Func, t_Traits), Node); AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE(NodeFunctionGenericMultiReturn); AZ_COMPONENT_BASE(NodeFunctionGenericMultiReturn, Node); + AZ_POP_DISABLE_WARNING + static const char* GetNodeFunctionName() { From 0eacd54b14ff74ac5f615d10aafbfee1d27c8de0 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 17:47:37 -0700 Subject: [PATCH 059/100] removing unnecessary bigobj flags from files (its applied globally) Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Common/MSVC/editor_lib_msvc.cmake | 5 ---- .../Framework/AzToolsFramework/CMakeLists.txt | 1 - .../Common/Clang/aztoolsframework_clang.cmake | 7 ----- .../Common/MSVC/aztoolsframework_msvc.cmake | 13 --------- .../MSVC/pythonassetbuilder_tests_msvc.cmake | 10 ------- Gems/ScriptCanvasTesting/Code/CMakeLists.txt | 2 -- ...riptcanvastesting_editor_tests_clang.cmake | 7 ----- ...criptcanvastesting_editor_tests_msvc.cmake | 28 ------------------- 8 files changed, 73 deletions(-) delete mode 100644 Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake delete mode 100644 Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake delete mode 100644 Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake delete mode 100644 Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake diff --git a/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake b/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake index cd72cfb3d8..7a325ca97e 100644 --- a/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake +++ b/Code/Editor/Platform/Common/MSVC/editor_lib_msvc.cmake @@ -5,8 +5,3 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT # # -ly_add_source_properties( - SOURCES MainWindow.cpp CryEdit.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) diff --git a/Code/Framework/AzToolsFramework/CMakeLists.txt b/Code/Framework/AzToolsFramework/CMakeLists.txt index 62f4f43d93..2754dd19eb 100644 --- a/Code/Framework/AzToolsFramework/CMakeLists.txt +++ b/Code/Framework/AzToolsFramework/CMakeLists.txt @@ -20,7 +20,6 @@ ly_add_target( AzToolsFramework/aztoolsframework_files.cmake AzToolsFramework/aztoolsframework_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake Platform/${PAL_PLATFORM_NAME}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - Platform/Common/${PAL_TRAIT_COMPILER_ID}/aztoolsframework_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PUBLIC . diff --git a/Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake b/Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake deleted file mode 100644 index 7a325ca97e..0000000000 --- a/Code/Framework/AzToolsFramework/Platform/Common/Clang/aztoolsframework_clang.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# diff --git a/Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake b/Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake deleted file mode 100644 index 1a34f54a63..0000000000 --- a/Code/Framework/AzToolsFramework/Platform/Common/MSVC/aztoolsframework_msvc.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -ly_add_source_properties( - SOURCES AzToolsFramework/Application/ToolsApplication.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) diff --git a/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake b/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake index b2c4543e99..7a325ca97e 100644 --- a/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake +++ b/Gems/PythonAssetBuilder/Code/Source/Platform/Common/MSVC/pythonassetbuilder_tests_msvc.cmake @@ -5,13 +5,3 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT # # - -ly_add_source_properties( - SOURCES - Tests/PythonAssetBuilderTest.cpp - Tests/PythonBuilderRegisterTest.cpp - Tests/PythonBuilderCreateJobsTest.cpp - Tests/PythonBuilderProcessJobTest.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) diff --git a/Gems/ScriptCanvasTesting/Code/CMakeLists.txt b/Gems/ScriptCanvasTesting/Code/CMakeLists.txt index 23c9627e83..29360912d8 100644 --- a/Gems/ScriptCanvasTesting/Code/CMakeLists.txt +++ b/Gems/ScriptCanvasTesting/Code/CMakeLists.txt @@ -87,8 +87,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) NAMESPACE Gem FILES_CMAKE scriptcanvastestingeditor_tests_files.cmake - PLATFORM_INCLUDE_FILES - Platform/Common/${PAL_TRAIT_COMPILER_ID}/scriptcanvastesting_editor_tests_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake INCLUDE_DIRECTORIES PRIVATE . diff --git a/Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake b/Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake deleted file mode 100644 index 7a325ca97e..0000000000 --- a/Gems/ScriptCanvasTesting/Code/Platform/Common/Clang/scriptcanvastesting_editor_tests_clang.cmake +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# diff --git a/Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake b/Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake deleted file mode 100644 index 3ea56febcb..0000000000 --- a/Gems/ScriptCanvasTesting/Code/Platform/Common/MSVC/scriptcanvastesting_editor_tests_msvc.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -ly_add_source_properties( - SOURCES - Source/Framework/ScriptCanvasTestUtilities.cpp - Tests/ScriptCanvas_BehaviorContext.cpp - Tests/ScriptCanvas_ContainerSupport.cpp - Tests/ScriptCanvas_Core.cpp - Tests/ScriptCanvas_EventHandlers.cpp - Tests/ScriptCanvas_Math.cpp - Tests/ScriptCanvas_MethodOverload.cpp - Tests/ScriptCanvas_NodeGenerics.cpp - Tests/ScriptCanvas_Regressions.cpp - Tests/ScriptCanvas_RuntimeInterpreted.cpp - Tests/ScriptCanvas_Slots.cpp - Tests/ScriptCanvas_StringNodes.cpp - Tests/ScriptCanvas_UnitTesting.cpp - Tests/ScriptCanvas_Variables.cpp - Tests/ScriptCanvas_VM.cpp - PROPERTY COMPILE_OPTIONS - VALUES -bigobj -) From 0cb66584eb30275ff5f1d6817e92003868650674 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 13 Aug 2021 17:51:49 -0700 Subject: [PATCH 060/100] small fix, everything compiling with VS2022 Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp b/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp index 3247e8d2bf..74f271e7c0 100644 --- a/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp +++ b/Code/Tools/CrashHandler/Tools/Uploader/ToolsCrashUploader.cpp @@ -75,7 +75,7 @@ namespace O3de #if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS char noConfirmation[64]{}; size_t variableSize = 0; - auto err = getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM"); + getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM"); if (variableSize == 0) #else const char* noConfirmation = getenv("LY_NO_CONFIRM"); From 230e0c697693d5e90f835123c0b037a56e4ee253 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:54:08 -0700 Subject: [PATCH 061/100] remove disabling of some warnings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 4e2ec5a852..02db57ca21 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -113,8 +113,6 @@ endif() ly_set(LY_CXX_SYSTEM_INCLUDE_CONFIGURATION_FLAG /experimental:external # Turns on "external" headers feature for MSVC compilers /external:W0 # Set warning level in external headers to 0. This is used to suppress warnings 3rdParty libraries which uses the "system_includes" option in their json configuration - /wd4193 # Temporary workaround for the /experiment:external feature generating warning C4193: #pragma warning(pop): no matching '#pragma warning(push)' - /wd4702 # Despite we set it to W0, we found that 3rdParty::OpenMesh was issuing these warnings while using some template functions. Disabling it here does the trick ) if(NOT CMAKE_INCLUDE_SYSTEM_FLAG_CXX) ly_set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX /external:I) From 06e6f83907d2fb423f60216d2c6bbc0489d7b563 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:54:35 -0700 Subject: [PATCH 062/100] Cleanup and fixing of Code/Framework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Framework/AzCore/AzCore/Jobs/Algorithms.h | 9 ------ .../Math/Internal/SimdMathVec4_scalar.inl | 9 ++---- .../Framework/AzCore/AzCore/Math/Quaternion.h | 7 ---- Code/Framework/AzCore/AzCore/Math/Vector2.h | 7 ---- Code/Framework/AzCore/AzCore/Math/Vector3.h | 7 ---- Code/Framework/AzCore/AzCore/Math/Vector4.h | 8 ----- .../AzCore/AzCore/Memory/dlmalloc.inl | 25 ++++----------- Code/Framework/AzCore/AzCore/PlatformDef.h | 3 -- .../AzCore/AzCore/RTTI/BehaviorContext.h | 11 +------ .../AzCore/AzCore/Serialization/EditContext.h | 21 ++++++------ .../AzCore/AzCore/std/delegate/delegate.h | 11 ++----- .../AzCore/std/function/function_base.h | 14 -------- .../AzCore/std/function/function_template.h | 9 ------ .../internal/concurrent_hash_table.h | 32 ++++++++++--------- .../AzCore/AzCore/std/smart_ptr/weak_ptr.h | 4 --- .../AzCore/AzCore/std/string/regex.h | 9 ------ Code/Framework/AzCore/Tests/Jobs.cpp | 2 +- .../Json/MathMatrixSerializerTests.cpp | 1 - 18 files changed, 40 insertions(+), 149 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h b/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h index 27efde7e64..a45846c107 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h +++ b/Code/Framework/AzCore/AzCore/Jobs/Algorithms.h @@ -13,11 +13,6 @@ #include -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable: 4355) // 'this' : used in base member initializer list -#endif - // A reasonable define for a stack allocator size for the high level jobs. #define AZ_JOBS_DEFAULT_STACK_ALLOCATOR_SIZE AZStd::GetMax(2048,512 * AZStd::thread::hardware_concurrency()) @@ -769,9 +764,5 @@ namespace AZ } } -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif - #endif #pragma once diff --git a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl index 7320c9be1c..484351c799 100644 --- a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl +++ b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl @@ -10,12 +10,9 @@ #include -#ifdef _MSC_VER // Unity builds on windows using the scalar backend are tripping some really strange warning behavior.. // Disable the warning so we can test the scalar implementation with unity on windows -# pragma warning (push) -# pragma warning (disable: 4723) // Potential divide by zero -#endif +AZ_PUSH_DISABLE_WARNING(4723, "-Wunknown-warning-option") // Potential divide by zero namespace AZ { @@ -1049,6 +1046,4 @@ namespace AZ } } -#ifdef _MSC_VER -# pragma warning (pop) -#endif +AZ_POP_DISABLE_WARNING \ No newline at end of file diff --git a/Code/Framework/AzCore/AzCore/Math/Quaternion.h b/Code/Framework/AzCore/AzCore/Math/Quaternion.h index 36def91817..f2c266ed3e 100644 --- a/Code/Framework/AzCore/AzCore/Math/Quaternion.h +++ b/Code/Framework/AzCore/AzCore/Math/Quaternion.h @@ -246,10 +246,6 @@ namespace AZ //! Takes the absolute value of each component of the quaternion. Quaternion GetAbs() const; -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec4::FloatType m_value; @@ -263,9 +259,6 @@ namespace AZ float m_w; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Non-member functionality belonging to the AZ namespace diff --git a/Code/Framework/AzCore/AzCore/Math/Vector2.h b/Code/Framework/AzCore/AzCore/Math/Vector2.h index c667f48010..b2b1ceeb4d 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector2.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector2.h @@ -281,10 +281,6 @@ namespace AZ private: -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec2::FloatType m_value; @@ -296,9 +292,6 @@ namespace AZ float m_y; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Allows pre-multiplying by a float. diff --git a/Code/Framework/AzCore/AzCore/Math/Vector3.h b/Code/Framework/AzCore/AzCore/Math/Vector3.h index 6b7ded5641..4bf0a18894 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector3.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector3.h @@ -312,10 +312,6 @@ namespace AZ private: -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec3::FloatType m_value; @@ -328,9 +324,6 @@ namespace AZ float m_z; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; //! Non member functionality belonging to the AZ namespace. diff --git a/Code/Framework/AzCore/AzCore/Math/Vector4.h b/Code/Framework/AzCore/AzCore/Math/Vector4.h index 7ae0350805..6bd67e8831 100644 --- a/Code/Framework/AzCore/AzCore/Math/Vector4.h +++ b/Code/Framework/AzCore/AzCore/Math/Vector4.h @@ -283,11 +283,6 @@ namespace AZ Simd::Vec4::FloatType GetSimdValue() const; protected: - -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable:4201) // anonymous union -#endif union { Simd::Vec4::FloatType m_value; @@ -301,9 +296,6 @@ namespace AZ float m_w; }; }; -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif }; } diff --git a/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl b/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl index 861e2de7ac..3756fbb36c 100644 --- a/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl +++ b/Code/Framework/AzCore/AzCore/Memory/dlmalloc.inl @@ -1294,14 +1294,6 @@ int mspace_mallopt(int, int); /*------------------------------ internal #includes ---------------------- */ -#ifdef WIN32 -#pragma warning(push) -#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ -# ifdef AZ_PLATFORM_WINDOWS -# pragma warning( disable : 4267 ) -# endif -#endif /* WIN32 */ - #include /* for printing in malloc_stats */ #ifndef LACKS_ERRNO_H @@ -2170,7 +2162,7 @@ typedef unsigned int flag_t; /* The type of various bit flag sets */ #define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) /* Bounds on request (not chunk) sizes. */ -#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) +#define MAX_REQUEST ((~MIN_CHUNK_SIZE + 1) << 2) #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) /* pad request bytes into a usable size */ @@ -2881,10 +2873,10 @@ static size_t traverse_and_check(mstate m); #define treemap_is_marked(M, i) ((M)->treemap & idx2bit(i)) /* isolate the least set bit of a bitmap */ -#define least_bit(x) ((x) & - (x)) +#define least_bit(x) ((x) & (~(x)+1)) /* mask with all bits to left of least bit of x on */ -#define left_bits(x) ((x << 1) | -(x << 1)) +#define left_bits(x) ((x << 1) | (~(x << 1)+1)) /* mask with all bits to left of or equal to least bit of x on */ #define same_or_left_bits(x) ((x) | -(x)) @@ -4528,7 +4520,7 @@ static int sys_trim(mstate m, size_t pad) static void* tmalloc_large(mstate m, size_t nb) { tchunkptr v = 0; - size_t rsize = -nb; /* Unsigned negation */ + size_t rsize = ~nb+1; /* Unsigned negation */ tchunkptr t; bindex_t idx; compute_tree_index(nb, idx); @@ -4807,7 +4799,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) char* br = (char*)mem2chunk((size_t)(((size_t)(mem + alignment - SIZE_T_ONE)) & - - alignment)); + (~alignment+1))); char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE) ? br : br + alignment; mchunkptr newp = (mchunkptr)pos; @@ -5489,7 +5481,7 @@ postaction: size_t msize; ensure_initialization(); msize = pad_request(sizeof(struct malloc_state)); - if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) + if (capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1)) { size_t rs = ((capacity == 0) ? mparams.granularity : (capacity + TOP_FOOT_SIZE + msize)); @@ -5512,7 +5504,7 @@ postaction: ensure_initialization(); msize = pad_request(sizeof(struct malloc_state)); if (capacity > msize + TOP_FOOT_SIZE && - capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) + capacity < (~(msize + TOP_FOOT_SIZE + mparams.page_size)+1)) { m = init_user_mstate((char*)base, capacity); m->seg.sflags = EXTERN_BIT; @@ -6367,6 +6359,3 @@ postaction: */ -#ifdef WIN32 -#pragma warning(pop) -#endif /* WIN32 */ diff --git a/Code/Framework/AzCore/AzCore/PlatformDef.h b/Code/Framework/AzCore/AzCore/PlatformDef.h index 55126fdf4c..47f45931ba 100644 --- a/Code/Framework/AzCore/AzCore/PlatformDef.h +++ b/Code/Framework/AzCore/AzCore/PlatformDef.h @@ -87,9 +87,6 @@ #define AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_WARNING # define AZ_FORCE_INLINE __forceinline -#if !defined(_DEBUG) -# pragma warning(disable:4714) //warning C4714 marked as __forceinline not inlined. Sadly this happens when LTCG during linking. We tried to NOT use force inline but VC 2012 is bad at inlining. -#endif /// Aligns a declaration. # define AZ_ALIGN(_decl, _alignment) \ diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index 42fc762769..0c4eaf8383 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -24,11 +24,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - namespace AZStd { template @@ -4507,7 +4502,7 @@ namespace AZ params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::Result], nullptr); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::UserData], nullptr); - if (sizeof...(Args) > 0) + if constexpr (sizeof...(Args) > 0) { SetParameters(¶ms[eBehaviorBusForwarderEventIndices::ParameterFirst], nullptr); } @@ -4872,10 +4867,6 @@ namespace AZ } // namespace Internal } // namespace AZ -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif - // pull AzStd on demand reflection #include #include diff --git a/Code/Framework/AzCore/AzCore/Serialization/EditContext.h b/Code/Framework/AzCore/AzCore/Serialization/EditContext.h index 492550f266..a08e971ac4 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/EditContext.h +++ b/Code/Framework/AzCore/AzCore/Serialization/EditContext.h @@ -656,26 +656,25 @@ namespace AZ using ElementType = typename AZStd::Utils::if_c::value, typename ElementTypeInfo::Type, typename ElementTypeInfo::ElementType>::type; AZ_Assert(m_classData->m_typeId == AzTypeInfo::Uuid(), "Data element (%s) belongs to a different class!", AzTypeInfo::Name()); -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif const SerializeContext::ClassData* classData = m_context->m_serializeContext.FindClassData(AzTypeInfo::Uuid()); if (classData && classData->m_editData) { return DataElement(uiId, memberVariable, classData->m_editData->m_name, classData->m_editData->m_description); } - else if (AZStd::is_enum::value && AzTypeInfo::Name() != nullptr) + else { - auto enumIter = m_context->m_enumData.find(AzTypeInfo::Uuid()); - if (enumIter != m_context->m_enumData.end()) + if constexpr (AZStd::is_enum::value) { - return DataElement(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description); + if (AzTypeInfo::Name() != nullptr) + { + auto enumIter = m_context->m_enumData.find(AzTypeInfo::Uuid()); + if (enumIter != m_context->m_enumData.end()) + { + return DataElement(uiId, memberVariable, enumIter->second.m_name, enumIter->second.m_description); + } + } } } -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif const char* typeName = AzTypeInfo::Name(); return DataElement(uiId, memberVariable, typeName, typeName); diff --git a/Code/Framework/AzCore/AzCore/std/delegate/delegate.h b/Code/Framework/AzCore/AzCore/std/delegate/delegate.h index 610c1982f2..1b44437f31 100644 --- a/Code/Framework/AzCore/AzCore/std/delegate/delegate.h +++ b/Code/Framework/AzCore/AzCore/std/delegate/delegate.h @@ -291,9 +291,7 @@ namespace AZStd template <> struct SimplifyMemFunc { -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 4121) // alignment of a member was sensitive to packing + AZ_PUSH_DISABLE_WARNING(4121, "-Wunknown-warning-option") // alignment of a member was sensitive to packing // GenericClass* (X::*ProbeFunc) changes it's size. From Microsoft: // Jason Shirk [MSFT] // This is a known bug/issue. Unfortunately, we can't fix it in X86 product @@ -302,7 +300,6 @@ namespace AZStd // We have addressed the issue for all future platforms (including IA64) where // binary compatibility isn't yet an issue. // We can fix this warning by adding forward decl class __single_inheritance CLASS; if the XFuncType is member function. -#endif template inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind, GenericMemFuncType& bound_func) { @@ -330,11 +327,7 @@ namespace AZStd u.s.codeptr = u2.s.codeptr; return (pthis->*u.ProbeFunc)(); } - -#if defined(AZ_COMPILER_MSVC) -# pragma warning(default: 4121) // alignment of a member was sensitive to packing -# pragma warning(pop) -#endif + AZ_POP_DISABLE_WARNING }; // Nasty hack for Microsoft and Intel (IA32 and Itanium) diff --git a/Code/Framework/AzCore/AzCore/std/function/function_base.h b/Code/Framework/AzCore/AzCore/std/function/function_base.h index c1dd669f51..32892a4c03 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_base.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_base.h @@ -20,13 +20,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4793 ) // complaint about native code generation -# pragma warning( disable : 4127 ) // "conditional expression is constant" -# pragma warning( disable : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast' -#endif - #define AZSTD_FUNCTION_TARGET_FIX(x) #define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t, Type> @@ -796,12 +789,5 @@ namespace AZStd //#undef aztypeid //#undef aztypeid_cmp -#if defined(AZ_COMPILER_MSVC) -# pragma warning( default : 4793 ) // complaint about native code generation -# pragma warning( default : 4127 ) // "conditional expression is constant" -# pragma warning( default : 4275 ) // non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_cast' -# pragma warning( pop ) -#endif - #endif // AZSTD_FUNCTION_BASE_HEADER #pragma once diff --git a/Code/Framework/AzCore/AzCore/std/function/function_template.h b/Code/Framework/AzCore/AzCore/std/function/function_template.h index 586b02e671..7f388c4006 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_template.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_template.h @@ -13,11 +13,6 @@ #include #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4127 ) // "conditional expression is constant" -#endif - namespace AZStd { namespace Internal @@ -689,7 +684,3 @@ namespace AZStd } }; } // end namespace AZStd - -#if defined(AZ_COMPILER_MSVC) -# pragma warning( pop ) -#endif diff --git a/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h b/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h index 524eff7e64..c8fc709778 100644 --- a/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h +++ b/Code/Framework/AzCore/AzCore/std/parallel/containers/internal/concurrent_hash_table.h @@ -489,24 +489,26 @@ namespace AZStd { return; } - - float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets(); - if (loadFactor > max_load_factor()) + else { - acquire_all(); - - //check the load factor again, as another thread may have beaten us to the rehash - size_type numElements = m_numElements.load(memory_order_acquire); - float maxLoadFactor = max_load_factor(); - size_type numBuckets = m_storage.get_num_buckets(); - loadFactor = (float)numElements / (float)numBuckets; - if (loadFactor > maxLoadFactor) + float loadFactor = (float)m_numElements.load(memory_order_acquire) / (float)m_storage.get_num_buckets(); + if (loadFactor > max_load_factor()) { - size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor); - m_storage.rehash(this, minNumBuckets); - } + acquire_all(); - release_all(); + // check the load factor again, as another thread may have beaten us to the rehash + size_type numElements = m_numElements.load(memory_order_acquire); + float maxLoadFactor = max_load_factor(); + size_type numBuckets = m_storage.get_num_buckets(); + loadFactor = (float)numElements / (float)numBuckets; + if (loadFactor > maxLoadFactor) + { + size_type minNumBuckets = (size_type)((float)numElements / maxLoadFactor); + m_storage.rehash(this, minNumBuckets); + } + + release_all(); + } } } diff --git a/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h b/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h index aaaf90e8f7..80dee72d03 100644 --- a/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h +++ b/Code/Framework/AzCore/AzCore/std/smart_ptr/weak_ptr.h @@ -192,9 +192,5 @@ namespace AZStd } } // namespace AZStd -/*#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif */ - #endif // #ifndef AZSTD_SMART_PTR_WEAK_PTR_H #pragma once diff --git a/Code/Framework/AzCore/AzCore/std/string/regex.h b/Code/Framework/AzCore/AzCore/std/string/regex.h index 2c120436d5..2ca223937b 100644 --- a/Code/Framework/AzCore/AzCore/std/string/regex.h +++ b/Code/Framework/AzCore/AzCore/std/string/regex.h @@ -22,11 +22,6 @@ // used for std::pointer_traits \note do an AZStd version #include -#if defined(AZ_COMPILER_MSVC) -# pragma warning(push) -# pragma warning(disable: 6011 28198) -#endif // AZ_COMPILER_MSVC - #ifndef AZ_REGEX_MAX_COMPLEXITY_COUNT #define AZ_REGEX_MAX_COMPLEXITY_COUNT 10000000L /* set to 0 to disable */ #endif /* AZ_REGEX_MAX_COMPLEXITY_COUNT */ @@ -4766,7 +4761,3 @@ namespace AZStd Trans(); } } // namespace AZStd - -#if defined(AZ_COMPILER_MSVC) -# pragma warning(pop) -#endif // AZ_COMPILER_MSVC diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index 4a1af4cc24..0eb46a0051 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -1736,7 +1736,7 @@ namespace Benchmark std::numeric_limits::max()); std::generate(m_randomPriorities.begin(), m_randomPriorities.end(), [&randomPriorityDistribution, &randomPriorityGenerator]() { - return randomPriorityDistribution(randomPriorityGenerator); + return static_cast(randomPriorityDistribution(randomPriorityGenerator)); }); // Generate some random depths diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp index ca558d1624..1126aeb662 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp @@ -225,7 +225,6 @@ namespace JsonSerializationTests static_assert((RowCount >= 3 && RowCount <= 4) && (ColumnCount >= 3 && ColumnCount <= 4), "Only matrix 3x3, 3x4 or 4x4 are supported by this test."); } - return "{}"; } void ConfigureFeatures(JsonSerializerConformityTestDescriptorFeatures& features) override From 3eb658534b3c0596ee32c94b49fc0ae59dd10ade Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:55:06 -0700 Subject: [PATCH 063/100] More Code/Framework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzFramework/AzFramework/Archive/Archive.cpp | 13 ++++--------- .../AzFramework/Physics/Common/PhysicsTypes.h | 2 +- .../AzNetworking/Utilities/QuantizedValues.h | 2 +- .../AzNetworking/Utilities/QuantizedValues.inl | 9 +-------- .../AzQtComponents/Components/Widgets/SliderCombo.h | 4 ++++ .../Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp | 2 +- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index a0dda9f692..962c82614f 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -347,17 +347,12 @@ namespace AZ::IO::ArchiveInternal return EOF; } int c = EOF; - int i; - for (i = 0; i < 1; i++) + if (m_nCurSeek == GetFileSize()) { - if (i + m_nCurSeek == GetFileSize()) - { - return c; - } - c = pData[i + m_nCurSeek]; - break; + return c; } - m_nCurSeek += i + 1; + c = pData[m_nCurSeek]; + m_nCurSeek += 1; return c; } } diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h index bb53d6d3dd..30f3fb6297 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h @@ -56,7 +56,7 @@ namespace AzPhysics //! A handle to a Scene within the physics simulation. //! A SceneHandle is a tuple of a Crc of the scenes name and the index in the Scene list. using SceneHandle = AZStd::tuple; - static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), -1 }; + static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), AZ::s8(-1) }; //! Ease of use type for referencing a List of SceneHandle objects. using SceneHandleList = AZStd::vector; diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h index 190a32ddc7..46e778d5b3 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h @@ -176,7 +176,7 @@ namespace AzNetworking //! Takes a quantized integral value and stores the floating point representation. void DecodeQuantizedValues(); - AZ_PUSH_DISABLE_WARNING(4201 4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment union { float m_quantizedValues[NUM_ELEMENTS]; diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl index b0a424d48a..86e736928a 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.inl @@ -218,14 +218,7 @@ namespace AzNetworking { SerializeType serializedValue = static_cast(m_serializeValues[i]); -#ifdef AZ_COMPILER_MSVC -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - if (NUM_BYTES == 3) -#ifdef AZ_COMPILER_MSVC -# pragma warning(pop) -#endif + if constexpr (NUM_BYTES == 3) { uint8_t lowByte = static_cast((serializedValue & 0x000000FF) ); uint8_t midByte = static_cast((serializedValue & 0x0000FF00) >> 8); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h index 7baa386784..2646162af4 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/SliderCombo.h @@ -40,6 +40,8 @@ namespace AzQtComponents //! Current value. Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) public: + using value_type = int; + explicit SliderCombo(QWidget *parent = nullptr); ~SliderCombo(); @@ -142,6 +144,8 @@ namespace AzQtComponents Q_PROPERTY(double curveMidpoint READ curveMidpoint WRITE setCurveMidpoint) public: + using value_type = double; + explicit SliderDoubleCombo(QWidget *parent = nullptr); ~SliderDoubleCombo(); diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp index a6c1e27caf..dd29654416 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/Benchmark/PrefabLoadBenchmarks.cpp @@ -16,7 +16,7 @@ namespace Benchmark BENCHMARK_DEFINE_F(BM_PrefabLoad, LoadPrefab_Basic)(::benchmark::State& state) { - const unsigned int numTemplates = state.range(); + const unsigned int numTemplates = static_cast(state.range()); CreateFakePaths(numTemplates); for (auto _ : state) From 14990012f812693ea5698e42bed239c06b543745 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:55:20 -0700 Subject: [PATCH 064/100] Code/Legacy Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CrySystem/CmdLine.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Code/Legacy/CrySystem/CmdLine.cpp b/Code/Legacy/CrySystem/CmdLine.cpp index 50b8b2c092..702709ffe5 100644 --- a/Code/Legacy/CrySystem/CmdLine.cpp +++ b/Code/Legacy/CrySystem/CmdLine.cpp @@ -192,7 +192,6 @@ AZStd::string CCmdLine::Next(char*& src) return AZStd::string(org, src); } - ch = *src++; } return AZStd::string(); From b255334535b61c632adb6a803eac0791007d678f Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:55:41 -0700 Subject: [PATCH 065/100] Code/Tools fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp | 2 +- .../native/tests/resourcecompiler/RCBuilderTest.cpp | 2 +- .../native/unittests/RCcontrollerUnitTests.cpp | 2 +- .../native/utilities/BatchApplicationServer.cpp | 2 +- .../native/utilities/PlatformConfiguration.cpp | 4 ++-- .../native/utilities/UnitTestShaderCompilerServer.cpp | 2 +- .../ProjectManager/Source/GemCatalog/GemItemDelegate.cpp | 8 ++++---- .../Source/GemCatalog/GemRequirementDelegate.cpp | 6 +++--- Code/Tools/ProjectManager/Source/ProjectUtils.cpp | 6 +++--- Code/Tools/ProjectManager/Source/PythonBindings.cpp | 2 -- .../Artifact/Factory/TestImpactTestRunSuiteFactory.cpp | 2 +- 11 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp b/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp index 7702cc259d..eb6cc4033c 100644 --- a/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp +++ b/Code/Tools/AssetProcessor/AssetBuilder/AssetBuilderComponent.cpp @@ -337,7 +337,7 @@ bool AssetBuilderComponent::ConnectToAssetProcessor() AZStd::string overridePort; if (GetParameter(s_paramPort, overridePort, false)) { - connectionSettings.m_assetProcessorPort = AZStd::stoi(overridePort); + connectionSettings.m_assetProcessorPort = static_cast(AZStd::stoi(overridePort)); } //the asset builder may have been given an optional asset platform to use diff --git a/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp b/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp index 7a78786258..2465be2b33 100644 --- a/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp +++ b/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp @@ -814,7 +814,7 @@ public: AssetRecognizer good; good.m_name = "Good"; - good.m_version = versionNumber; + good.m_version = static_cast(versionNumber); good.m_patternMatcher = AssetBuilderSDK::FilePatternMatcher("*.foo", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard); good.m_platformSpecs["pc"] = good_spec; good.m_productAssetType = builderProductType; diff --git a/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp b/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp index a3f5c117ea..0f5fea5eb9 100644 --- a/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp +++ b/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp @@ -147,7 +147,7 @@ void RCcontrollerUnitTests::RunRCControllerTests() if (returnedCount != expectedCount) { - Q_EMIT UnitTestFailed("RCJobListModel has " + QString(returnedCount) + " elements, which is invalid. Expected " + expectedCount); + Q_EMIT UnitTestFailed("RCJobListModel has " + QString(returnedCount) + " elements, which is invalid. Expected " + QString(expectedCount)); return; } diff --git a/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp b/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp index 8a7974c615..e7ebc030e6 100644 --- a/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/BatchApplicationServer.cpp @@ -38,7 +38,7 @@ bool BatchApplicationServer::startListening(unsigned short port) // Since we're starting up builders ourselves and informing them of the port chosen, we can scan for a free port - while (!listen(QHostAddress::Any, m_serverListeningPort)) + while (!listen(QHostAddress::Any, static_cast(m_serverListeningPort))) { auto error = serverError(); diff --git a/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp b/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp index 782e145ad6..07106614cf 100644 --- a/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp @@ -197,7 +197,7 @@ namespace AssetProcessor } else if (valueName == "order") { - scanFolderEntry.m_scanOrder = value; + scanFolderEntry.m_scanOrder = static_cast(value); } } @@ -475,7 +475,7 @@ namespace AssetProcessor RCAssetRecognizer& assetRecognizer = *assetRecognizerEntryIt; if (valueName == "priority") { - assetRecognizer.m_recognizer.m_priority = value; + assetRecognizer.m_recognizer.m_priority = static_cast(value); } } diff --git a/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp b/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp index 18e1730de5..88e8520e3c 100644 --- a/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/UnitTestShaderCompilerServer.cpp @@ -49,7 +49,7 @@ void UnitTestShaderCompilerServer::startServer() { if (!m_server->isListening()) { - if (!m_server->listen(QHostAddress(m_serverAddress), m_serverPort)) + if (!m_server->listen(QHostAddress(m_serverAddress), static_cast(m_serverPort))) { AZ_TracePrintf(AssetProcessor::DebugChannel, "Server %s could not start.\n", m_serverAddress.toUtf8().data()); emit errorMessage("Server could not start "); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp index 08e08afdd5..21bb56daef 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp @@ -29,7 +29,7 @@ namespace O3DE::ProjectManager { QPixmap pixmap(iconPath); qreal aspectRatio = static_cast(pixmap.width()) / pixmap.height(); - m_platformIcons.insert(platform, QIcon(iconPath).pixmap(s_platformIconSize * aspectRatio, s_platformIconSize)); + m_platformIcons.insert(platform, QIcon(iconPath).pixmap(static_cast(static_cast(s_platformIconSize) * aspectRatio), s_platformIconSize)); } void GemItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const @@ -48,7 +48,7 @@ namespace O3DE::ProjectManager CalcRects(options, fullRect, itemRect, contentRect); QFont standardFont(options.font); - standardFont.setPixelSize(s_fontSize); + standardFont.setPixelSize(static_cast(s_fontSize)); QFontMetrics standardFontMetrics(standardFont); painter->save(); @@ -78,7 +78,7 @@ namespace O3DE::ProjectManager QString gemName = GemModel::GetName(modelIndex); QFont gemNameFont(options.font); const int firstColumnMaxTextWidth = s_summaryStartX - 30; - gemNameFont.setPixelSize(s_gemNameFontSize); + gemNameFont.setPixelSize(static_cast(s_gemNameFontSize)); gemNameFont.setBold(true); gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth); QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize); @@ -178,7 +178,7 @@ namespace O3DE::ProjectManager QRect GemItemDelegate::GetTextRect(QFont& font, const QString& text, qreal fontSize) const { - font.setPixelSize(fontSize); + font.setPixelSize(static_cast(fontSize)); return QFontMetrics(font).boundingRect(text); } diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp index 655f6055f1..0d5f752858 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemRequirementDelegate.cpp @@ -35,7 +35,7 @@ namespace O3DE::ProjectManager CalcRects(options, fullRect, itemRect, contentRect); QFont standardFont(options.font); - standardFont.setPixelSize(s_fontSize); + standardFont.setPixelSize(static_cast(s_fontSize)); QFontMetrics standardFontMetrics(standardFont); painter->save(); @@ -55,10 +55,10 @@ namespace O3DE::ProjectManager QFont gemNameFont(options.font); const int firstColumnMaxTextWidth = s_summaryStartX - 30; gemName = QFontMetrics(gemNameFont).elidedText(gemName, Qt::TextElideMode::ElideRight, firstColumnMaxTextWidth); - gemNameFont.setPixelSize(s_gemNameFontSize); + gemNameFont.setPixelSize(static_cast(s_gemNameFontSize)); gemNameFont.setBold(true); QRect gemNameRect = GetTextRect(gemNameFont, gemName, s_gemNameFontSize); - gemNameRect.moveTo(contentRect.left(), contentRect.center().y() - s_gemNameFontSize); + gemNameRect.moveTo(contentRect.left(), contentRect.center().y() - static_cast(s_gemNameFontSize)); painter->setFont(gemNameFont); painter->setPen(m_textColor); diff --git a/Code/Tools/ProjectManager/Source/ProjectUtils.cpp b/Code/Tools/ProjectManager/Source/ProjectUtils.cpp index fb0ea23ece..fb3f7e0270 100644 --- a/Code/Tools/ProjectManager/Source/ProjectUtils.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectUtils.cpp @@ -117,7 +117,7 @@ namespace O3DE::ProjectManager const int updateStatusEvery = 64; if (outFileCount % updateStatusEvery == 0) { - statusCallback(outFileCount, outTotalSizeInBytes); + statusCallback(outFileCount, static_cast(outTotalSizeInBytes)); } } } @@ -163,7 +163,7 @@ namespace O3DE::ProjectManager } QLocale locale; - const float progressDialogRangeHalf = qFabs(progressDialog->maximum() - progressDialog->minimum()) * 0.5f; + const float progressDialogRangeHalf = static_cast(qFabs(progressDialog->maximum() - progressDialog->minimum()) * 0.5f); for (const QString& file : original.entryList(QDir::Files)) { if (progressDialog->wasCanceled()) @@ -184,7 +184,7 @@ namespace O3DE::ProjectManager // for cases combining many small files and some really large files. const float normalizedNumFiles = static_cast(outNumCopiedFiles) / filesToCopyCount; const float normalizedFileSize = static_cast(outCopiedFileSize) / totalSizeToCopy; - const int progress = normalizedNumFiles * progressDialogRangeHalf + normalizedFileSize * progressDialogRangeHalf; + const int progress = static_cast(normalizedNumFiles * progressDialogRangeHalf + normalizedFileSize * progressDialogRangeHalf); progressDialog->setValue(progress); const QString copiedFileSizeString = locale.formattedDataSize(outCopiedFileSize); diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 8bdfb0f152..18901946f3 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -434,8 +434,6 @@ namespace O3DE::ProjectManager { return AZ::Success(AZStd::move(engineInfo)); } - - return AZ::Failure(); } bool PythonBindings::SetEngineInfo(const EngineInfo& engineInfo) diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp index 5fe7c08535..f5d7d3a8a2 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp @@ -95,7 +95,7 @@ namespace TestImpact const auto getResult = [](const AZ::rapidxml::xml_node<>* node) { - for (auto child_node = node->first_node("failure"); child_node; child_node = child_node->next_sibling()) + if (auto child_node = node->first_node("failure")) { return TestRunResult::Failed; } From 8cef306efb7e3d26fc09390f153b3a454d263837 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:55:56 -0700 Subject: [PATCH 066/100] Code/Editor Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Util/Contrib/NvFloatMath.inl | 1 - Code/Editor/Util/ImageHistogram.cpp | 2 +- Code/Editor/Util/ImageTIF.cpp | 8 ++++---- Code/Editor/Util/PakFile.cpp | 2 +- Code/Editor/Util/VariablePropertyType.cpp | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Code/Editor/Util/Contrib/NvFloatMath.inl b/Code/Editor/Util/Contrib/NvFloatMath.inl index 218d77b749..6bd3b9f7c5 100644 --- a/Code/Editor/Util/Contrib/NvFloatMath.inl +++ b/Code/Editor/Util/Contrib/NvFloatMath.inl @@ -103,7 +103,6 @@ it hasn't been integrated into this code drop yet. ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#pragma warning(disable:4996) class TVec { diff --git a/Code/Editor/Util/ImageHistogram.cpp b/Code/Editor/Util/ImageHistogram.cpp index 15f6bc2e47..acea2dc340 100644 --- a/Code/Editor/Util/ImageHistogram.cpp +++ b/Code/Editor/Util/ImageHistogram.cpp @@ -220,5 +220,5 @@ void CImageHistogram::ComputeStatisticsForChannel(int aIndex) } } - m_median[aIndex] = median; + m_median[aIndex] = static_cast(median); } diff --git a/Code/Editor/Util/ImageTIF.cpp b/Code/Editor/Util/ImageTIF.cpp index 6544b93c6a..7929d63030 100644 --- a/Code/Editor/Util/ImageTIF.cpp +++ b/Code/Editor/Util/ImageTIF.cpp @@ -79,7 +79,7 @@ libtiffDummySeekProc (thandle_t fd, toff_t off, int i) switch (i) { case SEEK_SET: - memImage->offset = off; + memImage->offset = static_cast(off); break; case SEEK_CUR: @@ -87,11 +87,11 @@ libtiffDummySeekProc (thandle_t fd, toff_t off, int i) break; case SEEK_END: - memImage->offset = memImage->size - off; + memImage->offset = static_cast(memImage->size - off); break; default: - memImage->offset = off; + memImage->offset = static_cast(off); break; } @@ -262,7 +262,7 @@ bool CImageTIF::Load(const QString& fileName, CFloatImage& outImage) } } - uint32 linesize = TIFFScanlineSize(tif); + uint32 linesize = static_cast(TIFFScanlineSize(tif)); uint8* linebuf = static_cast(_TIFFmalloc(linesize)); // We assume that a scanline has all of the samples in it. Validate the assumption. diff --git a/Code/Editor/Util/PakFile.cpp b/Code/Editor/Util/PakFile.cpp index 88d5598495..fc8431ef24 100644 --- a/Code/Editor/Util/PakFile.cpp +++ b/Code/Editor/Util/PakFile.cpp @@ -106,7 +106,7 @@ bool CPakFile::UpdateFile(const char* filename, CCryMemFile& file, bool bCompres { if (m_pArchive) { - int nSize = file.GetLength(); + int nSize = static_cast(file.GetLength()); UpdateFile(filename, file.GetMemPtr(), nSize, bCompress); file.Close(); diff --git a/Code/Editor/Util/VariablePropertyType.cpp b/Code/Editor/Util/VariablePropertyType.cpp index 17c80a505c..3f472dde72 100644 --- a/Code/Editor/Util/VariablePropertyType.cpp +++ b/Code/Editor/Util/VariablePropertyType.cpp @@ -171,7 +171,7 @@ namespace Prop { // Limit step size to 1000. int nPrec = max(3 - int(log(m_rangeMax - m_rangeMin) / log(10.f)), 0); - m_step = max(m_step, powf(10.f, -nPrec)); + m_step = max(m_step, powf(10.f, static_cast(-nPrec))); } } From e6b5342c0765cbc9dce339d39951dbf79a08af3e Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:56:10 -0700 Subject: [PATCH 067/100] Gems/Atom Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Converters/Cubemap.cpp | 10 +++---- .../Code/Tests/ImageProcessing_Test.cpp | 5 ++-- .../External/CubeMapGen/CCubeMapProcessor.cpp | 30 +++++++++---------- .../External/CubeMapGen/CImageSurface.cpp | 2 +- .../External/CubeMapGen/VectorMacros.h | 2 +- .../DirectionalLightFeatureProcessor.cpp | 5 ++-- .../ProjectedShadowFeatureProcessor.cpp | 14 ++++----- .../Window/ToolBar/LightingPresetComboBox.cpp | 4 +-- .../Window/ToolBar/ModelPresetComboBox.cpp | 4 +-- 9 files changed, 39 insertions(+), 37 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp index cd01d955d1..4f13c6f9bf 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/Cubemap.cpp @@ -191,7 +191,7 @@ namespace ImageProcessingAtom } //for each pixel in dst image, find it's location in src and copy the data from there - float halfSize = rectSize / 2; + float halfSize = static_cast(rectSize / 2); for (AZ::u32 row = 0; row < rectSize; row++) { for (AZ::u32 col = 0; col < rectSize; col++) @@ -201,8 +201,8 @@ namespace ImageProcessingAtom float dstY = halfSize - row - 0.5f; float srcX = dstX * mtx[0] + dstY * mtx[1]; float srcY = dstX * mtx[2] + dstY * mtx[3]; - AZ::u32 srcCol = srcX + halfSize; - AZ::u32 srcRow = halfSize - srcY; + AZ::u32 srcCol = static_cast(srcX + halfSize); + AZ::u32 srcRow = static_cast(halfSize - srcY); memcpy(&dstImageBuf[(row * rectSize + col) * bytePerPixel], &srcImageBuf[(srcRow * rectSize + srcCol) * bytePerPixel], bytePerPixel); @@ -464,7 +464,7 @@ namespace ImageProcessingAtom else { //transform the image - TransformImage(srcDir, dstDir, buf, tempBuf, sizePerPixel, faceSize); + TransformImage(srcDir, dstDir, buf, tempBuf, static_cast(sizePerPixel), faceSize); dstCubemap->SetFaceData(face, tempBuf, outSize); } } @@ -649,7 +649,7 @@ namespace ImageProcessingAtom preset.m_cubemapSetting->m_mipSlope, //MipAnglePerLevelScale, (int)preset.m_cubemapSetting->m_filter, //FilterType, CP_FILTER_TYPE_COSINE for diffuse cube preset.m_cubemapSetting->m_edgeFixup > 0 ? CP_FIXUP_PULL_LINEAR : CP_FIXUP_NONE, //FixupType, CP_FIXUP_PULL_LINEAR if FixupWidth> 0 - preset.m_cubemapSetting->m_edgeFixup, //FixupWidth, + static_cast(preset.m_cubemapSetting->m_edgeFixup), //FixupWidth, true, //bUseSolidAngle, 16, //GlossScale, 0, //GlossBias diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp index 3ac9c334c5..4b28fbe4ef 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp @@ -269,11 +269,11 @@ namespace UnitTest public: //helper function to save an image object to a file through QtImage - static void SaveImageToFile(const IImageObjectPtr imageObject, const AZStd::string imageName, AZ::u32 maxMipCnt = 100) + static void SaveImageToFile([[maybe_unused]] const IImageObjectPtr imageObject, [[maybe_unused]] const AZStd::string imageName, [[maybe_unused]] AZ::u32 maxMipCnt = 100) { #ifndef DEBUG_OUTPUT_IMAGES return; - #endif + #else if (imageObject == nullptr) { return; @@ -314,6 +314,7 @@ namespace UnitTest QImage qimage(imageBuf, width, height, pitch, QImage::Format_RGBA8888); qimage.save(filePath); } + #endif } static bool GetComparisonResult(IImageObjectPtr image1, IImageObjectPtr image2, QString& output) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp index fa861c739a..8a4d727e8c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.cpp @@ -8,7 +8,7 @@ #include #include -#define CP_PI 3.14159265358979323846 +#define CP_PI 3.14159265358979323846f namespace ImageProcessingAtom @@ -259,10 +259,10 @@ namespace ImageProcessingAtom //get face idx and u, v texel coordinate in face VectToTexelCoord(a_XYZ, a_Surface[0].m_Width, &faceIdx, &u, &v ); - u = VM_MIN((int32)u, a_Surface[0].m_Width - 1); - v = VM_MIN((int32)v, a_Surface[0].m_Width - 1); + u = static_cast(VM_MIN((int32)u, a_Surface[0].m_Width - 1)); + v = static_cast(VM_MIN((int32)v, a_Surface[0].m_Width - 1)); - return( a_Surface[faceIdx].GetSurfaceTexelPtr(u, v) ); + return( a_Surface[faceIdx].GetSurfaceTexelPtr(static_cast(u), static_cast(v)) ); } //-------------------------------------------------------------------------------------- @@ -357,7 +357,7 @@ namespace ImageProcessingAtom VM_XPROD3_UNTYPED(xProdVect, edgeVect0, edgeVect1 ); texelArea += 0.5f * sqrt( VM_DOTPROD3_UNTYPED(xProdVect, xProdVect ) ); - return texelArea; + return static_cast(texelArea); } @@ -1130,7 +1130,7 @@ namespace ImageProcessingAtom // if p0 = 0 and p1 = 1, and d0 and d1 = 0, the interpolation reduces to // // p(t) = - 2t^3 + 3t^2 - fixupWeight = ((-2.0 * fixupFrac + 3.0) * fixupFrac * fixupFrac); + fixupWeight = ((-2.0f * fixupFrac + 3.0f) * fixupFrac * fixupFrac); } break; case CP_FIXUP_AVERAGE_LINEAR: @@ -1147,7 +1147,7 @@ namespace ImageProcessingAtom break; case CP_FIXUP_AVERAGE_HERMITE: { - fixupWeight = ((-2.0 * fixupFrac + 3.0) * fixupFrac * fixupFrac); + fixupWeight = ((-2.0f * fixupFrac + 3.0f) * fixupFrac * fixupFrac); //perform weighted average of edge tap value and current tap // fade off weight using hermite spline with distance from edge @@ -1538,7 +1538,7 @@ namespace ImageProcessingAtom // Find angle for which: cos(a) ^ cosinePower = epsilon const float epsilon = 0.000001f; float angle = acosf(powf(epsilon, 1.0f / cosinePower)); - angle *= 180.0f / (float)CP_PI; + angle *= 180.0f / CP_PI; angle *= 2.0f; return angle; @@ -1555,7 +1555,7 @@ namespace ImageProcessingAtom bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // float(bits) * 2^-32 + return float(bits) * 2.3283064365386963e-10f; // float(bits) * 2^-32 } inline void HammersleySequence(uint32 sampleIndex, uint32 sampleCount, float* vXi) @@ -1668,7 +1668,7 @@ namespace ImageProcessingAtom float mip = 0.5f * log2f(solidAngleSample / solidAngleTexel) + 1.0f; //determine surrounding mip levels - uint32 mipA = floor(mip); + uint32 mipA = static_cast(floor(mip)); uint32 mipB = mipA + 1; float lerp = 0.0f; VM_CLAMP(lerp, mip - mipA, 0.0f, 1.0f); @@ -1819,7 +1819,7 @@ namespace ImageProcessingAtom float filterAngle; //min angle a src texel can cover (in degrees) - srcTexelAngle = (180.0f / (float)CP_PI) * atan2f(1.0f, (float)a_SrcCubeMapWidth); + srcTexelAngle = (180.0f / CP_PI) * atan2f(1.0f, (float)a_SrcCubeMapWidth); //filter angle is 1/2 the cone angle filterAngle = a_FilterConeAngle / 2.0f; @@ -1870,7 +1870,7 @@ namespace ImageProcessingAtom const int32 dstSize = a_DstCubeMap[0].m_Width; //min angle a src texel can cover (in degrees) - const float srcTexelAngle = (180.0f / (float)CP_PI) * atan2f(1.0f, (float)srcSize); + const float srcTexelAngle = (180.0f / CP_PI) * atan2f(1.0f, (float)srcSize); //angle about center tap to define filter cone float filterAngle; @@ -1897,7 +1897,7 @@ namespace ImageProcessingAtom //dotProdThresh threshold based on cone angle to determine whether or not taps // reside within the cone angle - const float dotProdThresh = cosf( ((float)CP_PI / 180.0f) * filterAngle ); + const float dotProdThresh = cosf( (CP_PI / 180.0f) * filterAngle ); //thread progress m_ThreadProgress[a_ThreadIdx].m_StartFace = a_FaceIdxStart; @@ -2004,8 +2004,8 @@ namespace ImageProcessingAtom else if( a_FilterType == CP_FILTER_TYPE_ANGULAR_GAUSSIAN ) { //fit 3 standard deviations within angular extent of filter - CP_ITYPE stdDev = (a_FilterAngle * CP_PI / 180.0) / 3.0; - CP_ITYPE inv2Variance = 1.0 / (2.0 * stdDev * stdDev); + CP_ITYPE stdDev = (a_FilterAngle * CP_PI / 180.0f) / 3.0f; + CP_ITYPE inv2Variance = 1.0f / (2.0f * stdDev * stdDev); for(iLUTEntry=0; iLUTEntry>= (23 - 10); //assemble s10e5 number using logical operations - rawf16Data = (signVal << 15) | (exponent << 10) | mantissa; + rawf16Data = static_cast((signVal << 15) | (exponent << 10) | mantissa); //return re-assembled raw data as a 32 bit float return rawf16Data; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h index 0db22d03d6..42ec07e02c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/VectorMacros.h @@ -125,7 +125,7 @@ //normalize vectors #define VM_NORM3_UNTYPED(d, s) {double __idsq; __idsq=1.0/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; } -#define VM_NORM3_UNTYPED_F32(d, s) {float __idsq; __idsq=1.0/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; } +#define VM_NORM3_UNTYPED_F32(d, s) {float __idsq; __idsq=1.0f/sqrt(VM_DOTPROD3_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; } #define VM_NORM3(d, s) VM_NORM3_UNTYPED_F32(((float *)(d)), ((float *)(s))) #define VM_NORM4_UNTYPED(d, s) {double __idsq; __idsq=1.0/sqrt(VM_DOTPROD4_UNTYPED(s,s)); d[0]=s[0]*__idsq; d[1]=s[1]*__idsq; d[2]=s[2]*__idsq; d[3]=s[3]*__idsq; } diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 1fff70ce59..6a418117fc 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -933,9 +933,10 @@ namespace AZ uint16_t DirectionalLightFeatureProcessor::GetCascadeCount(LightHandle handle) const { - for (const auto& segmentIt : m_shadowProperties.GetData(handle.GetIndex()).m_segments) + const auto& segments = m_shadowProperties.GetData(handle.GetIndex()).m_segments; + if (!segments.empty()) { - return aznumeric_cast(segmentIt.second.size()); + return aznumeric_cast(segments.begin()->second.size()); } return 0; } diff --git a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp index 5a25951163..0e42c5520e 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp @@ -539,9 +539,10 @@ namespace AZ::Render { esmPass->QueueForBuildAndInitialization(); } - - for (ProjectedShadowmapsPass* shadowPass : m_projectedShadowmapsPasses) + + if (!m_projectedShadowmapsPasses.empty()) { + const ProjectedShadowmapsPass* shadowPass = m_projectedShadowmapsPasses.front(); for (const auto& shadowProperty : shadowProperties) { const int16_t shadowIndexInSrg = shadowProperty.m_shadowId.GetIndex(); @@ -553,7 +554,6 @@ namespace AZ::Render filterData.m_shadowmapOriginInSlice = origin.m_originInSlice; m_deviceBufferNeedsUpdate = true; } - break; } m_shadowmapPassNeedsUpdate = false; @@ -571,8 +571,9 @@ namespace AZ::Render void ProjectedShadowFeatureProcessor::PrepareViews(const PrepareViewsPacket&, AZStd::vector>& outViews) { - for (ProjectedShadowmapsPass* pass : m_projectedShadowmapsPasses) + if (!m_projectedShadowmapsPasses.empty()) { + ProjectedShadowmapsPass* pass = m_projectedShadowmapsPasses.front(); RPI::RenderPipeline* renderPipeline = pass->GetRenderPipeline(); if (renderPipeline) { @@ -598,7 +599,6 @@ namespace AZ::Render outViews.emplace_back(AZStd::make_pair(viewTag, shadowProperty.m_shadowmapView)); } } - break; } } @@ -606,8 +606,9 @@ namespace AZ::Render { AZ_ATOM_PROFILE_FUNCTION("RPI", "ProjectedShadowFeatureProcessor: Render"); - for (const ProjectedShadowmapsPass* pass : m_projectedShadowmapsPasses) + if (!m_projectedShadowmapsPasses.empty()) { + const ProjectedShadowmapsPass* pass = m_projectedShadowmapsPasses.front(); for (const RPI::ViewPtr& view : packet.m_views) { if (view->GetUsageFlags() & RPI::View::UsageFlags::UsageCamera) @@ -622,7 +623,6 @@ namespace AZ::Render m_filterParamBufferHandler.UpdateSrg(srg); } } - break; } } diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp index c034977aac..e0bb59cb82 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/LightingPresetComboBox.cpp @@ -61,7 +61,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setCurrentIndex(AZStd::distance(m_presets.begin(), presetItr)); + setCurrentIndex(static_cast(AZStd::distance(m_presets.begin(), presetItr))); } } @@ -80,7 +80,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setItemText(AZStd::distance(m_presets.begin(), presetItr), preset->m_displayName.c_str()); + setItemText(static_cast(AZStd::distance(m_presets.begin(), presetItr)), preset->m_displayName.c_str()); } else { diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp index 30b88f6f47..1e8bfec485 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/ToolBar/ModelPresetComboBox.cpp @@ -61,7 +61,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setCurrentIndex(AZStd::distance(m_presets.begin(), presetItr)); + setCurrentIndex(static_cast(AZStd::distance(m_presets.begin(), presetItr))); } } @@ -80,7 +80,7 @@ namespace MaterialEditor auto presetItr = AZStd::find(m_presets.begin(), m_presets.end(), preset); if (presetItr != m_presets.end()) { - setItemText(AZStd::distance(m_presets.begin(), presetItr), preset->m_displayName.c_str()); + setItemText(static_cast(AZStd::distance(m_presets.begin(), presetItr)), preset->m_displayName.c_str()); } else { From 29637392883b9138b01f149c008ca3364e4b7a76 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:56:36 -0700 Subject: [PATCH 068/100] Code/Editor Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/2DViewport.cpp | 80 ++++++++++--------- Code/Editor/Controls/ColorGradientCtrl.cpp | 7 +- Code/Editor/Controls/ConsoleSCB.cpp | 10 +-- Code/Editor/Controls/ImageHistogramCtrl.cpp | 20 ++--- .../Controls/QBitmapPreviewDialogImp.cpp | 4 +- .../ReflectedPropertyCtrl.cpp | 2 +- .../ReflectedVarWrapper.cpp | 28 +++---- Code/Editor/Controls/SplineCtrl.cpp | 4 +- Code/Editor/Controls/SplineCtrlEx.cpp | 18 ++--- Code/Editor/Controls/TimelineCtrl.cpp | 14 ++-- Code/Editor/CryEditDoc.cpp | 2 +- Code/Editor/DisplaySettings.cpp | 6 +- ...bjectSelectionReferenceFrameCalculator.cpp | 4 +- .../EditorPreferencesPageViewportGeneral.cpp | 36 +++++---- Code/Editor/EditorViewportWidget.cpp | 40 ++++++---- Code/Editor/ErrorReportTableModel.cpp | 6 +- Code/Editor/Export/ExportManager.cpp | 11 +-- Code/Editor/FBXExporterDialog.cpp | 4 +- Code/Editor/Geometry/TriMesh.cpp | 10 +-- Code/Editor/GotoPositionDlg.cpp | 2 +- Code/Editor/LogFile.cpp | 2 +- Code/Editor/Objects/BaseObject.cpp | 20 ++--- Code/Editor/Objects/SelectionGroup.cpp | 2 +- Code/Editor/Plugin.cpp | 2 +- Code/Editor/PluginManager.cpp | 2 +- .../Objects/ComponentEntityObject.cpp | 4 +- .../SandboxIntegration.cpp | 8 +- .../UI/Outliner/OutlinerListModel.cpp | 10 +-- .../UI/Outliner/OutlinerTreeView.cpp | 6 +- .../AssetImporterWindow.cpp | 4 +- Code/Editor/PythonEditorFuncs.cpp | 8 +- Code/Editor/QtUI/PixmapLabelPreview.cpp | 2 +- Code/Editor/QtViewPaneManager.cpp | 4 +- Code/Editor/Settings.cpp | 2 +- Code/Editor/ToolBox.cpp | 5 +- .../TrackView/SequenceBatchRenderDialog.cpp | 20 ++--- .../TrackView/TVCustomizeTrackColorsDlg.cpp | 2 +- Code/Editor/TrackView/TVSequenceProps.cpp | 12 +-- Code/Editor/TrackView/TrackViewDialog.cpp | 4 +- .../TrackView/TrackViewDopeSheetBase.cpp | 57 ++++++------- Code/Editor/TrackView/TrackViewNodes.cpp | 2 +- Code/Editor/Util/AffineParts.cpp | 46 +++++------ Code/Editor/Util/FileUtil.cpp | 2 +- Code/Editor/Util/GdiUtil.cpp | 37 --------- Code/Editor/Util/GdiUtil.h | 10 --- Code/Editor/Util/ImageASC.cpp | 4 +- Code/Editor/Util/ImageGif.cpp | 4 +- Code/Editor/Util/bitarray.h | 4 +- Code/Editor/ViewPane.cpp | 2 +- Code/Editor/Viewport.cpp | 18 ++--- Code/Editor/ViewportTitleDlg.cpp | 10 +-- 51 files changed, 286 insertions(+), 337 deletions(-) diff --git a/Code/Editor/2DViewport.cpp b/Code/Editor/2DViewport.cpp index 838d30e0b3..ed810aea29 100644 --- a/Code/Editor/2DViewport.cpp +++ b/Code/Editor/2DViewport.cpp @@ -70,9 +70,9 @@ static void OnMenuGrid() inline Vec3 SnapToSize(Vec3 v, double size) { Vec3 snapped; - snapped.x = floor((v.x / size) + 0.5) * size; - snapped.y = floor((v.y / size) + 0.5) * size; - snapped.z = floor((v.z / size) + 0.5) * size; + snapped.x = static_cast(floor((v.x / size) + 0.5) * size); + snapped.y = static_cast(floor((v.y / size) + 0.5) * size); + snapped.z = static_cast(floor((v.z / size) + 0.5) * size); return snapped; } @@ -479,8 +479,8 @@ void Q2DViewport::SetZoom(float fZoomFactor, const QPoint& center) SetZoomFactor(fZoomFactor); // Calculate new offset to center zoom on mouse. - float x2 = center.x(); - float y2 = m_rcClient.height() - center.y(); + float x2 = static_cast(center.x()); + float y2 = static_cast(m_rcClient.height() - center.y()); ofsx = -(x2 / s2 - x2 / s1 - ofsx); ofsy = -(y2 / s2 - y2 / s1 - ofsy); SetScrollOffset(ofsx, ofsy, true); @@ -544,21 +544,21 @@ void Q2DViewport::Update() QPoint Q2DViewport::WorldToView(const Vec3& wp) const { Vec3 sp = m_screenTM.TransformPoint(wp); - QPoint p = QPoint(sp.x, sp.y); + QPoint p = QPoint(static_cast(sp.x), static_cast(sp.y)); return p; } ////////////////////////////////////////////////////////////////////////// QPoint Q2DViewport::WorldToViewParticleEditor(const Vec3& wp, [[maybe_unused]] int width, [[maybe_unused]] int height) const //Eric@conffx implement for the children class of IDisplayViewport { Vec3 sp = m_screenTM.TransformPoint(wp); - QPoint p = QPoint(sp.x, sp.y); + QPoint p = QPoint(static_cast(sp.x), static_cast(sp.y)); return p; } ////////////////////////////////////////////////////////////////////////// Vec3 Q2DViewport::ViewToWorld(const QPoint& vp, [[maybe_unused]] bool* collideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const { - Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(vp.x(), vp.y(), 0)); + Vec3 wp = m_screenTM_Inverted.TransformPoint(Vec3(static_cast(vp.x()), static_cast(vp.y()), 0.0f)); switch (m_axis) { case VPA_XY: @@ -694,10 +694,10 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers) Matrix34 viewTM = GetViewTM().GetInverted() * m_screenTM_Inverted; Matrix34 viewTM_Inv = m_screenTM * GetViewTM(); - Vec3 viewP0 = viewTM.TransformPoint(Vec3(0, 0, 0)); - Vec3 viewP1 = viewTM.TransformPoint(Vec3(m_rcClient.width(), m_rcClient.height(), 0)); + Vec3 viewP0 = viewTM.TransformPoint(Vec3(0.0f, 0.0f, 0.0f)); + Vec3 viewP1 = viewTM.TransformPoint(Vec3(static_cast(m_rcClient.width()), static_cast(m_rcClient.height()), 0.0f)); - Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0, m_rcClient.height(), 0)); + Vec3 viewP_Text = viewTM.TransformPoint(Vec3(0.0f, static_cast(m_rcClient.height()), 0.0f)); if (m_bShowMinorGridLines && (!m_bAutoAdjustGrids || pixelsPerGrid > 5)) { @@ -806,8 +806,8 @@ void Q2DViewport::DrawGrid(DisplayContext& dc, bool bNoXNumbers) { Vec3 org = m_screenTM.TransformPoint(Vec3(0, 0, 0)); dc.SetColor(AXIS_GRID_COLOR); - dc.DrawLine(Vec3(org.x, 0, fZ), Vec3(org.x, height, fZ)); - dc.DrawLine(Vec3(0, org.y, fZ), Vec3(width, org.y, fZ)); + dc.DrawLine(Vec3(org.x, 0.0f, fZ), Vec3(org.x, static_cast(height), fZ)); + dc.DrawLine(Vec3(0.0f, org.y, fZ), Vec3(static_cast(width), org.y, fZ)); } ////////////////////////////////////////////////////////////////////////// } @@ -860,18 +860,18 @@ void Q2DViewport::DrawAxis(DisplayContext& dc) int height = m_rcClient.height(); int size = 25; - Vec3 pos(30, height - 15, 1); + Vec3 pos(30.0f, static_cast(height - 15), 1.0f); dc.SetColor(colx.x, colx.y, colx.z, 1); - dc.DrawLine(pos, pos + Vec3(size, 0, 0)); + dc.DrawLine(pos, pos + Vec3(static_cast(size), 0.0f, 0.0f)); - dc.SetColor(coly.x, coly.y, coly.z, 1); - dc.DrawLine(pos, pos - Vec3(0, size, 0)); + dc.SetColor(coly.x, coly.y, coly.z, 1.0f); + dc.DrawLine(pos, pos - Vec3(0.0f, static_cast(size), 0.0f)); dc.SetColor(m_colorAxisText); - pos.x -= 3; - pos.y -= 4; - pos.z = 2; + pos.x -= 3.0f; + pos.y -= 4.0f; + pos.z = 2.0f; dc.Draw2dTextLabel(pos.x + size + 4, pos.y - 2, 1, xstr); dc.Draw2dTextLabel(pos.x + 3, pos.y - size, 1, ystr); dc.Draw2dTextLabel(pos.x - 5, pos.y + 5, 1, zstr); @@ -910,10 +910,14 @@ void Q2DViewport::DrawSelection(DisplayContext& dc) dc.SetColor(SELECTION_RECT_COLOR.x, SELECTION_RECT_COLOR.y, SELECTION_RECT_COLOR.z, 1); QPoint p1(m_selectedRect.left(), m_selectedRect.top()); QPoint p2(m_selectedRect.right() + 1, m_selectedRect.bottom() +1); - dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p2.x(), p1.y(), 0)); - dc.DrawLine(Vec3(p1.x(), p2.y(), 0), Vec3(p2.x(), p2.y(), 0)); - dc.DrawLine(Vec3(p1.x(), p1.y(), 0), Vec3(p1.x(), p2.y(), 0)); - dc.DrawLine(Vec3(p2.x(), p1.y(), 0), Vec3(p2.x(), p2.y(), 0)); + dc.DrawLine( + Vec3(static_cast(p1.x()), static_cast(p1.y()), 0.0f), Vec3(static_cast(p2.x()), static_cast(p1.y()), 0.0f)); + dc.DrawLine( + Vec3(static_cast(p1.x()), static_cast(p2.y()), 0.0f), Vec3(static_cast(p2.x()), static_cast(p2.y()), 0.0f)); + dc.DrawLine( + Vec3(static_cast(p1.x()), static_cast(p1.y()), 0.0f), Vec3(static_cast(p1.x()), static_cast(p2.y()), 0.0f)); + dc.DrawLine( + Vec3(static_cast(p2.x()), static_cast(p1.y()), 0.0f), Vec3(static_cast(p2.x()), static_cast(p2.y()), 0.0f)); } } @@ -1038,16 +1042,16 @@ AABB Q2DViewport::GetWorldBounds(const QPoint& pnt1, const QPoint& pnt2) { case VPA_XY: case VPA_YX: - box.min.z = -maxSize; - box.max.z = maxSize; + box.min.z = static_cast(-maxSize); + box.max.z = static_cast(maxSize); break; case VPA_XZ: - box.min.y = -maxSize; - box.max.y = maxSize; + box.min.y = static_cast(-maxSize); + box.max.y = static_cast(maxSize); break; case VPA_YZ: - box.min.x = -maxSize; - box.max.x = maxSize; + box.min.x = static_cast(-maxSize); + box.max.x = static_cast(maxSize); break; } return box; @@ -1076,32 +1080,32 @@ void Q2DViewport::OnDragSelectRectangle(const QRect &rect, [[maybe_unused]] bool switch (m_axis) { case VPA_XY: - box.min.z = -maxSize; - box.max.z = maxSize; + box.min.z = static_cast(-maxSize); + box.max.z = static_cast(maxSize); w = box.max.x - box.min.x; h = box.max.y - box.min.y; sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h); break; case VPA_YX: - box.min.z = -maxSize; - box.max.z = maxSize; + box.min.z = static_cast(-maxSize); + box.max.z = static_cast(maxSize); w = box.max.y - box.min.y; h = box.max.x - box.min.x; sprintf_s(szNewStatusText, "X:%g Y:%g W:%g H:%g", org.x, org.y, w, h); break; case VPA_XZ: - box.min.y = -maxSize; - box.max.y = maxSize; + box.min.y = static_cast(-maxSize); + box.max.y = static_cast(maxSize); w = box.max.x - box.min.x; h = box.max.z - box.min.z; sprintf_s(szNewStatusText, "X:%g Z:%g W:%g H:%g", org.x, org.z, w, h); break; case VPA_YZ: - box.min.x = -maxSize; - box.max.x = maxSize; + box.min.x = static_cast(-maxSize); + box.max.x = static_cast(maxSize); w = box.max.y - box.min.y; h = box.max.z - box.min.z; diff --git a/Code/Editor/Controls/ColorGradientCtrl.cpp b/Code/Editor/Controls/ColorGradientCtrl.cpp index 3bd3b11690..446e5810c5 100644 --- a/Code/Editor/Controls/ColorGradientCtrl.cpp +++ b/Code/Editor/Controls/ColorGradientCtrl.cpp @@ -72,7 +72,7 @@ void CColorGradientCtrl::resizeEvent(QResizeEvent* event) m_grid.rect = m_rcGradient; if (m_bNoZoom) { - m_grid.zoom.x = m_grid.rect.width(); + m_grid.zoom.x = static_cast(m_grid.rect.width()); } m_rcKeys = rc; @@ -106,11 +106,6 @@ QPoint CColorGradientCtrl::KeyToPoint(int nKey) QPoint CColorGradientCtrl::TimeToPoint(float time) { return QPoint(m_grid.WorldToClient(Vec2(time, 0)).x(), m_rcGradient.height() / 2); - - QPoint point; - point.rx() = (time - m_fMinTime) * (m_rcGradient.width() / (m_fMaxTime - m_fMinTime)) + m_rcGradient.left(); - point.ry() = m_rcGradient.height() / 2; - return point; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index acbd75444c..c4f58b5297 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -833,15 +833,15 @@ static void SetEditorRange(EditorType* editor, IVariable* var) // If this variable has custom limits set, then use that as the min/max // Otherwise, the min/max for the input box will be bounded by the type // limit, but the slider will be constricted to a smaller default range - static const double defaultMin = -100.0f; - static const double defaultMax = 100.0f; + static const float defaultMin = -100.0f; + static const float defaultMax = 100.0f; if (var->HasCustomLimits()) { - editor->setRange(min, max); + editor->setRange(static_cast(min), static_cast(max)); } else { - editor->setSoftRange(defaultMin, defaultMax); + editor->setSoftRange(static_cast(defaultMin), static_cast(defaultMax)); } // Set the step size. The default variable step is 0, so if it's @@ -850,7 +850,7 @@ static void SetEditorRange(EditorType* editor, IVariable* var) // use that for the int values if (step > 0) { - editor->spinbox()->setSingleStep(step); + editor->spinbox()->setSingleStep(static_cast(step)); } else if (auto doubleSpinBox = qobject_cast(editor->spinbox())) { diff --git a/Code/Editor/Controls/ImageHistogramCtrl.cpp b/Code/Editor/Controls/ImageHistogramCtrl.cpp index 22223a3251..252bf4f09b 100644 --- a/Code/Editor/Controls/ImageHistogramCtrl.cpp +++ b/Code/Editor/Controls/ImageHistogramCtrl.cpp @@ -175,7 +175,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) penSpikes = penColor; painter.setPen(Qt::black); painter.setBrush(Qt::white); - rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), abs(rc.height() * m_graphHeightPercent))); + rcGraph = QRect(QPoint(m_graphMargin, m_graphMargin), QPoint(abs(rc.width() - m_graphMargin), static_cast(abs(rc.height() * m_graphHeightPercent)))); painter.drawRect(rcGraph); painter.setPen(penSpikes); @@ -193,7 +193,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) { float scale = 0; - i = ((float)x / graphWidth) * (kNumColorLevels - 1); + i = static_cast(((float)x / graphWidth) * (kNumColorLevels - 1)); i = CLAMP(i, 0, kNumColorLevels - 1); switch (m_drawMode) @@ -245,7 +245,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) } crtX = static_cast(rcGraph.left() + x + 1); - painter.drawLine(crtX, graphBottom, crtX, graphBottom - scale * graphHeight); + painter.drawLine(crtX, graphBottom, crtX, static_cast(graphBottom - scale * graphHeight)); } } else @@ -258,7 +258,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x) { - i = ((float)x / graphWidth) * (kNumColorLevels - 1); + i = static_cast(((float)x / graphWidth) * (kNumColorLevels - 1)); i = CLAMP(i, 0, kNumColorLevels - 1); crtX = static_cast(rcGraph.left() + x + 1); scaleR = scaleG = scaleB = scaleA = 0; @@ -283,10 +283,10 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) scaleA = (float)m_count[3][i] / m_maxCount[3]; } - heightR = graphBottom - scaleR * graphHeight; - heightG = graphBottom - scaleG * graphHeight; - heightB = graphBottom - scaleB * graphHeight; - heightA = graphBottom - scaleA * graphHeight; + heightR = static_cast(graphBottom - scaleR * graphHeight); + heightG = static_cast(graphBottom - scaleG * graphHeight); + heightB = static_cast(graphBottom - scaleB * graphHeight); + heightA = static_cast(graphBottom - scaleA * graphHeight); if (lastHeight[0] == INT_MAX) { @@ -350,7 +350,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x) { pos = (float)x / graphWidth; - i = (float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels; + i = static_cast((float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels); i = CLAMP(i, 0, kNumColorLevels - 1); scale = 0; @@ -385,7 +385,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event) } painter.setPen(pPen); - painter.drawLine(rcGraph.left() + static_cast(x) + 1, graphBottom, rcGraph.left() + static_cast(x) + 1, graphBottom - scale * graphHeight); + painter.drawLine(rcGraph.left() + static_cast(x) + 1, graphBottom, rcGraph.left() + static_cast(x) + 1, static_cast(graphBottom - scale * graphHeight)); } // then draw 3 lines so we separate the channels diff --git a/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp b/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp index c438858e81..b47a535d2a 100644 --- a/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp +++ b/Code/Editor/Controls/QBitmapPreviewDialogImp.cpp @@ -422,7 +422,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e) curr_x = histogramRect.left() + x + 1; - int i = ((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1); + int i = static_cast(((float)x / (graphWidth - 1)) * (CImageHistogram::kNumColorLevels - 1)); if (m_histrogramMode == eHistogramMode_SplitRGB) { // Filter out to area which we are interested @@ -446,7 +446,7 @@ void QBitmapPreviewDialogImp::paintEvent(QPaintEvent* e) scale = (float)m_histogram.m_count[c][i] / m_histogram.m_maxCount[c]; } - int height = graphBottom - graphHeight * scale; + int height = static_cast(graphBottom - graphHeight * scale); if (last_height == INT_MAX) { last_height = height; diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp index 3c7bda21d9..40ea71f577 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp @@ -308,7 +308,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo int nMin(0), nMax(0); if (child->getAttr("min", nMin) && child->getAttr("max", nMax)) { - intVar->SetLimits(nMin, nMax); + intVar->SetLimits(static_cast(nMin), static_cast(nMax)); } } else if (!azstricmp(type, "float")) diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp index aba346ce6a..b3f1b35461 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp @@ -39,20 +39,20 @@ namespace { hardMin = desc.m_bHardMin; hardMax = desc.m_bHardMax; } - reflectedVar->m_softMinVal = min; - reflectedVar->m_softMaxVal = max; + reflectedVar->m_softMinVal = static_cast(min); + reflectedVar->m_softMaxVal = static_cast(max); if (hardMin) { - reflectedVar->m_minVal = min; + reflectedVar->m_minVal = static_cast(min); } else { - reflectedVar->m_minVal = std::numeric_limits::lowest(); + reflectedVar->m_minVal = std::numeric_limits::lowest(); } if (hardMax) { - reflectedVar->m_maxVal = max; + reflectedVar->m_maxVal = static_cast(max); } else { @@ -64,9 +64,9 @@ namespace { ../Code/Editor/Controls/ReflectedPropertyControl/ReflectedVarWrapper.cpp:59:38: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion] reflectedVar->m_maxVal = std::numeric_limits::max(); */ - reflectedVar->m_maxVal = static_cast(std::numeric_limits::max()); + reflectedVar->m_maxVal = static_cast(std::numeric_limits::max()); } - reflectedVar->m_stepSize = step; + reflectedVar->m_stepSize = static_cast(step); } } @@ -95,9 +95,9 @@ void ReflectedVarIntAdapter::SyncReflectedVarToIVar(IVariable *pVariable) { int intValue; pVariable->Get(intValue); - value = intValue; + value = static_cast(intValue); } - m_reflectedVar->m_value = std::round(value * m_valueMultiplier); + m_reflectedVar->m_value = static_cast(std::round(value * m_valueMultiplier)); } void ReflectedVarIntAdapter::SyncIVarToReflectedVar(IVariable *pVariable) @@ -362,14 +362,14 @@ void ReflectedVarColorAdapter::SyncReflectedVarToIVar(IVariable *pVariable) Vec3 v(0, 0, 0); pVariable->Get(v); const QColor col = ColorLinearToGamma(ColorF(v.x, v.y, v.z)); - m_reflectedVar->m_color.Set(col.redF(), col.greenF(), col.blueF()); + m_reflectedVar->m_color.Set(static_cast(col.redF()), static_cast(col.greenF()), static_cast(col.blueF())); } else { int col(0); pVariable->Get(col); const QColor qcolor = ColorToQColor((uint32)col); - m_reflectedVar->m_color.Set(qcolor.redF(), qcolor.greenF(), qcolor.blueF()); + m_reflectedVar->m_color.Set(static_cast(qcolor.redF()), static_cast(qcolor.greenF()), static_cast(qcolor.blueF())); } } @@ -382,9 +382,9 @@ void ReflectedVarColorAdapter::SyncIVarToReflectedVar(IVariable *pVariable) } else { - int ir = m_reflectedVar->m_color.GetX() * 255.0f; - int ig = m_reflectedVar->m_color.GetY() * 255.0f; - int ib = m_reflectedVar->m_color.GetZ() * 255.0f; + int ir = static_cast(m_reflectedVar->m_color.GetX() * 255.0f); + int ig = static_cast(m_reflectedVar->m_color.GetY() * 255.0f); + int ib = static_cast(m_reflectedVar->m_color.GetZ() * 255.0f); pVariable->Set(static_cast(RGB(ir, ig, ib))); } diff --git a/Code/Editor/Controls/SplineCtrl.cpp b/Code/Editor/Controls/SplineCtrl.cpp index d66fc16ade..80d30b37ad 100644 --- a/Code/Editor/Controls/SplineCtrl.cpp +++ b/Code/Editor/Controls/SplineCtrl.cpp @@ -86,13 +86,13 @@ QPoint CSplineCtrl::KeyToPoint(int nKey) QPoint CSplineCtrl::TimeToPoint(float time) { QPoint point; - point.setX((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left()); + point.setX(static_cast((time - m_fMinTime) * (m_rcSpline.width() / (m_fMaxTime - m_fMinTime)) + m_rcSpline.left())); float val = 0; if (m_pSpline) { m_pSpline->InterpolateFloat(time, val); } - point.setY((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top())); + point.setY(static_cast((floor((m_fMaxValue - val) * (m_rcSpline.height() / (m_fMaxValue - m_fMinValue)) + 0.5f) + m_rcSpline.top()))); return point; } diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index 5bba14f0d6..f299ce185d 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -641,7 +641,7 @@ QPoint AbstractSplineWidget::TimeToPoint(float time, ISplineInterpolator* pSplin ////////////////////////////////////////////////////////////////////////// float AbstractSplineWidget::TimeToXOfs(float x) { - return WorldToClient(Vec2(float(x), 0.0f)).x(); + return static_cast(WorldToClient(Vec2(float(x), 0.0f)).x()); } ////////////////////////////////////////////////////////////////////////// @@ -832,8 +832,8 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float int nTotalNumberOfDimensions(0); int nCurrentDimension(0); - int left = TimeToXOfs(startTime);//rcClip.left; - int right = TimeToXOfs(endTime);//rcClip.right; + int left = static_cast(TimeToXOfs(startTime));//rcClip.left; + int right = static_cast(TimeToXOfs(endTime));//rcClip.right; QPoint p0 = TimeToPoint(pSpline->GetKeyTime(0), pSpline); QPoint p1 = TimeToPoint(pSpline->GetKeyTime(pSpline->GetKeyCount() - 1), pSpline); @@ -898,7 +898,7 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float if ((x == right && pointsInLine >= 0) || (pointsInLine > 0 && fabs(lineStart.y() + gradient * (pt.x() - lineStart.x()) - pt.y()) > 1.0f)) { - lineStart = QPoint(pt.x() - 1, lineStart.y() + gradient * (pt.x() - 1 - lineStart.x())); + lineStart = QPoint(pt.x() - 1, static_cast(lineStart.y() + gradient * (pt.x() - 1 - lineStart.x()))); path.lineTo(lineStart); gradient = float(pt.y() - lineStart.y()) / (pt.x() - lineStart.x()); pointsInLine = 1; @@ -1063,7 +1063,7 @@ void SplineWidget::DrawTimeMarker(QPainter* painter) float x = TimeToXOfs(m_fTimeMarker); if (x >= m_rcSpline.left() && x <= m_rcSpline.right() + 1) { - painter->drawLine(x, m_rcSpline.top(), x, m_rcSpline.bottom() + 1); + painter->drawLine(static_cast(x), m_rcSpline.top(), static_cast(x), m_rcSpline.bottom() + 1); } painter->setPen(pOldPen); } @@ -2145,8 +2145,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT } } - int rangeMin = TimeToXOfs(affectedRangeMin); - int rangeMax = TimeToXOfs(affectedRangeMax); + int rangeMin = static_cast(TimeToXOfs(affectedRangeMin)); + int rangeMax = static_cast(TimeToXOfs(affectedRangeMax)); if (m_timeRange.start == affectedRangeMin) { @@ -2377,8 +2377,8 @@ void AbstractSplineWidget::RedrawWindowAroundMarker() UpdateKeyTimes(); std::vector::iterator itKeyTime = std::lower_bound(m_keyTimes.begin(), m_keyTimes.end(), KeyTime(m_fTimeMarker, 0)); size_t keyTimeIndex = (itKeyTime != m_keyTimes.end() ? itKeyTime - m_keyTimes.begin() : m_keyTimes.size()); - int redrawRangeStart = (keyTimeIndex >= 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time) : m_rcSpline.left()); - int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time) : m_rcSpline.right() + 1); + int redrawRangeStart = (keyTimeIndex >= 2 ? static_cast(TimeToXOfs(m_keyTimes[keyTimeIndex - 2].time)) : m_rcSpline.left()); + int redrawRangeEnd = (keyTimeIndex < m_keyTimes.size() - 2 ? static_cast(TimeToXOfs(m_keyTimes[keyTimeIndex + 2].time)) : m_rcSpline.right() + 1); QRect rc(QPoint(redrawRangeStart, m_rcSpline.top()), QPoint(redrawRangeEnd, m_rcSpline.bottom() + 1) - QPoint(1, 1)); rc = rc.normalized().intersected(m_rcSpline); diff --git a/Code/Editor/Controls/TimelineCtrl.cpp b/Code/Editor/Controls/TimelineCtrl.cpp index a5a941fc78..8159084784 100644 --- a/Code/Editor/Controls/TimelineCtrl.cpp +++ b/Code/Editor/Controls/TimelineCtrl.cpp @@ -25,9 +25,9 @@ static const QColor ltgrayCol = QColor(110, 110, 110); QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction) { - const int r = (c2.red() - c1.red()) * fraction + c1.red(); - const int g = (c2.green() - c1.green()) * fraction + c1.green(); - const int b = (c2.blue() - c1.blue()) * fraction + c1.blue(); + const int r = static_cast(static_cast(c2.red() - c1.red()) * fraction + c1.red()); + const int g = static_cast(static_cast(c2.green() - c1.green()) * fraction + c1.green()); + const int b = static_cast(static_cast(c2.blue() - c1.blue()) * fraction + c1.blue()); return QColor(r, g, b); } @@ -120,7 +120,7 @@ float TimelineWidget::SnapTime(float time) { double t = floor((double)time * m_ticksStep + 0.5); t = t / m_ticksStep; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// @@ -153,10 +153,10 @@ void TimelineWidget::DrawTicks(QPainter* painter) painter->setPen(redpen); int x = TimeToClient(m_fTimeMarker); painter->setBrush(Qt::NoBrush); - painter->drawRect(QRect(QPoint(x - 3, rc.top()), QPoint(x + 2, rc.bottom()))); + painter->drawRect(QRect(QPoint(x - 3, static_cast(rc.top())), QPoint(x + 2, static_cast(rc.bottom())))); painter->setPen(redpen); - painter->drawLine(x, rc.top(), x, rc.bottom()); + painter->drawLine(x, static_cast(rc.top()), x, static_cast(rc.bottom())); painter->setBrush(Qt::NoBrush); // Draw vertical line showing current time. @@ -190,7 +190,7 @@ void TimelineWidget::DrawTicks(QPainter* painter) float keyTime = (m_pKeyTimeSet ? m_pKeyTimeSet->GetKeyTime(keyTimeIndex) : 0.0f); int x2 = TimeToClient(keyTime); - painter->drawRect(QRect(QPoint(x2 - 1, rc.top()), QPoint(x2 + 2, rc.bottom()))); + painter->drawRect(QRect(QPoint(x2 - 1, static_cast(rc.top())), QPoint(x2 + 2, static_cast(rc.bottom())))); } painter->setPen(pOldPen); diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index 789aa1bdb9..f3f38576b4 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -2091,7 +2091,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar) } // QVariant will not convert a void * to int, so do it manually. - int nKey = reinterpret_cast(pVar->GetUserData().value()); + int nKey = static_cast(reinterpret_cast(pVar->GetUserData().value())); int nGroup = (nKey & 0xFFFF0000) >> 16; int nChild = (nKey & 0x0000FFFF); diff --git a/Code/Editor/DisplaySettings.cpp b/Code/Editor/DisplaySettings.cpp index dc4cf083a9..ed4ca180b4 100644 --- a/Code/Editor/DisplaySettings.cpp +++ b/Code/Editor/DisplaySettings.cpp @@ -46,7 +46,7 @@ void CDisplaySettings::SaveRegistry() SaveValue("Settings", "RenderFlags", m_renderFlags); SaveValue("Settings", "DisplayFlags", m_flags & SETTINGS_SERIALIZABLE_FLAGS_MASK); SaveValue("Settings", "DebugFlags", m_debugFlags); - SaveValue("Settings", "LabelsDistance", m_labelsDistance); + SaveValue("Settings", "LabelsDistance", static_cast(m_labelsDistance)); } void CDisplaySettings::LoadRegistry() @@ -56,9 +56,9 @@ void CDisplaySettings::LoadRegistry() LoadValue("Settings", "DisplayFlags", m_flags); m_flags &= SETTINGS_SERIALIZABLE_FLAGS_MASK; LoadValue("Settings", "DebugFlags", m_debugFlags); - int temp = m_labelsDistance; + int temp = static_cast(m_labelsDistance); LoadValue("Settings", "LabelsDistance", temp); - m_labelsDistance = temp; + m_labelsDistance = static_cast(temp); gSettings.objectHideMask = m_objectHideMask; } diff --git a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp index cf7cf5e959..80368d3ec1 100644 --- a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp +++ b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp @@ -44,14 +44,14 @@ bool SubObjectSelectionReferenceFrameCalculator::GetFrame(Matrix34& refFrame) if (this->nNormals > 0) { - this->normal = this->normal / this->nNormals; + this->normal = this->normal / static_cast(this->nNormals); if (!this->normal.IsZero()) { this->normal.Normalize(); } // Average position. - this->pos = this->pos / this->nNormals; + this->pos = this->pos / static_cast(this->nNormals); refFrame.SetTranslation(this->pos); } diff --git a/Code/Editor/EditorPreferencesPageViewportGeneral.cpp b/Code/Editor/EditorPreferencesPageViewportGeneral.cpp index 1fc0d14988..a9eec22e69 100644 --- a/Code/Editor/EditorPreferencesPageViewportGeneral.cpp +++ b/Code/Editor/EditorPreferencesPageViewportGeneral.cpp @@ -201,20 +201,24 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply() ds->SetLabelsDistance(m_textLabels.m_labelsDistance); gSettings.objectColorSettings.fChildGeomAlpha = m_selectionPreviewColor.m_childObjectGeomAlpha; - gSettings.objectColorSettings.entityHighlight = QColor(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f, - m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f, - m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f); - gSettings.objectColorSettings.groupHighlight = QColor(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f, - m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f, - m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f); + gSettings.objectColorSettings.entityHighlight = QColor( + static_cast(m_selectionPreviewColor.m_colorEntityBBox.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorEntityBBox.GetG() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorEntityBBox.GetB() * 255.0f)); + gSettings.objectColorSettings.groupHighlight = QColor( + static_cast(m_selectionPreviewColor.m_colorGroupBBox.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorGroupBBox.GetG() * 255.0f), + static_cast(m_selectionPreviewColor.m_colorGroupBBox.GetB() * 255.0f)); gSettings.objectColorSettings.fBBoxAlpha = m_selectionPreviewColor.m_fBBoxAlpha; gSettings.objectColorSettings.fGeomAlpha = m_selectionPreviewColor.m_fgeomAlpha; - gSettings.objectColorSettings.geometryHighlightColor = QColor(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f, - m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f, - m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f); - gSettings.objectColorSettings.solidBrushGeometryColor = QColor(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f, - m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f, - m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f); + gSettings.objectColorSettings.geometryHighlightColor = QColor( + static_cast(m_selectionPreviewColor.m_geometryHighlightColor.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_geometryHighlightColor.GetG() * 255.0f), + static_cast(m_selectionPreviewColor.m_geometryHighlightColor.GetB() * 255.0f)); + gSettings.objectColorSettings.solidBrushGeometryColor = QColor( + static_cast(m_selectionPreviewColor.m_solidBrushGeometryColor.GetR() * 255.0f), + static_cast(m_selectionPreviewColor.m_solidBrushGeometryColor.GetG() * 255.0f), + static_cast(m_selectionPreviewColor.m_solidBrushGeometryColor.GetB() * 255.0f)); } void CEditorPreferencesPage_ViewportGeneral::InitializeSettings() @@ -252,10 +256,10 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings() m_textLabels.m_labelsDistance = ds->GetLabelsDistance(); m_selectionPreviewColor.m_childObjectGeomAlpha = gSettings.objectColorSettings.fChildGeomAlpha; - m_selectionPreviewColor.m_colorEntityBBox.Set(gSettings.objectColorSettings.entityHighlight.redF(), gSettings.objectColorSettings.entityHighlight.greenF(), gSettings.objectColorSettings.entityHighlight.blueF(), 1.0f); - m_selectionPreviewColor.m_colorGroupBBox.Set(gSettings.objectColorSettings.groupHighlight.redF(), gSettings.objectColorSettings.groupHighlight.greenF(), gSettings.objectColorSettings.groupHighlight.blueF(), 1.0f); + m_selectionPreviewColor.m_colorEntityBBox.Set(static_cast(gSettings.objectColorSettings.entityHighlight.redF()), static_cast(gSettings.objectColorSettings.entityHighlight.greenF()), static_cast(gSettings.objectColorSettings.entityHighlight.blueF()), 1.0f); + m_selectionPreviewColor.m_colorGroupBBox.Set(static_cast(gSettings.objectColorSettings.groupHighlight.redF()), static_cast(gSettings.objectColorSettings.groupHighlight.greenF()), static_cast(gSettings.objectColorSettings.groupHighlight.blueF()), 1.0f); m_selectionPreviewColor.m_fBBoxAlpha = gSettings.objectColorSettings.fBBoxAlpha; m_selectionPreviewColor.m_fgeomAlpha = gSettings.objectColorSettings.fGeomAlpha; - m_selectionPreviewColor.m_geometryHighlightColor.Set(gSettings.objectColorSettings.geometryHighlightColor.redF(), gSettings.objectColorSettings.geometryHighlightColor.greenF(), gSettings.objectColorSettings.geometryHighlightColor.blueF(), 1.0f); - m_selectionPreviewColor.m_solidBrushGeometryColor.Set(gSettings.objectColorSettings.solidBrushGeometryColor.redF(), gSettings.objectColorSettings.solidBrushGeometryColor.greenF(), gSettings.objectColorSettings.solidBrushGeometryColor.blueF(), 1.0f); + m_selectionPreviewColor.m_geometryHighlightColor.Set(static_cast(gSettings.objectColorSettings.geometryHighlightColor.redF()), static_cast(gSettings.objectColorSettings.geometryHighlightColor.greenF()), static_cast(gSettings.objectColorSettings.geometryHighlightColor.blueF()), 1.0f); + m_selectionPreviewColor.m_solidBrushGeometryColor.Set(static_cast(gSettings.objectColorSettings.solidBrushGeometryColor.redF()), static_cast(gSettings.objectColorSettings.solidBrushGeometryColor.greenF()), static_cast(gSettings.objectColorSettings.solidBrushGeometryColor.blueF()), 1.0f); } diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 701386951a..75b62f3781 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -284,7 +284,7 @@ void EditorViewportWidget::paintEvent([[maybe_unused]] QPaintEvent* event) const char* kFontName = "Arial"; const QColor kTextColor(255, 255, 255); const QColor kTextShadowColor(0, 0, 0); - const QFont font(kFontName, kFontSize / 10.0); + const QFont font(kFontName, static_cast(kFontSize / 10.0f)); painter.setFont(font); QString friendlyName = QFileInfo(GetIEditor()->GetLevelName()).fileName(); @@ -815,29 +815,35 @@ void EditorViewportWidget::UpdateSafeFrame() float maxSafeFrameWidth = m_safeFrame.height() * targetAspectRatio; float widthDifference = m_safeFrame.width() - maxSafeFrameWidth; - m_safeFrame.setLeft(m_safeFrame.left() + widthDifference * 0.5); - m_safeFrame.setRight(m_safeFrame.right() - widthDifference * 0.5); + m_safeFrame.setLeft(static_cast(m_safeFrame.left() + widthDifference * 0.5f)); + m_safeFrame.setRight(static_cast(m_safeFrame.right() - widthDifference * 0.5f)); } else { float maxSafeFrameHeight = m_safeFrame.width() / targetAspectRatio; float heightDifference = m_safeFrame.height() - maxSafeFrameHeight; - m_safeFrame.setTop(m_safeFrame.top() + heightDifference * 0.5); - m_safeFrame.setBottom(m_safeFrame.bottom() - heightDifference * 0.5); + m_safeFrame.setTop(static_cast(m_safeFrame.top() + heightDifference * 0.5f)); + m_safeFrame.setBottom(static_cast(m_safeFrame.bottom() - heightDifference * 0.5f)); } m_safeFrame.adjust(0, 0, -1, -1); // <-- aesthetic improvement. const float SAFE_ACTION_SCALE_FACTOR = 0.05f; m_safeAction = m_safeFrame; - m_safeAction.adjust(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR, - -m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR, -m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR); + m_safeAction.adjust( + static_cast(m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR), + static_cast(m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR), + static_cast(-m_safeFrame.width() * SAFE_ACTION_SCALE_FACTOR), + static_cast(-m_safeFrame.height() * SAFE_ACTION_SCALE_FACTOR)); const float SAFE_TITLE_SCALE_FACTOR = 0.1f; m_safeTitle = m_safeFrame; - m_safeTitle.adjust(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR, - -m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR, -m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR); + m_safeTitle.adjust( + static_cast(m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR), + static_cast(m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR), + static_cast(-m_safeFrame.width() * SAFE_TITLE_SCALE_FACTOR), + static_cast(-m_safeFrame.height() * SAFE_TITLE_SCALE_FACTOR)); } ////////////////////////////////////////////////////////////////////////// @@ -856,8 +862,8 @@ void EditorViewportWidget::RenderSafeFrame(const QRect& frame, float r, float g, const int LINE_WIDTH = 2; for (int i = 0; i < LINE_WIDTH; i++) { - AZ::Vector3 topLeft(frame.left() + i, frame.top() + i, 0); - AZ::Vector3 bottomRight(frame.right() - i, frame.bottom() - i, 0); + AZ::Vector3 topLeft(static_cast(frame.left() + i), static_cast(frame.top() + i), 0.0f); + AZ::Vector3 bottomRight(static_cast(frame.right() - i), static_cast(frame.bottom() - i), 0.0f); m_debugDisplay->DrawWireBox(topLeft, bottomRight); } } @@ -1936,8 +1942,8 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width ProjectToScreen(wp.x, wp.y, wp.z, &x, &y, &z); if (_finite(x) || _finite(y)) { - p.rx() = (x / 100) * width; - p.ry() = (y / 100) * height; + p.rx() = static_cast((x / 100) * width); + p.ry() = static_cast((y / 100) * height); } else { @@ -2091,8 +2097,8 @@ void EditorViewportWidget::UnProjectFromScreen(float sx, float sy, float sz, flo void EditorViewportWidget::ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const { AzFramework::ScreenPoint screenPosition = m_renderViewport->ViewportWorldToScreen(AZ::Vector3{ptx, pty, ptz}); - *sx = screenPosition.m_x; - *sy = screenPosition.m_y; + *sx = static_cast(screenPosition.m_x); + *sy = static_cast(screenPosition.m_y); *sz = 0.f; } @@ -2103,7 +2109,7 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& Vec3 pos0, pos1; float wx, wy, wz; - UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 0, &wx, &wy, &wz); + UnProjectFromScreen(static_cast(vp.x()), static_cast(rc.bottom() - vp.y()), 0.0f, &wx, &wy, &wz); if (!_finite(wx) || !_finite(wy) || !_finite(wz)) { return; @@ -2113,7 +2119,7 @@ void EditorViewportWidget::ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& return; } pos0(wx, wy, wz); - UnProjectFromScreen(vp.x(), rc.bottom() - vp.y(), 1, &wx, &wy, &wz); + UnProjectFromScreen(static_cast(vp.x()), static_cast(rc.bottom() - vp.y()), 1.0f, &wx, &wy, &wz); if (!_finite(wx) || !_finite(wy) || !_finite(wz)) { return; diff --git a/Code/Editor/ErrorReportTableModel.cpp b/Code/Editor/ErrorReportTableModel.cpp index 2da3110e37..f5dce1a86d 100644 --- a/Code/Editor/ErrorReportTableModel.cpp +++ b/Code/Editor/ErrorReportTableModel.cpp @@ -45,7 +45,7 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z) } if (ind > 0) { - *x = er.mid(0, ind).toDouble(); + *x = er.mid(0, ind).toFloat(); er = er.mid(ind); er.remove(QRegExp("^[ ,]*")); @@ -57,12 +57,12 @@ bool GetPositionFromString(QString er, float* x, float* y, float* z) } if (ind > 0) { - *y = er.mid(0, ind).toDouble(); + *y = er.mid(0, ind).toFloat(); er = er.mid(ind); er.remove(QRegExp("^[ ,]*")); if (er.length()) { - *z = er.toDouble(); + *z = er.toFloat(); return true; } } diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 8c90d7322d..7601740033 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -40,15 +40,6 @@ namespace { - void SetTexture(Export::TPath& outName, IRenderShaderResources* pRes, int nSlot) - { - SEfResTexture* pTex = pRes->GetTextureResource(nSlot); - if (pTex) - { - azstrcat(outName, AZ_ARRAY_SIZE(outName), Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data()); - } - } - inline Export::Vector3D Vec3ToVector3D(const Vec3& vec) { Export::Vector3D ret; @@ -1164,7 +1155,7 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con // Export the whole sequence with baked keys if (ShowFBXExportDialog()) { - m_numberOfExportFrames = pSequence->GetTimeRange().end * m_FBXBakedExportFPS; + m_numberOfExportFrames = static_cast(pSequence->GetTimeRange().end * m_FBXBakedExportFPS); if (!m_bExportOnlyPrimaryCamera) { diff --git a/Code/Editor/FBXExporterDialog.cpp b/Code/Editor/FBXExporterDialog.cpp index 86e7843ca1..bae4b9bf7e 100644 --- a/Code/Editor/FBXExporterDialog.cpp +++ b/Code/Editor/FBXExporterDialog.cpp @@ -20,7 +20,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING namespace { - const uint kDefaultFPS = 30.0f; + const uint kDefaultFPS = 30u; } CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent) @@ -43,7 +43,7 @@ CFBXExporterDialog::~CFBXExporterDialog() float CFBXExporterDialog::GetFPS() const { - return m_ui->m_fpsCombo->currentText().toDouble(); + return m_ui->m_fpsCombo->currentText().toFloat(); } bool CFBXExporterDialog::GetExportCoordsLocalToTheSelectedObject() const diff --git a/Code/Editor/Geometry/TriMesh.cpp b/Code/Editor/Geometry/TriMesh.cpp index 2106265aca..d56aa038b5 100644 --- a/Code/Editor/Geometry/TriMesh.cpp +++ b/Code/Editor/Geometry/TriMesh.cpp @@ -201,7 +201,7 @@ void CTriMesh::SetFromMesh(CMesh& mesh) face.v [j] = numv; face.uv[j] = numv; face.n [j] = mesh.m_pNorms[idx].GetN(); - face.MatID = subset.nMatID; + face.MatID = static_cast(subset.nMatID); face.flags = 0; numv++; @@ -269,7 +269,7 @@ void CTriMesh::SharePositions() for (int i = 0; i < 3; i++) { const Vec3& v = pVertices[face.v[i]].pos; - uint8 nHash = RoundFloatToInt((v.x + v.y + v.z) * fHashScale); + uint8 nHash = static_cast(RoundFloatToInt((v.x + v.y + v.z) * fHashScale)); int find = FindVertexInHash(v, pNewVerts, arrHashTable[nHash], fEpsilon); if (find < 0) @@ -320,7 +320,7 @@ void CTriMesh::ShareUV() for (int i = 0; i < 3; i++) { const Vec2 uv = pUV[face.uv[i]].GetUV(); - uint8 nHash = RoundFloatToInt((uv.x + uv.y) * fHashScale); + uint8 nHash = static_cast(RoundFloatToInt((uv.x + uv.y) * fHashScale)); int find = FindTexCoordInHash(pUV[face.uv[i]], pNewUV, arrHashTable[nHash], fEpsilon); if (find < 0) @@ -380,7 +380,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const // To find really used materials std::vector usedMaterialIds; uint16 MatIdToSubset[MAX_SUB_MATERIALS]; - int nLastSubsetId = 0; + uint16 nLastSubsetId = 0; memset(MatIdToSubset, 0, sizeof(MatIdToSubset)); ////////////////////////////////////////////////////////////////////////// @@ -398,7 +398,7 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const MatIdToSubset[face.MatID] = 1 + nLastSubsetId++; usedMaterialIds.push_back(face.MatID); // Order of material ids in usedMaterialIds correspond to the indices of chunks. } - meshFace.nSubset = MatIdToSubset[face.MatID] - 1; + meshFace.nSubset = static_cast(MatIdToSubset[face.MatID] - 1); for (int j = 0; j < 3; ++j) { diff --git a/Code/Editor/GotoPositionDlg.cpp b/Code/Editor/GotoPositionDlg.cpp index aec5f03fbd..84d149de58 100644 --- a/Code/Editor/GotoPositionDlg.cpp +++ b/Code/Editor/GotoPositionDlg.cpp @@ -86,7 +86,7 @@ void GotoPositionDialog::OnChangeEdit() const QStringList parts = m_transform.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts); for (int i = 0; i < argCount && i < parts.count(); ++i) { - transform[i] = parts[i].toDouble(); + transform[i] = parts[i].toFloat(); } m_ui->m_dymX->setValue(transform[0]); diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 2295e1897f..5978356781 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -504,7 +504,7 @@ static inline QString CopyAndRemoveColorCode(const char* sText) *d++ = *s++; } - ret.resize(d - ret.data()); + ret.resize(static_cast(d - ret.data())); return QString::fromLatin1(ret); } diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index e68b17b99f..7126e22a4e 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -1022,10 +1022,10 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l if (camDist < dc.settings->GetLabelsDistance() || (dc.flags & DISPLAY_SELECTION_HELPERS)) { float range = maxDist / 2.0f; - Vec3 c(labelColor.redF(), labelColor.greenF(), labelColor.redF()); + Vec3 c(static_cast(labelColor.redF()), static_cast(labelColor.greenF()), static_cast(labelColor.redF())); if (IsSelected()) { - c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF()); + c = Vec3(static_cast(dc.GetSelectedColor().redF()), static_cast(dc.GetSelectedColor().greenF()), static_cast(dc.GetSelectedColor().blueF())); } float col[4] = { c.x, c.y, c.z, 1 }; @@ -1033,7 +1033,7 @@ void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& l { if (IsHighlighted()) { - c = Vec3(dc.GetSelectedColor().redF(), dc.GetSelectedColor().greenF(), dc.GetSelectedColor().blueF()); + c = Vec3(static_cast(dc.GetSelectedColor().redF()), static_cast(dc.GetSelectedColor().greenF()), static_cast(dc.GetSelectedColor().blueF())); } col[0] = c.x; col[1] = c.y; @@ -1263,9 +1263,9 @@ int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& if (event == eMouseWheel) { - double angle = 1; + float angle = 1; Quat rot = GetRotation(); - rot.SetRotationXYZ(Ang3(0, 0, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle))); + rot.SetRotationXYZ(Ang3(0.f, 0.f, rot.GetRotZ() + DEG2RAD(flags > 0 ? angle * (-1) : angle))); SetRotation(rot); } return MOUSECREATE_CONTINUE; @@ -1857,10 +1857,10 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box) const int kMaxSizeOfEdgeList0(4); Edge2D edgelist0[kMaxSizeOfEdgeList0] = { - Edge2D(Vec2(hc.rect.left(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.top())), - Edge2D(Vec2(hc.rect.right(), hc.rect.top()), Vec2(hc.rect.right(), hc.rect.bottom())), - Edge2D(Vec2(hc.rect.right(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.bottom())), - Edge2D(Vec2(hc.rect.left(), hc.rect.bottom()), Vec2(hc.rect.left(), hc.rect.top())) + Edge2D(Vec2(static_cast(hc.rect.left()), static_cast(hc.rect.top())), Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.top()))), + Edge2D(Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.top())), Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.bottom()))), + Edge2D(Vec2(static_cast(hc.rect.right()), static_cast(hc.rect.bottom())), Vec2(static_cast(hc.rect.left()), static_cast(hc.rect.bottom()))), + Edge2D(Vec2(static_cast(hc.rect.left()), static_cast(hc.rect.bottom())), Vec2(static_cast(hc.rect.left()), static_cast(hc.rect.top()))) }; const int kMaxSizeOfEdgeList1(8); @@ -1888,7 +1888,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box) pointsForRegion1.reserve(kMaxSizeOfEdgeList1); for (int i = 0; i < kMaxSizeOfEdgeList1; ++i) { - pointsForRegion1.push_back(Vec3(obb_p[i].x(), obb_p[i].y(), 0)); + pointsForRegion1.push_back(Vec3(static_cast(obb_p[i].x()), static_cast(obb_p[i].y()), 0.0f)); } std::vector convexHullForRegion1; diff --git a/Code/Editor/Objects/SelectionGroup.cpp b/Code/Editor/Objects/SelectionGroup.cpp index 57a86262aa..f2b7b9ddaf 100644 --- a/Code/Editor/Objects/SelectionGroup.cpp +++ b/Code/Editor/Objects/SelectionGroup.cpp @@ -157,7 +157,7 @@ Vec3 CSelectionGroup::GetCenter() const } if (GetCount() > 0) { - c /= GetCount(); + c /= static_cast(GetCount()); } return c; } diff --git a/Code/Editor/Plugin.cpp b/Code/Editor/Plugin.cpp index e73b9daa2c..4f6fe0279d 100644 --- a/Code/Editor/Plugin.cpp +++ b/Code/Editor/Plugin.cpp @@ -136,7 +136,7 @@ IClassDesc* CClassFactory::FindClass(const char* pClassName) const return nullptr; } - QString name = QString(pClassName).left(pSubClassName - pClassName); + QString name = QString(pClassName).left(static_cast(pSubClassName - pClassName)); return stl::find_in_map(m_nameToClass, name, (IClassDesc*)nullptr); } diff --git a/Code/Editor/PluginManager.cpp b/Code/Editor/PluginManager.cpp index 350102ead2..494748dc79 100644 --- a/Code/Editor/PluginManager.cpp +++ b/Code/Editor/PluginManager.cpp @@ -262,7 +262,7 @@ void CPluginManager::RegisterPlugin(QLibrary* dllHandle, IPlugin* pPlugin) entry.hLibrary = dllHandle; entry.pPlugin = pPlugin; m_plugins.push_back(entry); - m_uuidPluginMap[m_currentUUID] = pPlugin; + m_uuidPluginMap[static_cast(m_currentUUID)] = pPlugin; ++m_currentUUID; } diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp index 85730d327b..74187fc9c5 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp @@ -661,8 +661,8 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc) if (IsEntityIconVisible()) { const QPoint entityScreenPos = hc.view->WorldToView(GetWorldPos()); - const float screenPosX = entityScreenPos.x(); - const float screenPosY = entityScreenPos.y(); + const float screenPosX = static_cast(entityScreenPos.x()); + const float screenPosY = static_cast(entityScreenPos.y()); const float iconRange = static_cast(s_kIconSize / 2); if ((hc.point2d.x() >= screenPosX - iconRange && hc.point2d.x() <= screenPosX + iconRange) diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index b10fe35513..276e6e4c83 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -626,7 +626,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con { view->GetDimensions(&width, &height); } - m_contextMenuViewPoint.Set(width / 2, height / 2); + m_contextMenuViewPoint.Set(static_cast(width / 2), static_cast(height / 2)); } else { @@ -998,7 +998,7 @@ void SandboxIntegrationManager::HandleObjectModeSelection(const AZ::Vector2& poi if (m_inObjectPickMode) { CViewport* view = GetIEditor()->GetViewManager()->GetGameViewport(); - const QPoint viewPoint(point.GetX(), point.GetY()); + const QPoint viewPoint(static_cast(point.GetX()), static_cast(point.GetY())); HitContext hitInfo; hitInfo.view = view; @@ -1440,7 +1440,7 @@ void SandboxIntegrationManager::ContextMenu_NewEntity() // will be created at the origin. if (view) { - const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY()); + const QPoint viewPoint(static_cast(m_contextMenuViewPoint.GetX()), static_cast(m_contextMenuViewPoint.GetY())); worldPosition = view->GetHitLocation(viewPoint); } @@ -1630,7 +1630,7 @@ void SandboxIntegrationManager::InstantiateSliceFromAssetId(const AZ::Data::Asse // will be instantiated at the origin. if (view) { - const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY()); + const QPoint viewPoint(static_cast(m_contextMenuViewPoint.GetX()), static_cast(m_contextMenuViewPoint.GetY())); sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint)))); } diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index c1938184db..95fe28f406 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -2476,10 +2476,10 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& auto backgroundBoxRect = option.rect; - backgroundBoxRect.setX(backgroundBoxRect.x() + 0.5); - backgroundBoxRect.setY(backgroundBoxRect.y() + 2.5); - backgroundBoxRect.setWidth(backgroundBoxRect.width() - 1.0); - backgroundBoxRect.setHeight(backgroundBoxRect.height() - 1.0); + backgroundBoxRect.setX(static_cast(backgroundBoxRect.x() + 0.5f)); + backgroundBoxRect.setY(static_cast(backgroundBoxRect.y() + 2.5f)); + backgroundBoxRect.setWidth(static_cast(backgroundBoxRect.width() - 1.0f)); + backgroundBoxRect.setHeight(static_cast(backgroundBoxRect.height() - 1.0f)); const qreal sliceBorderHeight = 0.8f; @@ -2513,7 +2513,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& else { auto newRect = option.rect; - newRect.setHeight(newRect.height() - 1.0); + newRect.setHeight(static_cast(newRect.height() - 1.0f)); path.addRect(newRect); } diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp index 158e45d6e2..452db49d37 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerTreeView.cpp @@ -274,8 +274,8 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const // if the item has children offset the drawn line to compensate for drawn expander buttons bool hasChildren = previousIndex.model()->index(0, 0, previousIndex).isValid(); int horizontalLineY = rect.top() + rectHalfHeight; - int horizontalLineLeft = rect.right() - indentation() * 1.5f; - int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : (lineBaseX - indentation() * 0.5f); + int horizontalLineLeft = static_cast(rect.right() - indentation() * 1.5f); + int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : static_cast(lineBaseX - indentation() * 0.5f); painter->drawLine(horizontalLineLeft, horizontalLineY, horizontalLineRight, horizontalLineY); } @@ -284,7 +284,7 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const bool hasNext = previousIndex.sibling(previousIndex.row() + 1, previousIndex.column()).isValid(); if (hasNext || previousIndex == index) { - int verticalLineX = lineBaseX - indentation() * 1.5f; + int verticalLineX = static_cast(lineBaseX - indentation() * 1.5f); int verticalLineTop = rect.top(); int verticalLineBottom = hasNext ? rect.bottom() : rect.bottom() - rectHalfHeight; painter->drawLine(verticalLineX, verticalLineTop, verticalLineX, verticalLineBottom); diff --git a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp index f9b2c6c023..98bf228391 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterWindow.cpp @@ -500,10 +500,10 @@ void AssetImporterWindow::SetTitle(const char* filePath) AZStd::string extension; if (AzFramework::StringFunc::Path::GetExtension(filePath, extension, false)) { - extension[0] = toupper(extension[0]); + extension[0] = static_cast(toupper(extension[0])); for (size_t i = 1; i < extension.size(); ++i) { - extension[i] = tolower(extension[i]); + extension[i] = static_cast(tolower(extension[i])); } } else diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp index 2b7bca3b0b..dff41c0a86 100644 --- a/Code/Editor/PythonEditorFuncs.cpp +++ b/Code/Editor/PythonEditorFuncs.cpp @@ -76,7 +76,7 @@ namespace } else if (pCVar->GetType() == CVAR_FLOAT) { - PySetCVarFromFloat(pName, std::stod(pValue)); + PySetCVarFromFloat(pName, static_cast(std::stod(pValue))); } else if (pCVar->GetType() != CVAR_STRING) { @@ -152,11 +152,11 @@ namespace } else if (pCVar->GetType() == CVAR_INT) { - PySetCVarFromInt(pName, AZStd::any_cast(value)); + PySetCVarFromInt(pName, static_cast(AZStd::any_cast(value))); } else if (pCVar->GetType() == CVAR_FLOAT) { - PySetCVarFromFloat(pName, AZStd::any_cast(value)); + PySetCVarFromFloat(pName, static_cast(AZStd::any_cast(value))); } else if (pCVar->GetType() == CVAR_STRING) { @@ -548,13 +548,11 @@ namespace if (title.empty()) { throw std::runtime_error("Incorrect title argument passed in. "); - return result; } if (values.size() == 0) { throw std::runtime_error("Empty value list passed in. "); - return result; } QStringList list; diff --git a/Code/Editor/QtUI/PixmapLabelPreview.cpp b/Code/Editor/QtUI/PixmapLabelPreview.cpp index a98c743afb..9c415a6c4d 100644 --- a/Code/Editor/QtUI/PixmapLabelPreview.cpp +++ b/Code/Editor/QtUI/PixmapLabelPreview.cpp @@ -31,7 +31,7 @@ int PixmapLabelPreview::heightForWidth(int width) const return width; } - return ((qreal)m_pixmap.height() * width) / m_pixmap.width(); + return static_cast(((qreal)m_pixmap.height() * width) / m_pixmap.width()); } diff --git a/Code/Editor/QtViewPaneManager.cpp b/Code/Editor/QtViewPaneManager.cpp index d8111aa09c..022bb6ecd9 100644 --- a/Code/Editor/QtViewPaneManager.cpp +++ b/Code/Editor/QtViewPaneManager.cpp @@ -1102,7 +1102,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings) entityInspectorViewPane->m_dockWidget->setFloating(false); static const float tabWidgetWidthPercentage = 0.2f; - int newWidth = (float)screenWidth * tabWidgetWidthPercentage; + int newWidth = static_cast((float)screenWidth * tabWidgetWidthPercentage); if (levelInspectorPane) { @@ -1139,7 +1139,7 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings) // so that they get an appropriate default width since the minimum sizes have // been removed from these widgets static const float entityOutlinerWidthPercentage = 0.15f; - int newWidth = (float)screenWidth * entityOutlinerWidthPercentage; + int newWidth = static_cast((float)screenWidth * entityOutlinerWidthPercentage); m_mainWindow->resizeDocks({ entityOutlinerViewPane->m_dockWidget }, { newWidth }, Qt::Horizontal); } diff --git a/Code/Editor/Settings.cpp b/Code/Editor/Settings.cpp index 259f71b69b..8672bad5c4 100644 --- a/Code/Editor/Settings.cpp +++ b/Code/Editor/Settings.cpp @@ -394,7 +394,7 @@ void SEditorSettings::LoadValue(const char* sSection, const char* sKey, float& v { const SettingsGroup sg(sSection); const QString defaultVal = s_editorSettings()->value(sKey, QString::number(value)).toString(); - value = defaultVal.toDouble(); + value = defaultVal.toFloat(); if (GetIEditor()->GetSettingsManager()) { diff --git a/Code/Editor/ToolBox.cpp b/Code/Editor/ToolBox.cpp index 1f08bd74fc..cfebc378f7 100644 --- a/Code/Editor/ToolBox.cpp +++ b/Code/Editor/ToolBox.cpp @@ -60,7 +60,7 @@ void CToolBoxCommand::Execute() const // Toggle the variable. float val = GetIEditor()->GetConsoleVar(m_text.toUtf8().data()); bool bOn = val != 0; - GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0 : 1); + GetIEditor()->SetConsoleVar(m_text.toUtf8().data(), (bOn) ? 0.0f : 1.0f); } else { @@ -186,7 +186,6 @@ const CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) const assert(0 <= iIndex && iIndex < m_shelveMacros.size()); return m_shelveMacros[iIndex]; } - return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -202,7 +201,6 @@ CToolBoxMacro* CToolBoxManager::GetMacro(int iIndex, bool bToolbox) assert(0 <= iIndex && iIndex < m_shelveMacros.size()); return m_shelveMacros[iIndex]; } - return nullptr; } ////////////////////////////////////////////////////////////////////////// @@ -275,7 +273,6 @@ CToolBoxMacro* CToolBoxManager::NewMacro(const QString& title, bool bToolbox, in m_shelveMacros.push_back(pNewTool); return pNewTool; } - return nullptr; } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp index aea655e9d3..33f1b0d441 100644 --- a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp +++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp @@ -93,7 +93,7 @@ static void UpdateAtomOutputFrameCaptureView(TrackView::AtomOutputFrameCapture& const AZ::EntityId activeCameraEntityId = TrackView::ActiveCameraEntityId(); atomOutputFrameCapture.UpdateView( TrackView::TransformFromEntityId(activeCameraEntityId), - TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, width, height)); + TrackView::ProjectionFromCameraEntityId(activeCameraEntityId, static_cast(width), static_cast(height))); } CSequenceBatchRenderDialog::CSequenceBatchRenderDialog(float fps, QWidget* pParent /* = nullptr */) @@ -170,10 +170,10 @@ void CSequenceBatchRenderDialog::OnInitDialog() connect(m_ui->m_endFrame, editingFinished, this, &CSequenceBatchRenderDialog::OnEndFrameChange); connect(m_ui->m_imageFormatCombo, static_cast(&QComboBox::currentIndexChanged), this, &CSequenceBatchRenderDialog::OnImageFormatChange); - const float bigEnoughNumber = 1000000.0f; - m_ui->m_startFrame->setRange(0.0f, bigEnoughNumber); + const int bigEnoughNumber = 1000000; + m_ui->m_startFrame->setRange(0, bigEnoughNumber); - m_ui->m_endFrame->setRange(0.0f, bigEnoughNumber); + m_ui->m_endFrame->setRange(0, bigEnoughNumber); // Fill the sequence combo box. bool activeSequenceWasSet = false; @@ -301,8 +301,8 @@ void CSequenceBatchRenderDialog::OnRenderItemSelChange() } } // frame range - m_ui->m_startFrame->setValue(item.frameRange.start * m_fpsForTimeToFrameConversion); - m_ui->m_endFrame->setValue(item.frameRange.end * m_fpsForTimeToFrameConversion); + m_ui->m_startFrame->setValue(static_cast(item.frameRange.start * m_fpsForTimeToFrameConversion)); + m_ui->m_endFrame->setValue(static_cast(item.frameRange.end * m_fpsForTimeToFrameConversion)); // folder m_ui->m_destinationEdit->setText(item.folder); // fps @@ -580,12 +580,12 @@ void CSequenceBatchRenderDialog::OnSequenceSelected() // Adjust the frame range. float sFrame = pSequence->GetTimeRange().start * m_fpsForTimeToFrameConversion; float eFrame = pSequence->GetTimeRange().end * m_fpsForTimeToFrameConversion; - m_ui->m_startFrame->setRange(0.0f, eFrame); - m_ui->m_endFrame->setRange(0.0f, eFrame); + m_ui->m_startFrame->setRange(0, static_cast(eFrame)); + m_ui->m_endFrame->setRange(0, static_cast(eFrame)); // Set the default start/end frames properly. - m_ui->m_startFrame->setValue(sFrame); - m_ui->m_endFrame->setValue(eFrame); + m_ui->m_startFrame->setValue(static_cast(sFrame)); + m_ui->m_endFrame->setValue(static_cast(eFrame)); m_ui->m_shotCombo->clear(); // Fill the shot combo box with the names of director nodes. diff --git a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp index e2f8a4f7a2..ae1080a9c1 100644 --- a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp +++ b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp @@ -367,7 +367,7 @@ bool CTVCustomizeTrackColorsDlg::Import(const QString& fullPath) { return entry.paramType == paramType; }); - int entryIndex = pEntry - g_trackEntries; + int entryIndex = static_cast(pEntry - g_trackEntries); if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this. { continue; diff --git a/Code/Editor/TrackView/TVSequenceProps.cpp b/Code/Editor/TrackView/TVSequenceProps.cpp index 1ac31d7e2b..d4e06d0c94 100644 --- a/Code/Editor/TrackView/TVSequenceProps.cpp +++ b/Code/Editor/TrackView/TVSequenceProps.cpp @@ -106,8 +106,8 @@ void CTVSequenceProps::MoveScaleKeys() // Move/Rescale the sequence to a new time range. Range timeRangeOld = m_pSequence->GetTimeRange(); Range timeRangeNew; - timeRangeNew.start = ui->START_TIME->value(); - timeRangeNew.end = ui->END_TIME->value(); + timeRangeNew.start = static_cast(ui->START_TIME->value()); + timeRangeNew.end = static_cast(ui->END_TIME->value()); if (!(timeRangeNew == timeRangeOld)) { @@ -123,14 +123,14 @@ void CTVSequenceProps::UpdateSequenceProps(const QString& name) } Range timeRange; - timeRange.start = ui->START_TIME->value(); - timeRange.end = ui->END_TIME->value(); + timeRange.start = static_cast(ui->START_TIME->value()); + timeRange.end = static_cast(ui->END_TIME->value()); if (m_timeUnit == Frames) { float invFPS = 1.0f / m_FPS; - timeRange.start = ui->START_TIME->value() * invFPS; - timeRange.end = ui->END_TIME->value() * invFPS; + timeRange.start = static_cast(ui->START_TIME->value()) * invFPS; + timeRange.end = static_cast(ui->END_TIME->value()) * invFPS; } m_pSequence->SetTimeRange(timeRange); diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index da3e7cebe2..f1701f9e20 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -1765,7 +1765,7 @@ void CTrackViewDialog::OnSnapFPS() if (ok) { m_wndDopeSheet->SetSnapFPS(fps); - m_wndCurveEditor->SetFPS(fps); + m_wndCurveEditor->SetFPS(static_cast(fps)); SetCursorPosText(GetIEditor()->GetAnimation()->GetTime()); } @@ -1828,7 +1828,7 @@ void CTrackViewDialog::ReadMiscSettings() if (settings.contains(s_kFrameSnappingFPSEntry)) { - float fps = settings.value(s_kFrameSnappingFPSEntry).toDouble(); + float fps = settings.value(s_kFrameSnappingFPSEntry).toFloat(); if (fps >= s_kMinimumFrameSnappingFPS && fps <= s_kMaximumFrameSnappingFPS) { m_wndDopeSheet->SetSnapFPS(FloatToIntRet(fps)); diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index f74d51c421..d0034b2da4 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -146,8 +146,7 @@ CTrackViewDopeSheetBase::~CTrackViewDopeSheetBase() ////////////////////////////////////////////////////////////////////////// int CTrackViewDopeSheetBase::TimeToClient(float time) const { - int x = m_leftOffset - m_scrollOffset.x() + (time * m_timeScale); - return x; + return static_cast(m_leftOffset - m_scrollOffset.x() + (time * m_timeScale)); } ////////////////////////////////////////////////////////////////////////// @@ -193,7 +192,7 @@ void CTrackViewDopeSheetBase::SetTimeRange(float start, float end) m_timeRange.Set(start, end); - SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale - m_leftOffset); + SetHorizontalExtent(-m_leftOffset, static_cast(m_timeRange.end * m_timeScale - m_leftOffset)); } ////////////////////////////////////////////////////////////////////////// @@ -263,7 +262,7 @@ void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) update(); - SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale); + SetHorizontalExtent(-m_leftOffset, static_cast(m_timeRange.end * m_timeScale)); ComputeFrameSteps(GetVisibleRange()); @@ -353,15 +352,15 @@ float CTrackViewDopeSheetBase::TickSnap(float time) const double tickTime = GetTickTime(); double t = floor(((double)time / tickTime) + 0.5); t *= tickTime; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// float CTrackViewDopeSheetBase::TimeFromPoint(const QPoint& point) const { int x = point.x() - m_leftOffset + m_scrollOffset.x(); - double t = (double)x / m_timeScale; - return (float)TickSnap(t); + float t = static_cast(x) / m_timeScale; + return TickSnap(t); } ////////////////////////////////////////////////////////////////////////// @@ -369,7 +368,7 @@ float CTrackViewDopeSheetBase::TimeFromPointUnsnapped(const QPoint& point) const { int x = point.x() - m_leftOffset + m_scrollOffset.x(); double t = (double)x / m_timeScale; - return t; + return static_cast(t); } void CTrackViewDopeSheetBase::mousePressEvent(QMouseEvent* event) @@ -1783,7 +1782,7 @@ float CTrackViewDopeSheetBase::FrameSnap(float time) const { double t = floor((double)time / m_snapFrameTime + 0.5); t = t * m_snapFrameTime; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// @@ -2003,9 +2002,10 @@ bool CTrackViewDopeSheetBase::CreateColorKey(CTrackViewTrack* pTrack, float keyT Vec3 vColor(0, 0, 0); pTrack->GetValue(keyTime, vColor); - const AZ::Color defaultColor(clamp_tpl(FloatToIntRet(vColor.x), 0, 255), - clamp_tpl(FloatToIntRet(vColor.y), 0, 255), - clamp_tpl(FloatToIntRet(vColor.z), 0, 255), + const AZ::Color defaultColor( + clamp_tpl(static_cast(FloatToIntRet(vColor.x)), 0, 255), + clamp_tpl(static_cast(FloatToIntRet(vColor.y)), 0, 255), + clamp_tpl(static_cast(FloatToIntRet(vColor.z)), 0, 255), 255); AzQtComponents::ColorPicker dlg(AzQtComponents::ColorPicker::Configuration::RGB, QString(), this); dlg.setWindowTitle(tr("Select Color")); @@ -2054,7 +2054,7 @@ void CTrackViewDopeSheetBase::OnCurrentColorChange(const AZ::Color& color) void CTrackViewDopeSheetBase::UpdateColorKey(const QColor& color, bool addToUndo) { - ColorF colArray(color.red(), color.green(), color.blue(), color.alpha()); + ColorF colArray(static_cast(color.redF()), static_cast(color.greenF()), static_cast(color.blueF()), static_cast(color.alphaF())); CTrackViewSequence* sequence = m_colorUpdateTrack->GetSequence(); if (nullptr != sequence) @@ -2119,9 +2119,10 @@ void CTrackViewDopeSheetBase::EditSelectedColorKey(CTrackViewTrack* pTrack) Vec3 color; pTrack->GetValue(m_colorUpdateKeyTime, color); - const AZ::Color defaultColor(clamp_tpl(FloatToIntRet(color.x), 0, 255), - clamp_tpl(FloatToIntRet(color.y), 0, 255), - clamp_tpl(FloatToIntRet(color.z), 0, 255), + const AZ::Color defaultColor( + clamp_tpl(static_cast(FloatToIntRet(color.x)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(color.y)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(color.z)), AZ::u8(0), AZ::u8(255)), 255); AzQtComponents::ColorPicker picker(AzQtComponents::ColorPicker::Configuration::RGB); @@ -2369,12 +2370,12 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang nNumberTicks = 8; } - double start = TickSnap(timeRange.start); - double step = 1.0 / m_ticksStep; + float start = TickSnap(timeRange.start); + float step = 1.0f / static_cast(m_ticksStep); - for (double t = 0.0f; t <= timeRange.end + step; t += step) + for (float t = 0.0f; t <= timeRange.end + step; t += step) { - double st = TickSnap(t); + float st = TickSnap(t); if (st > timeRange.end) { st = timeRange.end; @@ -2393,7 +2394,7 @@ void CTrackViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Rang continue; } - int k = RoundFloatToInt(st * m_ticksStep); + int k = RoundFloatToInt(st * static_cast(m_ticksStep)); if (k % nNumberTicks == 0) { if (st >= start) @@ -3218,7 +3219,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange) float nBIntermediateTicks = 5; m_fFrameLabelStep = fFact * afStepTable[nStepIdx]; - if (TimeToClient(m_fFrameLabelStep) - TimeToClient(0) > 1300) + if (TimeToClient(static_cast(m_fFrameLabelStep)) - TimeToClient(0.0f) > 1300) { nBIntermediateTicks = 10; } @@ -3230,7 +3231,7 @@ void CTrackViewDopeSheetBase::ComputeFrameSteps(const Range& visRange) void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRect& rc, [[maybe_unused]] const QColor& lineCol, const QColor& textCol, [[maybe_unused]] double step) { float fFramesPerSec = 1.0f / m_snapFrameTime; - float fInvFrameLabelStep = 1.0f / m_fFrameLabelStep; + float fInvFrameLabelStep = 1.0f / static_cast(m_fFrameLabelStep); Range VisRange = GetVisibleRange(); const Range& timeRange = m_timeRange; @@ -3238,9 +3239,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRec const QPen ltgray(QColor(90, 90, 90)); const QPen black(textCol); - for (double t = TickSnap(timeRange.start); t <= timeRange.end + m_fFrameTickStep; t += m_fFrameTickStep) + for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast(m_fFrameTickStep); t += static_cast(m_fFrameTickStep)) { - double st = t; + float st = t; if (st > timeRange.end) { st = timeRange.end; @@ -3285,9 +3286,9 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe const QPen ltgray(QColor(90, 90, 90)); const QPen black(textCol); - for (double t = TickSnap(timeRange.start); t <= timeRange.end + step; t += step) + for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast(step); t += static_cast(step)) { - double st = TickSnap(t); + float st = TickSnap(t); if (st > timeRange.end) { st = timeRange.end; @@ -3306,7 +3307,7 @@ void CTrackViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QRe } int x = TimeToClient(st); - int k = RoundFloatToInt(st * m_ticksStep); + int k = RoundFloatToInt(st * static_cast(m_ticksStep)); if (k % nNumberTicks == 0) { painter->setPen(black); diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index b64df7e2eb..ae38323cc3 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -1419,7 +1419,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) { if (animNode) { - UINT_PTR menuId = cmd - eMI_AddTrackBase; + unsigned int menuId = cmd - eMI_AddTrackBase; if (animNode->GetType() != AnimNodeType::AzEntity) { diff --git a/Code/Editor/Util/AffineParts.cpp b/Code/Editor/Util/AffineParts.cpp index c80ceb3ffa..d83a1986b9 100644 --- a/Code/Editor/Util/AffineParts.cpp +++ b/Code/Editor/Util/AffineParts.cpp @@ -158,11 +158,11 @@ static Quatern Qt_FromMatrix(HMatrix mat) if (tr >= 0.0) { s = sqrt(tr + mat[W][W]); - qu.w = s * 0.5; + qu.w = static_cast(s * 0.5); s = 0.5 / s; - qu.x = (mat[Z][Y] - mat[Y][Z]) * s; - qu.y = (mat[X][Z] - mat[Z][X]) * s; - qu.z = (mat[Y][X] - mat[X][Y]) * s; + qu.x = static_cast((mat[Z][Y] - mat[Y][Z]) * s); + qu.y = static_cast((mat[X][Z] - mat[Z][X]) * s); + qu.z = static_cast((mat[Y][X] - mat[X][Y]) * s); } else { @@ -180,11 +180,11 @@ static Quatern Qt_FromMatrix(HMatrix mat) #define caseMacro(i, j, k, I, J, K) \ case I: \ s = sqrt((mat[I][I] - (mat[J][J] + mat[K][K])) + mat[W][W]); \ - qu.i = s * 0.5; \ + qu.i = static_cast(s * 0.5); \ s = 0.5 / s; \ - qu.j = (mat[I][J] + mat[J][I]) * s; \ - qu.k = (mat[K][I] + mat[I][K]) * s; \ - qu.w = (mat[K][J] - mat[J][K]) * s; \ + qu.j = static_cast((mat[I][J] + mat[J][I]) * s); \ + qu.k = static_cast((mat[K][I] + mat[I][K]) * s); \ + qu.w = static_cast((mat[K][J] - mat[J][K]) * s); \ break caseMacro(x, y, z, X, Y, Z); caseMacro(y, z, x, Y, Z, X); @@ -263,7 +263,7 @@ static void make_reflector(float* v, float* u) u[0] = v[0]; u[1] = v[1]; u[2] = v[2] + ((v[2] < 0.0) ? -s : s); - s = sqrt(2.0 / vdot(u, u)); + s = static_cast(sqrt(2.0f / vdot(u, u))); u[0] = u[0] * s; u[1] = u[1] * s; u[2] = u[2] * s; @@ -407,8 +407,8 @@ float polar_decomp(HMatrix M, HMatrix Q, HMatrix S) MadjT_one = norm_one(MadjTk); MadjT_inf = norm_inf(MadjTk); gamma = sqrt(sqrt((MadjT_one * MadjT_inf) / (M_one * M_inf)) / fabs(det)); - g1 = gamma * 0.5; - g2 = 0.5 / (gamma * det); + g1 = gamma * 0.5f; + g2 = 0.5f / (gamma * det); mat_copy(Ek, =, Mk, 3); mat_binop(Mk, =, g1 * Mk, +, g2 * MadjTk, 3); mat_copy(Ek, -=, Mk, 3); @@ -424,7 +424,7 @@ float polar_decomp(HMatrix M, HMatrix Q, HMatrix S) { for (int j = i; j < 3; j++) { - S[i][j] = S[j][i] = 0.5 * (S[i][j] + S[j][i]); + S[i][j] = S[j][i] = 0.5f * (S[i][j] + S[j][i]); } } return (det); @@ -454,7 +454,7 @@ HVect spect_decomp(HMatrix S, HMatrix U) OffD[Z] = S[X][Y]; for (sweep = 20; sweep > 0; sweep--) { - float sm = fabs(OffD[X]) + fabs(OffD[Y]) + fabs(OffD[Z]); + float sm = static_cast(fabs(OffD[X]) + fabs(OffD[Y]) + fabs(OffD[Z])); if (sm == 0.0) { break; @@ -496,16 +496,16 @@ HVect spect_decomp(HMatrix S, HMatrix U) { a = U[j][p]; b = U[j][q]; - U[j][p] -= s * (b + tau * a); - U[j][q] += s * (a - tau * b); + U[j][p] -= static_cast(s * (b + tau * a)); + U[j][q] += static_cast(s * (a - tau * b)); } } } } - kv.x = Diag[X]; - kv.y = Diag[Y]; - kv.z = Diag[Z]; - kv.w = 1.0; + kv.x = static_cast(Diag[X]); + kv.y = static_cast(Diag[Y]); + kv.z = static_cast(Diag[Z]); + kv.w = 1.0f; return (kv); } @@ -650,7 +650,7 @@ Quatern snuggle(Quatern q, HVect* k) } qp = Qt_Mul(q, p); t = sqrt(mag[win] + 0.5); - p = Qt_Mul(p, Qt_(0.0, 0.0, -qp.z / t, qp.w / t)); + p = Qt_Mul(p, Qt_(0.0f, 0.0f, static_cast(-qp.z / t), static_cast(qp.w / t))); p = Qt_Mul(qtoz, Qt_Conj(p)); } else @@ -721,14 +721,14 @@ Quatern snuggle(Quatern q, HVect* k) int ii; for (ii = 0; ii < 4; ii++) { - pa[ii] = sgn(neg[ii], 0.5); + pa[ii] = static_cast(sgn(neg[ii], 0.5f)); } } cycle(ka, par) } else { /*big*/ - pa[hi] = sgn(neg[hi], 1.0); + pa[hi] = static_cast(sgn(neg[hi], 1.0f)); } } else @@ -752,7 +752,7 @@ Quatern snuggle(Quatern q, HVect* k) } else { /*big*/ - pa[hi] = sgn(neg[hi], 1.0); + pa[hi] = static_cast(sgn(neg[hi], 1.0f)); } } p.x = -pa[0]; diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index e39adcca82..435ec67a99 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -455,7 +455,7 @@ bool CFileUtil::ExtractDccFilenameUsingNamingConventions(const QString& assetFil ////////////////////////////////////////////////////////////////////////// void CFileUtil::FormatFilterString(QString& filter) { - const int numPipeChars = std::count(filter.begin(), filter.end(), '|'); + const int numPipeChars = static_cast(std::count(filter.begin(), filter.end(), '|')); if (numPipeChars == 1) { filter = QStringLiteral("%1||").arg(filter); diff --git a/Code/Editor/Util/GdiUtil.cpp b/Code/Editor/Util/GdiUtil.cpp index 8565aabf9d..1048b5f4dd 100644 --- a/Code/Editor/Util/GdiUtil.cpp +++ b/Code/Editor/Util/GdiUtil.cpp @@ -15,43 +15,6 @@ #include #include -bool ComputeThumbsLayoutInfo(float aContainerWidth, float aThumbWidth, float aMargin, UINT aThumbCount, UINT& rThumbsPerRow, float& rNewMargin) -{ - rThumbsPerRow = 0; - rNewMargin = 0; - - if (aThumbWidth <= 0 || aMargin <= 0 || (aThumbWidth + aMargin * 2) <= 0) - { - return false; - } - - if (aContainerWidth <= 0) - { - return true; - } - - rThumbsPerRow = (int) aContainerWidth / (aThumbWidth + aMargin * 2); - - if ((aThumbWidth + aMargin * 2) * aThumbCount < aContainerWidth) - { - rNewMargin = aMargin; - } - else - { - if (rThumbsPerRow > 0) - { - rNewMargin = (aContainerWidth - rThumbsPerRow * aThumbWidth); - - if (rNewMargin > 0) - { - rNewMargin = (float)rNewMargin / rThumbsPerRow / 2.0f; - } - } - } - - return true; -} - QColor ScaleColor(const QColor& c, float aScale) { QColor aColor = c; diff --git a/Code/Editor/Util/GdiUtil.h b/Code/Editor/Util/GdiUtil.h index 55165b5799..f38cbc0c0e 100644 --- a/Code/Editor/Util/GdiUtil.h +++ b/Code/Editor/Util/GdiUtil.h @@ -14,16 +14,6 @@ #define CRYINCLUDE_EDITOR_UTIL_GDIUTIL_H #pragma once -//! function used to compute thumbs per row and spacing, used in asset browser and other tools where thumb layout is needed and maybe GDI canvas used -//! \param aContainerWidth the thumbs' container width -//! \param aThumbWidth the thumb image width -//! \param aMargin the thumb default minimum horizontal margin -//! \param aThumbCount the thumb count -//! \param rThumbsPerRow returned thumb count per single row -//! \param rNewMargin returned new computed margin between thumbs -//! \note The margin between thumbs will grow/shrink dynamically to keep up with the thumb count per row -bool ComputeThumbsLayoutInfo(float aContainerWidth, float aThumbWidth, float aMargin, UINT aThumbCount, UINT& rThumbsPerRow, float& rNewMargin); - QColor ScaleColor(const QColor& coor, float aScale); //! This class loads alpha-channel bitmaps and holds a DC for use with AlphaBlend function diff --git a/Code/Editor/Util/ImageASC.cpp b/Code/Editor/Util/ImageASC.cpp index 8a63ebdc6a..c166917a68 100644 --- a/Code/Editor/Util/ImageASC.cpp +++ b/Code/Editor/Util/ImageASC.cpp @@ -132,7 +132,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) token = azstrtok(nullptr, 0, seps, &nextToken); validData = validData && (azstricmp(token, "nodata_value") == 0); token = azstrtok(nullptr, 0, seps, &nextToken); - nodataValue = atof(token); + nodataValue = static_cast(atof(token)); if (!validData) { @@ -157,7 +157,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) if (token != nullptr) { // Negative heights aren't supported, clamp to 0. - pixelValue = max(0.0, atof(token)); + pixelValue = max(0.0f, static_cast(atof(token))); // If this is a location we specifically don't have data for, set it to 0. if (pixelValue == nodataValue) diff --git a/Code/Editor/Util/ImageGif.cpp b/Code/Editor/Util/ImageGif.cpp index 383319a666..a9ab4efdaf 100644 --- a/Code/Editor/Util/ImageGif.cpp +++ b/Code/Editor/Util/ImageGif.cpp @@ -411,7 +411,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) FreeCode = FirstFree; CurCode = OldCode = Code = ReadCode(); FinChar = CurCode & BitMask; - AddToPixel (FinChar); + AddToPixel(static_cast(FinChar)); } else { @@ -455,7 +455,7 @@ bool CImageGif::Load(const QString& fileName, CImageEx& outImage) for (i = OutCount - 1; i >= 0; i--) { - AddToPixel (OutCode[i]); + AddToPixel(static_cast(OutCode[i])); } OutCount = 0; diff --git a/Code/Editor/Util/bitarray.h b/Code/Editor/Util/bitarray.h index f55d195fd1..5a887b02d5 100644 --- a/Code/Editor/Util/bitarray.h +++ b/Code/Editor/Util/bitarray.h @@ -220,7 +220,7 @@ public: b.resize((compsize + 1) << 3); out = (char*)b.m_bits; in = (char*)m_bits; - *out++ = bsize; + *out++ = static_cast(bsize); for (i = 0; i < bsize; i++) { *out++ = in[i]; @@ -239,7 +239,7 @@ public: } } i--; - *out++ = countz; + *out++ = static_cast(countz); } } } diff --git a/Code/Editor/ViewPane.cpp b/Code/Editor/ViewPane.cpp index 466274c06e..a932f05c79 100644 --- a/Code/Editor/ViewPane.cpp +++ b/Code/Editor/ViewPane.cpp @@ -646,7 +646,7 @@ namespace if (viewPane && viewPane->GetViewport()) { const QRect rcViewport = viewPane->GetViewport()->rect(); - return AZ::Vector2(rcViewport.width(), rcViewport.height()); + return AZ::Vector2(static_cast(rcViewport.width()), static_cast(rcViewport.height())); } else { diff --git a/Code/Editor/Viewport.cpp b/Code/Editor/Viewport.cpp index 873f555c80..2646f1cd50 100644 --- a/Code/Editor/Viewport.cpp +++ b/Code/Editor/Viewport.cpp @@ -419,7 +419,7 @@ void QtViewport::Update() ////////////////////////////////////////////////////////////////////////// QPoint QtViewport::WorldToView(const Vec3& wp) const { - return QPoint(wp.x, wp.y); + return QPoint(static_cast(wp.x), static_cast(wp.y)); } ////////////////////////////////////////////////////////////////////////// @@ -427,8 +427,8 @@ Vec3 QtViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) cons { QPoint p = WorldToView(wp); Vec3 out; - out.x = p.x(); - out.y = p.y(); + out.x = static_cast(p.x()); + out.y = static_cast(p.y()); out.z = wp.z; return out; } @@ -437,8 +437,8 @@ Vec3 QtViewport::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nFlags) cons Vec3 QtViewport::ViewToWorld(const QPoint& vp, bool* pCollideWithTerrain, [[maybe_unused]] bool onlyTerrain, [[maybe_unused]] bool bSkipVegetation, [[maybe_unused]] bool bTestRenderMesh, [[maybe_unused]] bool* collideWithObject) const { Vec3 wp; - wp.x = vp.x(); - wp.y = vp.y(); + wp.x = static_cast(vp.x()); + wp.y = static_cast(vp.y()); wp.z = 0; if (pCollideWithTerrain) { @@ -520,7 +520,7 @@ void QtViewport::mouseMoveEvent(QMouseEvent* event) void QtViewport::wheelEvent(QWheelEvent* event) { - OnMouseWheel(event->modifiers(), event->angleDelta().y(), event->position().toPoint()); + OnMouseWheel(event->modifiers(), static_cast(event->angleDelta().y()), event->position().toPoint()); event->accept(); } @@ -1276,9 +1276,9 @@ float QtViewport::GetDistanceToLine(const Vec3& lineP1, const Vec3& lineP2, cons QPoint p2 = WorldToView(lineP2); return PointToLineDistance2D( - Vec3(p1.x(), p1.y(), 0), - Vec3(p2.x(), p2.y(), 0), - Vec3(point.x(), point.y(), 0)); + Vec3(static_cast(p1.x()), static_cast(p1.y()), 0.0f), + Vec3(static_cast(p2.x()), static_cast(p2.y()), 0.0f), + Vec3(static_cast(point.x()), static_cast(point.y()), 0.0f)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp index b54ce54ddd..0c59c1e9b5 100644 --- a/Code/Editor/ViewportTitleDlg.cpp +++ b/Code/Editor/ViewportTitleDlg.cpp @@ -306,7 +306,7 @@ void CViewportTitleDlg::OnInitDialog() AZ::VR::VREventBus::Handler::BusConnect(); QFontMetrics metrics({}); - int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier; + int width = static_cast(metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier); m_cameraSpeed->setFixedWidth(width); @@ -457,7 +457,7 @@ void CViewportTitleDlg::AddFOVMenus(QMenu* menu, std::function call float fov = gSettings.viewports.fDefaultFov; bool ok; - float f = customPreset.toDouble(&ok); + float f = customPreset.toFloat(&ok); if (ok) { fov = std::max(1.0f, f); @@ -477,7 +477,7 @@ void CViewportTitleDlg::OnMenuFOVCustom() if (ok) { - m_pViewPane->SetViewportFOV(fov); + m_pViewPane->SetViewportFOV(static_cast(fov)); // Update the custom presets. const QString text = QString::number(fov); @@ -973,12 +973,12 @@ void CViewportTitleDlg::OnAngleSnappingToggled() void CViewportTitleDlg::OnGridSpinBoxChanged(double value) { - SandboxEditor::SetGridSnappingSize(value); + SandboxEditor::SetGridSnappingSize(static_cast(value)); } void CViewportTitleDlg::OnAngleSpinBoxChanged(double value) { - SandboxEditor::SetAngleSnappingSize(value); + SandboxEditor::SetAngleSnappingSize(static_cast(value)); } void CViewportTitleDlg::UpdateOverFlowMenuState() From 3060b0c1bb83b087467a771805d5d9ae09d088ce Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:56:49 -0700 Subject: [PATCH 069/100] Gems/EMotionFX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/EMotionFX/Source/ActorInstance.cpp | 2 +- .../Source/AnimGraph/AnimGraphModel.cpp | 12 ++++++------ .../Source/Editor/PropertyWidgets/PropertyTypes.cpp | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp index 5a8fcda907..5a4ca95670 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp @@ -1115,7 +1115,7 @@ namespace EMotionFX void ActorInstance::EnableAllNodes() { m_enabledNodes.resize(m_actor->GetNumNodes()); - std::iota(m_enabledNodes.begin(), m_enabledNodes.end(), 0); + std::iota(m_enabledNodes.begin(), m_enabledNodes.end(), uint16(0)); } // disable all nodes diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp index 6e68a761de..a6733ee614 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.cpp @@ -562,9 +562,9 @@ namespace EMStudio ModelItemData modelItemData(graphInstance, animGraphObject); AZStd::pair itModelItemData = m_modelItemDataSet.equal_range(&modelItemData); - for (ModelItemDataSet::const_iterator it = itModelItemData.first; it != itModelItemData.second; ++it) + if (itModelItemData.first != itModelItemData.second) { - ModelItemData* modelItemData2 = *it; + ModelItemData* modelItemData2 = *itModelItemData.first; return createIndex(modelItemData2->m_row, 0, modelItemData2); } return QModelIndex(); @@ -590,9 +590,9 @@ namespace EMStudio // Find the model index ModelItemData modelItemData(animGraphInstance, animGraphObject); AZStd::pair itModelItemData = m_modelItemDataSet.equal_range(&modelItemData); - for (ModelItemDataSet::const_iterator it = itModelItemData.first; it != itModelItemData.second; ++it) + if (itModelItemData.first != itModelItemData.second) { - ModelItemData* modelItemData2 = *it; + ModelItemData* modelItemData2 = *itModelItemData.first; return createIndex(modelItemData2->m_row, 0, modelItemData2); } } @@ -603,9 +603,9 @@ namespace EMStudio // Find the model index ModelItemData modelItemData(nullptr, animGraphObject); AZStd::pair itModelItemData = m_modelItemDataSet.equal_range(&modelItemData); - for (ModelItemDataSet::const_iterator it = itModelItemData.first; it != itModelItemData.second; ++it) + if (itModelItemData.first != itModelItemData.second) { - ModelItemData* modelItemData2 = *it; + ModelItemData* modelItemData2 = *itModelItemData.first; return createIndex(modelItemData2->m_row, 0, modelItemData2); } } diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp index e8c4ee69d8..a93ec07477 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/PropertyTypes.cpp @@ -89,8 +89,9 @@ namespace EMotionFX AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Broadcast(&AzToolsFramework::PropertyTypeRegistrationMessages::RegisterPropertyType, handler); } return propertyHandlers; -#endif +#else return AZStd::vector {}; +#endif } From 939c188448f0ef49930f560f8b1a28abb02ce88b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:57:05 -0700 Subject: [PATCH 070/100] Gems/GraphCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp b/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp index fd7ac05cd2..e76487a4e8 100644 --- a/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp +++ b/Gems/GraphCanvas/Code/Source/Widgets/GraphCanvasLabel.cpp @@ -432,7 +432,5 @@ namespace GraphCanvas default: return QGraphicsWidget::sizeHint(which, constraint); } - - return QGraphicsWidget::sizeHint(which, constraint); } } From 2ab9648425d922be3ebf0bb10fd408f9239350e8 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:57:19 -0700 Subject: [PATCH 071/100] Gems/LyShine Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Animation/Controls/UiTimelineCtrl.cpp | 14 +- .../Animation/UiAVCustomizeTrackColorsDlg.cpp | 2 +- .../Editor/Animation/UiAnimViewDialog.cpp | 4 +- .../Animation/UiAnimViewDopeSheetBase.cpp | 48 +++--- .../Code/Editor/Animation/UiAnimViewNodes.cpp | 144 ++++++++-------- Gems/LyShine/Code/Editor/QtHelpers.cpp | 5 +- Gems/LyShine/Code/Editor/ViewportIcon.cpp | 2 +- Gems/LyShine/Code/Editor/ViewportWidget.cpp | 8 +- Gems/LyShine/Code/Source/UiCanvasManager.cpp | 162 +++++++++--------- 9 files changed, 194 insertions(+), 195 deletions(-) diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp index 4140cff935..3f9ba6e813 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.cpp @@ -20,9 +20,9 @@ QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction) { - const int r = (c2.red() - c1.red()) * fraction + c1.red(); - const int g = (c2.green() - c1.green()) * fraction + c1.green(); - const int b = (c2.blue() - c1.blue()) * fraction + c1.blue(); + const int r = static_cast(static_cast(c2.red() - c1.red()) * fraction + c1.red()); + const int g = static_cast(static_cast(c2.green() - c1.green()) * fraction + c1.green()); + const int b = static_cast(static_cast(c2.blue() - c1.blue()) * fraction + c1.blue()); return QColor(r, g, b); } @@ -114,7 +114,7 @@ float TimelineWidget::SnapTime(float time) { double t = floor((double)time * m_ticksStep + 0.5); t = t / m_ticksStep; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// @@ -147,10 +147,10 @@ void TimelineWidget::DrawTicks(QPainter* painter) painter->setPen(redpen); int x = TimeToClient(m_fTimeMarker); painter->setBrush(Qt::NoBrush); - painter->drawRect(QRect(QPoint(x - 3, rc.top()), QPoint(x + 4, rc.bottom()))); + painter->drawRect(QRect(QPoint(x - 3, static_cast(rc.top())), QPoint(x + 4, static_cast(rc.bottom())))); painter->setPen(redpen); - painter->drawLine(x, rc.top(), x, rc.bottom()); + painter->drawLine(x, static_cast(rc.top()), x, static_cast(rc.bottom())); painter->setBrush(Qt::NoBrush); // Draw vertical line showing current time. @@ -184,7 +184,7 @@ void TimelineWidget::DrawTicks(QPainter* painter) float keyTime = (m_pKeyTimeSet ? m_pKeyTimeSet->GetKeyTime(keyTimeIndex) : 0.0f); int x2 = TimeToClient(keyTime); - painter->drawRect(QRect(QPoint(x2 - 2, rc.top()), QPoint(x2 + 3, rc.bottom()))); + painter->drawRect(QRect(QPoint(x2 - 2, static_cast(rc.top())), QPoint(x2 + 3, static_cast(rc.bottom())))); } painter->setPen(pOldPen); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp index 8bfb3f955d..533625c762 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp @@ -320,7 +320,7 @@ bool CUiAVCustomizeTrackColorsDlg::Import(const QString& fullPath) { return entry.paramType == paramType; }); - int entryIndex = pEntry - g_trackEntries; + int entryIndex = static_cast(pEntry - g_trackEntries); if (entryIndex >= arraysize(g_trackEntries)) // If not found, skip this. { continue; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index 97f21e9bab..6a3afe2036 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -1470,7 +1470,7 @@ void CUiAnimViewDialog::OnSnapFPS() if (ok) { m_wndDopeSheet->SetSnapFPS(fps); - m_wndCurveEditor->SetFPS(fps); + m_wndCurveEditor->SetFPS(static_cast(fps)); SetCursorPosText(m_animationContext->GetTime()); } @@ -1541,7 +1541,7 @@ void CUiAnimViewDialog::ReadMiscSettings() if (settings.contains(s_kFrameSnappingFPSEntry)) { - float fps = settings.value(s_kFrameSnappingFPSEntry).toDouble(); + float fps = settings.value(s_kFrameSnappingFPSEntry).toFloat(); m_wndDopeSheet->SetSnapFPS(FloatToIntRet(fps)); m_wndCurveEditor->SetFPS(fps); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index 82d05a6f67..4e67fb520e 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -139,8 +139,7 @@ CUiAnimViewDopeSheetBase::~CUiAnimViewDopeSheetBase() ////////////////////////////////////////////////////////////////////////// int CUiAnimViewDopeSheetBase::TimeToClient(float time) const { - int x = m_leftOffset - m_scrollOffset.x() + (time * m_timeScale); - return x; + return static_cast(m_leftOffset - m_scrollOffset.x() + (time * m_timeScale)); } ////////////////////////////////////////////////////////////////////////// @@ -186,7 +185,7 @@ void CUiAnimViewDopeSheetBase::SetTimeRange(float start, float end) m_timeRange.Set(start, end); - SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale - m_leftOffset); + SetHorizontalExtent(-m_leftOffset, static_cast(m_timeRange.end * m_timeScale - m_leftOffset)); } ////////////////////////////////////////////////////////////////////////// @@ -255,7 +254,7 @@ void CUiAnimViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) update(); - SetHorizontalExtent(-m_leftOffset, m_timeRange.end * m_timeScale); + SetHorizontalExtent(-m_leftOffset, static_cast(m_timeRange.end * m_timeScale)); ComputeFrameSteps(GetVisibleRange()); } @@ -346,15 +345,15 @@ float CUiAnimViewDopeSheetBase::TickSnap(float time) const double tickTime = GetTickTime(); double t = floor(((double)time / tickTime) + 0.5); t *= tickTime; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// float CUiAnimViewDopeSheetBase::TimeFromPoint(const QPoint& point) const { int x = point.x() - m_leftOffset + m_scrollOffset.x(); - double t = (double)x / m_timeScale; - return (float)TickSnap(t); + float t = static_cast(x) / m_timeScale; + return TickSnap(t); } ////////////////////////////////////////////////////////////////////////// @@ -362,7 +361,7 @@ float CUiAnimViewDopeSheetBase::TimeFromPointUnsnapped(const QPoint& point) cons { int x = point.x() - m_leftOffset + m_scrollOffset.x(); double t = (double)x / m_timeScale; - return t; + return static_cast(t); } void CUiAnimViewDopeSheetBase::mousePressEvent(QMouseEvent* event) @@ -1651,7 +1650,7 @@ float CUiAnimViewDopeSheetBase::FrameSnap(float time) const { double t = floor((double)time / m_snapFrameTime + 0.5); t = t * m_snapFrameTime; - return t; + return static_cast(t); } ////////////////////////////////////////////////////////////////////////// @@ -1755,9 +1754,10 @@ bool CUiAnimViewDopeSheetBase::CreateColorKey(CUiAnimViewTrack* pTrack, float ke Vec3 vColor(0, 0, 0); pTrack->GetValue(keyTime, vColor); - const AZ::Color defaultColor = AZ::Color::CreateFromRgba(clamp_tpl(FloatToIntRet(vColor.x), 0, 255), - clamp_tpl(FloatToIntRet(vColor.y), 0, 255), - clamp_tpl(FloatToIntRet(vColor.z), 0, 255), 255); + const AZ::Color defaultColor = AZ::Color::CreateFromRgba( + clamp_tpl(static_cast(FloatToIntRet(vColor.x)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(vColor.y)), AZ::u8(0), AZ::u8(255)), + clamp_tpl(static_cast(FloatToIntRet(vColor.z)), AZ::u8(0), AZ::u8(255)), 255); AzQtComponents::ColorPicker dlg(AzQtComponents::ColorPicker::Configuration::RGB, tr("Select Color"), this); dlg.setCurrentColor(defaultColor); dlg.setSelectedColor(defaultColor); @@ -1997,12 +1997,12 @@ void CUiAnimViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Ran nNumberTicks = 8; } - double start = TickSnap(timeRange.start); - double step = 1.0 / m_ticksStep; + float start = TickSnap(timeRange.start); + float step = 1.0f / static_cast(m_ticksStep); - for (double t = 0.0f; t <= timeRange.end + step; t += step) + for (float t = 0.0f; t <= timeRange.end + step; t += step) { - double st = TickSnap(t); + float st = TickSnap(t); if (st > timeRange.end) { st = timeRange.end; @@ -2021,7 +2021,7 @@ void CUiAnimViewDopeSheetBase::DrawTicks(QPainter* painter, const QRect& rc, Ran continue; } - int k = RoundFloatToInt(st * m_ticksStep); + int k = RoundFloatToInt(st * static_cast(m_ticksStep)); if (k % nNumberTicks == 0) { if (st >= start) @@ -2743,7 +2743,7 @@ void CUiAnimViewDopeSheetBase::ComputeFrameSteps(const Range& visRange) float nBIntermediateTicks = 5; m_fFrameLabelStep = fFact * afStepTable[nStepIdx]; - if (TimeToClient(m_fFrameLabelStep) - TimeToClient(0) > 1300) + if (TimeToClient(static_cast(m_fFrameLabelStep)) - TimeToClient(0) > 1300) { nBIntermediateTicks = 10; } @@ -2755,7 +2755,7 @@ void CUiAnimViewDopeSheetBase::ComputeFrameSteps(const Range& visRange) void CUiAnimViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRect& rc, [[maybe_unused]] const QColor& lineCol, const QColor& textCol, [[maybe_unused]] double step) { float fFramesPerSec = 1.0f / m_snapFrameTime; - float fInvFrameLabelStep = 1.0f / m_fFrameLabelStep; + float fInvFrameLabelStep = 1.0f / static_cast(m_fFrameLabelStep); Range VisRange = GetVisibleRange(); const Range& timeRange = m_timeRange; @@ -2763,9 +2763,9 @@ void CUiAnimViewDopeSheetBase::DrawTimeLineInFrames(QPainter* painter, const QRe const QPen ltgray(QColor(90, 90, 90)); const QPen black(textCol); - for (double t = TickSnap(timeRange.start); t <= timeRange.end + m_fFrameTickStep; t += m_fFrameTickStep) + for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast(m_fFrameTickStep); t += static_cast(m_fFrameTickStep)) { - double st = t; + float st = t; if (st > timeRange.end) { st = timeRange.end; @@ -2810,9 +2810,9 @@ void CUiAnimViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QR const QPen ltgray(QColor(90, 90, 90)); const QPen black(textCol); - for (double t = TickSnap(timeRange.start); t <= timeRange.end + step; t += step) + for (float t = TickSnap(timeRange.start); t <= timeRange.end + static_cast(step); t += static_cast(step)) { - double st = TickSnap(t); + float st = TickSnap(t); if (st > timeRange.end) { st = timeRange.end; @@ -2831,7 +2831,7 @@ void CUiAnimViewDopeSheetBase::DrawTimeLineInSeconds(QPainter* painter, const QR } int x = TimeToClient(st); - int k = RoundFloatToInt(st * m_ticksStep); + int k = RoundFloatToInt(st * static_cast(m_ticksStep)); if (k % nNumberTicks == 0) { painter->setPen(black); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 820849bc93..3df400ddf2 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -95,88 +95,88 @@ public: } protected: - void dragMoveEvent(QDragMoveEvent* event) + void dragMoveEvent([[maybe_unused]] QDragMoveEvent* event) { // For now we do not support any drag and drop in the Nodes pane return; - CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); - if (!pRecord) - { - return; - } - CUiAnimViewNode* pTargetNode = pRecord->GetNode(); - - QTreeWidget::dragMoveEvent(event); - if (!event->isAccepted()) - { - return; - } - - if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) - { - CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); - bool bAllValidReparenting = true; - QList nodes = draggedNodes(event); - Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - { - if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) - { - bAllValidReparenting = false; - break; - } - } - - if (!bAllValidReparenting) - { - event->ignore(); - } - - return; - } + //CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); + //if (!pRecord) + //{ + // return; + //} + //CUiAnimViewNode* pTargetNode = pRecord->GetNode(); + // + //QTreeWidget::dragMoveEvent(event); + //if (!event->isAccepted()) + //{ + // return; + //} + // + //if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) + //{ + // CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); + // bool bAllValidReparenting = true; + // QList nodes = draggedNodes(event); + // Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) + // { + // if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) + // { + // bAllValidReparenting = false; + // break; + // } + // } + // + // if (!bAllValidReparenting) + // { + // event->ignore(); + // } + // + // return; + //} } - void dropEvent(QDropEvent* event) + void dropEvent([[maybe_unused]] QDropEvent* event) { // For now we do not support any drag and drop in the Nodes pane return; - CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); - if (!pRecord) - { - return; - } - CUiAnimViewNode* pTargetNode = pRecord->GetNode(); - - QTreeWidget::dropEvent(event); - if (!event->isAccepted()) - { - return; - } - - if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) - { - CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); - bool bAllValidReparenting = true; - QList nodes = draggedNodes(event); - Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - { - if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) - { - bAllValidReparenting = false; - break; - } - } - - if (bAllValidReparenting) - { - UiAnimUndo undo("Drag and Drop UiAnimView Nodes"); - Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - { - pDraggedNode->SetNewParent(pDragTarget); - } - } - } + //CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); + //if (!pRecord) + //{ + // return; + //} + //CUiAnimViewNode* pTargetNode = pRecord->GetNode(); + // + //QTreeWidget::dropEvent(event); + //if (!event->isAccepted()) + //{ + // return; + //} + // + //if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) + //{ + // CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); + // bool bAllValidReparenting = true; + // QList nodes = draggedNodes(event); + // Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) + // { + // if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) + // { + // bAllValidReparenting = false; + // break; + // } + // } + // + // if (bAllValidReparenting) + // { + // UiAnimUndo undo("Drag and Drop UiAnimView Nodes"); + // Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) + // { + // pDraggedNode->SetNewParent(pDragTarget); + // } + // } + //} } void keyPressEvent(QKeyEvent* event) diff --git a/Gems/LyShine/Code/Editor/QtHelpers.cpp b/Gems/LyShine/Code/Editor/QtHelpers.cpp index 8b6063a055..d9147463ed 100644 --- a/Gems/LyShine/Code/Editor/QtHelpers.cpp +++ b/Gems/LyShine/Code/Editor/QtHelpers.cpp @@ -32,8 +32,7 @@ namespace QtHelpers float GetHighDpiScaleFactor(const QWidget& widget) { - float dpiScale = QHighDpiScaling::factor(widget.windowHandle()->screen()); - return dpiScale; + return static_cast(QHighDpiScaling::factor(widget.windowHandle()->screen())); } QSize GetDpiScaledViewportSize(const QWidget& widget) @@ -41,7 +40,7 @@ namespace QtHelpers float dpiScale = GetHighDpiScaleFactor(widget); float width = ceilf(widget.size().width() * dpiScale); float height = ceilf(widget.size().height() * dpiScale); - return QSize(width, height); + return QSize(static_cast(width), static_cast(height)); } } // namespace QtHelpers diff --git a/Gems/LyShine/Code/Editor/ViewportIcon.cpp b/Gems/LyShine/Code/Editor/ViewportIcon.cpp index e4ada665d5..e3ad68922e 100644 --- a/Gems/LyShine/Code/Editor/ViewportIcon.cpp +++ b/Gems/LyShine/Code/Editor/ViewportIcon.cpp @@ -27,7 +27,7 @@ AZ::Vector2 ViewportIcon::GetTextureSize() const if (m_image) { AZ::RHI::Size size = m_image->GetDescriptor().m_size; - AZ::Vector2 scaledSize(size.m_width, size.m_height); + AZ::Vector2 scaledSize(static_cast(size.m_width), static_cast(size.m_height)); if (m_applyDpiScaleFactorToSize) { scaledSize *= m_dpiScaleFactor; diff --git a/Gems/LyShine/Code/Editor/ViewportWidget.cpp b/Gems/LyShine/Code/Editor/ViewportWidget.cpp index 1ce8f5b64d..e172d43b60 100644 --- a/Gems/LyShine/Code/Editor/ViewportWidget.cpp +++ b/Gems/LyShine/Code/Editor/ViewportWidget.cpp @@ -1001,7 +1001,7 @@ void ViewportWidget::RenderEditMode() // Render this canvas QSize scaledViewportSize = QtHelpers::GetDpiScaledViewportSize(*this); - AZ::Vector2 viewportSize(scaledViewportSize.width(), scaledViewportSize.height()); + AZ::Vector2 viewportSize(static_cast(scaledViewportSize.width()), static_cast(scaledViewportSize.height())); EBUS_EVENT_ID(canvasEntityId, UiEditorCanvasBus, RenderCanvasInEditorViewport, false, viewportSize); m_draw2d->SetSortKey(topLayerKey); @@ -1111,7 +1111,7 @@ void ViewportWidget::UpdatePreviewMode(float deltaTime) if (canvasEntityId.IsValid()) { QSize scaledViewportSize = QtHelpers::GetDpiScaledViewportSize(*this); - AZ::Vector2 viewportSize(scaledViewportSize.width(), scaledViewportSize.height()); + AZ::Vector2 viewportSize(static_cast(scaledViewportSize.width()), static_cast(scaledViewportSize.height())); // Get the canvas size AZ::Vector2 canvasSize = m_editorWindow->GetPreviewCanvasSize(); @@ -1153,7 +1153,7 @@ void ViewportWidget::RenderPreviewMode() if (canvasEntityId.IsValid()) { QSize scaledViewportSize = QtHelpers::GetDpiScaledViewportSize(*this); - AZ::Vector2 viewportSize(scaledViewportSize.width(), scaledViewportSize.height()); + AZ::Vector2 viewportSize(static_cast(scaledViewportSize.width()), static_cast(scaledViewportSize.height())); // Get the canvas size AZ::Vector2 canvasSize = m_editorWindow->GetPreviewCanvasSize(); @@ -1239,7 +1239,7 @@ void ViewportWidget::RenderViewportBackground() Draw2dHelper draw2d(m_draw2d.get()); draw2d.SetImageColor(backgroundColor.GetAsVector3()); - draw2d.DrawImage(image, AZ::Vector2(0.0f, 0.0f), AZ::Vector2(viewportSize.width(), viewportSize.height())); + draw2d.DrawImage(image, AZ::Vector2(0.0f, 0.0f), AZ::Vector2(static_cast(viewportSize.width()), static_cast(viewportSize.height()))); } void ViewportWidget::SetupShortcuts() diff --git a/Gems/LyShine/Code/Source/UiCanvasManager.cpp b/Gems/LyShine/Code/Source/UiCanvasManager.cpp index 5f2adcd20c..d13a8f5034 100644 --- a/Gems/LyShine/Code/Source/UiCanvasManager.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasManager.cpp @@ -808,7 +808,7 @@ UiCanvasComponent* UiCanvasManager::FindEditorCanvasComponentByPathname(const AZ } //////////////////////////////////////////////////////////////////////////////////////////////////// -bool UiCanvasManager::HandleInputEventForInWorldCanvases(const AzFramework::InputChannel::Snapshot& inputSnapshot, const AZ::Vector2& viewportPos) +bool UiCanvasManager::HandleInputEventForInWorldCanvases([[maybe_unused]] const AzFramework::InputChannel::Snapshot& inputSnapshot, [[maybe_unused]] const AZ::Vector2& viewportPos) { // First we need to construct a ray from the either the center of the screen or the mouse position. // This requires knowledge of the camera @@ -816,86 +816,86 @@ bool UiCanvasManager::HandleInputEventForInWorldCanvases(const AzFramework::Inpu // ToDo: Re-implement by getting the camera from Atom. LYN-3680 return false; - const CCamera cam; - - // construct a ray from the camera position in the view direction of the camera - const float rayLength = 5000.0f; - Vec3 rayOrigin(cam.GetPosition()); - Vec3 rayDirection = cam.GetViewdir() * rayLength; - - // If the mouse cursor is visible we will assume that the ray should be in the direction of the - // mouse pointer. This is a temporary solution. A better solution is to be able to configure the - // LyShine system to say how ray input should be handled. - bool isCursorVisible = false; - UiCursorBus::BroadcastResult(isCursorVisible, &UiCursorInterface::IsUiCursorVisible); - if (isCursorVisible) - { - // for some reason Unproject seems to work when given the viewport pos with (0,0) at the - // bottom left as opposed to the top left - even though that function specifically sets top left - // to (0,0). - const float viewportYInverted = cam.GetViewSurfaceZ() - viewportPos.GetY(); - - // Unproject to get the screen position in world space, use arbitrary Z that is within the depth range - Vec3 flippedViewportRayOrigin(viewportPos.GetX(), viewportYInverted, 0.f); - Vec3 flippedViewportRayForward(viewportPos.GetX(), viewportYInverted, 1.f); - - cam.Unproject(flippedViewportRayOrigin, rayOrigin); - - Vec3 unprojectedPosForward; - cam.Unproject(flippedViewportRayForward, unprojectedPosForward); - - // We want a vector relative to the camera origin - Vec3 rayVec = unprojectedPosForward - rayOrigin; - - // we want to ensure that the ray is a certain length so normalize it and scale it - rayVec.NormalizeSafe(); - rayDirection = rayVec * rayLength; - } - - - AzFramework::EntityContextId gameContextId; - AzFramework::GameEntityContextRequestBus::BroadcastResult(gameContextId, - &AzFramework::GameEntityContextRequests::GetGameEntityContextId); - - AzFramework::RenderGeometry::RayRequest request; - request.m_startWorldPosition = LYVec3ToAZVec3(rayOrigin); - request.m_endWorldPosition = LYVec3ToAZVec3(rayOrigin + rayDirection); - - AzFramework::RenderGeometry::RayResult rayResult; - AzFramework::RenderGeometry::IntersectorBus::EventResult(rayResult, gameContextId, - &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, request); - - if (rayResult) - { - AZ::EntityId hitEntity = rayResult.m_entityAndComponent.GetEntityId(); - if (hitEntity.IsValid()) - { - AZ::EntityId canvasEntityId; - UiCanvasRefBus::EventResult(canvasEntityId, hitEntity, &UiCanvasRefInterface::GetCanvas); - if (canvasEntityId.IsValid()) - { - // Checkif the UI canvas referenced by the hit entity supports automatic input - bool doesCanvasSupportInput = false; - UiCanvasBus::EventResult(doesCanvasSupportInput, canvasEntityId, &UiCanvasInterface::GetIsPositionalInputSupported); - - if (doesCanvasSupportInput) - { - // set the hit details to the hit entity, it will convert into canvas coords and send to canvas - bool handled = false; - UiCanvasOnMeshBus::EventResult(handled, hitEntity, - &UiCanvasOnMeshInterface::ProcessHitInputEvent, inputSnapshot, rayResult); - - if (handled) - { - return true; - } - } - } - } - } - - - return false; + //const CCamera cam; + // + //// construct a ray from the camera position in the view direction of the camera + //const float rayLength = 5000.0f; + //Vec3 rayOrigin(cam.GetPosition()); + //Vec3 rayDirection = cam.GetViewdir() * rayLength; + // + //// If the mouse cursor is visible we will assume that the ray should be in the direction of the + //// mouse pointer. This is a temporary solution. A better solution is to be able to configure the + //// LyShine system to say how ray input should be handled. + //bool isCursorVisible = false; + //UiCursorBus::BroadcastResult(isCursorVisible, &UiCursorInterface::IsUiCursorVisible); + //if (isCursorVisible) + //{ + // // for some reason Unproject seems to work when given the viewport pos with (0,0) at the + // // bottom left as opposed to the top left - even though that function specifically sets top left + // // to (0,0). + // const float viewportYInverted = cam.GetViewSurfaceZ() - viewportPos.GetY(); + // + // // Unproject to get the screen position in world space, use arbitrary Z that is within the depth range + // Vec3 flippedViewportRayOrigin(viewportPos.GetX(), viewportYInverted, 0.f); + // Vec3 flippedViewportRayForward(viewportPos.GetX(), viewportYInverted, 1.f); + // + // cam.Unproject(flippedViewportRayOrigin, rayOrigin); + // + // Vec3 unprojectedPosForward; + // cam.Unproject(flippedViewportRayForward, unprojectedPosForward); + // + // // We want a vector relative to the camera origin + // Vec3 rayVec = unprojectedPosForward - rayOrigin; + // + // // we want to ensure that the ray is a certain length so normalize it and scale it + // rayVec.NormalizeSafe(); + // rayDirection = rayVec * rayLength; + //} + // + // + //AzFramework::EntityContextId gameContextId; + //AzFramework::GameEntityContextRequestBus::BroadcastResult(gameContextId, + // &AzFramework::GameEntityContextRequests::GetGameEntityContextId); + // + //AzFramework::RenderGeometry::RayRequest request; + //request.m_startWorldPosition = LYVec3ToAZVec3(rayOrigin); + //request.m_endWorldPosition = LYVec3ToAZVec3(rayOrigin + rayDirection); + // + //AzFramework::RenderGeometry::RayResult rayResult; + //AzFramework::RenderGeometry::IntersectorBus::EventResult(rayResult, gameContextId, + // &AzFramework::RenderGeometry::IntersectorInterface::RayIntersect, request); + // + //if (rayResult) + //{ + // AZ::EntityId hitEntity = rayResult.m_entityAndComponent.GetEntityId(); + // if (hitEntity.IsValid()) + // { + // AZ::EntityId canvasEntityId; + // UiCanvasRefBus::EventResult(canvasEntityId, hitEntity, &UiCanvasRefInterface::GetCanvas); + // if (canvasEntityId.IsValid()) + // { + // // Checkif the UI canvas referenced by the hit entity supports automatic input + // bool doesCanvasSupportInput = false; + // UiCanvasBus::EventResult(doesCanvasSupportInput, canvasEntityId, &UiCanvasInterface::GetIsPositionalInputSupported); + // + // if (doesCanvasSupportInput) + // { + // // set the hit details to the hit entity, it will convert into canvas coords and send to canvas + // bool handled = false; + // UiCanvasOnMeshBus::EventResult(handled, hitEntity, + // &UiCanvasOnMeshInterface::ProcessHitInputEvent, inputSnapshot, rayResult); + // + // if (handled) + // { + // return true; + // } + // } + // } + // } + //} + // + // + //return false; } //////////////////////////////////////////////////////////////////////////////////////////////////// From 76c452d43d36c756008ddcdd9de81751586907f7 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:57:34 -0700 Subject: [PATCH 072/100] Gems/Metastream Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Metastream/Code/Source/MetastreamGem.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gems/Metastream/Code/Source/MetastreamGem.cpp b/Gems/Metastream/Code/Source/MetastreamGem.cpp index 2bb213662c..e8c659474d 100644 --- a/Gems/Metastream/Code/Source/MetastreamGem.cpp +++ b/Gems/Metastream/Code/Source/MetastreamGem.cpp @@ -339,10 +339,9 @@ namespace Metastream // Server already started return true; } -#endif // AZ_TRAIT_METASTREAM_USE_CIVET - - // Metastream only supported on PC +#else return false; +#endif } void Metastream::MetastreamGem::StopHTTPServer() From 2d09e9c60e17fa5c671182d3dd9487a945f7cff2 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:57:51 -0700 Subject: [PATCH 073/100] Gems/Multiplayer Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/AutoGen/AutoComponent_Source.jinja | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index 56ab828ffe..b1946eb61f 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -1568,8 +1568,7 @@ namespace {{ Component.attrib['Namespace'] }} return s_netComponentId; } -#pragma warning(push) -#pragma warning(disable: 4065) // switch statement contains 'default' but no 'case' labels + AZ_PUSH_DISABLE_WARNING(4065, "-Wunknown-warning-option") // switch statement contains 'default' but no 'case' labels bool {{ ComponentBaseName }}::HandleRpcMessage ( [[maybe_unused]] AzNetworking::IConnection* invokingConnection, @@ -1590,7 +1589,7 @@ namespace {{ Component.attrib['Namespace'] }} AZ_Assert(0, "Got unhandled RpcType %d in {{ ComponentBaseName }}", static_cast(rpcType)); return false; } -#pragma warning(pop) + AZ_POP_DISABLE_WARNING bool {{ ComponentBaseName }}::SerializeStateDeltaMessage(Multiplayer::ReplicationRecord& replicationRecord, AzNetworking::ISerializer& serializer) { From 0b70cf2308ec7d95f90828d502b2e8d17add2342 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:58:05 -0700 Subject: [PATCH 074/100] Gems/PhysX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysX/Code/Source/Scene/PhysXScene.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp index a47f0ba16f..ce604bd9f1 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -139,8 +139,9 @@ namespace PhysX else if (auto* shapeColliderPairList = AZStd::get_if>(&shapeData)) { bool shapeAdded = false; - for (const auto& shapeColliderConfigs : *shapeColliderPairList) + if (!shapeColliderPairList->empty()) { + const auto& shapeColliderConfigs = shapeColliderPairList->front(); auto shapePtr = AZStd::make_shared(*(shapeColliderConfigs.first), *(shapeColliderConfigs.second)); AZStd::visit([shapePtr, &shapeAdded](auto&& body) { From b9e73a823a245bf38bd4ad9dd4c8a8005301d1f0 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:58:20 -0700 Subject: [PATCH 075/100] Gems/SceneProcessing Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Tests/SceneBuilder/SceneBuilderTests.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp index 46e14e6985..a4da836aeb 100644 --- a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp +++ b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp @@ -164,8 +164,8 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_PathDepen TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDependency) { AZ::Uuid dependencyId = AZ::Uuid::CreateRandom(); - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); - exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt)); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt); + exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt)); TestSuccessCase(exportProduct, nullptr, &dependencyId); } @@ -173,8 +173,8 @@ TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductDe TEST_F(SceneBuilderTests, SceneBuilderWorker_ExportProductDependencies_ProductAndPathDependencies) { AZ::Uuid dependencyId = AZ::Uuid::CreateRandom(); - SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), u8(0), AZStd::nullopt); - exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), 0, AZStd::nullopt)); + SceneAPI::Events::ExportProduct exportProduct("testExportFile", AZ::Uuid::CreateRandom(), AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt); + exportProduct.m_productDependencies.push_back(SceneAPI::Events::ExportProduct("testDependencyFile", dependencyId, AZ::Data::AssetType::CreateNull(), AZ::u8(0), AZStd::nullopt)); const char* relativeDependencyPathToFile = "some/test/file.mtl"; From f22d2d736b6a30e29f85bcc483310a7513eb27d3 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 15:59:25 -0700 Subject: [PATCH 076/100] Gems/ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Include/ScriptCanvas/Utils/NodeUtils.cpp | 2 -- .../EditorAutomationActions/EditorKeyActions.cpp | 2 +- .../EditorAutomationActions/EditorMouseActions.cpp | 4 ++-- .../ScriptCanvasActions/ElementInteractions.cpp | 8 ++++---- .../EditorAutomationActions/WidgetActions.cpp | 2 +- .../EditorAutomationStates/CreateElementsStates.cpp | 4 ++-- .../EditorAutomationStates/UtilityStates.cpp | 4 ++-- .../Editor/Source/EditorAutomationTests/GroupTests.cpp | 4 ++-- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp index d54e9457c1..5aa922d627 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Utils/NodeUtils.cpp @@ -77,8 +77,6 @@ namespace ScriptCanvas { return ConstructCustomNodeIdentifier(scriptCanvasNode->RTTI_GetType()); } - - return NodeTypeIdentifier(0); } NodeTypeIdentifier NodeUtils::ConstructEBusIdentifier(ScriptCanvas::EBusBusId ebusIdentifier) diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp index a20e674063..4114292938 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorKeyActions.cpp @@ -30,7 +30,7 @@ namespace ScriptCanvasDeveloper #if defined(AZ_COMPILER_MSVC) INPUT osInput = { 0 }; osInput.type = INPUT_KEYBOARD; - osInput.ki.wVk = m_keyValue; + osInput.ki.wVk = static_cast(m_keyValue); switch (m_keyAction) { diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp index a5ed19a8d7..cf757af1ec 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp @@ -174,8 +174,8 @@ namespace ScriptCanvasDeveloper osInput.type = INPUT_MOUSE; osInput.mi.mouseData = 0; osInput.mi.time = 0; - osInput.mi.dx = targetPoint.x() - currentPosition.x(); - osInput.mi.dy = targetPoint.y() - currentPosition.y(); + osInput.mi.dx = static_cast(targetPoint.x() - currentPosition.x()); + osInput.mi.dy = static_cast(targetPoint.y() - currentPosition.y()); osInput.mi.dwFlags = MOUSEEVENTF_MOVE; ::SendInput(1, &osInput, sizeof(osInput)); diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp index 411d176356..9a8165b5e8 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.cpp @@ -78,8 +78,8 @@ namespace ScriptCanvasDeveloper { CompoundAction* compoundAction = aznew CompoundAction(); - QPoint startPoint(m_scenePoint.x() - 5, m_scenePoint.y() - 5); - QPoint endPoint(m_scenePoint.x() + 5, m_scenePoint.y() + 5); + QPoint startPoint(static_cast(m_scenePoint.x() - 5.0), static_cast(m_scenePoint.y() - 5.0)); + QPoint endPoint(static_cast(m_scenePoint.x() + 5.0), static_cast(m_scenePoint.y() + 5.0)); QRect sceneRect = QRect(startPoint, endPoint); @@ -150,8 +150,8 @@ namespace ScriptCanvasDeveloper { CompoundAction* compoundAction = aznew CompoundAction(); - QPoint startPoint(m_scenePoint.x() - 5, m_scenePoint.y() - 5); - QPoint endPoint(m_scenePoint.x() + 5, m_scenePoint.y() + 5); + QPoint startPoint(static_cast(m_scenePoint.x() - 5.0), static_cast(m_scenePoint.y() - 5.0)); + QPoint endPoint(static_cast(m_scenePoint.x() + 5.0), static_cast(m_scenePoint.y() + 5.0)); QRect sceneRect = QRect(startPoint, endPoint); diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp index 5601c89c97..46c98ca48c 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/WidgetActions.cpp @@ -40,7 +40,7 @@ namespace ScriptCanvasDeveloper { ClearActionQueue(); - QPoint targetPoint = m_targetEdit->mapToGlobal(QPoint(5, m_targetEdit->height() * 0.5f)); + QPoint targetPoint = m_targetEdit->mapToGlobal(QPoint(5, static_cast(m_targetEdit->height() * 0.5f))); // Cheaty clear for right now. m_targetEdit->clear(); diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp index 679cf5690e..bfb36235ef 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/CreateElementsStates.cpp @@ -70,7 +70,7 @@ namespace ScriptCanvasDeveloper if (dropPoint) { - QPointF qPoint = QPoint(dropPoint->GetX(), dropPoint->GetY()); + QPointF qPoint = QPoint(static_cast(dropPoint->GetX()), static_cast(dropPoint->GetY())); m_createNodeAction = aznew CreateNodeFromPaletteAction(m_nodePaletteWidget, (*graphId), m_nodeName, qPoint); } break; @@ -218,7 +218,7 @@ namespace ScriptCanvasDeveloper if (dropPoint) { - QPointF qPoint = QPoint(dropPoint->GetX(), dropPoint->GetY()); + QPointF qPoint = QPoint(static_cast(dropPoint->GetX()), static_cast(dropPoint->GetY())); m_createNodeAction = aznew CreateNodeFromContextMenuAction((*graphId), m_nodeName, qPoint); } break; diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp index c8e82bdf90..459dc82542 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp @@ -54,7 +54,7 @@ namespace ScriptCanvasDeveloper qreal verticalPoint = boundingRect.top() + boundingRect.height() * m_offsets.m_verticalPosition; verticalPoint += m_offsets.m_verticalOffset; - AZ::Vector2 scenePoint(horizontalPoint, verticalPoint); + AZ::Vector2 scenePoint(static_cast(horizontalPoint), static_cast(verticalPoint)); GetStateModel()->SetStateData(m_outputId, scenePoint); } } @@ -92,7 +92,7 @@ namespace ScriptCanvasDeveloper qreal verticalPoint = groupBoundingBox.top() + groupBoundingBox.height() * m_offsets.m_verticalPosition; verticalPoint += m_offsets.m_verticalPosition; - AZ::Vector2 scenePoint(horizontalPoint, verticalPoint); + AZ::Vector2 scenePoint(static_cast(horizontalPoint), static_cast(verticalPoint)); GetStateModel()->SetStateData(m_outputId, scenePoint); } else diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp index cfe5996530..0428eb6640 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/GroupTests.cpp @@ -70,8 +70,8 @@ namespace ScriptCanvasDeveloper AZ::Vector2 modifiedValue = (*position); QRectF sceneBoundingBox = nodeItem->sceneBoundingRect(); - modifiedValue.SetX(position->GetX() + sceneBoundingBox.width() * m_horizontalDimension); - modifiedValue.SetY(position->GetY() + sceneBoundingBox.height() * m_verticalDimension); + modifiedValue.SetX(position->GetX() + static_cast(sceneBoundingBox.width()) * m_horizontalDimension); + modifiedValue.SetY(position->GetY() + static_cast(sceneBoundingBox.height()) * m_verticalDimension); GetStateModel()->SetStateData(m_positionId, modifiedValue); } From f0fa62bde3f962adc2a6ff5f797fb16048e66c3b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 16:46:48 -0700 Subject: [PATCH 077/100] PR comments/observations Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzFramework/Physics/Common/PhysicsTypes.h | 2 +- .../Code/Editor/Animation/UiAnimViewNodes.cpp | 72 ------------------- 2 files changed, 1 insertion(+), 73 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h index 30f3fb6297..26dfcd3b77 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsTypes.h @@ -56,7 +56,7 @@ namespace AzPhysics //! A handle to a Scene within the physics simulation. //! A SceneHandle is a tuple of a Crc of the scenes name and the index in the Scene list. using SceneHandle = AZStd::tuple; - static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), AZ::s8(-1) }; + static constexpr SceneHandle InvalidSceneHandle = { AZ::Crc32(), SceneIndex(-1) }; //! Ease of use type for referencing a List of SceneHandle objects. using SceneHandleList = AZStd::vector; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 3df400ddf2..74d2c7d4fb 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -99,84 +99,12 @@ protected: { // For now we do not support any drag and drop in the Nodes pane return; - - //CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); - //if (!pRecord) - //{ - // return; - //} - //CUiAnimViewNode* pTargetNode = pRecord->GetNode(); - // - //QTreeWidget::dragMoveEvent(event); - //if (!event->isAccepted()) - //{ - // return; - //} - // - //if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) - //{ - // CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); - // bool bAllValidReparenting = true; - // QList nodes = draggedNodes(event); - // Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - // { - // if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) - // { - // bAllValidReparenting = false; - // break; - // } - // } - // - // if (!bAllValidReparenting) - // { - // event->ignore(); - // } - // - // return; - //} } void dropEvent([[maybe_unused]] QDropEvent* event) { // For now we do not support any drag and drop in the Nodes pane return; - - //CUiAnimViewNodesCtrl::CRecord* pRecord = (CUiAnimViewNodesCtrl::CRecord*) itemAt(event->pos()); - //if (!pRecord) - //{ - // return; - //} - //CUiAnimViewNode* pTargetNode = pRecord->GetNode(); - // - //QTreeWidget::dropEvent(event); - //if (!event->isAccepted()) - //{ - // return; - //} - // - //if (pTargetNode && pTargetNode->IsGroupNode() /*&& !m_draggedNodes.DoesContain(pTargetNode)*/) - //{ - // CUiAnimViewAnimNode* pDragTarget = static_cast(pTargetNode); - // bool bAllValidReparenting = true; - // QList nodes = draggedNodes(event); - // Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - // { - // if (!pDraggedNode->IsValidReparentingTo(pDragTarget)) - // { - // bAllValidReparenting = false; - // break; - // } - // } - // - // if (bAllValidReparenting) - // { - // UiAnimUndo undo("Drag and Drop UiAnimView Nodes"); - // Q_FOREACH(CUiAnimViewAnimNode * pDraggedNode, nodes) - // { - // pDraggedNode->SetNewParent(pDragTarget); - // } - // } - //} } void keyPressEvent(QKeyEvent* event) From b8787739e112448ef6f9b60139bcc41ea71274aa Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 17:05:50 -0700 Subject: [PATCH 078/100] more fixes after rebase Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/ViewportTitleDlg.cpp | 6 +++--- .../UI/PropertyEditor/EntityPropertyEditor.cpp | 4 ++-- .../UI/PropertyEditor/PropertyRowWidget.cpp | 2 +- .../Components/LocalPredictionPlayerInputComponent.cpp | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp index 0c59c1e9b5..7ffe14c899 100644 --- a/Code/Editor/ViewportTitleDlg.cpp +++ b/Code/Editor/ViewportTitleDlg.cpp @@ -462,7 +462,7 @@ void CViewportTitleDlg::AddFOVMenus(QMenu* menu, std::function call { fov = std::max(1.0f, f); fov = std::min(120.0f, f); - QAction* action = menu->addAction(customPresets[i]); + QAction* action = menu->addAction(customPreset); connect(action, &QAction::triggered, action, [fov, callback](){ callback(fov); }); } } @@ -536,7 +536,7 @@ void CViewportTitleDlg::AddAspectRatioMenus(QMenu* menu, std::functionaddAction(customPresets[i]); + QAction* action = menu->addAction(customPreset); connect(action, &QAction::triggered, action, [width, height, callback]() {callback(width, height); }); } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 2c46bb2d26..41cbde191a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -254,8 +254,8 @@ namespace AzToolsFramework QRect globalRect = m_editor->GetWidgetAndVisibleChildrenGlobalRect(dragRowWidget); int top = mapFromGlobal(globalRect.topLeft()).y(); - int imageHeight = dragImage.height() / dragImage.devicePixelRatioF(); - int imageWidth = dragImage.width() / dragImage.devicePixelRatioF(); + int imageHeight = static_cast(dragImage.height() / dragImage.devicePixelRatioF()); + int imageWidth = static_cast(dragImage.width() / dragImage.devicePixelRatioF()); QRect currRect = QRect(QPoint(LeftMargin + 1, top), QPoint(LeftMargin + 1 + imageWidth, top + imageHeight)); painter.setOpacity(alpha); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp index 604c6141d7..c298d0d97e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp @@ -1867,7 +1867,7 @@ namespace AzToolsFramework } const auto dpr = devicePixelRatioF(); - QPixmap dragImage(width * dpr, height * dpr); + QPixmap dragImage(static_cast(width * dpr), static_cast(height * dpr)); dragImage.setDevicePixelRatio(dpr); dragImage.fill(Qt::transparent); diff --git a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp index de4ea67467..936f2ea92c 100644 --- a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp @@ -277,7 +277,7 @@ namespace Multiplayer input.SetClientInputId(GetLastInputId()); ScopedAlterTime scopedTime(input.GetHostFrameId(), input.GetHostTimeMs(), input.GetHostBlendFactor(), invokingConnection->GetConnectionId()); - GetNetBindComponent()->ProcessInput(input, clientInputRateSec); + GetNetBindComponent()->ProcessInput(input, static_cast(clientInputRateSec)); AZLOG(NET_Prediction, "Migrated InputId=%d", aznumeric_cast(input.GetClientInputId())); @@ -345,7 +345,7 @@ namespace Multiplayer // Reprocess the input for this frame NetworkInput& input = m_inputHistory[replayIndex]; ScopedAlterTime scopedTime(input.GetHostFrameId(), input.GetHostTimeMs(), input.GetHostBlendFactor(), invokingConnection->GetConnectionId()); - GetNetBindComponent()->ReprocessInput(input, clientInputRateSec); + GetNetBindComponent()->ReprocessInput(input, static_cast(clientInputRateSec)); AZLOG(NET_Prediction, "Replayed InputId=%d", aznumeric_cast(input.GetClientInputId())); } @@ -438,10 +438,10 @@ namespace Multiplayer input.SetHostBlendFactor(multiplayer->GetCurrentBlendFactor()); // Allow components to form the input for this frame - GetNetBindComponent()->CreateInput(input, clientInputRateSec); + GetNetBindComponent()->CreateInput(input, static_cast(clientInputRateSec)); // Process the input for this frame - GetNetBindComponent()->ProcessInput(input, clientInputRateSec); + GetNetBindComponent()->ProcessInput(input, static_cast(clientInputRateSec)); AZLOG(NET_Prediction, "Processed InputId=%d", aznumeric_cast(m_clientInputId)); @@ -506,7 +506,7 @@ namespace Multiplayer NetworkInput& input = m_lastInputReceived[0]; { ScopedAlterTime scopedTime(input.GetHostFrameId(), input.GetHostTimeMs(), DefaultBlendFactor, GetNetBindComponent()->GetOwningConnectionId()); - GetNetBindComponent()->ProcessInput(input, clientInputRateSec); + GetNetBindComponent()->ProcessInput(input, static_cast(clientInputRateSec)); } AZLOG(NET_Prediction, "Forced InputId=%d", aznumeric_cast(input.GetClientInputId())); From 239fbda10f001da672b9476ee2a75e3ee9d7e3e8 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 17:29:25 -0700 Subject: [PATCH 079/100] OpenMesh warnings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp index 3bcd2dbd94..a7834100b5 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -30,6 +30,7 @@ #include // OpenMesh includes +AZ_PUSH_DISABLE_WARNING(4702, "-Wunknown-warning-option") // OpenMesh\Core\Utils\Property.hh has unreachable code #include #include #include @@ -37,6 +38,7 @@ #include #include #include +AZ_POP_DISABLE_WARNING namespace OpenMesh { From 9e4c434095846b38fc176652074d6d0daa15cb16 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 17:41:23 -0700 Subject: [PATCH 080/100] unreachable code in jinja Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index b1946eb61f..b89d1a2b2e 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -1586,8 +1586,6 @@ namespace {{ Component.attrib['Namespace'] }} default: return false; } - AZ_Assert(0, "Got unhandled RpcType %d in {{ ComponentBaseName }}", static_cast(rpcType)); - return false; } AZ_POP_DISABLE_WARNING From 0f26a6508ab6fc3f9788486bde9531a339342655 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 17:54:17 -0700 Subject: [PATCH 081/100] fixing comment Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzNetworking/AzNetworking/Utilities/QuantizedValues.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h index 46e778d5b3..49f5533548 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/QuantizedValues.h @@ -176,7 +176,7 @@ namespace AzNetworking //! Takes a quantized integral value and stores the floating point representation. void DecodeQuantizedValues(); - AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") // anonymous union, structure was padded due to alignment + AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") // structure was padded due to alignment union { float m_quantizedValues[NUM_ELEMENTS]; From 9a8ec8bfcd7648e3f2aa0fcfb479f92559e0a82d Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 18:13:27 -0700 Subject: [PATCH 082/100] fix for clang Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzFramework/Archive/ZipDirStructures.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index 1748d1578b..5f0d58a4cb 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -342,7 +342,9 @@ namespace AZ::IO::ZipDir AZ::u64 fileSize = 0; if (!m_fileIOBase->Size(realFileHandle, fileSize)) { - goto error; + // Error + m_nSize = 0; + return; } const size_t nFileSize = static_cast(fileSize); @@ -352,16 +354,18 @@ namespace AZ::IO::ZipDir if (!m_fileIOBase->Seek(realFileHandle, 0, AZ::IO::SeekType::SeekFromStart)) { - goto error; + // Error + m_nSize = 0; + return; } if (!m_fileIOBase->Read(realFileHandle, m_pInMemoryData->m_address.get(), nFileSize, true)) { - goto error; + // Error + m_nSize = 0; + return; } return; - error: - m_nSize = 0; } } } From e3cf15a00f650545bd94e7e6303c4de8a5d26ac2 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 16 Aug 2021 19:52:00 -0700 Subject: [PATCH 083/100] Fixes for Android/Linux Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Controls/ConsoleSCB.cpp | 4 ++-- Gems/LyShine/Code/Source/Animation/AnimTrack.h | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index c4f58b5297..dbe7ba3472 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -837,11 +837,11 @@ static void SetEditorRange(EditorType* editor, IVariable* var) static const float defaultMax = 100.0f; if (var->HasCustomLimits()) { - editor->setRange(static_cast(min), static_cast(max)); + editor->setRange(static_cast(min), static_cast(max)); } else { - editor->setSoftRange(static_cast(defaultMin), static_cast(defaultMax)); + editor->setSoftRange(static_cast(defaultMin), static_cast(defaultMax)); } // Set the step size. The default variable step is 0, so if it's diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index 97a251ebfa..21a78ae6a1 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -221,6 +221,8 @@ protected: float m_lastTime; int m_flags; + constexpr unsigned int InvalidKey = 0x7FFFFFFF; + UiAnimParamData m_componentParamData; #ifdef UI_ANIMATION_SYSTEM_SUPPORT_EDITING @@ -521,7 +523,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) if (nkeys == 0) { m_lastTime = time; - m_currKey = std::numeric_limits::max(); + m_currKey = InvalidKey; return m_currKey; } @@ -554,7 +556,7 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) } else { - m_currKey = std::numeric_limits::max(); + m_currKey = InvalidKey; } return m_currKey; } @@ -600,6 +602,6 @@ inline int TUiAnimTrack::GetActiveKey(float time, KeyType* key) break; } } - m_currKey = std::numeric_limits::max(); + m_currKey = InvalidKey; return m_currKey; } From b1444828ff96ce666d76cd3e0dfa2c1d1cfce1df Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 17 Aug 2021 08:48:40 -0700 Subject: [PATCH 084/100] make Jenkins happy Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/LyShine/Code/Source/Animation/AnimTrack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index 21a78ae6a1..df0ae3a805 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -221,7 +221,7 @@ protected: float m_lastTime; int m_flags; - constexpr unsigned int InvalidKey = 0x7FFFFFFF; + static constexpr unsigned int InvalidKey = 0x7FFFFFFF; UiAnimParamData m_componentParamData; From 0c6a838c6f994614db2e03aedbb153d775fac3b0 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 17 Aug 2021 13:22:52 -0700 Subject: [PATCH 085/100] fix warnigns after merge Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/ViewportManipulatorController.cpp | 4 ++-- .../Input/QtEventToAzInputManager.cpp | 8 ++++---- .../temp/128x128_RGBA8.tga.streamingimage | Bin 28066 -> 28861 bytes .../Shader/Code/Tests/McppBinderTests.cpp | 2 +- .../Source/Document/AtomToolsDocument.cpp | 14 +++++++------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Code/Editor/ViewportManipulatorController.cpp b/Code/Editor/ViewportManipulatorController.cpp index 5282af009f..a67d733cf9 100644 --- a/Code/Editor/ViewportManipulatorController.cpp +++ b/Code/Editor/ViewportManipulatorController.cpp @@ -113,8 +113,8 @@ namespace SandboxEditor windowSize, event.m_windowHandle, &AzFramework::WindowRequestBus::Events::GetClientAreaSize); auto screenPoint = AzFramework::ScreenPoint( - position->m_normalizedPosition.GetX() * windowSize.m_width, - position->m_normalizedPosition.GetY() * windowSize.m_height); + static_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), + static_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)); m_mouseInteraction.m_mousePick.m_screenCoordinates = screenPoint; AZStd::optional ray; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index b7776238ba..3e6639c29b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -300,11 +300,11 @@ namespace AzToolsFramework // Generate movement events based on the pixel delta divided by the DPI scaling factor, to calculate a rough approximation // of cursor movement velocity. movementXChannel->ProcessRawInputEvent( - m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / - m_sourceWidget->devicePixelRatioF()); + static_cast(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / + m_sourceWidget->devicePixelRatioF())); movementYChannel->ProcessRawInputEvent( - m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetY() * aznumeric_cast(m_sourceWidget->height()) / - m_sourceWidget->devicePixelRatioF()); + static_cast(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetY() * aznumeric_cast(m_sourceWidget->height()) / + m_sourceWidget->devicePixelRatioF())); mouseWheelChannel->ProcessRawInputEvent(0.0f); NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage index b867b7cfb19ea2f70157e69cd9534fd8bfb04002..6826f2a76e90456d281de0067934c304f03e7704 100644 GIT binary patch literal 28861 zcmeHQ3tW^{`u=7>gqhS)F|TcyC?QT0t9U^I)HJX_6Q@DM85C0xF|Pp{Fp65bqKFqn z&_+md(Gf2VhJTiH`xB$RzipQpT2}qph=4Is zKB-p+%XF^>2llUseGU&3aiO1O9LSt$vwHB2{sDtG>5oU$n0~m67BP3UX20_k(ZFQ= z_@$OtcYadae%+fF{xL6fS*M|jAs17k;;UZUl9sY)klmSkNjP82g_;Adwt8}lCA&-H z6Iw(Z7xHENtd-yCKC(Gf`|9E~b@L;VZKwI-wL*r8E`>gJ+>Q$^+dK1e>gV(Bk8m4$ z@9(dFbmNn=i$2EV2XaUMetX3P(c7~wTsT-dtmh`>$*)iMZkra;F;x}w*nM#ScXml- zj~(YYzh{zPiB(+4YY{nXY{1%e8;hrPn(lRUkgs}xXxZ_1d-gi$w{Gjk1Krzid-mfo z%Pu{gG_$~WeS9ZB_soX6-IlNV^x(KL_e*=Ud;Bo>=S?2#sz3YWPd)ixv>h%qbU>8L z6C5HOS!mm5s<)q4#YAXc9`yXG5577YdN*SRjyLB*-x#FW@Z^h*UjCa?KT-VtrPD&5 zdF92O7SCy|3unZJnC|3cJ;BF?T)LNj|Iy<-&xJe_`M0u1kK@rHT_=9@?xV+XerS12 zbl?+wF@%ulw> z3w>*~Xx`s(R7jGiyS~UqAZ7B*>q~5nO+}e&GDd@6`LYj;cS|J0qosj*7VWPdBcZxTFKA1=`*=LBBbo*DfyEqi5VYN{n&9k?p|Q<)&Am` zO&fgQbr0}L8Ps`*?W{>348Y6($dj0)q*Fn) zEf?A)-O~4oEe~?8Unjk9lgU0>nojncl3v!7^f22dq?i4H(mORNJz9Rb^!80jPh+Yl zb8q_xN)NJ{80ewpmrD;_eX{0rzD-F_TJc9|KFDf9dbIp<>BUV-@6?p^)GvRO^dPGV z>Cy7brN`_;6Wl|Uo~-#CTK*{M@w!b&kCtC9J+!z9>Cw`J^k`{9db~mtJ|E`tTSUA+ zrGN7D)}P!rIl0$Vy#G`4pP1{>80Am9e?r#!r`LOOp8u!MfAT2je?H=Ierv8fEiaGl zvZK6>ddlkL)cO$>i7n!27UA5OxZbaPG2&=J>+tGtcBFgSTc=34pK8Wn^QW3e{&e%` zpKezEOtbG#K3j>0&%KtNK2u*mCTd2EvSZq)PX?{H;u=m3|JffA=b!5ApNi2O``8e6 zaCNZa=D>At4{XG(IRD%H+sFN_?QKQC(F6URa6qY4@@+Z(tdy~v{GjW-$pE) z?-psrEw~XAN+(JqaJlfY$Nhb#wrIq*^gaR7NNYQL-v!QA{O9*i_rL>w8&5+2rXHFx zMq)kiH0R$?`t~sgCmc{JjrGqp1D5x5=xR^6p6?|&_ST*&eH{i7HuGEm+U8hQ{-quw z!bUz%GO(jR_#NO+nCEl3m!9#TQ0na3B<}nQ=j2~HEY*5`AIA}=FLrkDBdp;owY{W? zr!SV;3s{-R=Q`W_f8!J0BC;zzU&S|c;P`NUYKvs{z8YS_`JZ;#)=F=cM@;(SFLt%! z|Fv(yUJGutvC7>+?7#7H%ovFi4k$t3^UaUNr(NwM@CUk!`#BbTzxE2l^~GDogP*(i z{n|^;q6so54s?qHUN{z=cBO}Cfozby((J~K?gxDU|JfaY`CM_ZkNZsQ0In&7dtul zEx>FW-;k>t(EjehbDbO_1pR5)!nsKjKDBg`3RtP(EuFcBp!?wu^h1@{;J}Ue#${X5 zPHTVsxBCyK->I+$_G!uaZ@dt5y`>W%{I9V`bN`Kn{mwJ{1-}E@6x>L?dPuO}`eHYU zUyp(tYr((JpLw~GH$2dOsgH>I-(0*^GT~+Lf5lm3+jW6VS)V7FGD6S?Zm8?Q4oYLO zWOlH?KldhK@Exo1pSA~lFLwV{!1E_C`_FN=?Mm&B;y5*b=A3Z;6(?$s88hPaIoSUs z;rdE#^vH&Tqz}ULG#1^&VFKTN^gb&1hu{HshY8G?bZU`I{zC=*5VaM1i837nS%0ZCLcE(Oc4xi$pZ8zJ_v%KzMQ!qJBTBY- zu=h8b-I^E7n{|!xYc$sv5BW>MyfpAF*l&HF+Z*nTf9fwI@Z?v>{tr1&e;SM2Br$Ik z0QYquKF!5$;zi;2q6wD|aPCU{Cr@Mkz<%&hS95VsZtXnq4SSCqp5spZWoU(Xz~zoQ zGJx>L`ON;0hm;FAdlAzIE6&uy-b?L$t>>?s2mcR$KV=lV--_wr`=Y&{|M11`O7OXO za>AzT`fkIF5c4#461o#a2@9%{*7@Y_}xh5l4&5|MA5c8*%$@keRG1HK#cF_EJk@$GKq zTVY=i_aom$c_W?!-!G^F7m&X$%5w|%WSHa!6weG~`at$%G~`JaO znFTjy!v3khp%3D$Mez6V4>v;W2P^BhinpyO5aK~}ROE2N`Rgek=pi~e?|2B|Pd2f9 zplaSz;mZ14ZeJGT|HXyC(1(4SiElg3iVL#@{yEvg?f+H@~|PxmAK#Fw#XtK{&lS0z+v z4QmCQO!}b#{$PO_`G7Q;{EG(sr@Up}P5eI(e+8_YuVQ>td;mQxF$ZGf_hE%4jwh z4gO0U_#Z71{CSaHG0qF^z=C}%;J*W7uFnL&jBmZ$+Nq3x|Kaf0;9tLx;itmw2LnqB zGk||McASogn?-e^~N;>XknJ`)cl&8S^9@ zZ@%}{ObqaOeq5EZI9I~g`j_p>=m8vGrL0=Y@wMPT!_JSehOqf=@BGttzI48d&(+pd z8FsHsvE%4|no2Eq|C*5RMbh(N{#^B?c*^gS@0Xn~BKt4@%-s7fFzF-s*L{`G_#}Ts z{2$%K@Qh_og%kg~-($EJ;)i-}ttoYyz^~qQ_?xbv+Y}ST_@;P4?PL3G>wOpelYQZG zlXpkfPJCEuO{Twy?(Fu?T45%>RL}>+hfkel_Fb3?wyFzKhENba^MY{tEruz!l*2E9V6O8|y`kUs}@+q<6m3$kyV zFFmbi{(=0dLGLF0{utw*`p*np{Z-ucQ5#+qdBJ{xC3WA=hz!hh68JFarDDD|E^^u` zXA$vda1(QU-6m(uZDOpyuSSnq1ipa~!zdKNaRK6+{p)9O{V1`oaNWKdix$`4`ydYfjJ?s#60+hH#Z%%x zbRhI0q{S)n2XkvHOkSP9e{c&S9@N4gbP?a_?UQR`AwJ;`C_l)0*dM?@tb5sE4Xl}c zoNVIKg8JQR*_GM5*|)2^xh41%@;SX+F<}Vwp(?DUVDBI_X@WcXhn7b$9s`tbS~x@C zpY+#&1I1aS4-+Mnufg6G7mH@Z1pP2kLirf!!>um`{~@`E_-c?Vr1jr{@6G!i$es*x zsRVqF6e0Rh|H>U;@4q#FzxDkd(ue6L=)=wIY-5QendFHz>9luB!58ei^X2nJ#9!Hd zhHHvaSF3U0AKBRo^6xX21w=s~YIELWeA4&=^w%zp*edW(@f7FBM*3w7Snvlp{}q?4 zY;$lc_ydXu6&0>_H@bNu9+3Yg{_VKe2D{8!(C82BIRCWKGg`N`^6%o{-mca4>4LqR zk>3sP<-UgaC;wvbkjtY2+|9(lbJy$+fb!%S;P=+emd_7<(-nNm^(%?*n=Jz{9wU4t z5BJ0MyH;J4k-DL=lkdM z$Fkn$i~aWRQM`bAH(4sckF140zAF7hY^=$2{S^2CUlboeXGO_Q@C|zw`~mphord<1 z73S^m2hfMub+fm^-{+ahzd|2krw3&v5#KC7h>acjSHjF6sNw$=El3|$2>u`;At6@6 z-N^RdV$+x(%D5%z8FA?`R{q^vyRR8_{bozjm!hH~`KZ3`?Sg=Xe7;DppZx~f!7n{e z4}RCiqP^-)%SgNrp!{P5k05t*;PzR$qX?Je-@4QCT9}0LAJT`av*bUn1g<|fM-SMF z|Bm9x#6YqSx!hIC*R}Q)*)n^VO2z;A_WpDHH~5O3uv3iumrhImASC+~_%EyJQcnEe zxsVP2pJ$}}k@z(3%S!SHZgp!8#+!h(1sfT^Rr79y0LNw|W!}O|A4ivMFRhxP9R)`PfJnUn)U;JwEsSBK_>Vm{^f}G zZw!R}Kj2@E194*%=0LR5^T3~cUE(cStLrx<^ge_ObY$;0ThjXyKEIFR$8^Ep6TWrH zz1;}3le~oM?`)bb>0uJ>tMMv#aF9xouL-e;`b#Xtd8V2Fa=!L+eEh-f4K*We&|{xd zz6!b`%qGD;%{2Zb{=Pay{I4+6d<5a*oUEh)z%;)=`2B_Jgm#)wAe<0R=O>wIKAZ5k z!Aw7BzU3WYpJ##bM|{Hln4T6_lKnIO5f9pn3ex7`kMzNaPv57BJjOrhSB&$4edCYT zLx``rp{#we`xPg`Gc&_`_r)L0mlFO&$J%9x_k=GVbYI!>dP+;0Pa#}ma)*Ct7ewQ0 z!VNXoQzU<%4nH4XMfkto-~XI`-3zukRr1sqByR=yxO+7?$z!CA$GEC7hzGH;mk)z% z{82tk_|qJQUq?Pb_`@ZPPs*gqa5#OL+ zBXTT}=<(OcfBS#tKX@R+R{lrMWqe!t-;~7k!^;1G4;XIb{{Xw*%767`VCVzo_l*A! zWs*%P|2zC!O2l%RjXUuVIx6m71^G~cM*fchtVwAjUW4gKB(U`WgOZ z@c*i~HM5}(!lyUcKlmYiA^U%0U{y-X>oVB?AbW*EE{_`{@Hxur|JNt7cB}v2`#!bH zf~@}kVsX`-K&S-e`^5L1(yE(*igrO(|KD&YC#+?8O3TZ9Xt{$c?7x9tLng#a{Nukr z{y*vuYGC{_8xP_?A|f`{{7vu*kM-R=X?#fb`qd%gubZdU|L@;SSm9~)|GGu2z0vNGxwmc`x3V$+Q?zD$ z3h^Ha;OqT>Z!!M$`l6!QZ-8I$N%4xu& zz|g0?=hjj>=uuylGd=LSV-V$kQU~x~hjhtNhWwx6Kk|V``|rOE*K^p7VCzKka9XXl z{?>lU7qVmz%6Cj*VX?O^%970?-8{)2K!3=&B4F@M_5vJQr~`i!x_Mgjzf5iLiUDu| z73|^9!2`GGA zCEy$U()mROv-#Ct;0yLj<3G8)yT??2*lX3DQ8fN*0sfMwp&k6wcvK2Px2+()9fN56 zM|>aKM&~;Q(R{dEUSzoPIq~l}tN&rg&D36dWkZ+*?eU0zQdha2uU%c@08I8FkxKvj z^MQL>yZ5kOM*N$?VuSBjlt@m6C_Lk<)}J$(Xuv1?+o=#A&-LdeSgxKgiw)&kUmT6`o{|m>p7&=p#$M1^*%B{|O1| zzsg|zS-pk)FBStpDaHTF-Y! zt}hxtm|>d#AwCy`=a`@$vuOT@_}sKWz(JIsU^c*TKzGd)*spyIC)pdafAy5tf)%76#0Tyd8`v{MVaeX@P4hn$6}6UL z%^4deWkON|8}B&D^&$)A3NcI*=SVuZ3Dhwk90lKfuhiU zKinDBFD;Gq%T1v#ih1MOP2!j4BLNMoV_@IVADW*aes`|iO!^T+>$ikI({CXDXVLtx zR3SH9Jxu(!Ppc_9lPPtR8)_~SPD`Wlkkn0YXt>!H`rtUL4E|Cql^ggvlx{l8h70{G zmg@iT_)v$A(%QNT@5AXL_-d`)k~S}S()_Qk!jf?Bo02U%!%xEA$DA8c ze$t!#AMt;37xV%A(|ix%kJric#_W^cG~Z*Yh)qb3gMUCf)f1pSAwHx7+KV5=d$oGp zK&C$w@6oLG?#%Rq_(Hg^?IK>M@VqfZ@b_xOdoec>^S?jxZROqiZO;u@Irdn_AuE2~ z4t(}o6GQhafFJh=*-)W?OWWS3iY=*t3rIA07!arBR)LHxH*8;W=Yb2TrI67(TM$Pd7G-a^JF z$w&Hd=zWG?Uv?wJEw9LY@gs(<`f&9q^h1$WNbA4E|IIJk`Ubv`R!I30u+egD)&77N z(hF(+SS-mi*Hv*ZI$V9ako+wt-fFJD3x9ES?Ip@5#JRkZzbDp3cTWeO(g%=Cl!(81oF#K8*7jUb<{z#5fG zX#;=n{94oY-jp6#kK1$ZD`!9C54zjr+zgCK%b@#{KY00BX77|A5P##mn0?dxNnqd! zO2#L}2RGRFx@ioPd}QxC7BNivAOZd)6MV;{6_S4-zE24LA-$0DN8 zV?GJyZ!G^D`Y%b@MpVoJE6%Cq?mi)*!^g*>@Cc~7^kv=2@ zG5#r^C%z*Gv3ByWPzRM?cg8o1@0NyM&1HHs`~~r!kf>2T#p#N@&1e2)d$;o3)c2$L zfs9kMj#-j%$q5%AJy5>TT;Mx{o)7wsBb^zaqz_Uk#AI)V>HR^k@nLL#S6j(sh7?o9+c90DDl646WM=yA&rN{z@P6B_`gi~1o$?eDHId`m#AJ# zytQ6g`YHH-JEM-~pNQ|T4h#G{pT~Nefd9exKacq~!j}$mA0_MST}ZzOpD)sWv=W%^ zNBE0fqz}=I-^xVgq0K2dJAo-*(^V#_K3dE4f#SCoeCI4={8K(m{$SPgk}ap84^-bl zc;OhvFY!%y>X0A#CV!!HWtjPQwQ8W0Ve0SNh6K&i;Jd;6tq|WeDy0&?)I$4Z8uPiP zc>Vt#7jsKeUViBQ;&z>ElC_h3NgvG62X`CdFGh$DilX{PeIR|6xaAd38p!m4@)huJ zoIR5GPcNi+0sA+;8xH(-dLh+IO5BRgYv#1Y{n84_KE%M;?*hl9UlRO9UcGV0>Qy7B z#bne8`jKZ==4S}}U#9vJ;%i@a8^Qi*{6To#e*e??&IQq=KZN&xNc`8kSnAmQMoRb@lW|0(gW3!$tBQ_ zaXzHqI*UdXGn(lG`E%ks()UNcE9PocqaWe>rItVPjr2j&SrlAkF@Nhq{S9-6e@8y| zEBrfd^Q%5$ZYA=C)s6brPV~d{w1SK)PPi-SgQ9t681lhFtABXeiTF+{6#N71Ke!L$ zTZk9HlZLe|2>{>ZFNp7$F^q4DACj%b=7p2n2>jE0H`g=IykZ9P_cY!>_*bUC)5dq& z+Zk7AK9cNz!+hrdb4QgAAiiUCjQ`^y6@v(W@LuZ6sreh6t$5=CZU^{xA^$_|>*KYg z4=!{+u98=#%|1PBmw|Vo=Mn!)Ca2`@-1fbdUuAqqN#9-Ds(k2u$^IjUGktJ|JcP&g zC;rFzki5tT6aAclw`zRIK6I59zK<<1@_+4rwf23$=3 z;bH$H6aA2qc5DOF2W$Z8VVh}!{a)@$@uJ?W9OwxC5zk3p@Llik!u&h=JE`8R3?9h% zr~VReEv}z9tPREc%YuF&-cKLhcI3=G8CS@Eh{1nM2;-mpsdy`|oU0N1eO(ULtBB8} ziHvWWFMSw)Ncx2Kcg73+J6qf1#tQ!5neIpJZ;j%Fe1M)u{7>=|{DBX>k9JFgDs*59 z{6Vz9uXc+iF~AM{!~RJgZLLP>-I4K6@@jP!-p#(`W8=0e7s8-h*-jMvg{7g|ne2!B zxeX`l*5e_6`)m36cVGW#{$S5-pPq5-{YHP$S-g3AOaapm-mFyibYOf_f8^o7zz%|c zza;2K&tiU<^D5YP`eh-Wn-S4DO#w_FpIHOD=B?_ThE}ApaxG<>v9@ zhcNyr{t%y`L!ck}4bE1q9)xzo2Iqr9d!kb5NqpA}eByk~2zSPR7V%lhD~I)?8lxR8MRZ{Kdr*DyZ+ zUE}w^oByAC9>tG`^9cuT^K|%&M*Zl(Wt!F&Z{VG9Bhn9NyHz7+7H3@PivBF-jY@av zs+VViZ|dKze7&;I)6D(}W4vd6svq^T^)RKJu zeZimdh(GPf!1iol7zf0iq6?!_Z81qeHKj_WqgZ?P;qzr8?V;*?zR4uGoKEpC^8MAlq*=$$h+x z_Mara%=RBna>xE-;OYI?ev_fD!hU0|`Wfsu!+uiXej1Bzhz;9+Lh(k44F}KR_Xu3> zB$?U!sMKtK-v599&!h4_kNrQF3SwF@K8%Jj9IMyQ!t-fAS7JZfuY1TL#~u4|&3V%F zFxDTrSRo|&^|RT2tmvp5ciNA)XCd}uVZY7Ec@=|5-jB7cKdK(!?Q_`v+T~bLqWxBz z#x>CXy2#@pxL=}0m*j^5;)Sy*lKNj#}&vEIGZF_Otd8Rc9U#q5UZ3 zyV-uExD&#DH1X|2Y(LulvR%Udvztf!h5d(Cd}D9oY3vt`NI${$n_b!fzPm}2=jfjb zr~QN<&tdW}pS9SX_LnRl$o3CZ49b$x{(>oO9`29Y3TF=eQElUG)sIK*Mfm*+|FyQ( z<1cZno_{>-(`a}}9^aqs_gM^n%~-MD^;R7AbDS0AH9-C!vRJ+TIYU4c^+)~Zv_Iz% z_T%)~jQtwo>-8o5`vz=8`QF}h=B=oMtS$J0ew>5mSIs@~U3<41{dfjp%@*XqmD{={ z3-$D+Y`@JZbMJGfB@yvebMzY8Pw^p>ucl}@_E*)K_D*5)FQ1j;u110F!k5^73F1eC zdTRe>*dKv)S4MWy)yBO?vU0UCwx|rm-a94)th`pLfv9$xm@}i>`%B;((*l_KTt1d z(sGuPY}5}+m+h;WqsR6@lQBcs53;k*=BL6@KWf_eCaWht9)kLC90+rw`teq$$bYC& z5GZ~wDd5X?nFj_5{#T`va|LOr|7lCuXfzn2`(W`OB^=IO2id=b1zr7Ag_-Ji$$qI| zK%WU$)CG6D7ImVI_(l2d?_aO+-AJ1+w37FD{(f0(m}!6I$E@Cc{khkd zQT^=hScbR5e-NHc#g8a~ApcACkP1;{H*ZtY0FqawR)>mTL@^fr2pbF@9?#BZ^=)tB ze26E{Pek!6`s3uha-qJl>K{}epVG3lEOj-t^EDl(i=GY>>eU_a;eYS?lzUq7QLRLa z^{y(2zyJ1ess~N-=u&Q9Vj2HNW3&f^h5V%d#P7CQ zRL>#{BK-$6l7R5J z>|d!I+X?bveV+Uu%6kmyVZd0=r+5x=4W~9TT%CC%gx2#dC#imCbqsb>>S_I+ucq~R zs^`V}8W!w-ZGYTu;CY`!%WPUt#|YbW|IB`Ss+ZYNwbp?88TI*0wmwe&kJdlmpTyQb zZ@~Wns>gQ)Mm>!!_>2uzt8Jg_7Ujrv3ErZ+cKqCYYnu|AFUYOF`{ zwFq{rR^wOuvA)Pj>aqUFajEC9o=jMm$bX0b!OH2Qz*xW3R%$FITD#=%FT6L_tkGjV zSyR1*%?EclynGg|7Zto+l6wmE1ltk+XuT-Om#q&`{KI;&=4E@<9~A$ve5{djb5A>u zXnOvznbYA3Nqr}Fw(3KO2=jB8&!_wf^&RHF^=G&o_a}MxOlFw+gVt-#ti${b)@K|y z-=Ot7<8=d@pN&I4L-VoKN7#I9XRO#@xUIZ(l*ZfjE?vq`3%GI*n@=HsPV;NVEX%*KofZ2pS!RY_jGa>pDdKjpI| zf5BqNi}|RkdG>=z{=JxQru9cF-VsCd3*YF`eoVuBF6kGRZ@7w<{eh&uY$rG>P_jWKo+_f6#V|>^=sqN>e z51M&o0LJ4gb!>ZjUf=>3>-*S^?mOvkho`uce8_)2jt`^#=@TXNJR0xpsFAt#omy76 zujWPMyV!qv^SUsX$Mc;p>nYE_HP*%#Lh*c;^11lFzbo73l-53MU(F2UqbBXi0AW0G zYS(J#t{Nny5u*6PE;qV)Q~#(`>d^RRv|p}WPgg#z;O5rt=Iq{+z2sSj{?{TuC<$csbkzUI2Q*KO z-E`@|>X$B1|A(qosKE+O=y8@imWbce5v?^~K1x|Hy}+^ghk=R zkuPxCu!~~KXLozk^-v#`o%ZmQ@ci+m&Uk+hbl3&1txyk;kNZjCZ@&~_Jx0&F(D|lB z%-=3}#_Ph4=+dEh|4yvpHk3@scSuPhk%S*u$r0jsBn@!Yf1CGKgL z2s^YeDBFLVXqIj6bs@C8t9{sXwNhGrVaLQ*7q=koi$8cU9(Ub4B>2qZztAlF)aw5M D1ff2g literal 28066 zcmeHw3tUvy+Www_jG0lKM3T}r0q0=BDqi7`=Dv~mQ43nCrM-=cf zB48sNjRQ{PWiZ4M%QDSUw7?RRDKCtmj)o%_9p?YMdpYVsJ$?PNb2{G_zkWZ@Gi%T6 zz1H)-&-<>m-n9?Mah%ipf+1`2d!%I!bJ^sa^oYLfy(uHV%TVEczi2)X?Y zdpzG13{KTgS=#*4mR*gV*1q=r7fBJz9v$H`?0DLYWXsF>+O&6{Z}V-_LR_!mBCMm% zw7+{xb6%I|yR-;6F8qh&xb*Y7?M|OJzO;Dt^>?PHI?oKkV}-vUI1zEj=WV!%lRM{B zXMCM>ZH#P0(?4F>UbpMJcR#`Hhj9D<@ym)R!MwQdzu#N+LhlXo!#^GE>!uBVBtsE@ z$M4|x=Wmrr@A#bKMn0DMqRQv{qIS`76GyFCyS{AZqqB$Xe?BPEPq6IZd%d6DJ92H| z`cI$gwE2loCM-Mg@WMGILF2j7nEUHT?ii}S#^f(M z`M>BpTttN546nNgB7`i$?Xmigjw#}&D~CVdbLHQE+#hi@D;A$W$VI&Ryid;EzqG&l zZ(RoplJ_i~8UEOdeYQ0F&wQvfRuyi#vMKj28W(<|Df3$E&+T?D{ITf2ooxL%ZXMoj z+V=Nae~#-TYT{!?-$jej39&x^$-9IbwA`~35z{|)PMts8H#_>xmlqfLt{#_uBC*tt zKQ1Er_{XVt?>ILyV%93t%!bvAp4v7s<-IG4`gezZyE>foy7dE7NB;U8!S())12?kf ziY@4&8MecH(;^=J_`7v09ynyvjHFSXXxcs^DP+W>>GpS=`n_SB9)9xD5%0TE5-~I6L|MKr((2%9k3ts*}lcqYbch>GI z$HmArxQG{jX*qcpGZJzmzwWf^v({g|M}8IVQJ!-8E)N|3-sbXNcYH43Mh=suPWXKW zifrYshAX_s=T7(d-1#1#KX8xF@1LRE{rUg+-{(fYvwXvYvz#tBr0$Pgz1AiA#pUxR zhVcga;F}9a6rUdY-iB>K2|w)|@{j$|vmSrxkIr@@Hv5dadKVMy%0&pjy?*x279q@b z4A;HOoh?DI==;!-pnIn6Xt{UVey@&5@6{1F;5|Aby+0l4de4ra<+pdlO4FogH$ z2wHx7M=;E+5x)hoIe>N;&&qvuY|K~(_iLspnKL~t%-e6HTkR+Ge3fgkP zzu4#biJm8HE#n>%0LKg#Od)J9;M|13Gi6*9aw56CkaH6RN7-W}K@1n%xLy+ExV{}X z=4bm`l4$<-l+BzAem^j#T`G^|DQ0JSp5>|fu6Q81Tv^MWcfp@_JpZKpI_RYF&GxTR`duy_ISWh;|B=?v^WP_);BZob>Ao{@jK8XcxLH|9^7KzT;KxEuS;-L)rmITCf_`do4Cs5CLZ|6n4`x#i-H{2 z_wA5!w6e2kX8`M~>)4_p8-;J}@TA-dz%X%A+f%wAXSTf|Mxx=5~7i zc~hEoVlMb+uM6$B@b;omHwwvKf)@<9*glkJyR@lCO)l2;z1otF045-K(xtsfz(=7C>;J|Q;ZhaWvFwv3h+PL`#{W& z(>+ANAtQQO%L=&h1IQkF2$qH}_9YxPq>0Cc;Wd85cX&{6RB2Tk?qIn2d4|FFZFs_S zj92yD3b3XTiXUkr~^gN1|0?pt~geB2m`Yn(uTWWPr zyQn{F27U_mqJTX-Ca|BfZ(gw_5B94_X)%kSFJ9Xh9$|W-Z2WK64`$yP9Ub=V${qNi zI^~=z^{>MEoTP{I0bA)a$G~q_&T1=?`E@9%TXW`f#;;K(4(U+>ev84UXE*RI4jaJu zF2ML(i+T&E4R4Cs0sh-gbr}kNg)_&1|1$#wqh>^hpq-nmVEiwSD-0)o6C)4ID)sad z98Rj^@%$;lQ9Ho5C8_OHYM&nkJ-7`gMS|}tmms=ciT3yju#fJdksrk!lbdZ1-*b9lQ{=WZMabI`eQV~z%%Z(qsBBc-~Lk9YGH+_rR0`tj${3&!`l zn|!;0@3NF8S9<;mtI@~%!IC8H#m_}g_3GwgH5N&RJq8TE&Cl=kAbwwcmhsR0RVIF8 zL<#)=bCLIqp5V7o94{w4K=e^uK`8P6?o`IVbkWmONe@=cV*JN0inckU@tqz^{x6xH zvFf8Z1@wRMYrMZt@3Y8z2Kd$_D!_MVNzCD-gW-ylTHTD1SNFpIQ^`IR>So=90amhy z)WUGmlUm)2Pg?gjKiV$UW#}o7lxDN;S&?;EGukP>fPUShf|R3yn^#njKH~c(R{|>w> zm*;<^u9s>T+-gfGjezvkAS^PNgd*M6L;UxI8u}GF0&G>$0*{B)B_Xah?ZaJ1D zBm8}9TFDI30~&9uu~586NA@s4rWK_33sj`{;fZ;{BM0j7arH2_Mwl#;h zKjPf28|*=45_9UKUa$w^OQDQV{hFS)Zf`x`_7EJ%$x4ZLBfYU2y?y*1iskuUjQN$p z+eaezjcu9(z6+3VgKt^vXl4&Fh<8RGnK(6?*~2S{&twmq7A7>!fj*F4!hFQLbBOQn zc)kfA-3t4Fzptw-HjqA?-dA#s^1~rDgZ7bqTs~GZW96CcJil;%Vbkf7x{MS3M7tY? z)KGq4ySU^+#tBc(Zcnx#KJ;#}HvKrK%2Q;w?`{C!VtZro$*oyEcwAvw%Gn#o94*dj zGm_esz%ACReT$E_3A%B;#%5_5R(#wgn0_y%r9gM>>{aA%qG-Aw(s{1_2kS88b1`Hu z3bk2NbHKWn^qRL1*h6J8@heHC{t#cE>A)}inb!+^Q20Lh1SWeRf6kc6_@#UXP!~Ur z;pK5lL)DFD)5L+B`(6!ix8)%62YlTe@Cdc1Zu!zLSE^1lo1PF@w*?feu+sckspj*? zpFLmtpX&kqecjq6THfC)Dy;o`K9CSU&N59*`KhtUM;824Y<%3sX|AM4M)3W{aN>KK z>(j`8fhF%w;rVx^{EX~jgPPex$Bm@tg|gC2hRGicFc9z!efaJs-!%uAK6HV9QT|~4 zv7~7Z_$U9R_+Yz`P&emHKY@c^dqeDmnJYbkcQ+ViLe75uaxv{d+U?c$A~F7LAw(FZ zK>WWffBqk1TZ~Y5`}dnp=cT7H`#`woS}a%kRvvYk&f5p{ywP-pkJq~!I#(0lwO?Q0 z@gz&;A&TFX#XO&Shdq?72Zq1%`p{_BZCc3qCjTHlm%h&ME6bjqN_@W+!s8>OW(0?* z6B|vVWrd^Lu^B+Wt!_^%)gD^-m+Kw17DmhrhHuwy`MLpw+~m!X9%y3ONftyy^x-f zJ#0;5_OZs0v5M^F>&;9*NY4qM{(|8y@NcrOt3Q%Hj29E%M!ihZV)1=rbWRZX&9RU^ z*soo#Z0E%I)f3sNbq-L3*po)WDk+*=EfbXHxr**D1QK*rgbXfv)z$zvkxZ`zw^ThuQ)>U3$?1z z6fwB4`&IBw@fO$|@Ms~mSCAfnesdSWmA-)m?VEGKr&^_=^{1nrx8(=OAG4<|(LycQ zUstCDtzuwod(sccz0c5YzH`S}CW~plruX)dMGcFE9++GyKQZEig;9j3@%|1h%UwWt zvTMhU(nZAY9v$=o?G46`8(}|^%)()w?rcRkMsR&_H&y(Trxo)F6DJc{sw!4r z4f!bi)%?XK^5+#t2JIWak@(JkpJ5gs5*wFJXZ%vWtOmi+BYDj00r`8dR~~O4J+U68 zQkhL&ZR)!FuUlcI^|Z)Hm8uQ*@@HO2!oY5nA1D-&ZMY@cu#$8)!WF9xhTbAS_i^Vg zxzhFhy}i9(miev@1)sFurT6ysd25s}&p*v)$sST?`gS6Fpm;@Cznrzx^8(7g(o_3n zSBJl!{fhMAv@6-a0bgi5<=YT?cC47S1(56wS2UFIbD zqz5LGMuUi-XC2#4Uu_>!lh|Bqu0727i@ z-9K!FmGqVTJ8m3nC;d%?e}_Jc?}x3ZAbo~?sQR?a&9jEBxJ>atg?0&dWm`b)!WN1L zkr5H|C0vPCk+7Pd&-L%$-@8wH;`@>-T@Si_Li;gH>z^Bl8k(l@=2kI(tRa0 z`>%B;=C7d3T)IBDdo%d1#CXCSOxek~JpbQjTau_fabj*>6WVFL5_GF3_~ZKU71n~# zFZ}>b13R(nX+Hy4^^l-0FTlKz&j(bh*|S{*39A(e>3qINeD!#y>qT{8w^px39GW+NnQimtC$R z{x7*wf9dyZSI*6L-DKkZ-JsX&k*^_A{f>O?-_7rDylFQ=)R6{KFPnX+0ZIHR*Y@uU%n1816EZ z@ZiVMzILJCmzbXueppyb{0Go{Za%P70P^wQ6zBo*G2jv3huWV@1OK@^|6u`_rGyKx zUPtYTlY#Ny;iU6XgtHegOzWkDcjft}yTX2G{fzMOz4$#`LhC7n>rK9^UGaOEe^={) zTN=)#iT^PhI={Pt+W+hI{@3iGX|2=ca@PygU$e<%x_V~q!v0|k`&0ZQeyaC_EZ}P= zCmbUD**|pDZpCVpo^am#xqN%ajjt>t{Lbq-;-1{Ga3bE(ophYX^RQmH)qk+{;q8Tl_QoxXFJtoF6|){1e|T z4IfIy8`A#o@ZT(T@*V5cpXCE4^VKsT8_=-?E~G%-OT@XST2no=pIM;AM8PYp`r%gUp;OT=6m$}wu_r)k3QFN z9OZvLMS7$Cx>FzS@iff$|Ci){HjdMA;;xSV*e;igzmXP!{~U|iT$_0LxJRlrystmy zL(^5Nupf+JK38)C{mEazJXB`|L3bCvEG*+wnUpv{2L6`irymT&s0wXdY*gf z>9f2))BF#7>0?G+BpgTcKN&t)G4tZ3(Z25SH2)*4U%_7=Py2Cz#)Ep`f$s4%|C9OX z^=A*BC3}dc`Ja!s-q3Vo~ z8k6aoSt>aa?gM|1r~y>fmV4-}xn=%CYBCR*pa(~`g{2Z+SGmT}*qo@|zB&x;+x%(% z2YX0d{Wjq;f0}O*jvG(c_w^@#1iy))eHo_tA7Nit;y=*;HTW~}FX2o@Ew#hEh;LOy zM5Gh9BwZDp{drfYu3>dWMK>qQY&XOMTK|E38;5mc{L%h2_|;Dx2EM@`t^W|ei>5L@ zDgL0{n7iOC@fqI_`Xuw#8$Z>ZHH{wFDW2B5ee^~{m62gu|A9RiFCW`Dc{Hx4`Jeog_1wNJurXo=kWKI%jG?{ga`VQzw6-dS5A}{9LX&U zp!FYfV`60WXVSt7@Jaherbd-|-zE=zMP8Xdb|>|qH!^<-Zyy1)o`UAcrP0h@X#K~m zN>oRO5Z>lb>%q8Q9nzERW1D|4*5~p2i9Oqd6*c8<3!wEJWQSPqnf#r#@azxKsQ`us_0U z-X^S#-wOMbfZuKD^nI=*PJztNu|d(bA39>|J}XZGbxCQR$Ugs+~=hCOJtG(KYB zmP^^?!Dl;aY5WM=uXBhG(ph8=oKT|wkLL&1;W&F1!!GeWoX%{oPwSET=yTwEeS^;2 ztZw?bJpahl!|?YZH74+V?jZP{dN_dekMPm09)%Tohk1WD!{0yAO2Pl(fMSf72?S;( z0K-0L{TEQ39M0^+g7sg*lZHt3)~GVX`x-ykPhvo4W*@ZvOW*GzTR_1}Bf54j*8NIH=9Iq5@xLq$dJHjGcQA4GRU@KYO2? zad8y!tJRVo5dXO;xE`3+gJnKO!>)AMF#w%y@>zuP|e zd~|{5&EIS0oJT%+Fo3@wm*3oSDXmBP)E|N2-}%kz#-Gabw@e*1nDRLdaNQx|e@x&c zOTr;@ZF9=89q@nfzZ3Zo*~h0Jz#a<61U4Ama&+cK^@odq!9VGz3GIJ-gJIs^VJ|a7 zJY4JG*J^3MAMR_- zU&OE+`~9+_GGkdz4%tU3*#r6aciV{X%+kz5#RkG>z6747EhT*bw*B%0;mpz;%kfHK z?;>OK*_Gv^=4Doqe{td>tId+JXVf#9)np&yf--B%RbiiC@5~d#m$1Mtw>JrOF+DQD zC+wx5&~9(yK92Ep-~xLK-d+>!IWdrL&$laVmo=U--D7~kZ$Wd)HM3?@>RUesQvBvL zwdyNXY57~GO#;4l5_Buf2f_ba%0RMTojFnY{f_dUTQ@5M9enT21^;=URz4>f%wdbA-&gTQNBnx|6Sg{OUWL37na#} zWdX-$-mr%<>!FW;=Vg{s{z&|vC|gPG)s#QL-EHQtSB{-IFSDA)TiCnIYB| zic8;X{+{~Qg+R*Bxq=k=xkG82(%*{V`Gxx{t3NH@v}JQlAg$NwYSoG(TgpG#vUyS< z~<58&TpUww9dZA;4LCBWdH;Y%jp6GZKs&O&sYAczqjVQHEx|B zNV$RO+9g>hC_c3JHdH+GAmjfj+#m994erkKs|^l0)A|$PANPU(d0C#s7xDk&myCZ0KCxG`Jza0}qWQN5 z?Zv_2U7$LW8+Ek3w&&s>f#$*QLNLk=o@MT~Ew8my;qO%M(7UM2s+|je2j7%WLho%G z-{t+iitK~@{p0kNLFE6ueH7X&O0o!N*^9CM#Pu$+?#}B#_&Tkh5Z`+~r`pH9#FnU z_OSE~#y7=p=z}tTJj0}iWDiq=%JU82zwK1`x4AiGR8O?S{~de}XbTMf!MD@|f;$Vs zjLp_lUNqi>ow%^yrSGl%{kLKv7oF}Lyzb_CCwIZcOWLNK(++#^aX~&0e`q4!x)NM|kmT;2*dT@=M}BJr@2yFRMCZ z)$%wo_|HsYeAD^}>HYe5z&H4(`flP|x0u@#Q=H{V_Ct8Xd*Ht~=O+GO0r-diJFZ_h zAN<2U==X5Fa%CLjpYEqAXi+YCBaQ4Kknw9*%nv6$u<-g#`tVi=@jWY$=4Yh$69*BV z6iD@3I^=`U^ZYIFck+*X;J#wuY05x{e|Hgteba2Uc;yn`@ONi!?Y17jBcA_Oet+xr zqz|{xC#4*-2Z|RGA8SPq=WG+jZ>k>^7nRutcLd)vGfOF-6hhx$>dE|_<`>WlYxp4E z->Z4OD700){sQ5wYSKsOfpzvPJpb33e%R#k6Bz$gKgsnjlP4<~K8*b_;#)n9_|NgQ zBt7lGAIBJO;pE9Y|7d5|Crsr1-;?$`xqQ2PPAKD>?x(4>E2fWR*qitTju=e-e*ye{ z>8FAJkCqXh6iD@1qz3_y5dSfOG(RJMm$fPXw^!2Ut2N&+*?9u}tcv3#;W0lLh2+qvbmgQV0`xY13tWQ74`}+xsACUWs z!4LENSJ8PH_`mf9Pp0>D-bz?dRx!p0{Laj(4i0&(7wP@0gBahmUQPMm#K4T8ImKDm zX?{%nM+`;$hyT<1IFE;+q+g$N6Hg3ceBZcUq3~z=Px~Kq{VTqR|1lT9=VD(jzePT> zM;h{j3xU00uf+dzkH8*~FMbGqNgsSfz~GnqqpM9(JRvOK*?hI$i`Lgbze3E79c5Sl z!sly^kqSBH=YMGY{!iOO>-$suxILc`ac5^|9mw${z3{PB$UV4h)0(mzJH->&hurgl zm1F0WWu2z^hq%aI;Vof&Q+$Em%lma?_;u(B@inM3^uIXk^d{_Q16K@wf(x1n|EK*B zY9IVK>;e2cuwNI%1Ly&r52f}2?o9t_{fn?qTi~~BUc{#c^Mf93z^}pXN%hyd<`j8n zLHYjUSM9uB>zeIK2`4?++_IAIk4deN!=F!)K0^MuNVy#6x&i)+{riu8egP-=r}ar^ z?qu30w~d#GJ281j(+B+c%ItD^dv2wv*v>FlXp?soGR)hL-7bGvC@iP;DA*J6=`Q5< z5TqyuoL_TK<2|e;?rOcYPy9@B?vKUudZ8Jm17&|lT_IDdrmC?CbS z45j|7hK|AcLzf^2p3|S5KcegDyxEk;*m;xlQF}db{zUhplbX&GhEGiIUR!y%axo zKF5;ur5~NoTR)NYzdpMz9Oo~DTi@o-V+rQ!>HJ=AZs#JL$3p)r4X-St{_lL3KYtf= z%*gPzdG>GVy!{#j&con5^@d5T|86=1S@O zj5p5DdetqoGW&`A&Eo-n*PmFD*@@@3!q8tKLH#<;t5AP&yiM}Aq3nFZE6ajI=zL1? zEY|wk^~J3Q$BFJDmq+u*!W z7?0}=)L+qbx}MIL|FDjoAKh75pH1flOXAr1l48T*BsyQT;zgV%!TF)Bt9pgd`GN>3 zt2bX7x#H`rpU~c*?;d>vr)YrdF68Mo&S+1zC~GyG?Xb0P<#BOz zwS8SB@q2a?@!d{;?PR}==&r8hZB|cT40{1KEec>*y2xcH>g&zH&gc93qrS4|P&zNC zYNYpfcqT94^DVhtF}^c*ASZi?wlnD!j<@xn^awleP#B(vdUtPGPB_)GPjju$J{V5* z>J@9KUVWN)C-|lF3fB(e`m^PtlMR`N==__#e#3BqQ&+x!-je%pKH;i|Q$Byb0QG`< zXgp9q>>){|@u2e|$FtaZft{6ZIq04#Z!)VV?zpk-RH`4J)|KJ9@Y7vUFKBv_Oa9Dj z&Vm54Zv_f~WvKsF_@%o&1wA$x`ad_zm(}Zznz5L#_x(7|*Gl!kz><+dTrEm z52;y0<=Zm5`P?+|`mw0jh^Rq*{vThjeSWOd1&#Q9vJcf{ljg!Fe7*CLNtRRCyT z34gMH;bH?$c;oNVUeqsQJd)wRgzXL8E(so=%%49JiJY8%_kPo_)(>igW=&fS`Ols` zdo)+}=b}Dvg>`)cs~6n8gy9Bb>@sZktLDFedcm~|Q6JnZgs`9U&rbfR2gB@zum3~; z)6sv_``qY%5MS>%?q>fNq8{X&beyCAm-nLcz_#2S% zqDCnBH`FJb*SO@Dw?#ckvW4nLE`EagA=Gz}{iA#&aYrKhkNP39e_+*IKf>KnAHvsz ztDfa_P60n}3wRCvRjDE(J7d3Bbs+Nu>0f^ofJ8ou{$YRjAoP#=mot&?Z#>0wU}L3r z6ZU&L#Zx?zVSo4f*I4hhbc`pxm&m*g_A6Xh&Rxpab7Ft~_t$G+KQ2ha>SwUgKHFAa z?s5e66xCSa$99OiDu?ZtAFu4Vk@iFKCS!jb`{ks6wEsD+8}`GoKTi5*!uUMNnY()> z9rZee{-XRv@c?%K^Uw936#v{;%jLs`XD@}uYPA&qB&bi)__O^i%5SipX)KOqnDQC) z*LXUQt#=QpK|KT3H?M!=Ha6rLZE3YV;SlXt;gvvr1V2*!0`?1qy^Z!p+-T)0yqX;Q zkDSnk{YQ?=c%AJxa&YVOcvt7qudtt-Y{CAb(pIkNp`SV_ko2C`i)-@P{$b~8>^EQo zpmZMF51{x*_}xH;rHg9(%)lYeY=4O2AGU`hMcnM8v>!<8FXLambN<ofKH*nV7&Wx^qvZ`JerFE%d+zOV!9D_B2?sHrs2di(KgwqAA|@r~Bc zcFrZN40QB2JsA5Vz!|HSVt-VvoYaBsuNQ>odB8p*dvK<{fyuvkQvRdD`bz8kr!{W9 zUe%jxNQ*y^bDGxYu-zq}&<_1YeFEiIV)XwVf7XA>M``_97s1vm>$A^CVL!^cJ>HGq zf1vn@^(yPG#jO97?^6GFy~po2csZ~^#jiJD|HzW0!TLh(WLiJE5J>h+{eL%r_7|0b zl;6;P!lZ{V9#fTp)L+^^>cfSV1)#qp5Z|c3zjr^V^>}o{c$C6l$UeLca`_8R*<h`7iqpYj;%Kh0N&|2h5n^%#51j1T$sv&7;2dW`4cq@MixTjFrG-s-?_4`l0Y z%j0PM&aRx=mG!?a{FDdw)0Dx^)PIW?*)!H#6i;zsV**n$Zu0wk``g+cehs%l{5Xw} zNApn(hx~DFxjR^{{SbhPe$4-zn<2M=zf31`cVgd{z9V2U77w%~mOMY6ANyboy5KD^%v^UJyv_I|gB8a7|7 zdk6EyDwmN%YGV2MD6|e-!tnp<-z=XHMmN+0s&IeY9FK78{>XPwpWmg1<-7JvxcLK8{`|F2=!AbU ze)!LhKXez*)e6^h&XYM8@r$!zOYck?-vt>UdzjG?DrAhq|b{4Qd#BZ zab9G96rVge)z373xwv11;?DTn5%su^=jjiJd6mnVt;Kpc`IE$0A&+%}o?`!E)QqmY zUc@?)Ugq4yVO;tCW_1Rx@5<47vj;c(mz(#)@3r>7*T^3ZWOZB~$NOLZ6M_RN^ggw! zlX%~utx)_U-am!)CcOU!?@vsr)x1g9&ld(@cMSgeYS?iu0q1)!xh5Q1fcJr5KJ?j! zARKpuU3lyh(ZBnoP8yEp^Mm$H)^J?40Oyfm66-3Xq&SYOs^aiv-_`N-eSF6&pfSr{K=saWO8=NRT8;?Zx`_yW={G?_ z>3M}%|2-+7{aU*h-A_}SB7ciB?e&75(({KQ|FPqJMsXir60C3N=2D>-N$i~ZS$}E! zuXi`#eSL|OO?K{y*(rollback++); buffer[bufferPos] = value; if (value == 'z') { diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp index 48212fe154..ae193298a7 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocument.cpp @@ -38,30 +38,30 @@ namespace AtomToolsFramework return m_relativePath; } - const AZStd::any& AtomToolsDocument::GetPropertyValue(const AZ::Name& propertyFullName) const + const AZStd::any& AtomToolsDocument::GetPropertyValue([[maybe_unused]] const AZ::Name& propertyFullName) const { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return m_invalidValue; } - const AtomToolsFramework::DynamicProperty& AtomToolsDocument::GetProperty(const AZ::Name& propertyFullName) const + const AtomToolsFramework::DynamicProperty& AtomToolsDocument::GetProperty([[maybe_unused]] const AZ::Name& propertyFullName) const { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return m_invalidProperty; } - bool AtomToolsDocument::IsPropertyGroupVisible(const AZ::Name& propertyGroupFullName) const + bool AtomToolsDocument::IsPropertyGroupVisible([[maybe_unused]] const AZ::Name& propertyGroupFullName) const { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return false; } - void AtomToolsDocument::SetPropertyValue(const AZ::Name& propertyFullName, const AZStd::any& value) + void AtomToolsDocument::SetPropertyValue([[maybe_unused]] const AZ::Name& propertyFullName, [[maybe_unused]] const AZStd::any& value) { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); } - bool AtomToolsDocument::Open(AZStd::string_view loadPath) + bool AtomToolsDocument::Open([[maybe_unused]] AZStd::string_view loadPath) { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return false; @@ -79,14 +79,14 @@ namespace AtomToolsFramework return false; } - bool AtomToolsDocument::SaveAsCopy(AZStd::string_view savePath) + bool AtomToolsDocument::SaveAsCopy([[maybe_unused]] AZStd::string_view savePath) { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return false; } - bool AtomToolsDocument::SaveAsChild(AZStd::string_view savePath) + bool AtomToolsDocument::SaveAsChild([[maybe_unused]] AZStd::string_view savePath) { AZ_Error("AtomToolsDocument", false, "%s not implemented.", __FUNCTION__); return false; From b2dfd4d6902202a6b5f8132b526acfb90c6bed10 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 17 Aug 2021 13:53:31 -0700 Subject: [PATCH 086/100] fix Linux unit test hang Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp b/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp index 443fe0ce72..de073fe600 100644 --- a/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp +++ b/Gems/FastNoise/Code/External/FastNoise/FastNoise.cpp @@ -201,8 +201,8 @@ void FastNoise::SetSeed(int seed) std::mt19937_64 gen(seed); - for (unsigned char i = 0; i < 256; i++) - m_perm[i] = i; + for (int i = 0; i < 256; i++) + m_perm[i] = static_cast(i); for (int j = 0; j < 256; j++) { From 14036458c127ed80ed9a35ba8d526134a3139ca9 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:16:25 -0700 Subject: [PATCH 087/100] more warnings triggered by nightly builds Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../ImageProcessingAtom/External/CubeMapGen/CImageSurface.cpp | 4 ++-- .../ScriptedEntityTweener/ScriptedEntityTweenerEnums.h | 2 +- .../Code/Source/ScriptedEntityTweenerTask.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.cpp b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.cpp index b4f1f7e306..6ad7b6d884 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.cpp @@ -386,7 +386,7 @@ namespace ImageProcessingAtom if (k < 3) //only apply gamma and scale to RGB channels { //degamma texel val, by raising to the power gamma - texelVal = pow(texelVal, a_Gamma); + texelVal = static_cast(pow(texelVal, a_Gamma)); //scale texel val in linear space (after degamma) texelVal *= a_Scale; @@ -514,7 +514,7 @@ namespace ImageProcessingAtom texelVal *= a_Scale; //apply gamma to texel val by raising the texelVal to the power of (1/gamma) - texelVal = pow(texelVal, 1.0f / a_Gamma); + texelVal = static_cast(pow(texelVal, 1.0f / a_Gamma)); } //write out texture value diff --git a/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h b/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h index 46bba2f1b9..4c85c18382 100644 --- a/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h +++ b/Gems/ScriptedEntityTweener/Code/Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h @@ -79,7 +79,7 @@ namespace ScriptedEntityTweener struct AnimationProperties { static const float UninitializedParamFloat; - static const unsigned int InvalidCallbackId; + static const int InvalidCallbackId; static const unsigned int InvalidTimelineId; EasingMethod m_easeMethod; diff --git a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp index 8be0efdbdc..cd52583ff6 100644 --- a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp +++ b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweenerTask.cpp @@ -15,7 +15,7 @@ namespace ScriptedEntityTweener const AZStd::any ScriptedEntityTweenerTask::QueuedSubtaskInfo::m_emptyInitialValue; const float AnimationProperties::UninitializedParamFloat = FLT_MIN; - const unsigned int AnimationProperties::InvalidCallbackId = 0; + const int AnimationProperties::InvalidCallbackId = 0; const unsigned int AnimationProperties::InvalidTimelineId = 0; ScriptedEntityTweenerTask::ScriptedEntityTweenerTask(AZ::EntityId id) From d15d40fec667ee0e3190a4904bde0f26eb497a7a Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Fri, 13 Aug 2021 01:14:06 -0600 Subject: [PATCH 088/100] Add Windows PIX runtime support Signed-off-by: Jeremy Ong --- .gitignore | 1 + .../AzCore/AzCore/Debug/Profiler.cpp | 19 +++++++++++++++++++ Code/Framework/AzCore/AzCore/Debug/Profiler.h | 5 +---- Code/Framework/AzCore/CMakeLists.txt | 10 ++++++++++ Gems/Atom/RHI/DX12/Code/CMakeLists.txt | 9 --------- .../Source/Platform/Android/PAL_android.cmake | 1 - .../Source/Platform/Linux/PAL_linux.cmake | 1 - .../Code/Source/Platform/Mac/PAL_mac.cmake | 1 - .../Source/Platform/Windows/PAL_windows.cmake | 12 ------------ .../Code/Source/Platform/iOS/PAL_ios.cmake | 1 - .../3rdParty/FindPIX.cmake | 9 ++++----- .../Platform/Windows/pix_windows.cmake | 2 +- cmake/3rdParty/cmake_files.cmake | 1 + cmake/Platform/Android/PAL_android.cmake | 2 ++ cmake/Platform/Linux/PAL_linux.cmake | 2 ++ cmake/Platform/Mac/PAL_mac.cmake | 2 ++ cmake/Platform/Windows/PAL_windows.cmake | 2 ++ cmake/Platform/iOS/PAL_ios.cmake | 2 ++ 18 files changed, 47 insertions(+), 35 deletions(-) rename Gems/Atom/RHI/DX12/3rdParty/Findpix.cmake => cmake/3rdParty/FindPIX.cmake (59%) rename {Gems/Atom/RHI/DX12 => cmake}/3rdParty/Platform/Windows/pix_windows.cmake (98%) diff --git a/.gitignore b/.gitignore index b73c89b1d9..e41b92498f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .vscode/ __pycache__ AssetProcessorTemp/** +CMakeUserPresets.json [Bb]uild/** [Oo]ut/** [Cc]ache/ diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp index e6b7a80707..eda7330cfc 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp @@ -18,6 +18,12 @@ #include #include +#ifdef USE_PIX +#include +#include +#endif + + namespace AZ { namespace Debug @@ -495,6 +501,10 @@ namespace AZ ProfilerRegister* ProfilerRegister::TimerCreateAndStart(const char* systemName, const char* name, ProfilerSection * section, const char* function, int line) { +#if defined(USE_PIX) + PIXBeginEvent(PIX_COLOR(0, 0, 1), "%s:%s", name, function); +#endif + AZStd::chrono::system_clock::time_point start = AZStd::chrono::system_clock::now(); ProfilerRegister* reg = CreateRegister(systemName, name, function, line, ProfilerRegister::PRT_TIME); AZStd::chrono::system_clock::time_point end = AZStd::chrono::system_clock::now(); @@ -537,6 +547,11 @@ namespace AZ void ProfilerRegister::TimerStart(ProfilerSection* section) { ProfilerRegister* reg = this; + +#if defined(USE_PIX) + PIXBeginEvent(PIX_COLOR(0, 0, 1), "%s:%s", reg->m_name, reg->m_function); +#endif + if (reg->m_isActive) { section->m_register = reg; @@ -555,6 +570,10 @@ namespace AZ //========================================================================= void ProfilerRegister::TimerStop() { +#if defined(USE_PIX) + PIXEndEvent(); +#endif + AZStd::chrono::system_clock::time_point end = AZStd::chrono::system_clock::now(); ProfilerSection* section = m_threadData->m_stack.back(); AZStd::chrono::microseconds elapsedTime = end - section->m_start; diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index 243a8da0b0..6dcdcfdddc 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -5,8 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ -#ifndef AZCORE_PROFILER_H -#define AZCORE_PROFILER_H 1 +#pragma once #include #include @@ -615,5 +614,3 @@ namespace AZ } } // namespace AZ -#endif // AZCORE_PROFILER_H -#pragma once diff --git a/Code/Framework/AzCore/CMakeLists.txt b/Code/Framework/AzCore/CMakeLists.txt index ea7cc27af5..ab9596e2b2 100644 --- a/Code/Framework/AzCore/CMakeLists.txt +++ b/Code/Framework/AzCore/CMakeLists.txt @@ -19,6 +19,12 @@ if(LY_RAD_TELEMETRY_ENABLED) set(AZ_CORE_RADTELEMETRY_BUILD_DEPENDENCIES 3rdParty::RadTelemetry) endif() +if(PAL_TRAIT_PROF_PIX_SUPPORTED AND LY_PIX_ENABLED) + set(LY_PIX_PATH "${LY_3RDPARTY_PATH}/winpixeventruntime" CACHE PATH "Path to the Windows Pix Event Runtime.") + set(AZ_CORE_PIX_BUILD_DEPENDENCIES 3rdParty::pix) + set(AZ_CORE_PIX_BUILD_DEFINES "USE_PIX") +endif() + ly_add_target( NAME AzCore STATIC NAMESPACE AZ @@ -45,6 +51,10 @@ ly_add_target( 3rdParty::zstd 3rdParty::cityhash ${AZ_CORE_RADTELEMETRY_BUILD_DEPENDENCIES} + ${AZ_CORE_PIX_BUILD_DEPENDENCIES} + COMPILE_DEFINITIONS + PUBLIC + ${AZ_CORE_PIX_BUILD_DEFINES} ) ly_add_source_properties( SOURCES diff --git a/Gems/Atom/RHI/DX12/Code/CMakeLists.txt b/Gems/Atom/RHI/DX12/Code/CMakeLists.txt index a16b958c66..8670efa7e6 100644 --- a/Gems/Atom/RHI/DX12/Code/CMakeLists.txt +++ b/Gems/Atom/RHI/DX12/Code/CMakeLists.txt @@ -12,10 +12,8 @@ ly_get_list_relative_pal_filename(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Sourc include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) # PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED if(PAL_TRAIT_PIX_AVAILABLE) - set(USE_PIX_DEFINE "USE_PIX") set(PIX_BUILD_DEPENDENCY "3rdParty::pix") else() - set(USE_PIX_DEFINE "") set(PIX_BUILD_DEPENDENCY "") endif() @@ -94,9 +92,6 @@ ly_add_target( AZ::AzCore ${PIX_BUILD_DEPENDENCY} Gem::Atom_RHI.Reflect - COMPILE_DEFINITIONS - PRIVATE - ${USE_PIX_DEFINE} ) ly_add_target( @@ -124,7 +119,6 @@ ly_add_target( ${PIX_BUILD_DEPENDENCY} COMPILE_DEFINITIONS PRIVATE - ${USE_PIX_DEFINE} ${USE_NSIGHT_AFTERMATH_DEFINE} ) @@ -149,9 +143,6 @@ ly_add_target( Gem::Atom_RHI_DX12.Reflect Gem::Atom_RHI_DX12.Private.Static ${PIX_BUILD_DEPENDENCY} - COMPILE_DEFINITIONS - PRIVATE - ${USE_PIX_DEFINE} ) if(PAL_TRAIT_BUILD_HOST_TOOLS) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/Android/PAL_android.cmake b/Gems/Atom/RHI/DX12/Code/Source/Platform/Android/PAL_android.cmake index 240ec6941c..8becd70f81 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/Android/PAL_android.cmake +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/Android/PAL_android.cmake @@ -7,5 +7,4 @@ # set(PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED FALSE) -set(PAL_TRAIT_PIX_AVAILABLE FALSE) set(PAL_TRAIT_AFTERMATH_AVAILABLE FALSE) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/Linux/PAL_linux.cmake b/Gems/Atom/RHI/DX12/Code/Source/Platform/Linux/PAL_linux.cmake index 240ec6941c..8becd70f81 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/Linux/PAL_linux.cmake +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/Linux/PAL_linux.cmake @@ -7,5 +7,4 @@ # set(PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED FALSE) -set(PAL_TRAIT_PIX_AVAILABLE FALSE) set(PAL_TRAIT_AFTERMATH_AVAILABLE FALSE) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/Mac/PAL_mac.cmake b/Gems/Atom/RHI/DX12/Code/Source/Platform/Mac/PAL_mac.cmake index 240ec6941c..8becd70f81 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/Mac/PAL_mac.cmake +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/Mac/PAL_mac.cmake @@ -7,5 +7,4 @@ # set(PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED FALSE) -set(PAL_TRAIT_PIX_AVAILABLE FALSE) set(PAL_TRAIT_AFTERMATH_AVAILABLE FALSE) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake b/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake index a7e4015659..b885e53ec0 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake @@ -21,18 +21,6 @@ endif() set(PAL_TRAIT_PIX_AVAILABLE FALSE) unset(pix3_header CACHE) -file(TO_CMAKE_PATH "$ENV{ATOM_PIX_PATH}" ATOM_PIX_PATH_CMAKE_FORMATTED) -find_file(pix3_header - pix3.h - PATHS - "${ATOM_PIX_PATH_CMAKE_FORMATTED}/Include/WinPixEventRuntime" -) - -mark_as_advanced(pix3_header) -if(pix3_header) - set(PAL_TRAIT_PIX_AVAILABLE TRUE) -endif() - set(PAL_TRAIT_AFTERMATH_AVAILABLE FALSE) unset(aftermath_header CACHE) file(TO_CMAKE_PATH "$ENV{ATOM_AFTERMATH_PATH}" ATOM_AFTERMATH_PATH_CMAKE_FORMATTED) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/iOS/PAL_ios.cmake b/Gems/Atom/RHI/DX12/Code/Source/Platform/iOS/PAL_ios.cmake index 240ec6941c..8becd70f81 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/iOS/PAL_ios.cmake +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/iOS/PAL_ios.cmake @@ -7,5 +7,4 @@ # set(PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED FALSE) -set(PAL_TRAIT_PIX_AVAILABLE FALSE) set(PAL_TRAIT_AFTERMATH_AVAILABLE FALSE) diff --git a/Gems/Atom/RHI/DX12/3rdParty/Findpix.cmake b/cmake/3rdParty/FindPIX.cmake similarity index 59% rename from Gems/Atom/RHI/DX12/3rdParty/Findpix.cmake rename to cmake/3rdParty/FindPIX.cmake index b8e7118953..4bce14312d 100644 --- a/Gems/Atom/RHI/DX12/3rdParty/Findpix.cmake +++ b/cmake/3rdParty/FindPIX.cmake @@ -6,15 +6,14 @@ # # -file(TO_CMAKE_PATH "$ENV{ATOM_PIX_PATH}" ATOM_PIX_PATH_CMAKE_FORMATTED) +if(LY_PIX_ENABLED) + file(TO_CMAKE_PATH "${LY_PIX_PATH}" PIX_PATH) + message(STATUS "PIX PATH ${PIX_PATH}") -if(EXISTS "${ATOM_PIX_PATH_CMAKE_FORMATTED}/include/WinPixEventRuntime/pix3.h") ly_add_external_target( NAME pix + 3RDPARTY_ROOT_DIRECTORY "${PIX_PATH}" VERSION - 3RDPARTY_ROOT_DIRECTORY ${ATOM_PIX_PATH_CMAKE_FORMATTED} INCLUDE_DIRECTORIES include ) endif() - - diff --git a/Gems/Atom/RHI/DX12/3rdParty/Platform/Windows/pix_windows.cmake b/cmake/3rdParty/Platform/Windows/pix_windows.cmake similarity index 98% rename from Gems/Atom/RHI/DX12/3rdParty/Platform/Windows/pix_windows.cmake rename to cmake/3rdParty/Platform/Windows/pix_windows.cmake index 54d419d1c2..aba65d9627 100644 --- a/Gems/Atom/RHI/DX12/3rdParty/Platform/Windows/pix_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/pix_windows.cmake @@ -11,4 +11,4 @@ if(LY_MONOLITHIC_GAME) else() set(PIX_LIBS ${BASE_PATH}/bin/x64/WinPixEventRuntime.lib) set(PIX_RUNTIME_DEPENDENCIES ${BASE_PATH}/bin/x64/WinPixEventRuntime.dll) -endif() +endif() \ No newline at end of file diff --git a/cmake/3rdParty/cmake_files.cmake b/cmake/3rdParty/cmake_files.cmake index 99e83da4fe..cf56031db6 100644 --- a/cmake/3rdParty/cmake_files.cmake +++ b/cmake/3rdParty/cmake_files.cmake @@ -9,6 +9,7 @@ set(FILES BuiltInPackages.cmake FindOpenGLInterface.cmake + FindPIX.cmake FindRadTelemetry.cmake FindVkValidation.cmake FindWwise.cmake diff --git a/cmake/Platform/Android/PAL_android.cmake b/cmake/Platform/Android/PAL_android.cmake index 8a7c6406b7..1ef36b1af6 100644 --- a/cmake/Platform/Android/PAL_android.cmake +++ b/cmake/Platform/Android/PAL_android.cmake @@ -18,6 +18,8 @@ ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS) ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE TRUE) ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) +ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE) + # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED FALSE) ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED FALSE) diff --git a/cmake/Platform/Linux/PAL_linux.cmake b/cmake/Platform/Linux/PAL_linux.cmake index c137538ac0..528bb5794c 100644 --- a/cmake/Platform/Linux/PAL_linux.cmake +++ b/cmake/Platform/Linux/PAL_linux.cmake @@ -18,6 +18,8 @@ ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS) ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE FALSE) ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) +ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE) + # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE) diff --git a/cmake/Platform/Mac/PAL_mac.cmake b/cmake/Platform/Mac/PAL_mac.cmake index 7ddb4a1b5e..b415daf44a 100644 --- a/cmake/Platform/Mac/PAL_mac.cmake +++ b/cmake/Platform/Mac/PAL_mac.cmake @@ -18,6 +18,8 @@ ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS ".mm") ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE FALSE) ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) +ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE) + # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE) diff --git a/cmake/Platform/Windows/PAL_windows.cmake b/cmake/Platform/Windows/PAL_windows.cmake index f4fa2e676a..f329425cd3 100644 --- a/cmake/Platform/Windows/PAL_windows.cmake +++ b/cmake/Platform/Windows/PAL_windows.cmake @@ -18,6 +18,8 @@ ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS) ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE FALSE) ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED TRUE) +ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED TRUE) + # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED TRUE) ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED TRUE) diff --git a/cmake/Platform/iOS/PAL_ios.cmake b/cmake/Platform/iOS/PAL_ios.cmake index 3da4a13ed2..e1c4b6d37e 100644 --- a/cmake/Platform/iOS/PAL_ios.cmake +++ b/cmake/Platform/iOS/PAL_ios.cmake @@ -18,6 +18,8 @@ ly_set(PAL_TRAIT_BUILD_UNITY_EXCLUDE_EXTENSIONS ".mm") ly_set(PAL_TRAIT_BUILD_EXCLUDE_ALL_TEST_RUNS_FROM_IDE TRUE) ly_set(PAL_TRAIT_BUILD_CPACK_SUPPORTED FALSE) +ly_set(PAL_TRAIT_PROF_PIX_SUPPORTED FALSE) + # Test library support ly_set(PAL_TRAIT_TEST_GOOGLE_TEST_SUPPORTED FALSE) ly_set(PAL_TRAIT_TEST_GOOGLE_BENCHMARK_SUPPORTED FALSE) From df9b4d4a2fb197c551b1db66f5befd716797c614 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Tue, 17 Aug 2021 12:10:57 -0600 Subject: [PATCH 089/100] Deprecate profiler categories based on global enum (to be supplanted by registered budgets in the future) Signed-off-by: Jeremy Ong --- Code/Editor/CryEditDoc.cpp | 10 +- Code/Editor/EditorViewportWidget.cpp | 4 +- Code/Editor/Objects/AxisGizmo.cpp | 2 +- Code/Editor/Objects/BaseObject.cpp | 6 +- Code/Editor/Objects/EntityObject.cpp | 2 +- Code/Editor/Objects/ObjectManager.cpp | 38 +- .../Objects/ObjectManagerLegacyUndo.cpp | 8 +- .../Objects/ComponentEntityObject.cpp | 6 +- .../SandboxIntegration.cpp | 14 +- .../UI/Outliner/OutlinerListModel.cpp | 34 +- .../UI/Outliner/OutlinerWidget.cpp | 24 +- .../AssetImporterDocument.cpp | 2 +- .../ImporterRootDisplay.cpp | 4 +- .../SceneSerializationHandler.cpp | 3 +- Code/Editor/Viewport.cpp | 4 +- .../AzCore/AzCore/Android/APKFileHandler.h | 4 +- .../AzCore/AzCore/Asset/AssetDataStream.cpp | 20 +- .../AzCore/AzCore/Asset/AssetManager.cpp | 38 +- Code/Framework/AzCore/AzCore/AzCoreModule.cpp | 8 - .../AzCore/Component/ComponentApplication.cpp | 10 +- .../AzCore/AzCore/Component/Entity.cpp | 6 +- .../AzCore/AzCore/Component/EntityUtils.cpp | 2 +- .../AzCore/AzCore/Component/EntityUtils.h | 6 +- .../AzCore/AzCore/Debug/EventTrace.h | 4 +- .../AzCore/AzCore/Debug/MemoryProfiler.h | 16 + .../AzCore/AzCore/Debug/Profiler.cpp | 24 +- Code/Framework/AzCore/AzCore/Debug/Profiler.h | 339 ++++-------------- Code/Framework/AzCore/AzCore/IO/FileIO.cpp | 9 +- .../AzCore/AzCore/IO/Streamer/BlockCache.cpp | 5 +- .../IO/Streamer/FullFileDecompressor.cpp | 9 +- .../AzCore/IO/Streamer/ReadSplitter.cpp | 5 +- .../AzCore/AzCore/IO/Streamer/Scheduler.cpp | 29 +- .../AzCore/AzCore/IO/Streamer/Statistics.cpp | 2 +- .../AzCore/IO/Streamer/StorageDrive.cpp | 8 +- .../AzCore/AzCore/IO/Streamer/Streamer.cpp | 7 +- .../AzCore/IO/Streamer/StreamerContext.cpp | 6 +- .../Framework/AzCore/AzCore/IO/SystemFile.cpp | 43 --- .../AzCore/Jobs/Internal/JobManagerBase.cpp | 4 +- .../Jobs/Internal/JobManagerWorkStealing.cpp | 8 +- .../AzCore/AzCore/Jobs/JobCompletion.h | 2 +- .../AzCore/AzCore/Jobs/LegacyJobExecutor.h | 2 +- .../AzCore/Memory/AllocationRecords.cpp | 1 + .../AzCore/Memory/SimpleSchemaAllocator.h | 12 +- .../AzCore/AzCore/Memory/SystemAllocator.cpp | 8 +- .../AzCore/Script/ScriptSystemComponent.cpp | 2 +- .../AzCore/AzCore/Serialization/DataPatch.cpp | 26 +- .../AzCore/Serialization/ObjectStream.cpp | 4 +- .../Serialization/SerializationUtils.cpp | 12 +- .../AzCore/AzCore/Slice/SliceComponent.cpp | 60 ++-- .../Statistics/StatisticalProfilerProxy.h | 10 +- .../Statistics/TimeDataStatisticsManager.h | 2 +- .../AzCore/AzCore/azcore_files.cmake | 5 +- .../AzCore/AzCore/std/parallel/spin_mutex.h | 3 - .../Common/RadTelemetry/ProfileTelemetry.h | 18 +- .../AzCore/IO/SystemFile_UnixLike.cpp | 3 +- .../IO/Streamer/StorageDrive_Windows.cpp | 18 +- Code/Framework/AzCore/Tests/Components.cpp | 7 +- Code/Framework/AzCore/Tests/Debug.cpp | 270 -------------- .../AzCore/Tests/StatisticalProfiler.cpp | 44 +-- .../AzCore/Tests/TimeDataStatistics.cpp | 6 +- .../AzCore/Tests/azcoretests_files.cmake | 1 - .../AzFramework/Application/Application.cpp | 11 +- .../AzFramework/Archive/Archive.cpp | 19 +- .../AzFramework/Entity/EntityContext.cpp | 4 +- .../Entity/SliceEntityOwnershipService.cpp | 14 +- .../AzFramework/IO/RemoteStorageDrive.cpp | 6 +- .../AzFramework/Script/ScriptComponent.cpp | 8 +- .../TargetManagementComponent.cpp | 10 +- .../EntityVisibilityBoundsUnionSystem.cpp | 11 +- .../Visibility/EntityVisibilityQuery.cpp | 2 +- .../Platform/Android/AzTest_Traits_Android.h | 1 - .../Application/ToolsApplication.cpp | 30 +- .../Commands/EntityStateCommand.cpp | 8 +- .../Commands/PreemptiveUndoCache.cpp | 2 +- .../Entity/EditorEntityContextComponent.cpp | 24 +- .../Entity/EditorEntityHelpers.cpp | 42 +-- .../Entity/EditorEntityModel.cpp | 70 ++-- .../Entity/EditorEntitySortComponent.cpp | 10 +- .../SliceEditorEntityOwnershipService.cpp | 32 +- .../Manipulators/BaseManipulator.cpp | 22 +- .../Manipulators/EditorVertexSelection.cpp | 42 +-- .../Manipulators/ManipulatorManager.cpp | 12 +- .../Prefab/PrefabPublicHandler.cpp | 16 +- .../Prefab/PrefabUndoCache.cpp | 3 +- .../Slice/SliceCompilation.cpp | 4 +- .../Slice/SliceTransaction.cpp | 38 +- .../AzToolsFramework/Slice/SliceUtilities.cpp | 42 +-- .../ToolsComponents/EditorLayerComponent.cpp | 10 +- .../EditorSelectionAccentSystemComponent.cpp | 8 +- .../ComponentPalette/ComponentPaletteUtil.cpp | 4 +- .../ComponentPaletteWidget.cpp | 4 +- .../UI/Outliner/EntityOutlinerListModel.cpp | 34 +- .../UI/Outliner/EntityOutlinerWidget.cpp | 24 +- .../UI/Prefab/PrefabIntegrationManager.cpp | 10 +- .../UI/PropertyEditor/ComponentEditor.cpp | 2 +- .../PropertyEditor/EntityPropertyEditor.cpp | 26 +- .../PropertyEditor/InstanceDataHierarchy.cpp | 14 +- .../UI/PropertyEditor/PropertyEditorAPI.h | 2 +- .../PropertyEditorAPI_Internals.h | 3 +- .../UI/PropertyEditor/PropertyEditorApi.cpp | 2 +- .../UI/PropertyEditor/PropertyRowWidget.cpp | 2 +- .../ReflectedPropertyEditor.cpp | 8 +- .../Viewport/EditorContextMenu.cpp | 2 +- .../ViewportSelection/EditorBoxSelect.cpp | 4 +- .../ViewportSelection/EditorHelpers.cpp | 8 +- .../EditorInteractionSystemComponent.cpp | 2 +- .../EditorPickEntitySelection.cpp | 2 +- .../ViewportSelection/EditorSelectionUtil.cpp | 6 +- .../EditorTransformComponentSelection.cpp | 140 ++++---- .../EditorVisibleEntityDataCache.cpp | 16 +- .../GridMate/GridMate/Replica/Replica.cpp | 34 +- .../GridMate/Replica/ReplicaChunk.cpp | 22 +- .../GridMate/GridMate/Replica/ReplicaMgr.cpp | 10 +- .../GridMate/GridMate/Replica/ReplicaMgr.h | 2 +- .../GridMate/GridMate/Replica/ReplicaUtils.h | 2 +- Code/Legacy/CryCommon/FrameProfiler.h | 19 +- Code/Legacy/CryCommon/ISystem.h | 8 +- Code/Legacy/CryCommon/LegacyAllocator.h | 8 +- Code/Legacy/CryCommon/platform_impl.cpp | 2 +- Code/Legacy/CrySystem/System.cpp | 2 +- .../SceneUI/SceneWidgets/ManifestWidget.cpp | 4 +- .../SceneWidgets/ManifestWidgetPage.cpp | 4 +- .../Standalone/Source/Driller/AreaChart.cpp | 8 +- .../Source/Driller/Replica/BaseDetailView.h | 4 +- .../Driller/Replica/ReplicaDataView.cpp | 2 +- .../Atom/ImageProcessing/ImageProcessingBus.h | 1 + .../Code/Source/ImageBuilderComponent.h | 1 + .../Code/Source/AuxGeom/AuxGeomDrawQueue.cpp | 4 +- .../Source/AuxGeom/FixedShapeProcessor.cpp | 2 +- .../DecalTextureArrayFeatureProcessor.cpp | 8 +- .../DiffuseProbeGridFeatureProcessor.cpp | 4 +- .../Common/Code/Source/ImGui/ImGuiPass.cpp | 4 +- .../Code/Source/Mesh/MeshFeatureProcessor.cpp | 20 +- .../ReflectionProbeFeatureProcessor.cpp | 4 +- .../SkinnedMeshFeatureProcessor.cpp | 8 +- .../SkinnedMesh/SkinnedMeshInputBuffers.cpp | 2 +- .../RHI/Code/Source/RHI/AsyncWorkQueue.cpp | 4 +- .../Atom/RHI/Code/Source/RHI/CommandQueue.cpp | 4 +- Gems/Atom/RHI/Code/Source/RHI/Fence.cpp | 2 +- .../RHI/Code/Source/RHI/FrameScheduler.cpp | 24 +- .../Code/Source/RHI/PipelineStateCache.cpp | 2 +- Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp | 4 +- .../DX12/Code/Source/RHI/AsyncUploadQueue.cpp | 24 +- .../DX12/Code/Source/RHI/CommandListBase.cpp | 4 +- .../DX12/Code/Source/RHI/CommandListBase.h | 6 +- .../RHI/DX12/Code/Source/RHI/CommandQueue.cpp | 8 +- .../Code/Source/RHI/CommandQueueContext.cpp | 10 +- Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp | 2 +- Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h | 3 +- .../Code/Source/RHI/StreamingImagePool.cpp | 2 +- .../Metal/Code/Source/RHI/CommandQueue.cpp | 2 +- .../Code/Source/RHI/CommandQueueContext.cpp | 4 +- .../Code/Source/RHI/AsyncUploadQueue.cpp | 16 +- .../Vulkan/Code/Source/RHI/CommandQueue.cpp | 2 +- .../Code/Source/RHI/CommandQueueContext.cpp | 6 +- .../RPI/Code/Source/RPI.Public/Culling.cpp | 14 +- .../Source/RPI.Public/Material/Material.cpp | 4 +- .../Code/Source/RPI.Public/MeshDrawPacket.cpp | 6 +- .../Code/Source/RPI.Public/Model/Model.cpp | 10 +- .../Code/Source/RPI.Public/Model/ModelLod.cpp | 4 +- .../Source/RPI.Public/Model/ModelLodUtils.cpp | 2 +- .../Source/RPI.Public/Pass/PassSystem.cpp | 8 +- .../Source/RPI.Public/Pass/RasterPass.cpp | 4 +- .../RPI/Code/Source/RPI.Public/RPISystem.cpp | 2 +- .../Code/Source/RPI.Public/RenderPipeline.cpp | 2 +- .../Atom/RPI/Code/Source/RPI.Public/Scene.cpp | 10 +- .../Shader/Metrics/ShaderMetricsSystem.cpp | 2 +- .../Code/Source/RPI.Public/Shader/Shader.cpp | 6 +- Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp | 2 +- .../Source/RPI.Reflect/Model/ModelAsset.cpp | 2 +- .../Source/RPI.Reflect/Shader/ShaderAsset.cpp | 4 +- .../Shader/ShaderVariantTreeAsset.cpp | 2 +- .../Include/Atom/Utils/StableDynamicArray.h | 1 + .../SurfaceData/SurfaceDataMeshComponent.cpp | 4 +- .../Source/Engine/AudioSystemImpl_wwise.cpp | 4 +- .../Source/Engine/FileIOHandler_wwise.cpp | 2 +- Gems/AudioSystem/Code/Source/Engine/ATL.cpp | 4 +- .../Code/Source/Engine/ATLComponents.cpp | 7 +- .../AudioSystem/Code/Source/Engine/ATLUtils.h | 1 + .../Code/Source/Engine/AudioSystem.cpp | 16 +- .../Code/Source/Engine/FileCacheManager.cpp | 11 +- .../Components/BlastFamilyComponent.cpp | 14 +- .../Components/BlastSystemComponent.cpp | 18 +- .../Editor/EditorBlastFamilyComponent.cpp | 4 +- .../Editor/EditorBlastMeshDataComponent.cpp | 4 +- .../Code/Source/Family/ActorRenderManager.cpp | 6 +- .../Blast/Code/Source/Family/ActorTracker.cpp | 3 +- .../Code/Source/Family/BlastFamilyImpl.cpp | 12 +- .../EMotionFX/Source/EMotionFXManager.cpp | 2 +- .../EMotionFX/Source/MultiThreadScheduler.cpp | 2 +- .../Integration/Components/ActorComponent.cpp | 2 +- .../ExpressionEvaluationSystemComponent.cpp | 5 +- .../Include/GradientSignal/GradientSampler.h | 3 +- .../Components/DitherGradientComponent.cpp | 2 +- .../GradientSurfaceDataComponent.cpp | 2 +- .../Components/GradientTransformComponent.cpp | 4 +- .../Components/ImageGradientComponent.cpp | 2 +- .../Components/LevelsGradientComponent.cpp | 2 +- .../Components/MixedGradientComponent.cpp | 2 +- .../Components/PerlinGradientComponent.cpp | 2 +- .../Components/RandomGradientComponent.cpp | 2 +- .../Components/ReferenceGradientComponent.cpp | 2 +- .../ShapeAreaFalloffGradientComponent.cpp | 2 +- .../SurfaceAltitudeGradientComponent.cpp | 2 +- .../SurfaceMaskGradientComponent.cpp | 2 +- .../GradientSignal/Code/Source/ImageAsset.cpp | 2 +- .../GraphCanvas/Editor/GraphCanvasProfiler.h | 8 +- .../Dependency/DependencyMonitor.h | 1 + .../Dependency/DependencyMonitor.inl | 10 +- .../Code/Editor/PropertiesContainer.cpp | 2 +- Gems/LyShine/Code/Editor/UiSliceManager.cpp | 10 +- .../Code/Tests/MultiplayerCompressionTest.cpp | 1 + .../ClothComponentMesh/ActorClothSkinning.cpp | 12 +- .../ClothComponentMesh/ClothComponentMesh.cpp | 14 +- Gems/NvCloth/Code/Source/System/Cloth.cpp | 2 +- .../Code/Source/System/FabricCooker.cpp | 5 +- Gems/NvCloth/Code/Source/System/Solver.cpp | 14 +- .../Code/Source/System/SystemComponent.cpp | 12 +- .../Code/Source/System/TangentSpaceHelper.cpp | 8 +- .../Code/Source/Utils/MeshAssetHelper.cpp | 2 +- .../Code/Source/ForceRegionComponent.cpp | 2 +- .../Pipeline/HeightFieldAssetHandler.cpp | 4 +- Gems/PhysX/Code/Source/Scene/PhysXScene.cpp | 84 ++--- Gems/PhysX/Code/Source/System/PhysXJob.cpp | 2 +- .../Code/Source/System/PhysXSdkCallbacks.cpp | 8 +- Gems/PhysX/Code/Source/System/PhysXSystem.cpp | 2 +- .../Code/Source/SystemComponent.cpp | 20 +- .../Code/Source/ProfileTelemetryComponent.cpp | 2 +- .../Code/Source/RADTelemetryModule.cpp | 2 +- .../Components/MeshOptimizer/MeshBuilder.cpp | 2 +- .../Editor/Assets/ScriptCanvasMemoryAsset.cpp | 8 +- .../Editor/Assets/ScriptCanvasUndoHelper.cpp | 4 +- .../Code/Editor/Nodes/NodeCreateUtils.cpp | 22 +- .../Code/Editor/Nodes/NodeDisplayUtils.cpp | 20 +- .../Include/ScriptCanvas/Core/EBusHandler.cpp | 2 +- .../Code/Include/ScriptCanvas/Core/Node.cpp | 40 +-- .../Execution/RuntimeComponent.cpp | 4 +- .../Internal/Nodeables/BaseTimer.cpp | 2 +- .../Internal/Nodes/StringFormatted.cpp | 2 +- .../Libraries/Operators/Math/OperatorMul.cpp | 2 +- .../Libraries/Time/DelayNodeable.cpp | 2 +- .../Libraries/Time/DurationNodeable.cpp | 2 +- .../Libraries/Time/TimerNodeable.cpp | 2 +- .../SurfaceData/Utility/SurfaceDataUtility.h | 3 +- .../SurfaceDataColliderComponent.cpp | 6 +- .../Components/SurfaceDataShapeComponent.cpp | 6 +- .../Source/SurfaceDataSystemComponent.cpp | 7 +- .../Code/Source/SurfaceDataUtility.cpp | 2 +- Gems/SurfaceData/Code/Source/SurfaceTag.cpp | 6 +- .../Code/Source/AreaSystemComponent.cpp | 48 +-- .../Components/AreaBlenderComponent.cpp | 10 +- .../Source/Components/AreaComponentBase.cpp | 4 +- .../Source/Components/BlockerComponent.cpp | 6 +- .../DescriptorListCombinerComponent.cpp | 6 +- .../DescriptorWeightSelectorComponent.cpp | 2 +- .../DistanceBetweenFilterComponent.cpp | 2 +- .../DistributionFilterComponent.cpp | 2 +- .../Components/MeshBlockerComponent.cpp | 8 +- .../Components/PositionModifierComponent.cpp | 2 +- .../Components/RotationModifierComponent.cpp | 2 +- .../Components/ScaleModifierComponent.cpp | 2 +- .../ShapeIntersectionFilterComponent.cpp | 2 +- .../SlopeAlignmentModifierComponent.cpp | 2 +- .../Source/Components/SpawnerComponent.cpp | 20 +- .../SurfaceAltitudeFilterComponent.cpp | 2 +- .../SurfaceMaskDepthFilterComponent.cpp | 2 +- .../Components/SurfaceMaskFilterComponent.cpp | 2 +- .../SurfaceSlopeFilterComponent.cpp | 2 +- .../Code/Source/InstanceSystemComponent.cpp | 24 +- .../Code/Source/Core/WhiteBoxToolApi.cpp | 184 +++++----- .../Code/Source/EditorWhiteBoxComponent.cpp | 16 +- .../Source/EditorWhiteBoxComponentMode.cpp | 6 +- .../EditorWhiteBoxComponentModeTypes.cpp | 3 +- .../EditorWhiteBoxDefaultMode.cpp | 10 +- 274 files changed, 1435 insertions(+), 1965 deletions(-) create mode 100644 Code/Framework/AzCore/AzCore/Debug/MemoryProfiler.h diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index 90b020f452..b83babc5c5 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -1047,7 +1047,7 @@ static bool TryRenameFile(const QString& oldPath, const QString& newPath, int re bool CCryEditDoc::SaveLevel(const QString& filename) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); QWaitCursor wait; CAutoCheckOutDialogEnableForAll enableForAll; @@ -1067,7 +1067,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave"); + AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave"); BackupBeforeSave(); } @@ -1178,7 +1178,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) CPakFile pakFile; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile"); + AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile"); if (!pakFile.Open(tempSaveFile.toUtf8().data(), false)) { gEnv->pLog->LogWarning("Unable to open pack file %s for writing", tempSaveFile.toUtf8().data()); @@ -1209,7 +1209,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) AZ::IO::ByteContainerStream> entitySaveStream(&entitySaveBuffer); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream"); + AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream"); EBUS_EVENT_RESULT( savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForEditor, entitySaveStream, layerEntities, instancesInLayers); @@ -1223,7 +1223,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) if (savedEntities) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml"); + AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Updated PakFile levelEntities.editor_xml"); pakFile.UpdateFile("LevelEntities.editor_xml", entitySaveBuffer.begin(), entitySaveBuffer.size()); // Save XML archive to pak file. diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 28e8cce33e..37ddb993f2 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1950,7 +1950,7 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width Vec3 EditorViewportWidget::ViewToWorld( const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); AZ_UNUSED(collideWithTerrain) AZ_UNUSED(onlyTerrain) @@ -1985,7 +1985,7 @@ Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, AZ_UNUSED(onlyTerrain) AZ_UNUSED(bTestRenderMesh) - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); return Vec3(0, 0, 1); } diff --git a/Code/Editor/Objects/AxisGizmo.cpp b/Code/Editor/Objects/AxisGizmo.cpp index 8f81ea66b7..a603b2615d 100644 --- a/Code/Editor/Objects/AxisGizmo.cpp +++ b/Code/Editor/Objects/AxisGizmo.cpp @@ -274,7 +274,7 @@ Matrix34 CAxisGizmo::GetTransformation(RefCoordSys coordSys, IDisplayViewport* v ////////////////////////////////////////////////////////////////////////// bool CAxisGizmo::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int nFlags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (event == eMouseLDown) { diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index 482055d7ed..c9002f2dfa 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -1233,7 +1233,7 @@ float CBaseObject::GetCameraVisRatio(const CCamera& camera) ////////////////////////////////////////////////////////////////////////// int CBaseObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (event == eMouseMove || event == eMouseLDown) { @@ -1928,7 +1928,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box) ////////////////////////////////////////////////////////////////////////// bool CBaseObject::HitTestRect(HitContext& hc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AABB box; @@ -1965,7 +1965,7 @@ bool CBaseObject::HitHelperTest(HitContext& hc) ////////////////////////////////////////////////////////////////////////// bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool bResult = false; diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index 0f4a17f3ba..b42afb5c39 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -497,7 +497,7 @@ bool CEntityObject::HitTestRect(HitContext& hc) ////////////////////////////////////////////////////////////////////////// int CEntityObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (event == eMouseMove || event == eMouseLDown) { diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index fbdd56f080..61a8944a90 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -368,7 +368,7 @@ CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* pre ////////////////////////////////////////////////////////////////////////// void CObjectManager::DeleteObject(CBaseObject* obj) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (m_currEditObject == obj) { EndEditParams(); @@ -414,7 +414,7 @@ void CObjectManager::DeleteObject(CBaseObject* obj) ////////////////////////////////////////////////////////////////////////// void CObjectManager::DeleteSelection(CSelectionGroup* pSelection) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (pSelection == nullptr) { return; @@ -478,7 +478,7 @@ void CObjectManager::DeleteSelection(CSelectionGroup* pSelection) ////////////////////////////////////////////////////////////////////////// void CObjectManager::DeleteAllObjects() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); EndEditParams(); @@ -519,7 +519,7 @@ void CObjectManager::DeleteAllObjects() CBaseObject* CObjectManager::CloneObject(CBaseObject* obj) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); assert(obj); //CRuntimeClass *cls = obj->GetRuntimeClass(); //CBaseObject *clone = (CBaseObject*)cls->CreateObject(); @@ -1112,7 +1112,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading) ////////////////////////////////////////////////////////////////////////// int CObjectManager::ClearSelection() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Make sure to unlock selection. GetIEditor()->LockSelection(false); @@ -1165,7 +1165,7 @@ int CObjectManager::ClearSelection() ////////////////////////////////////////////////////////////////////////// int CObjectManager::InvertSelection() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); int selCount = 0; // iterate all objects. @@ -1189,7 +1189,7 @@ int CObjectManager::InvertSelection() void CObjectManager::SetSelection(const QString& name) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr); if (selection) { @@ -1202,7 +1202,7 @@ void CObjectManager::SetSelection(const QString& name) void CObjectManager::RemoveSelection(const QString& name) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); QString selName = name; CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr); @@ -1221,7 +1221,7 @@ void CObjectManager::RemoveSelection(const QString& name) void CObjectManager::SelectCurrent() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); for (int i = 0; i < m_currSelection->GetCount(); i++) { CBaseObject* obj = m_currSelection->GetObject(i); @@ -1236,7 +1236,7 @@ void CObjectManager::SelectCurrent() void CObjectManager::UnselectCurrent() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Make sure to unlock selection. GetIEditor()->LockSelection(false); @@ -1260,7 +1260,7 @@ void CObjectManager::UnselectCurrent() ////////////////////////////////////////////////////////////////////////// void CObjectManager::Display(DisplayContext& dc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); int currentHideMask = GetIEditor()->GetDisplaySettings()->GetObjectHideMask(); if (m_lastHideMask != currentHideMask) @@ -1320,7 +1320,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]] return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); auto start = std::chrono::steady_clock::now(); CBaseObjectsCache* pDispayedViewObjects = dc.view->GetVisibleObjectsCache(); @@ -1451,7 +1451,7 @@ void CObjectManager::EndEditParams([[maybe_unused]] int flags) //! Select objects within specified distance from given position. int CObjectManager::SelectObjects(const AABB& box, bool bUnselect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); int numSel = 0; AABB objBounds; @@ -1551,7 +1551,7 @@ bool CObjectManager::IsObjectDeletionAllowed(CBaseObject* pObject) ////////////////////////////////////////////////////////////////////////// void CObjectManager::DeleteSelection() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Make sure to unlock selection. GetIEditor()->LockSelection(false); @@ -1581,7 +1581,7 @@ void CObjectManager::DeleteSelection() ////////////////////////////////////////////////////////////////////////// bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (obj->IsFrozen()) { @@ -1648,7 +1648,7 @@ bool CObjectManager::HitTestObject(CBaseObject* obj, HitContext& hc) ////////////////////////////////////////////////////////////////////////// bool CObjectManager::HitTest(HitContext& hitInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); hitInfo.object = nullptr; hitInfo.dist = FLT_MAX; @@ -1766,7 +1766,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo) } void CObjectManager::FindObjectsInRect(CViewport* view, const QRect& rect, std::vector& guids) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (rect.width() < 1 || rect.height() < 1) { @@ -1795,7 +1795,7 @@ void CObjectManager::FindObjectsInRect(CViewport* view, const QRect& rect, std:: ////////////////////////////////////////////////////////////////////////// void CObjectManager::SelectObjectsInRect(CViewport* view, const QRect& rect, bool bSelect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Ignore too small rectangles. if (rect.width() < 1 || rect.height() < 1) @@ -2363,7 +2363,7 @@ bool CObjectManager::ConvertToType(CBaseObject* pObject, const QString& typeName ////////////////////////////////////////////////////////////////////////// void CObjectManager::SetObjectSelected(CBaseObject* pObject, bool bSelect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Only select/unselect once. if ((pObject->IsSelected() && bSelect) || (!pObject->IsSelected() && !bSelect)) { diff --git a/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp b/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp index f21ba46e65..08a7f4cf48 100644 --- a/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp +++ b/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp @@ -204,7 +204,7 @@ CUndoBaseObjectBulkSelect::CUndoBaseObjectBulkSelect(const AZStd::unordered_set< void CUndoBaseObjectBulkSelect::Undo(bool bUndo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (!bUndo) { return; @@ -217,7 +217,7 @@ void CUndoBaseObjectBulkSelect::Undo(bool bUndo) void CUndoBaseObjectBulkSelect::Redo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); AzToolsFramework::ToolsApplicationRequestBus::Broadcast( &AzToolsFramework::ToolsApplicationRequests::MarkEntitiesSelected, @@ -256,7 +256,7 @@ CUndoBaseObjectClearSelection::CUndoBaseObjectClearSelection(const CSelectionGro void CUndoBaseObjectClearSelection::Undo(bool bUndo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (!bUndo) { @@ -270,7 +270,7 @@ void CUndoBaseObjectClearSelection::Undo(bool bUndo) void CUndoBaseObjectClearSelection::Redo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); AzToolsFramework::ToolsApplicationRequestBus::Broadcast( &AzToolsFramework::ToolsApplicationRequests::SetSelectedEntities, diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp index 85730d327b..ba08b5c069 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp @@ -679,7 +679,7 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc) bool CComponentEntityObject::HitTest(HitContext& hc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (m_iconOnlyHitTest) { @@ -705,7 +705,7 @@ bool CComponentEntityObject::HitTest(HitContext& hc) [&hc, &closestDistance, &rayIntersection, &preciseSelectionRequired, viewportId]( AzToolsFramework::EditorComponentSelectionRequests* handler) -> bool { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (handler->SupportsEditorRayIntersect()) { @@ -768,7 +768,7 @@ bool CComponentEntityObject::HitTest(HitContext& hc) void CComponentEntityObject::GetBoundBox(AABB& box) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); box.Reset(); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index 6b60f96089..ac393607ae 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -472,7 +472,7 @@ void SandboxIntegrationManager::EntityParentChanged( const AZ::EntityId newParentId, const AZ::EntityId oldParentId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_unsavedEntities.find(entityId) != m_unsavedEntities.end()) { @@ -858,7 +858,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu) void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); AzToolsFramework::EntityIdList selectedEntities; GetSelectedOrHighlightedEntities(selectedEntities); @@ -960,7 +960,7 @@ void SandboxIntegrationManager::SetupSliceContextMenu(QMenu* menu) void SandboxIntegrationManager::SetupSliceContextMenu_Modify(QMenu* menu, const AzToolsFramework::EntityIdList& selectedEntities, [[maybe_unused]] const AZ::u32 numEntitiesInSlices) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); using namespace AzToolsFramework; // Gather the set of relevant entities from the selected entities and all descendants @@ -1083,7 +1083,7 @@ void SandboxIntegrationManager::CreateEditorRepresentation(AZ::Entity* entity) bool SandboxIntegrationManager::DestroyEditorRepresentation(AZ::EntityId entityId, bool deleteAZEntity) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); IEditor* editor = GetIEditor(); if (editor->GetObjectManager()) @@ -1095,7 +1095,7 @@ bool SandboxIntegrationManager::DestroyEditorRepresentation(AZ::EntityId entityI { static_cast(object)->AssignEntity(nullptr, deleteAZEntity); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SandboxIntegrationManager::DestroyEditorRepresentation:ObjManagerDeleteObject"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SandboxIntegrationManager::DestroyEditorRepresentation:ObjManagerDeleteObject"); editor->GetObjectManager()->DeleteObject(object); } return true; @@ -1217,7 +1217,7 @@ void SandboxIntegrationManager::ClearRedoStack() void SandboxIntegrationManager::CloneSelection(bool& handled) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityIdList entities; AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult( @@ -1850,7 +1850,7 @@ AZStd::string SandboxIntegrationManager::GetComponentEditorIcon(const AZ::Uuid& AZStd::string SandboxIntegrationManager::GetComponentIconPath(const AZ::Uuid& componentType, AZ::Crc32 componentIconAttrib, AZ::Component* component) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (componentIconAttrib != AZ::Edit::Attributes::Icon && componentIconAttrib != AZ::Edit::Attributes::ViewportIcon && componentIconAttrib != AZ::Edit::Attributes::HideIcon) diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index 02d2174fb8..7d63f8e15b 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -1054,7 +1054,7 @@ bool OutlinerListModel::dropMimeDataEntities(const QMimeData* data, Qt::DropActi bool OutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, const AzToolsFramework::EntityIdList &selectedEntityIds) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (selectedEntityIds.empty()) { return false; @@ -1143,7 +1143,7 @@ bool OutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, con bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const AzToolsFramework::EntityIdList &selectedEntityIds, const AZ::EntityId& beforeEntityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!CanReparentEntities(newParentId, selectedEntityIds)) { return false; @@ -1233,7 +1233,7 @@ bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const QMimeData* OutlinerListModel::mimeData(const QModelIndexList& indexes) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::TypeId uuid1 = AZ::AzTypeInfo::Uuid(); AZ::TypeId uuid2 = AZ::AzTypeInfo::Uuid(); @@ -1323,7 +1323,7 @@ public: void OutlinerListModel::ProcessEntityUpdates() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); m_entityChangeQueued = false; if (m_layoutResetQueued) { @@ -1331,7 +1331,7 @@ void OutlinerListModel::ProcessEntityUpdates() } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:ExpandQueue"); + AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:ExpandQueue"); for (auto entityId : m_entityExpandQueue) { emit ExpandEntity(entityId, IsExpanded(entityId)); @@ -1340,7 +1340,7 @@ void OutlinerListModel::ProcessEntityUpdates() } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:SelectQueue"); + AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:SelectQueue"); for (auto entityId : m_entitySelectQueue) { emit SelectEntity(entityId, AzToolsFramework::IsSelected(entityId)); @@ -1350,7 +1350,7 @@ void OutlinerListModel::ProcessEntityUpdates() if (!m_entityChangeQueue.empty()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:ChangeQueue"); + AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:ChangeQueue"); // its faster to just do a bulk data change than to carefully pick out indices // so we'll just merge all ranges into a single range rather than try to make gaps @@ -1383,7 +1383,7 @@ void OutlinerListModel::ProcessEntityUpdates() } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:LayoutChanged"); + AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:LayoutChanged"); if (m_entityLayoutQueued) { emit layoutAboutToBeChanged(); @@ -1393,7 +1393,7 @@ void OutlinerListModel::ProcessEntityUpdates() } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "OutlinerListModel::ProcessEntityUpdates:InvalidateFilter"); + AZ_PROFILE_SCOPE(Editor, "OutlinerListModel::ProcessEntityUpdates:InvalidateFilter"); if (m_isFilterDirty) { InvalidateFilter(); @@ -1416,7 +1416,7 @@ void OutlinerListModel::OnEntityInfoResetEnd() void OutlinerListModel::ProcessEntityInfoResetEnd() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_layoutResetQueued = false; m_entityChangeQueued = false; m_entityChangeQueue.clear(); @@ -1437,7 +1437,7 @@ void OutlinerListModel::OnEntityInfoUpdatedAddChildBegin(AZ::EntityId parentId, void OutlinerListModel::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId parentId, AZ::EntityId childId) { (void)parentId; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); endInsertRows(); //expand ancestors if a new descendant is already selected @@ -1475,7 +1475,7 @@ void OutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentI void OutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId) { (void)childId; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); endResetModel(); @@ -1494,7 +1494,7 @@ void OutlinerListModel::OnEntityInfoUpdatedOrderBegin(AZ::EntityId parentId, AZ: void OutlinerListModel::OnEntityInfoUpdatedOrderEnd(AZ::EntityId parentId, AZ::EntityId childId, AZ::u64 index) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); (void)index; m_entityLayoutQueued = true; QueueEntityUpdate(parentId); @@ -1565,7 +1565,7 @@ QString OutlinerListModel::GetSliceAssetName(const AZ::EntityId& entityId) const QModelIndex OutlinerListModel::GetIndexFromEntity(const AZ::EntityId& entityId, int column) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entityId.IsValid()) { @@ -1727,7 +1727,7 @@ void OutlinerListModel::OnEditorEntityDuplicated(const AZ::EntityId& oldEntity, void OutlinerListModel::ExpandAncestors(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //typically to reveal selected entities, expand all parent entities if (entityId.IsValid()) { @@ -1932,7 +1932,7 @@ bool OutlinerListModel::HasSelectedDescendant(const AZ::EntityId& entityId) cons bool OutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entityId) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies bool isLocked = false; AzToolsFramework::EditorEntityInfoRequestBus::EventResult(isLocked, entityId, &AzToolsFramework::EditorEntityInfoRequestBus::Events::IsJustThisEntityLocked); @@ -1953,7 +1953,7 @@ bool OutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entit bool OutlinerListModel::AreAllDescendantsSameVisibleState(const AZ::EntityId& entityId) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies bool isVisible = AzToolsFramework::IsEntitySetToBeVisible(entityId); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp index 6e16ab6557..9ed7c4a144 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp @@ -96,7 +96,7 @@ namespace void SortEntityChildren(AZ::EntityId entityId, const EntityIdCompareFunc& comparer, AzToolsFramework::EntityOrderArray* newEntityOrder = nullptr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityOrderArray entityOrderArray = AzToolsFramework::GetEntityChildOrder(entityId); AZStd::sort(entityOrderArray.begin(), entityOrderArray.end(), comparer); @@ -110,7 +110,7 @@ namespace void SortEntityChildrenRecursively(AZ::EntityId entityId, const EntityIdCompareFunc& comparer) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityOrderArray entityOrderArray; SortEntityChildren(entityId, comparer, &entityOrderArray); @@ -303,7 +303,7 @@ void OutlinerWidget::OnSelectionChanged(const QItemSelection& selected, const QI return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityIdList newlySelected; ExtractEntityIdsFromSelection(selected, newlySelected); @@ -450,7 +450,7 @@ void OutlinerWidget::UpdateSelection() { if (m_selectionChangeQueued) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_selectionChangeInProgress = true; @@ -458,7 +458,7 @@ void OutlinerWidget::UpdateSelection() { // Calling Deselect for a large number of items is very slow, // use a single ClearAndSelect call instead. - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect"); + AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect"); AzToolsFramework::EntityIdList selectedEntities; AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntities, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::GetSelectedEntities); @@ -469,12 +469,12 @@ void OutlinerWidget::UpdateSelection() else { { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Deselect"); + AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Deselect"); m_gui->m_objectTree->selectionModel()->select( BuildSelectionFromEntities(m_entitiesToDeselect), QItemSelectionModel::Deselect); } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Select"); + AZ_PROFILE_SCOPE(AzToolsFramework, "OutlinerWidget::ModelEntitySelectionChanged:Select"); m_gui->m_objectTree->selectionModel()->select( BuildSelectionFromEntities(m_entitiesToSelect), QItemSelectionModel::Select); } @@ -497,7 +497,7 @@ void OutlinerWidget::UpdateSelection() template QItemSelection OutlinerWidget::BuildSelectionFromEntities(const EntityIdCollection& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); QItemSelection selection; for (const auto& entityId : entityIds) @@ -517,7 +517,7 @@ QItemSelection OutlinerWidget::BuildSelectionFromEntities(const EntityIdCollecti void OutlinerWidget::contextMenuEvent(QContextMenuEvent* event) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); bool isDocumentOpen = false; EBUS_EVENT_RESULT(isDocumentOpen, AzToolsFramework::EditorRequests::Bus, IsLevelDocumentOpen); @@ -1272,7 +1272,7 @@ void OutlinerWidget::ExtractEntityIdsFromSelection(const QItemSelection& selecti void OutlinerWidget::OnSearchTextChanged(const QString& activeTextFilter) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::string filterString = activeTextFilter.toUtf8().data(); m_listModel->SearchStringChanged(filterString); @@ -1388,7 +1388,7 @@ void OutlinerWidget::QueueContentUpdateSort(const AZ::EntityId& entityId) void OutlinerWidget::SortContent() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_sortContentQueued = false; @@ -1424,7 +1424,7 @@ void OutlinerWidget::OnSortModeChanged(EntityOutliner::DisplaySortMode sortMode) if (sortMode != EntityOutliner::DisplaySortMode::Manually) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, sortMode); SortEntityChildrenRecursively(AZ::EntityId(), comparer); } diff --git a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp index db6e355799..c7e14d9c4e 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp @@ -43,7 +43,7 @@ AssetImporterDocument::AssetImporterDocument() bool AssetImporterDocument::LoadScene(const AZStd::string& sceneFullPath) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); namespace SceneEvents = AZ::SceneAPI::Events; SceneEvents::SceneSerializationBus::BroadcastResult(m_scene, &SceneEvents::SceneSerializationBus::Events::LoadScene, sceneFullPath, AZ::Uuid::CreateNull()); return !!m_scene; diff --git a/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp b/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp index 34527e598a..4f942a4251 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp @@ -45,7 +45,7 @@ AZ::SceneAPI::UI::ManifestWidget* ImporterRootDisplay::GetManifestWidget() void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd::shared_ptr& scene) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (!scene) { AZ_Assert(scene, "No scene provided to display."); @@ -62,7 +62,7 @@ void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd void ImporterRootDisplay::HandleSceneWasReset(const AZStd::shared_ptr& scene) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Don't accept updates while the widget is being filled in. BusDisconnect(); m_manifestWidget->BuildFromScene(scene); diff --git a/Code/Editor/Plugins/EditorAssetImporter/SceneSerializationHandler.cpp b/Code/Editor/Plugins/EditorAssetImporter/SceneSerializationHandler.cpp index c087a27ba4..b1d07af41c 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/SceneSerializationHandler.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/SceneSerializationHandler.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -37,7 +38,7 @@ namespace AZ AZStd::shared_ptr SceneSerializationHandler::LoadScene( const AZStd::string& filePath, Uuid sceneSourceGuid) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); namespace Utilities = AZ::SceneAPI::Utilities; using AZ::SceneAPI::Events::AssetImportRequest; diff --git a/Code/Editor/Viewport.cpp b/Code/Editor/Viewport.cpp index 873f555c80..fe60778c13 100644 --- a/Code/Editor/Viewport.cpp +++ b/Code/Editor/Viewport.cpp @@ -969,7 +969,7 @@ void QtViewport::MakeConstructionPlane(int axis) ////////////////////////////////////////////////////////////////////////// Vec3 QtViewport::MapViewToCP(const QPoint& point, int axis) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (axis == AXIS_TERRAIN) { @@ -1336,7 +1336,7 @@ bool QtViewport::GetAdvancedSelectModeFlag() ////////////////////////////////////////////////////////////////////////// bool QtViewport::MouseCallback(EMouseEvent event, const QPoint& point, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); // Ignore any mouse events in game mode. if (GetIEditor()->IsInGameMode()) diff --git a/Code/Framework/AzCore/AzCore/Android/APKFileHandler.h b/Code/Framework/AzCore/AzCore/Android/APKFileHandler.h index 0d9d3c984d..8df97a0cea 100644 --- a/Code/Framework/AzCore/AzCore/Android/APKFileHandler.h +++ b/Code/Framework/AzCore/AzCore/Android/APKFileHandler.h @@ -26,8 +26,8 @@ #if AZ_ENABLED_VERBOSE_ANDROID_IO_PROFILING #include - #define ANDROID_IO_PROFILE_SECTION AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore) - #define ANDROID_IO_PROFILE_SECTION_ARGS(...) AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, __VA_ARGS__) + #define ANDROID_IO_PROFILE_SECTION AZ_PROFILE_FUNCTION(AzCore) + #define ANDROID_IO_PROFILE_SECTION_ARGS(...) AZ_PROFILE_SCOPE(AzCore, __VA_ARGS__) #else #define ANDROID_IO_PROFILE_SECTION #define ANDROID_IO_PROFILE_SECTION_ARGS(...) diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetDataStream.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetDataStream.cpp index 425c729806..305ec0617b 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetDataStream.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetDataStream.cpp @@ -27,7 +27,7 @@ namespace AZ::Data void AssetDataStream::Open(const AZStd::vector& data) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(!m_isOpen, "Attempting to open the stream when it is already open."); @@ -45,7 +45,7 @@ namespace AZ::Data void AssetDataStream::Open(AZStd::vector&& data) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(!m_isOpen, "Attempting to open the stream when it is already open."); @@ -62,7 +62,7 @@ namespace AZ::Data AZStd::chrono::milliseconds deadline, AZ::IO::IStreamerTypes::Priority priority, OnCompleteCallback loadCallback) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(!m_isOpen, "Attempting to open the stream when it is already open."); AZ_Assert(!m_curReadRequest, "Queueing an asset stream load while one is still in progress."); @@ -80,7 +80,7 @@ namespace AZ::Data // Set up the callback that will process the asset data once the raw file load is finished. auto streamerCallback = [this, loadCallback](AZ::IO::FileRequestHandle fileHandle) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "AZ::Data::LoadAssetDataStreamCallback %s", + AZ_PROFILE_SCOPE(AzCore, "AZ::Data::LoadAssetDataStreamCallback %s", m_filePath.c_str()); // Get the results @@ -183,13 +183,13 @@ namespace AZ::Data // the real interval we want to record below won't show up unless this is here. /**/ { - AZ_PROFILE_INTERVAL_START(AZ::Debug::ProfileCategory::AzCore, this + 1, "AssetDataStream: %s", streamName); - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::AzCore, this + 1); + AZ_PROFILE_INTERVAL_START(AzCore, this + 1, "AssetDataStream: %s", streamName); + AZ_PROFILE_INTERVAL_END(AzCore, this + 1); } /**/ // Start a timespan marker to track the full load time for the requested asset. - AZ_PROFILE_INTERVAL_START(AZ::Debug::ProfileCategory::AzCore, this, "AssetLoad: %s", streamName); + AZ_PROFILE_INTERVAL_START(AzCore, this, "AssetLoad: %s", streamName); // Lock the allocator to ensure it remains active from Open to Close. m_bufferAllocator->LockAllocator(); @@ -216,7 +216,7 @@ namespace AZ::Data ClearInternalStateData(); // End the load time timespan marker for this asset. - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::AzCore, this); + AZ_PROFILE_INTERVAL_END(AzCore, this); } void AssetDataStream::RequestCancel() @@ -231,7 +231,7 @@ namespace AZ::Data void AssetDataStream::Seek(AZ::IO::OffsetType bytes, AZ::IO::GenericStream::SeekMode mode) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ::IO::OffsetType requestedOffset = 0; switch (mode) @@ -261,7 +261,7 @@ namespace AZ::Data AZ::IO::SizeType AssetDataStream::Read(AZ::IO::SizeType bytes, void* oBuffer) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (m_curOffset >= m_loadedSize) { return 0; diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp index 2a71baea46..f31859c14d 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp @@ -163,7 +163,7 @@ namespace AZ else { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "AZ::Data::LoadAssetJob::Process: %s", + AZ_PROFILE_SCOPE(AzCore, "AZ::Data::LoadAssetJob::Process: %s", asset.GetHint().c_str()); AZ_ASSET_ATTACH_TO_SCOPE(this); @@ -198,7 +198,7 @@ namespace AZ if(cl_assetLoadDelay > 0) { - AZ_PROFILE_SCOPE_IDLE(AZ::Debug::ProfileCategory::AzCore, "LoadData suspended"); + AZ_PROFILE_SCOPE(AzCore, "LoadData suspended"); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(cl_assetLoadDelay)); } @@ -314,7 +314,7 @@ namespace AZ protected: void Wait() { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "WaitForAsset - %s", m_assetData.GetHint().c_str()); + AZ_PROFILE_SCOPE(AzCore, "WaitForAsset - %s", m_assetData.GetHint().c_str()); // Continue to loop until the load completes. (Most of the time in the loop will be spent in a thread-blocking state) while (!m_loadCompleted) @@ -344,7 +344,7 @@ namespace AZ void Finish() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); m_loadCompleted = true; m_waitEvent.release(); } @@ -403,7 +403,7 @@ namespace AZ void SaveAsset() { auto asset = m_asset.GetStrongReference(); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); bool isSaved = false; AssetStreamInfo saveInfo = m_owner->GetSaveStreamInfoForAsset(asset.GetId(), asset.GetType()); if (saveInfo.IsValid()) @@ -565,7 +565,7 @@ namespace AZ //========================================================================= void AssetManager::DispatchEvents() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AssetManagerNotificationBus::Broadcast(&AssetManagerNotificationBus::Events::OnAssetEventsDispatchBegin); AssetBus::ExecuteQueuedEvents(); AssetManagerNotificationBus::Broadcast(&AssetManagerNotificationBus::Events::OnAssetEventsDispatchEnd); @@ -937,14 +937,14 @@ namespace AZ Asset AssetManager::GetAssetInternal(const AssetId& assetId, [[maybe_unused]] const AssetType& assetType, AssetLoadBehavior assetReferenceLoadBehavior, const AssetLoadParameters& loadParams, AssetInfo assetInfo /*= () */, bool signalLoaded /*= false */) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Error("AssetDatabase", assetId.IsValid(), "GetAsset called with invalid asset Id."); AZ_Error("AssetDatabase", !assetType.IsNull(), "GetAsset called with invalid asset type."); bool assetMissing = false; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "GetAsset: GetAssetInfo"); + AZ_PROFILE_SCOPE(AzCore, "GetAsset: GetAssetInfo"); // Attempt to look up asset info from catalog // This is so that when assetId is a legacy id, we're operating on the canonical id anyway @@ -974,7 +974,7 @@ namespace AZ } } - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "GetAsset: %s", assetInfo.m_relativePath.c_str()); + AZ_PROFILE_SCOPE(AzCore, "GetAsset: %s", assetInfo.m_relativePath.c_str()); AZ_ASSET_NAMED_SCOPE("GetAsset: %s", assetInfo.m_relativePath.c_str()); AZStd::shared_ptr dataStream; @@ -992,7 +992,7 @@ namespace AZ // check if asset already exists { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "GetAsset: FindAsset"); + AZ_PROFILE_SCOPE(AzCore, "GetAsset: FindAsset"); AssetMap::iterator it = m_assets.find(assetInfo.m_assetId); if (it != m_assets.end()) @@ -1007,7 +1007,7 @@ namespace AZ } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "GetAsset: FindAssetHandler"); + AZ_PROFILE_SCOPE(AzCore, "GetAsset: FindAssetHandler"); // find the asset type handler AssetHandlerMap::iterator handlerIt = m_handlers.find(assetInfo.m_assetType); @@ -1019,7 +1019,7 @@ namespace AZ handler = handlerIt->second; if (isNewEntry) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "GetAsset: CreateAsset"); + AZ_PROFILE_SCOPE(AzCore, "GetAsset: CreateAsset"); assetData = handler->CreateAsset(assetInfo.m_assetId, assetInfo.m_assetType); if (assetData) @@ -1043,7 +1043,7 @@ namespace AZ { if (isNewEntry && assetData->IsRegisterReadonlyAndShareable()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "GetAsset: RegisterAsset"); + AZ_PROFILE_SCOPE(AzCore, "GetAsset: RegisterAsset"); m_assets.insert(AZStd::make_pair(assetInfo.m_assetId, assetData)); } if (assetData->GetStatus() == AssetData::AssetStatus::NotLoaded) @@ -1596,7 +1596,7 @@ namespace AZ const AZ::Data::AssetStreamInfo& streamInfo, bool isReload, AssetHandler* handler, const AssetLoadParameters& loadParams, bool signalLoaded) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Set up the callback that will process the asset data once the raw file load is finished. // The callback is declared as mutable so that we can clear weakAsset within the callback. The refcount in weakAsset @@ -1613,7 +1613,7 @@ namespace AZ if (loadingAsset) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "AZ::Data::LoadAssetStreamerCallback %s", + AZ_PROFILE_SCOPE(AzCore, "AZ::Data::LoadAssetStreamerCallback %s", loadingAsset.GetHint().c_str()); { AZStd::scoped_lock assetLock(m_assetMutex); @@ -1788,7 +1788,7 @@ namespace AZ //========================================================================= void AssetManager::RegisterAssetLoading(const Asset& asset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AssetData* data = asset.Get(); if (data) @@ -1803,7 +1803,7 @@ namespace AZ //========================================================================= void AssetManager::UnregisterAssetLoading([[maybe_unused]] const Asset& asset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); } //========================================================================= @@ -2050,7 +2050,7 @@ namespace AZ AZStd::shared_ptr stream, const AssetFilterCB& assetLoadFilterCB) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "AssetHandler::LoadAssetData - %s", asset.GetHint().c_str()); + AZ_PROFILE_SCOPE(AzCore, "AssetHandler::LoadAssetData - %s", asset.GetHint().c_str()); #ifdef AZ_ENABLE_TRACING auto start = AZStd::chrono::system_clock::now(); @@ -2119,7 +2119,7 @@ namespace AZ void AssetManager::PostLoad(AZ::Data::Asset& asset, bool loadSucceeded, bool isReload, AZ::Data::AssetHandler* assetHandler) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!assetHandler) { assetHandler = GetHandler(asset.GetType()); diff --git a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp index 6afcb6a334..d2b1b141a9 100644 --- a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp +++ b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -45,9 +44,6 @@ namespace AZ LoggerSystemComponent::CreateDescriptor(), EventSchedulerSystemComponent::CreateDescriptor(), -#if !defined(_RELEASE) - Statistics::StatisticalProfilerProxySystemComponent::CreateDescriptor(), -#endif // #if !defined(_RELEASE) #if !defined(AZCORE_EXCLUDE_LUA) ScriptSystemComponent::CreateDescriptor(), #endif // #if !defined(AZCORE_EXCLUDE_LUA) @@ -61,10 +57,6 @@ namespace AZ azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), - -#if !defined(_RELEASE) - azrtti_typeid(), -#endif // #if !defined(_RELEASE) }; } } diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index 7b1060a10f..5114ea19ec 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -1394,8 +1394,7 @@ namespace AZ void ComponentApplication::Tick(float deltaOverride /*= -1.f*/) { { - AZ_PROFILE_TIMER("System", "Component application simulation tick function"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_SCOPE(System, "Component application simulation tick"); AZStd::chrono::system_clock::time_point now = AZStd::chrono::system_clock::now(); @@ -1408,12 +1407,12 @@ namespace AZ } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "ComponentApplication::Tick:ExecuteQueuedEvents"); + AZ_PROFILE_SCOPE(AzCore, "ComponentApplication::Tick:ExecuteQueuedEvents"); TickBus::ExecuteQueuedEvents(); } m_currentTime = now; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "ComponentApplication::Tick:OnTick"); + AZ_PROFILE_SCOPE(AzCore, "ComponentApplication::Tick:OnTick"); EBUS_EVENT(TickBus, OnTick, m_deltaTime, ScriptTimePoint(now)); } } @@ -1428,8 +1427,7 @@ namespace AZ //========================================================================= void ComponentApplication::TickSystem() { - AZ_PROFILE_TIMER("System", "Component application system tick function"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_SCOPE(System, "Component application tick"); SystemTickBus::ExecuteQueuedEvents(); EBUS_EVENT(SystemTickBus, OnSystemTick); diff --git a/Code/Framework/AzCore/AzCore/Component/Entity.cpp b/Code/Framework/AzCore/AzCore/Component/Entity.cpp index 09b5526b6c..00c1895261 100644 --- a/Code/Framework/AzCore/AzCore/Component/Entity.cpp +++ b/Code/Framework/AzCore/AzCore/Component/Entity.cpp @@ -189,7 +189,7 @@ namespace AZ void Entity::Activate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(m_state == State::Init, "Entity should be in Init state to be Activated!"); @@ -226,7 +226,7 @@ namespace AZ void Entity::Deactivate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ::ComponentApplicationRequests* componentApplication = AZ::Interface::Get(); if (componentApplication != nullptr) @@ -1034,7 +1034,7 @@ namespace AZ Entity::DependencySortOutcome Entity::DependencySort(ComponentArrayType& inOutComponents) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); using DependencySortInternal::ComponentInfo; using DependencySortInternal::InvalidEntry; diff --git a/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp b/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp index 9bb41bfd58..8241400aac 100644 --- a/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp @@ -40,7 +40,7 @@ namespace AZ //========================================================================= void EnumerateEntityIds(const void* classPtr, const Uuid& classUuid, const EntityIdVisitor& visitor, SerializeContext* context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!context) { diff --git a/Code/Framework/AzCore/AzCore/Component/EntityUtils.h b/Code/Framework/AzCore/AzCore/Component/EntityUtils.h index a5d0e4e53f..ce258bc637 100644 --- a/Code/Framework/AzCore/AzCore/Component/EntityUtils.h +++ b/Code/Framework/AzCore/AzCore/Component/EntityUtils.h @@ -54,7 +54,7 @@ namespace AZ template unsigned int ReplaceEntityRefs(T* classPtr, const EntityIdMapper& mapper, SerializeContext* context = nullptr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto idMapper = [&mapper](const EntityId& originalId, bool isEntityId, const IdUtils::Remapper::IdGenerator&) -> EntityId { return mapper(originalId, isEntityId); @@ -83,7 +83,7 @@ namespace AZ template unsigned int ReplaceEntityIds(T* classPtr, const EntityIdMapper& mapper, SerializeContext* context = nullptr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto idMapper = [&mapper](const EntityId& originalId, bool isEntityId, const IdUtils::Remapper::IdGenerator&) -> EntityId { return mapper(originalId, isEntityId); @@ -97,7 +97,7 @@ namespace AZ template unsigned int ReplaceEntityIdsAndEntityRefs(T* classPtr, const EntityIdMapper& mapper, SerializeContext* context = nullptr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto idMapper = [&mapper](const EntityId& originalId, bool isEntityId, const IdUtils::Remapper::IdGenerator&) -> EntityId { return mapper(originalId, isEntityId); diff --git a/Code/Framework/AzCore/AzCore/Debug/EventTrace.h b/Code/Framework/AzCore/AzCore/Debug/EventTrace.h index 5faf08f46e..8d096707ba 100644 --- a/Code/Framework/AzCore/AzCore/Debug/EventTrace.h +++ b/Code/Framework/AzCore/AzCore/Debug/EventTrace.h @@ -42,11 +42,11 @@ namespace AZ # define AZ_TRACE_METHOD_NAME_CATEGORY(name, category) AZ::Debug::EventTrace::ScopedSlice AZ_JOIN(ScopedSlice__, __LINE__)(name, category); # define AZ_TRACE_METHOD_NAME(name) \ AZ_TRACE_METHOD_NAME_CATEGORY(name, "") \ - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzTrace, name) + AZ_PROFILE_SCOPE(AzTrace, name) # define AZ_TRACE_METHOD() \ AZ_TRACE_METHOD_NAME_CATEGORY(AZ_FUNCTION_SIGNATURE, "") \ - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzTrace) + AZ_PROFILE_FUNCTION(AzTrace) #else # define AZ_TRACE_METHOD_NAME_CATEGORY(name, category) # define AZ_TRACE_METHOD_NAME(name) AZ_TRACE_METHOD_NAME_CATEGORY(name, "") diff --git a/Code/Framework/AzCore/AzCore/Debug/MemoryProfiler.h b/Code/Framework/AzCore/AzCore/Debug/MemoryProfiler.h new file mode 100644 index 0000000000..5b22e20c60 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/MemoryProfiler.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#ifndef AZ_PROFILE_MEMORY_ALLOC +// No other profiler has defined the performance markers AZ_PROFILE_MEMORY_ALLOC (and friends), fall back to a Driller implementation (currently empty) +# define AZ_PROFILE_MEMORY_ALLOC(category, address, size, context) +# define AZ_PROFILE_MEMORY_ALLOC_EX(category, filename, lineNumber, address, size, context) +# define AZ_PROFILE_MEMORY_FREE(category, address) +# define AZ_PROFILE_MEMORY_FREE_EX(category, filename, lineNumber, address) +#endif diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp index eda7330cfc..649bb0b8d7 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp @@ -18,14 +18,14 @@ #include #include -#ifdef USE_PIX -#include -#include -#endif - - namespace AZ { + uint32_t ProfileScope::GetSystemID(const char* system) + { + // TODO: stable ids for registered budgets + return AZ::Crc32(system); + } + namespace Debug { ////////////////////////////////////////////////////////////////////////// @@ -501,10 +501,6 @@ namespace AZ ProfilerRegister* ProfilerRegister::TimerCreateAndStart(const char* systemName, const char* name, ProfilerSection * section, const char* function, int line) { -#if defined(USE_PIX) - PIXBeginEvent(PIX_COLOR(0, 0, 1), "%s:%s", name, function); -#endif - AZStd::chrono::system_clock::time_point start = AZStd::chrono::system_clock::now(); ProfilerRegister* reg = CreateRegister(systemName, name, function, line, ProfilerRegister::PRT_TIME); AZStd::chrono::system_clock::time_point end = AZStd::chrono::system_clock::now(); @@ -548,10 +544,6 @@ namespace AZ { ProfilerRegister* reg = this; -#if defined(USE_PIX) - PIXBeginEvent(PIX_COLOR(0, 0, 1), "%s:%s", reg->m_name, reg->m_function); -#endif - if (reg->m_isActive) { section->m_register = reg; @@ -570,10 +562,6 @@ namespace AZ //========================================================================= void ProfilerRegister::TimerStop() { -#if defined(USE_PIX) - PIXEndEvent(); -#endif - AZStd::chrono::system_clock::time_point end = AZStd::chrono::system_clock::now(); ProfilerSection* section = m_threadData->m_stack.back(); AZStd::chrono::microseconds elapsedTime = end - section->m_start; diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index 6dcdcfdddc..faf511e375 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -10,304 +10,48 @@ #include #include -namespace AZ -{ - namespace Debug - { - using ProfileCategoryPrimitiveType = AZ::u64; +#ifdef USE_PIX +#include +#include +// The pix3 header unfortunately brings in other Windows macros we need to undef +#undef DeleteFile +#undef LoadImage +#endif - /** - * Profiling categories consumed by AZ_PROFILE_FUNCTION and AZ_PROFILE_SCOPE variants for profile filtering - */ - enum class ProfileCategory : ProfileCategoryPrimitiveType - { - // These initial categories match up with the legacy EProfiledSubsystem categories - Any = 0, - Renderer, - ThreeDEngine, - Particle, - AI, - Animation, - Movie, - Entity, - Font, - Network, - Physics, - Script, - ScriptCFunc, - Audio, - Editor, - System, - Action, - Game, - Input, - Sync, - - // Legacy network traffic categories - LegacyNetworkTrafficReserved, - LegacyDeviceReserved, - - // must match EProfiledSubsystem::PROFILE_LAST_SUBSYSTEM - LegacyLast, - - // Bulk category via AZ_TRACE_METHOD - AzTrace, - - AzCore, - AzRender, - AzFramework, - AzToolsFramework, - ScriptCanvas, - LegacyTerrain, - Terrain, - Cloth, - // Add new major categories here (and add names to the parallel position in ProfileCategoryNames) - these categories are enabled by default - - FirstDetailedCategory, - RendererDetailed = FirstDetailedCategory, - ThreeDEngineDetailed, - JobManagerDetailed, - - AzRenderDetailed, - ClothDetailed, - // Add new detailed categories here (and add names to the parallel position in ProfileCategoryNames) -- these categories are disabled by default - - // Internal reserved categories, not for use with performance events - FirstReservedCategory, - MemoryReserved = FirstReservedCategory, - Global, - - // Must be last - Count - }; - static_assert(static_cast(ProfileCategory::Count) < (sizeof(ProfileCategoryPrimitiveType) * 8), "The number of profile categories must not exceed the number of bits in ProfileCategoryPrimitiveType"); - - /** - * Parallel array to ProfileCategory as string category names to be used as Driller category names or for debug purposes - */ - static const char * ProfileCategoryNames[] = - { - "Any", - "Renderer", - "3DEngine", - "Particle", - "AI", - "Animation", - "Movie", - "Entity", - "Font", - "Network", - "Physics", - "Script", - "ScriptCFunc", - "Audio", - "Editor", - "System", - "Action", - "Game", - "Input", - "Sync", - - "LegacyNetworkTrafficReserved", - "LegacyDeviceReserved", - - "LegacyLast", - - "AzTrace", - "AzCore", - "AzRender", - "AzFramework", - "AzToolsFramework", - "ScriptCanvas", - "LegacyTerrain", - "Terrain", - "Cloth", - - "RendererDetailed", - "3DEngineDetailed", - "JobManagerDetailed", - "AzRenderDetailed", - "ClothDetailed", - - "MemoryReserved", - "Global" - }; - static_assert(AZ_ARRAY_SIZE(ProfileCategoryNames) == static_cast(ProfileCategory::Count), "ProfileCategory and ProfileCategoryNames size mismatch"); - } -} - -// Must be included below ProfileCategory #ifdef AZ_PROFILE_TELEMETRY # include #endif #if defined(AZ_PROFILER_MACRO_DISABLE) // by default we never disable the profiler registers as their overhead should be minimal, you can still do that for your code though. -# define AZ_PROFILE_TIMER(...) -# define AZ_PROFILE_TIMER_END(_SectionVariableName) -# define AZ_PROFILE_VALUE_SET(...) -# define AZ_PROFILE_VALUE_ADD(...) -# define AZ_PROFILE_VALUE_SET_NAMED(...) -# define AZ_PROFILE_VALUE_ADD_NAMED(...) +# define AZ_PROFILE_SCOPE(...) +# define AZ_PROFILE_FUNCTION(...) +# define AZ_PROFILE_BEGIN(...) +# define AZ_PROFILE_END(...) #else -/// Implementation when we have only 1 param system name -# define AZ_PROFILE_TIMER_1(_1) AZ_PROFILE_TIMER_2(_1, nullptr) -/// Implementation when we have 2 params (_1 system name and _2 is name of the "section"/register/profiled section - used for debug) -# define AZ_PROFILE_TIMER_2(_1, _2) AZ_PROFILE_TIMER_3(_1, _2, AZ_JOIN(azProfileSection, __LINE__)) -/// Implementation when we have all 3 params (system name, section/register name, section variable name) -# define AZ_PROFILE_TIMER_3(_1, _2, _3) \ - AZ::Debug::ProfilerSection _3; \ - if (AZ::u64 profilerId = AZ::Debug::Profiler::GetId()) { \ - static AZ_THREAD_LOCAL AZ::Internal::RegisterData AZ_JOIN(azProfileRegister, __LINE__) = {0, 0}; \ - if (AZ_JOIN(azProfileRegister, __LINE__).m_profilerId != profilerId) { \ - AZ_JOIN(azProfileRegister, __LINE__).m_register = AZ::Debug::ProfilerRegister::TimerCreateAndStart(_1, _2, &_3, AZ_FUNCTION_SIGNATURE, __LINE__); \ - AZ_JOIN(azProfileRegister, __LINE__).m_profilerId = profilerId; \ - } else { \ - AZ_JOIN(azProfileRegister, __LINE__).m_register->TimerStart(&_3); \ - } \ - } - /** * Macro to declare a profile section for the current scope { }. - * format is: AZ_PROFILE_TIMER(const char* systemName, const char* sectionDescription = nullptr , optional sectionName ) - * \param _1 is required and it's 'const char*' of the system name of which system this scope/register belongs to. - * \param _2 is optional and it's 'const char*' with a name for the "section"/register/profiled section - used as description. If not provided a "Anonymous" will be set. - * \param _3 is optional unique name for a section C++ variable (so you can stop the SCOPE as you wish). If not provided a default unique name is created. + * format is: AZ_PROFILE_SCOPE(categoryName, const char* formatStr, ...) */ -# define AZ_PROFILE_TIMER(...) AZ_MACRO_SPECIALIZE(AZ_PROFILE_TIMER_, AZ_VA_NUM_ARGS(__VA_ARGS__), (__VA_ARGS__)) - -// Optional (USE ONLY IN EXTREME CASES!!!) scope end command for named sections, so you stop the profiler register timing before it goes out of scope. -# define AZ_PROFILE_TIMER_END(_SectionVariableName) { _SectionVariableName.Stop(); } - -/** - * Macro to operate on custom values. All values are AZ::s64. You can provide up to 5 values. - * format is AZ_PROFILE_VALUE_SET/ADD(const char* systemName, const char* valueName, - * value1, optional value2, optional value3, optional value 4, optional value5, optional registerName (for direct register manipulation for EXPERTS ONLY)). - * \param _SystemName is required and it's 'const char*' of the system name of which system this scope/register belongs to. - * \param _RegisterName is required and it's 'const char*' with a name for the register - used as description. - * \param 3 is required and it's AZ::s64, operates on m_value1. - * \param 4 is optional and it's AZ::s64, operates on m_value2. - * \param 5 is optional and it's AZ::s64, operates on m_value3. - * \param 6 is optional and it's AZ::s64, operates on m_value4. - * \param 7 is optional and it's AZ::s64, operates on m_value5. - */ -# define AZ_PROFILE_VALUE_SET(_SystemName, _RegisterName, ...) \ - if (AZ::u64 profilerId = AZ::Debug::Profiler::GetId()) { \ - static AZ_THREAD_LOCAL AZ::Internal::RegisterData AZ_JOIN(azProfileRegister, __LINE__) = {0, 0}; \ - if (AZ_JOIN(azProfileRegister, __LINE__).m_profilerId != profilerId) { \ - AZ_JOIN(azProfileRegister, __LINE__).m_register = AZ::Debug::ProfilerRegister::ValueCreate(_SystemName, _RegisterName, AZ_FUNCTION_SIGNATURE, __LINE__); \ - AZ_JOIN(azProfileRegister, __LINE__).m_profilerId = profilerId; \ - } \ - AZ_JOIN(azProfileRegister, __LINE__).m_register->ValueSet(__VA_ARGS__); \ - } - -/// Same as AZ_PROFILE_VALUE_SET except is add the values passed in the macro (you can use -(value), to subtract values) -# define AZ_PROFILE_VALUE_ADD(_SystemName, _RegisterName, ...) \ - if (AZ::u64 profilerId = AZ::Debug::Profiler::GetId()) { \ - static AZ_THREAD_LOCAL AZ::Internal::RegisterData AZ_JOIN(azProfileRegister, __LINE__) = {0, 0}; \ - if (AZ_JOIN(azProfileRegister, __LINE__).m_profilerId != profilerId) { \ - AZ_JOIN(azProfileRegister, __LINE__).m_register = AZ::Debug::ProfilerRegister::ValueCreate(_SystemName, _RegisterName, AZ_FUNCTION_SIGNATURE, __LINE__); \ - AZ_JOIN(azProfileRegister, __LINE__).m_profilerId = profilerId; \ - } \ - AZ_JOIN(azProfileRegister, __LINE__).m_register->ValueAdd(__VA_ARGS__); \ - } - -/** - * Same as AZ_PROFILER_VALUE_SET but with option to access the register by name. (USE ONLY IN EXTREME CASES!!!) - * \param _RegisterVaribaleName is optional unique name for a register C++ variable so you can manipulate the register. - */ -# define AZ_PROFILE_VALUE_SET_NAMED(_SystemName, _RegisterName, _RegisterVaribaleName, ...) \ - AZ::Debug::ProfilerRegister * _RegisterVaribaleName = nullptr; \ - if (AZ::u64 profilerId = AZ::Debug::Profiler::GetId()) { \ - static AZ_THREAD_LOCAL AZ::Internal::RegisterData AZ_JOIN(azProfileRegister, __LINE__) = {0, 0}; \ - if (AZ_JOIN(azProfileRegister, __LINE__).m_profilerId != profilerId) { \ - AZ_JOIN(azProfileRegister, __LINE__).m_register = AZ::Debug::ProfilerRegister::ValueCreate(_SystemName, _RegisterName, AZ_FUNCTION_SIGNATURE, __LINE__); \ - AZ_JOIN(azProfileRegister, __LINE__).m_profilerId = profilerId; \ - } \ - AZ_JOIN(azProfileRegister, __LINE__).m_register->ValueSet(__VA_ARGS__); \ - _RegisterVaribaleName = AZ_JOIN(azProfileRegister, __LINE__).m_register; \ - } - -/// Same as AZ_PROFILE_VALUE_SET_NAMED but add the values to the current. (USE ONLY IN EXTREME CASES!!!) -# define AZ_PROFILE_VALUE_ADD_NAMED(_SystemName, _RegisterName, _RegisterVaribaleName, ...) \ - AZ::Debug::ProfilerRegister * _RegisterVaribaleName = nullptr; \ - if (AZ::u64 profilerId = AZ::Debug::Profiler::GetId()) { \ - static AZ_THREAD_LOCAL AZ::Internal::RegisterData AZ_JOIN(azProfileRegister, __LINE__) = {0, 0}; \ - if (AZ_JOIN(azProfileRegister, __LINE__).m_profilerId != profilerId) { \ - AZ_JOIN(azProfileRegister, __LINE__).m_register = AZ::Debug::ProfilerRegister::ValueCreate(_SystemName, _RegisterName, AZ_FUNCTION_SIGNATURE, __LINE__); \ - AZ_JOIN(azProfileRegister, __LINE__).m_profilerId = profilerId; \ - } \ - AZ_JOIN(azProfileRegister, __LINE__).m_register->ValueAdd(__VA_ARGS__); \ - _RegisterVaribaleName = AZ_JOIN(azProfileRegister, __LINE__).m_register; \ - } +# define AZ_PROFILE_SCOPE(category, formatStr, ...) ::AZ::ProfileScope AZ_JOIN(azProfileScope, __LINE__){ #category, formatStr, __VA_ARGS__ } +# define AZ_PROFILE_FUNCTION(category) AZ_PROFILE_SCOPE(category, AZ_FUNCTION_SIGNATURE) +// Prefer using the scoped macros which automatically end the event (AZ_PROFILE_SCOPE/AZ_PROFILE_FUNCTION) +# define AZ_PROFILE_BEGIN(category, name, ...) ::AZ::ProfileScope::BeginRegion(#category, name, __VA_ARGS__) +# define AZ_PROFILE_END() ::AZ::ProfileScope::EndRegion() #endif // AZ_PROFILER_MACRO_DISABLE -#ifndef AZ_PROFILE_FUNCTION -// No other profiler has defined the performance markers AZ_PROFILE_SCOPE (and friends), fallback to a Driller implementation -# define AZ_INTERNAL_PROF_VERIFY_CAT(category) static_assert(category < AZ::Debug::ProfileCategory::Count, "Invalid profile category") -# define AZ_INTERNAL_PROF_CAT_NAME(category) AZ::Debug::ProfileCategoryNames[static_cast(category)] - -# define AZ_PROFILE_FUNCTION(category) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)) -# define AZ_PROFILE_FUNCTION_STALL(category) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)) -# define AZ_PROFILE_FUNCTION_IDLE(category) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)) - -# define AZ_PROFILE_SCOPE(category, name) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)); (void)(name) -# define AZ_PROFILE_SCOPE_STALL(category, name) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)); (void)(name) -# define AZ_PROFILE_SCOPE_IDLE(category, name) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)); (void)(name) - -# define AZ_PROFILE_SCOPE_DYNAMIC(category, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)) -# define AZ_PROFILE_SCOPE_STALL_DYNAMIC(category, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)) -# define AZ_PROFILE_SCOPE_IDLE_DYNAMIC(category, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_PROFILE_TIMER(AZ_INTERNAL_PROF_CAT_NAME(category)) -#endif - -#ifndef AZ_PROFILE_EVENT_BEGIN -// No other profiler has defined the performance markers AZ_PROFILE_EVENT_START/END, fallback to a Driller implementation (currently empty) -# define AZ_PROFILE_EVENT_BEGIN(category, name) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); (void)(name) -# define AZ_PROFILE_EVENT_END(category) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category) -#endif - #ifndef AZ_PROFILE_INTERVAL_START // No other profiler has defined the performance markers AZ_PROFILE_INTERVAL_START/END, fallback to a Driller implementation (currently empty) -# define AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) static_assert(sizeof(id) <= sizeof(AZ::u64), "Interval id must be a unique value no larger than 64-bits") -# define AZ_PROFILE_INTERVAL_START(category, id, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) -# define AZ_PROFILE_INTERVAL_START_COLORED(category, id, color, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); (void)(color); AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) -# define AZ_PROFILE_INTERVAL_END(category, id) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) -# define AZ_PROFILE_INTERVAL_SCOPED(category, id, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) +# define AZ_PROFILE_INTERVAL_START(...) +# define AZ_PROFILE_INTERVAL_START_COLORED(...) +# define AZ_PROFILE_INTERVAL_END(...) +# define AZ_PROFILE_INTERVAL_SCOPED(...) #endif #ifndef AZ_PROFILE_DATAPOINT // No other profiler has defined the performance markers AZ_PROFILE_DATAPOINT, fallback to a Driller implementation (currently empty) -#define AZ_PROFILE_DATAPOINT(category, value, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); static_cast(value) -#define AZ_PROFILE_DATAPOINT_PERCENT(category, value, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); static_cast(value) -#endif - -#ifndef AZ_PROFILE_MEMORY_ALLOC -// No other profiler has defined the performance markers AZ_PROFILE_MEMORY_ALLOC (and friends), fall back to a Driller implementation (currently empty) -# define AZ_PROFILE_MEMORY_ALLOC(category, address, size, context) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); (void)(context) -# define AZ_PROFILE_MEMORY_ALLOC_EX(category, filename, lineNumber, address, size, context) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); (void)(context) -# define AZ_PROFILE_MEMORY_FREE(category, address) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category) -# define AZ_PROFILE_MEMORY_FREE_EX(category, filename, lineNumber, address) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category) +# define AZ_PROFILE_DATAPOINT(...) +# define AZ_PROFILE_DATAPOINT_PERCENT(...) #endif namespace AZStd @@ -317,6 +61,43 @@ namespace AZStd namespace AZ { + class ProfileScope + { + public: + static uint32_t GetSystemID(const char* system); + + template + static void BeginRegion(const char* system, char const* eventName, [[maybe_unused]] T const&... args) + { + // TODO: Verification that the supplied system name corresponds to a known budget +#if defined(USE_PIX) + PIXBeginEvent(PIX_COLOR_INDEX(GetSystemID(system) & 0xff), eventName, args...); +#else + (void)system; + (void)eventName; +#endif + // TODO: injecting instrumentation for other profilers + } + + static void EndRegion() + { +#if defined(USE_PIX) + PIXEndEvent(); +#endif + } + + template + ProfileScope(const char* system, char const* eventName, T const&... args) + { + BeginRegion(system, eventName, args...); + } + + ~ProfileScope() + { + EndRegion(); + } + }; + namespace Debug { class ProfilerSection; diff --git a/Code/Framework/AzCore/AzCore/IO/FileIO.cpp b/Code/Framework/AzCore/AzCore/IO/FileIO.cpp index 125951c261..a6ce8cf101 100644 --- a/Code/Framework/AzCore/AzCore/IO/FileIO.cpp +++ b/Code/Framework/AzCore/AzCore/IO/FileIO.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ @@ -353,7 +354,7 @@ namespace AZ m_filename = path; } - AZ_PROFILE_INTERVAL_START_COLORED(AZ::Debug::ProfileCategory::AzCore, &m_filename, 0xff0000ff, "FileIO: %s", m_filename.c_str()); + AZ_PROFILE_INTERVAL_START_COLORED(AzCore, &m_filename, 0xff0000ff, "FileIO: %s", m_filename.c_str()); return result; } @@ -372,7 +373,7 @@ namespace AZ FileIOBase::GetInstance()->Close(m_handle); m_handle = InvalidHandle; m_ownsHandle = false; - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::AzCore, &m_filename); + AZ_PROFILE_INTERVAL_END(AzCore, &m_filename); } } @@ -425,7 +426,7 @@ namespace AZ void FileIOStream::Seek(OffsetType bytes, SeekMode mode) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "FileIO Seek: %s", m_filename.c_str()); + AZ_PROFILE_SCOPE(AzCore, "FileIO Seek: %s", m_filename.c_str()); AZ_Assert(FileIOBase::GetInstance(), "FileIO is not initialized."); AZ_Assert(IsOpen(), "Cannot seek on a FileIOStream that is not open."); @@ -453,7 +454,7 @@ namespace AZ SizeType FileIOStream::Read(SizeType bytes, void* oBuffer) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "FileIO Read: %s", m_filename.c_str()); + AZ_PROFILE_SCOPE(AzCore, "FileIO Read: %s", m_filename.c_str()); AZ_Assert(FileIOBase::GetInstance(), "FileIO is not initialized."); AZ_Assert(IsOpen(), "Cannot read from a FileIOStream that is not open."); diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp index f358370be5..09ab10b8cf 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/BlockCache.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -245,7 +246,7 @@ namespace AZ auto continueReadFile = [this, request](FileRequest& fileSizeRequest) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(m_numMetaDataRetrievalInProgress > 0, "More requests have completed meta data retrieval in the Block Cache than were requested."); m_numMetaDataRetrievalInProgress--; @@ -454,7 +455,7 @@ namespace AZ section.m_readSize, sharedRead); readRequest->SetCompletionCallback([this](FileRequest& request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); CompleteRead(request); }); section.m_cacheBlockIndex = cacheLocation; diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp index 2e9dd43e83..44bf36bd9d 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/FullFileDecompressor.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -367,7 +368,7 @@ namespace AZ { auto callback = [this, nextRequest](const FileRequest& checkRequest) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto check = AZStd::get_if(&checkRequest.GetCommand()); AZ_Assert(check, "Callback in FullFileDecompressor::PrepareReadRequest expected FileExistsCheck but got another command."); @@ -426,7 +427,7 @@ namespace AZ { auto callback = [this, nextRequest](const FileRequest& checkRequest) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto check = AZStd::get_if(&checkRequest.GetCommand()); AZ_Assert(check, "Callback in FullFileDecompressor::PrepareDedicatedCache expected FileExistsCheck but got another command."); @@ -508,7 +509,7 @@ namespace AZ archiveReadRequest->SetCompletionCallback( [this, readSlot = i](FileRequest& request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); FinishArchiveRead(&request, readSlot); }); m_next->QueueRequest(archiveReadRequest); @@ -596,7 +597,7 @@ namespace AZ waitRequest->SetCompletionCallback([this, jobSlot](FileRequest& request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); FinishDecompression(&request, jobSlot); }); diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/ReadSplitter.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/ReadSplitter.cpp index 9e019745a3..00c1c63933 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/ReadSplitter.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/ReadSplitter.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -218,7 +219,7 @@ namespace AZ subRequest->CreateRead(pending.m_request, pending.m_output, bufferSize, data->m_path, pending.m_offset, readSize, data->m_sharedRead); subRequest->SetCompletionCallback([this](FileRequest&) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); QueuePendingRequest(); }); m_next->QueueRequest(subRequest); @@ -302,7 +303,7 @@ namespace AZ offset, readSize, data->m_sharedRead); subRequest->SetCompletionCallback([this, bufferSlot]([[maybe_unused]] FileRequest& request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); BufferCopyInformation& copyInfo = m_bufferCopyInformation[bufferSlot]; memcpy(copyInfo.m_target, GetBufferSlot(bufferSlot) + copyInfo.m_bufferOffset, copyInfo.m_size); diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp index d6e5a7bb2c..e7f9b0fd18 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/Scheduler.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -138,14 +139,14 @@ namespace AZ::IO while (m_isRunning) { { - AZ_PROFILE_SCOPE_IDLE(AZ::Debug::ProfileCategory::AzCore, "Scheduler suspended."); + AZ_PROFILE_SCOPE(AzCore, "Scheduler suspended."); m_context.SuspendSchedulingThread(); } // Only do processing if the thread hasn't been suspended. while (!m_isSuspended) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "Scheduler main loop."); + AZ_PROFILE_SCOPE(AzCore, "Scheduler main loop."); // Always schedule requests first as the main Streamer thread could have been asleep for a long time due to slow reading // but also don't schedule after every change in the queue as scheduling is not cheap. @@ -154,7 +155,7 @@ namespace AZ::IO { do { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "Scheduler queue requests."); + AZ_PROFILE_SCOPE(AzCore, "Scheduler queue requests."); // If there are pending requests and available slots, queue the next requests. while(m_context.GetNumPreparedRequests() > 0) { @@ -208,7 +209,7 @@ namespace AZ::IO void Scheduler::Thread_QueueNextRequest() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); FileRequest* next = m_context.PopPreparedRequest(); next->SetStatus(IStreamerTypes::RequestStatus::Processing); @@ -279,7 +280,7 @@ namespace AZ::IO m_processingSize += info.m_uncompressedSize; #endif } - AZ_PROFILE_INTERVAL_START_COLORED(AZ::Debug::ProfileCategory::AzCore, next, ProfilerColor, + AZ_PROFILE_INTERVAL_START_COLORED(AzCore, next, ProfilerColor, "Streamer queued %zu: %s", next->GetCommand().index(), parentReadRequest->m_path.GetRelativePath()); m_threadData.m_streamStack->QueueRequest(next); } @@ -293,7 +294,7 @@ namespace AZ::IO } else if constexpr (AZStd::is_same_v || AZStd::is_same_v) { - AZ_PROFILE_INTERVAL_START_COLORED(AZ::Debug::ProfileCategory::AzCore, next, ProfilerColor, + AZ_PROFILE_INTERVAL_START_COLORED(AzCore, next, ProfilerColor, "Streamer queued %zu", next->GetCommand().index()); // Flushing becomes a lot less complicated if there are no jobs and/or asynchronous I/O running. This does mean overall // longer processing time as bubbles are introduced into the pipeline, but flushing is an infrequent event that only @@ -303,7 +304,7 @@ namespace AZ::IO } else { - AZ_PROFILE_INTERVAL_START_COLORED(AZ::Debug::ProfileCategory::AzCore, next, ProfilerColor, + AZ_PROFILE_INTERVAL_START_COLORED(AzCore, next, ProfilerColor, "Streamer queued %zu", next->GetCommand().index()); m_threadData.m_streamStack->QueueRequest(next); } @@ -312,13 +313,13 @@ namespace AZ::IO bool Scheduler::Thread_ExecuteRequests() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); return m_threadData.m_streamStack->ExecuteRequests(); } bool Scheduler::Thread_PrepareRequests(AZStd::vector& outstandingRequests) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); { AZStd::scoped_lock lock(m_pendingRequestsLock); @@ -372,7 +373,7 @@ namespace AZ::IO void Scheduler::Thread_ProcessTillIdle() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); while (true) { @@ -390,7 +391,7 @@ namespace AZ::IO void Scheduler::Thread_ProcessCancelRequest(FileRequest* request, FileRequest::CancelData& data) { - AZ_PROFILE_INTERVAL_START_COLORED(AZ::Debug::ProfileCategory::AzCore, request, ProfilerColor, "Streamer queued cancel"); + AZ_PROFILE_INTERVAL_START_COLORED(AzCore, request, ProfilerColor, "Streamer queued cancel"); auto& pending = m_context.GetPreparedRequests(); auto pendingIt = pending.begin(); while (pendingIt != pending.end()) @@ -412,7 +413,7 @@ namespace AZ::IO void Scheduler::Thread_ProcessRescheduleRequest(FileRequest* request, FileRequest::RescheduleData& data) { - AZ_PROFILE_INTERVAL_START_COLORED(AZ::Debug::ProfileCategory::AzCore, request, ProfilerColor, "Streamer queued reschedule"); + AZ_PROFILE_INTERVAL_START_COLORED(AzCore, request, ProfilerColor, "Streamer queued reschedule"); auto& pendingRequests = m_context.GetPreparedRequests(); for (FileRequest* pending : pendingRequests) { @@ -543,7 +544,7 @@ namespace AZ::IO void Scheduler::Thread_ScheduleRequests() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZStd::chrono::system_clock::time_point now = AZStd::chrono::system_clock::now(); auto& pendingQueue = m_context.GetPreparedRequests(); @@ -554,7 +555,7 @@ namespace AZ::IO if (m_context.GetNumPreparedRequests() > 1) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, + AZ_PROFILE_SCOPE(AzCore, "Scheduler::Thread_ScheduleRequests - Sorting %i requests", m_context.GetNumPreparedRequests()); auto sorter = [this](const FileRequest* lhs, const FileRequest* rhs) -> bool { diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/Statistics.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/Statistics.cpp index 593c052853..e64c3cae74 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/Statistics.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/Statistics.cpp @@ -48,7 +48,7 @@ namespace AZ [[maybe_unused]] AZStd::string_view name, [[maybe_unused]] double value) { - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::AzCore, value, + AZ_PROFILE_DATAPOINT(AzCore, value, "Streamer/%.*s/%.*s (Raw)", aznumeric_cast(owner.size()), owner.data(), aznumeric_cast(name.size()), name.data()); diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/StorageDrive.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/StorageDrive.cpp index c4f9840a0b..6f33c0a216 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/StorageDrive.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/StorageDrive.cpp @@ -59,7 +59,7 @@ namespace AZ void StorageDrive::PrepareRequest(FileRequest* request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(request, "PrepareRequest was provided a null request."); if (AZStd::holds_alternative(request->GetCommand())) @@ -254,7 +254,7 @@ namespace AZ void StorageDrive::ReadFile(FileRequest* request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto data = AZStd::get_if(&request->GetCommand()); AZ_Assert(data, "FileRequest queued on StorageDrive to be read didn't contain read data."); @@ -341,7 +341,7 @@ namespace AZ void StorageDrive::FileExistsRequest(FileRequest* request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); TIMED_AVERAGE_WINDOW_SCOPE(m_getFileExistsTimeAverage); auto& fileExists = AZStd::get(request->GetCommand()); @@ -359,7 +359,7 @@ namespace AZ void StorageDrive::FileMetaDataRetrievalRequest(FileRequest* request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); TIMED_AVERAGE_WINDOW_SCOPE(m_getFileMetaDataTimeAverage); auto& command = AZStd::get(request->GetCommand()); diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/Streamer.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/Streamer.cpp index 792ef8ea1e..e634f2eac8 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/Streamer.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/Streamer.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -262,15 +263,15 @@ namespace AZ::IO switch (stat.GetType()) { case Statistic::Type::FloatingPoint: - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::AzCore, stat.GetFloatValue(), "Streamer/%.*s/%.*s", + AZ_PROFILE_DATAPOINT(AzCore, stat.GetFloatValue(), "Streamer/%.*s/%.*s", aznumeric_cast(stat.GetOwner().length()), stat.GetOwner().data(), aznumeric_cast(stat.GetName().length()), stat.GetName().data()); break; case Statistic::Type::Integer: - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::AzCore, stat.GetIntegerValue(), "Streamer/%.*s/%.*s", + AZ_PROFILE_DATAPOINT(AzCore, stat.GetIntegerValue(), "Streamer/%.*s/%.*s", aznumeric_cast(stat.GetOwner().length()), stat.GetOwner().data(), aznumeric_cast(stat.GetName().length()), stat.GetName().data()); break; case Statistic::Type::Percentage: - AZ_PROFILE_DATAPOINT_PERCENT(AZ::Debug::ProfileCategory::AzCore, stat.GetPercentage(), "Streamer/%.*s/%.*s (percent)", + AZ_PROFILE_DATAPOINT_PERCENT(AzCore, stat.GetPercentage(), "Streamer/%.*s/%.*s (percent)", aznumeric_cast(stat.GetOwner().length()), stat.GetOwner().data(), aznumeric_cast(stat.GetName().length()), stat.GetName().data()); break; default: diff --git a/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp b/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp index e870e29786..823ab6e050 100644 --- a/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp +++ b/Code/Framework/AzCore/AzCore/IO/Streamer/StreamerContext.cpp @@ -153,7 +153,7 @@ namespace AZ bool StreamerContext::FinalizeCompletedRequests() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); #if AZ_STREAMER_ADD_EXTRA_PROFILING_INFO auto now = AZStd::chrono::system_clock::now(); @@ -218,10 +218,10 @@ namespace AZ bool isInternal = top->m_usage == FileRequest::Usage::Internal; { - AZ_PROFILE_SCOPE_STALL(AZ::Debug::ProfileCategory::AzCore, + AZ_PROFILE_SCOPE(AzCore, isInternal ? "Completion callback internal" : "Completion callback external"); top->m_onCompletion(*top); - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::AzCore, top); + AZ_PROFILE_INTERVAL_END(AzCore, top); } if (parent) diff --git a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp index d98b7e1d36..8de8b6b70f 100644 --- a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp +++ b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -97,9 +96,6 @@ SystemFile& SystemFile::operator=(SystemFile&& other) bool SystemFile::Open(const char* fileName, int mode, int platformFlags) { - AZ_PROFILE_INTERVAL_SCOPED(AZ::Debug::ProfileCategory::AzCore, this, "SystemFile::Open - %s", fileName); - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Open - %s", fileName); - if (fileName) // If we reopen the file we are allowed to have NULL file name { if (strlen(fileName) > m_fileName.max_size()) @@ -136,9 +132,6 @@ bool SystemFile::ReOpen(int mode, int platformFlags) void SystemFile::Close() { - AZ_PROFILE_INTERVAL_SCOPED(AZ::Debug::ProfileCategory::AzCore, this, "SystemFile::Close - %s", m_fileName.c_str()); - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Close - %s", m_fileName.c_str()); - if (FileIOBus::HasHandlers()) { bool isHandled = false; @@ -154,8 +147,6 @@ void SystemFile::Close() void SystemFile::Seek(SeekSizeType offset, SeekMode mode) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Seek - %s:%i", m_fileName.c_str(), offset); - if (FileIOBus::HasHandlers()) { bool isHandled = false; @@ -181,16 +172,11 @@ bool SystemFile::Eof() AZ::u64 SystemFile::ModificationTime() { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::ModTime - %s", m_fileName.c_str()); - return Platform::ModificationTime(m_handle, this); } SystemFile::SizeType SystemFile::Read(SizeType byteSize, void* buffer) { - AZ_PROFILE_INTERVAL_SCOPED(AZ::Debug::ProfileCategory::AzCore, this, "SystemFile::Read - %s:%i", m_fileName.c_str(), byteSize); - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Read - %s:%i", m_fileName.c_str(), byteSize); - if (FileIOBus::HasHandlers()) { SizeType numRead = 0; @@ -207,9 +193,6 @@ SystemFile::SizeType SystemFile::Read(SizeType byteSize, void* buffer) SystemFile::SizeType SystemFile::Write(const void* buffer, SizeType byteSize) { - AZ_PROFILE_INTERVAL_SCOPED(AZ::Debug::ProfileCategory::AzCore, this, "SystemFile::Write - %s:%i", m_fileName.c_str(), byteSize); - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Write - %s:%i", m_fileName.c_str(), byteSize); - if (FileIOBus::HasHandlers()) { SizeType numWritten = 0; @@ -226,15 +209,11 @@ SystemFile::SizeType SystemFile::Write(const void* buffer, SizeType byteSize) void SystemFile::Flush() { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Flush - %s", m_fileName.c_str()); - Platform::Flush(m_handle, this); } SystemFile::SizeType SystemFile::Length() const { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Length - %s", m_fileName.c_str()); - return Platform::Length(m_handle, this); } @@ -253,36 +232,26 @@ SystemFile::SizeType SystemFile::DiskOffset() const bool SystemFile::Exists(const char* fileName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Exists(util) - %s", fileName); - return Platform::Exists(fileName); } void SystemFile::FindFiles(const char* filter, FindFileCB cb) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::FindFiles(util) - %s", filter); - Platform::FindFiles(filter, cb); } AZ::u64 SystemFile::ModificationTime(const char* fileName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::ModTime(util) - %s", fileName); - return Platform::ModificationTime(fileName); } SystemFile::SizeType SystemFile::Length(const char* fileName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Length(util) - %s", fileName); - return Platform::Length(fileName); } SystemFile::SizeType SystemFile::Read(const char* fileName, void* buffer, SizeType byteSize, SizeType byteOffset) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Read(util) - %s:[%i,%i]", fileName, byteOffset, byteSize); - SizeType numBytesRead = 0; SystemFile f; if (f.Open(fileName, SF_OPEN_READ_ONLY)) @@ -305,8 +274,6 @@ SystemFile::SizeType SystemFile::Read(const char* fileName, void* buffer, SizeTy bool SystemFile::Delete(const char* fileName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Delete(util) - %s", fileName); - if (!Exists(fileName)) { return false; @@ -317,8 +284,6 @@ bool SystemFile::Delete(const char* fileName) bool SystemFile::Rename(const char* sourceFileName, const char* targetFileName, bool overwrite) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::Rename(util) - %s", sourceFileName); - if (!Exists(sourceFileName)) { return false; @@ -329,29 +294,21 @@ bool SystemFile::Rename(const char* sourceFileName, const char* targetFileName, bool SystemFile::IsWritable(const char* sourceFileName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::IsWritable(util) - %s", sourceFileName); - return Platform::IsWritable(sourceFileName); } bool SystemFile::SetWritable(const char* sourceFileName, bool writable) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::SetWritable(util) - %s", sourceFileName); - return Platform::SetWritable(sourceFileName, writable); } bool SystemFile::CreateDir(const char* dirName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::CreateDir(util) - %s", dirName); - return Platform::CreateDir(dirName); } bool SystemFile::DeleteDir(const char* dirName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::DeleteDir(util) - %s", dirName); - return Platform::DeleteDir(dirName); } diff --git a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerBase.cpp b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerBase.cpp index 130ff8da6b..a17290d8c5 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerBase.cpp +++ b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerBase.cpp @@ -23,10 +23,10 @@ void JobManagerBase::Process(Job* job) Job* dependent = job->GetDependent(); bool isDelete = job->IsAutoDelete(); - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::JobManagerDetailed, job); + AZ_PROFILE_INTERVAL_END(JobManagerDetailed, job); if (!job->IsCancelled()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "AZ::JobManagerBase::Process Job"); + AZ_PROFILE_SCOPE(AzCore, "AZ::JobManagerBase::Process Job"); job->Process(); } diff --git a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp index bdf137f621..73fb4ecfe8 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp +++ b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp @@ -122,7 +122,7 @@ void JobManagerWorkStealing::AddPendingJob(Job* job) } #endif - AZ_PROFILE_INTERVAL_START(AZ::Debug::ProfileCategory::JobManagerDetailed, job, "AzCore Job Queued Awaiting Execute"); + AZ_PROFILE_INTERVAL_START(JobManagerDetailed, job, "AzCore Job Queued Awaiting Execute"); if (job->IsCompletion()) { @@ -371,7 +371,7 @@ void JobManagerWorkStealing::ProcessJobsInternal(ThreadInfo* info, Job* suspende { //no available work, so go to sleep (or we have already been signaled by another thread and will acquire the semaphore but not actually sleep) info->m_waitEvent.acquire(); - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::JobManagerDetailed, info); + AZ_PROFILE_INTERVAL_END(JobManagerDetailed, info); if (m_quitRequested) { @@ -457,7 +457,7 @@ void JobManagerWorkStealing::ProcessJobsInternal(ThreadInfo* info, Job* suspende else { //attempt to steal a job from another thread's queue - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "JobManagerWorkStealing::ProcessJobsInternal:WorkStealing"); + AZ_PROFILE_SCOPE(AzCore, "JobManagerWorkStealing::ProcessJobsInternal:WorkStealing"); unsigned int numStealAttempts = 0; const unsigned int maxStealAttempts = (unsigned int)m_workerThreads.size() * 3; //try every thread a few times before giving up @@ -674,7 +674,7 @@ inline void JobManagerWorkStealing::ActivateWorker() m_numAvailableWorkers.fetch_sub(1, AZStd::memory_order_acq_rel); // resume the thread execution - AZ_PROFILE_INTERVAL_START(AZ::Debug::ProfileCategory::JobManagerDetailed, info, "AzCore WakeJobThread %d", info->m_workerId); + AZ_PROFILE_INTERVAL_START(JobManagerDetailed, info, "AzCore WakeJobThread %d", info->m_workerId); info->m_waitEvent.release(); return; } diff --git a/Code/Framework/AzCore/AzCore/Jobs/JobCompletion.h b/Code/Framework/AzCore/AzCore/Jobs/JobCompletion.h index 50776a30da..eda03bb5f6 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/JobCompletion.h +++ b/Code/Framework/AzCore/AzCore/Jobs/JobCompletion.h @@ -33,7 +33,7 @@ namespace AZ */ void StartAndWaitForCompletion() { - AZ_PROFILE_FUNCTION_STALL(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // start the job Start(); diff --git a/Code/Framework/AzCore/AzCore/Jobs/LegacyJobExecutor.h b/Code/Framework/AzCore/AzCore/Jobs/LegacyJobExecutor.h index dd626a9829..8018cf409f 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/LegacyJobExecutor.h +++ b/Code/Framework/AzCore/AzCore/Jobs/LegacyJobExecutor.h @@ -72,7 +72,7 @@ namespace AZ while (m_running) { - AZ_PROFILE_FUNCTION_STALL(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); m_completionCondition.wait(uniqueLock, [this] { return !this->m_running; }); } } diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp b/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp index fc75f3c37e..7d644c6917 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include diff --git a/Code/Framework/AzCore/AzCore/Memory/SimpleSchemaAllocator.h b/Code/Framework/AzCore/AzCore/Memory/SimpleSchemaAllocator.h index 08e8098dac..e9d001aec3 100644 --- a/Code/Framework/AzCore/AzCore/Memory/SimpleSchemaAllocator.h +++ b/Code/Framework/AzCore/AzCore/Memory/SimpleSchemaAllocator.h @@ -12,9 +12,7 @@ #include #include #include -#include - -#include +#include namespace AZ { @@ -82,7 +80,7 @@ namespace AZ if (ProfileAllocations) { - AZ_PROFILE_MEMORY_ALLOC_EX(AZ::Debug::ProfileCategory::MemoryReserved, fileName, lineNum, ptr, byteSize, name ? name : GetName()); + AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, ptr, byteSize, name ? name : GetName()); AZ_MEMORY_PROFILE(ProfileAllocation(ptr, byteSize, alignment, name, fileName, lineNum, suppressStackRecord)); } @@ -102,7 +100,7 @@ namespace AZ if (ProfileAllocations) { - AZ_PROFILE_MEMORY_FREE(AZ::Debug::ProfileCategory::MemoryReserved, ptr); + AZ_PROFILE_MEMORY_FREE(MemoryReserved, ptr); AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, byteSize, alignment, nullptr)); } @@ -128,7 +126,7 @@ namespace AZ { if (ProfileAllocations) { - AZ_PROFILE_MEMORY_FREE(AZ::Debug::ProfileCategory::MemoryReserved, ptr); + AZ_PROFILE_MEMORY_FREE(MemoryReserved, ptr); } newSize = MemorySizeAdjustedUp(newSize); @@ -142,7 +140,7 @@ namespace AZ if (ProfileAllocations) { - AZ_PROFILE_MEMORY_ALLOC(AZ::Debug::ProfileCategory::MemoryReserved, newPtr, newSize, GetName()); + AZ_PROFILE_MEMORY_ALLOC(MemoryReserved, newPtr, newSize, GetName()); AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newPtr, newSize, newAlignment)); } diff --git a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp index ada6c8f330..41c70b4e30 100644 --- a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp @@ -254,7 +254,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co AZ_Assert(address != 0, "SystemAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); - AZ_PROFILE_MEMORY_ALLOC_EX(AZ::Debug::ProfileCategory::MemoryReserved, fileName, lineNum, address, byteSize, name); + AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, address, byteSize, name); AZ_MEMORY_PROFILE(ProfileAllocation(address, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1)); return address; @@ -268,7 +268,7 @@ void SystemAllocator::DeAllocate(pointer_type ptr, size_type byteSize, size_type alignment) { byteSize = MemorySizeAdjustedUp(byteSize); - AZ_PROFILE_MEMORY_FREE(AZ::Debug::ProfileCategory::MemoryReserved, ptr); + AZ_PROFILE_MEMORY_FREE(MemoryReserved, ptr); AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, byteSize, alignment, nullptr)); m_allocator->DeAllocate(ptr, byteSize, alignment); } @@ -283,9 +283,9 @@ SystemAllocator::ReAllocate(pointer_type ptr, size_type newSize, size_type newAl newSize = MemorySizeAdjustedUp(newSize); AZ_MEMORY_PROFILE(ProfileReallocationBegin(ptr, newSize)); - AZ_PROFILE_MEMORY_FREE(AZ::Debug::ProfileCategory::MemoryReserved, ptr); + AZ_PROFILE_MEMORY_FREE(MemoryReserved, ptr); pointer_type newAddress = m_allocator->ReAllocate(ptr, newSize, newAlignment); - AZ_PROFILE_MEMORY_ALLOC(AZ::Debug::ProfileCategory::MemoryReserved, newAddress, newSize, "SystemAllocator realloc"); + AZ_PROFILE_MEMORY_ALLOC(MemoryReserved, newAddress, newSize, "SystemAllocator realloc"); AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newAddress, newSize, newAlignment)); return newAddress; diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp index fa61a225c8..018f9ed15a 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp @@ -291,7 +291,7 @@ void ScriptSystemComponent::OnSystemTick() if (contextContainer.m_context->GetId() == ScriptContextIds::DefaultScriptContextId) { size_t memoryUsageBytes = contextContainer.m_context->GetMemoryUsage(); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Script, memoryUsageBytes / 1024.0, "Script Memory (KB)"); + AZ_PROFILE_DATAPOINT(Script, memoryUsageBytes / 1024.0, "Script Memory (KB)"); } #endif // AZ_PROFILE_TELEMETRY diff --git a/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp b/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp index 12bb474cfe..edc0e8398b 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp @@ -143,7 +143,7 @@ namespace AZ //========================================================================= void DataNodeTree::Build(const void* rootClassPtr, const Uuid& rootClassId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); m_root.Reset(); m_currentNode = nullptr; @@ -1400,7 +1400,7 @@ namespace AZ AddressTypeElement AddressTypeSerializer::LoadAddressElementFromPath(const AZStd::string& pathElement) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // AddressTypeElement default constructor defaults to an invalid addressElement AddressTypeElement addressElement; @@ -1485,13 +1485,13 @@ namespace AZ /// Load the class data from a stream. bool AddressTypeSerializer::Load(void* classPtr, IO::GenericStream& stream, unsigned int version, bool isDataBigEndian /*= false*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); (void)isDataBigEndian; constexpr unsigned int version1PathAddress = 1; if (version < version1PathAddress) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "AddressTypeSerializer::Load::LegacyUpgrade"); + AZ_PROFILE_SCOPE(AzCore, "AddressTypeSerializer::Load::LegacyUpgrade"); // Grab the AddressType object to be filled AddressType* address = reinterpret_cast(classPtr); address->clear(); @@ -1516,7 +1516,7 @@ namespace AZ } else { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "AddressTypeSerializer::Load::CurrentFlow"); + AZ_PROFILE_SCOPE(AzCore, "AddressTypeSerializer::Load::CurrentFlow"); // Grab the AddressType object to be filled AddressType* address = reinterpret_cast(classPtr); address->clear(); @@ -1749,7 +1749,7 @@ namespace AZ const FlagsMap& targetFlagsMap, SerializeContext* context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!source || !target) { @@ -1804,7 +1804,7 @@ namespace AZ targetTree.Build(target, targetClassId); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "DataPatch::Create:RecursiveCallToCompareElements"); + AZ_PROFILE_SCOPE(AzCore, "DataPatch::Create:RecursiveCallToCompareElements"); sourceTree.CompareElements( &sourceTree.m_root, @@ -1829,7 +1829,7 @@ namespace AZ const FlagsMap& sourceFlagsMap, const FlagsMap& targetFlagsMap) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!source) { @@ -1870,7 +1870,7 @@ namespace AZ { // Loop over the original data patch and make a copy of the key value pair - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "DataPatch::Apply:UpgradeDataPatch"); + AZ_PROFILE_SCOPE(AzCore, "DataPatch::Apply:UpgradeDataPatch"); // Copy of the patch element is purposefully being created here(notice no ampersand) so that the UpgradeDataPatch // function can modify the key and insert it into the fixed patch map for (PatchMap::value_type patch : m_patch) @@ -1883,7 +1883,7 @@ namespace AZ // Build a mapping of child patches for quick look-up: [parent patch address] -> [list of patches for child elements (parentAddress + one more address element)] ChildPatchMap childPatchMap; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "DataPatch::Apply:GenerateChildPatchMap"); + AZ_PROFILE_SCOPE(AzCore, "DataPatch::Apply:GenerateChildPatchMap"); for (auto& patch : fixedPatch) { AddressType parentAddress = patch.first; @@ -1921,7 +1921,7 @@ namespace AZ } } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "DataPatch::Apply:RecursiveCallToApplyToElements"); + AZ_PROFILE_SCOPE(AzCore, "DataPatch::Apply:RecursiveCallToApplyToElements"); int rootContainerElementCounter = 0; result = DataNodeTree::ApplyToElements( @@ -2015,7 +2015,7 @@ namespace AZ */ bool LegacyDataPatchConverter(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ::Outcome conversionResult = LegacyDataPatchConverter_Impl(context, classElement); if (!conversionResult.IsSuccess()) @@ -2043,7 +2043,7 @@ namespace AZ */ AZ::Outcome LegacyDataPatchConverter_Impl(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Pull the targetClassId value out of the class element before it gets cleared when converting the DataPatch TypeId AZ::TypeId targetClassTypeId; if (!classElement.GetChildData(AZ_CRC("m_targetClassId", 0xcabab9dc), targetClassTypeId)) diff --git a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp index e0ee18633b..73ab174699 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp @@ -786,7 +786,7 @@ namespace AZ // Serializable leaf element. else if (classData->m_serializer) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "ObjectStreamImpl::LoadClass Load"); + AZ_PROFILE_SCOPE(AzCore, "ObjectStreamImpl::LoadClass Load"); // Wrap the stream IO::GenericStream* currentStream = &m_inStream; @@ -1929,7 +1929,7 @@ namespace AZ //========================================================================= bool ObjectStreamImpl::Start() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); ++m_pending; diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp b/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp index fdc7cd94b6..c8e6c28679 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp @@ -24,7 +24,7 @@ namespace AZ { bool LoadObjectFromStreamInPlace(IO::GenericStream& stream, AZ::SerializeContext* context, const SerializeContext::ClassData* objectClassData, void* targetPointer, const FilterDescriptor& filterDesc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(objectClassData, "Class data is required."); @@ -72,7 +72,7 @@ namespace AZ bool LoadObjectFromStreamInPlace(IO::GenericStream& stream, AZ::SerializeContext* context, const Uuid& targetClassId, void* targetPointer, const FilterDescriptor& filterDesc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!context) { @@ -111,7 +111,7 @@ namespace AZ void* LoadObjectFromStream(IO::GenericStream& stream, AZ::SerializeContext* context, const Uuid* targetClassId, const FilterDescriptor& filterDesc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!context) { @@ -169,7 +169,7 @@ namespace AZ void* LoadObjectFromFile(const AZStd::string& filePath, const Uuid& targetClassId, SerializeContext* context, const FilterDescriptor& filterDesc, int /*platformFlags*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ::IO::FileIOStream fileStream; if (!fileStream.Open(filePath.c_str(), IO::OpenMode::ModeRead | IO::OpenMode::ModeBinary)) @@ -183,7 +183,7 @@ namespace AZ bool SaveObjectToStream(IO::GenericStream& stream, DataStream::StreamType streamType, const void* classPtr, const Uuid& classId, SerializeContext* context, const SerializeContext::ClassData* classData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!context) { @@ -243,7 +243,7 @@ namespace AZ bool SaveObjectToFile(const AZStd::string& filePath, DataStream::StreamType fileType, const void* classPtr, const Uuid& classId, SerializeContext* context, int platformFlags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // \note This is ok for tools, but we should use the streamer to write objects directly (no memory store) AZStd::vector dstData; diff --git a/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp b/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp index 4cfccfa8bb..23a197b2ad 100644 --- a/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp +++ b/Code/Framework/AzCore/AzCore/Slice/SliceComponent.cpp @@ -198,7 +198,7 @@ namespace AZ const EntityIdToEntityIdMap* remapFromIdToId/*=nullptr*/, const DataFlagsTransformFunction& dataFlagsTransformFn/*=nullptr*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); for (const auto& entityIdFlagsMapPair : from.m_entityToDataFlags) { @@ -240,7 +240,7 @@ namespace AZ //========================================================================= DataPatch::FlagsMap SliceComponent::DataFlagsPerEntity::GetDataFlagsForPatching(const EntityIdToEntityIdMap* remapFromIdToId /*=nullptr*/) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Collect together data flags from all entities DataPatch::FlagsMap dataFlagsForAllEntities; @@ -423,7 +423,7 @@ namespace AZ //========================================================================= void SliceComponent::DataFlagsPerEntity::Cleanup(const EntityList& validEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); EntityIdSet validEntityIds; for (const Entity* entity : validEntities) @@ -677,7 +677,7 @@ namespace AZ //========================================================================= SliceComponent::SliceInstance* SliceComponent::SliceReference::PrepareCreateInstance(const SliceInstanceId& sliceInstanceId, bool allowUninstantiated) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // create an empty instance (just copy of the existing data) SliceInstance* instance = CreateEmptyInstance(sliceInstanceId); @@ -737,7 +737,7 @@ namespace AZ AZ::SerializeContext* serializeContext, const AZ::IdUtils::Remapper::IdMapper& customMapper) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!remapContainer) { @@ -808,7 +808,7 @@ namespace AZ SliceComponent::SliceInstance* SliceComponent::SliceReference::CreateInstance(const AZ::IdUtils::Remapper::IdMapper& customMapper, SliceInstanceId sliceInstanceId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Validate that we are able to create an instance at this time // If we are instantiated then this includes verifying that we have a valid component and asset @@ -842,7 +842,7 @@ namespace AZ const EntityIdToEntityIdMap assetToLiveIdMap, SliceInstanceId sliceInstanceId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Validate that we are able to create an instance at this time // This includes verifying that we are instantiated, and have a valid component and asset @@ -883,7 +883,7 @@ namespace AZ SliceComponent::SliceInstance* SliceComponent::SliceReference::CloneInstance(SliceComponent::SliceInstance* instance, SliceComponent::EntityIdToEntityIdMap& sourceToCloneEntityIdMap) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // check if source instance belongs to this slice reference auto findIt = AZStd::find_if(m_instances.begin(), m_instances.end(), [instance](const SliceInstance& element) -> bool { return &element == instance; }); @@ -1053,7 +1053,7 @@ namespace AZ //========================================================================= bool SliceComponent::SliceReference::Instantiate(const AZ::ObjectStream::FilterDescriptor& filterDesc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (m_isInstantiated) { @@ -1145,7 +1145,7 @@ namespace AZ //========================================================================= void SliceComponent::SliceReference::InstantiateInstance(SliceInstance& instance, const AZ::ObjectStream::FilterDescriptor& filterDesc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Could have set this during SliceInstance() constructor, but we wait until instantiation since it involves allocation. instance.m_dataFlags.SetIsValidEntityFunction([&instance](EntityId entityId) { return instance.IsValidEntity(entityId); }); @@ -1167,7 +1167,7 @@ namespace AZ // An empty map indicates its a fresh instance (i.e. has never be instantiated and then serialized). if (entityIdMap.empty()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "SliceComponent::SliceReference::InstantiateInstance:FreshInstanceClone"); + AZ_PROFILE_SCOPE(AzCore, "SliceComponent::SliceReference::InstantiateInstance:FreshInstanceClone"); // Generate new Ids and populate the map. AZ_Assert(!dataPatch.IsValid(), "Data patch is valid for slice instance, but entity Id map is not!"); @@ -1175,7 +1175,7 @@ namespace AZ } else { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "SliceComponent::SliceReference::InstantiateInstance:CloneAndApplyDataPatches"); + AZ_PROFILE_SCOPE(AzCore, "SliceComponent::SliceReference::InstantiateInstance:CloneAndApplyDataPatches"); // Clone entities while applying any data patches. AZ_Assert(dataPatch.IsValid(), "Data patch is not valid for existing slice instance!"); @@ -1261,7 +1261,7 @@ namespace AZ // Broadcast OnSliceEntitiesLoaded for freshly instantiated entities. if (!instance.m_instantiated->m_entities.empty()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "SliceComponent::SliceReference::InstantiateInstance:OnSliceEntitiesLoaded"); + AZ_PROFILE_SCOPE(AzCore, "SliceComponent::SliceReference::InstantiateInstance:OnSliceEntitiesLoaded"); SliceAssetSerializationNotificationBus::Broadcast(&SliceAssetSerializationNotificationBus::Events::OnSliceEntitiesLoaded, instance.m_instantiated->m_entities); } } @@ -1363,7 +1363,7 @@ namespace AZ //========================================================================= void SliceComponent::SliceReference::ComputeDataPatch() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // Get source entities from the base asset (instantiate if needed) InstantiatedContainer source(m_asset.Get()->GetComponent(), false); @@ -1499,7 +1499,7 @@ namespace AZ //========================================================================= bool SliceComponent::GetEntities(EntityList& entities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); bool result = true; @@ -1532,7 +1532,7 @@ namespace AZ //========================================================================= bool SliceComponent::GetEntityIds(EntityIdSet& entities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); bool result = true; @@ -1582,7 +1582,7 @@ namespace AZ //========================================================================= bool SliceComponent::GetMetadataEntityIds(EntityIdSet& metadataEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); bool result = true; @@ -1654,7 +1654,7 @@ namespace AZ //========================================================================= SliceComponent::InstantiateResult SliceComponent::Instantiate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZStd::unique_lock lock(m_instantiateMutex); if (m_slicesAreInstantiated) @@ -1856,7 +1856,7 @@ namespace AZ SliceComponent::SliceInstanceAddress SliceComponent::AddSliceUsingExistingEntities(const Data::Asset& sliceAsset, const AZ::SliceComponent::EntityIdToEntityIdMap& liveToAssetMap, SliceInstanceId sliceInstanceId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!sliceAsset.Get()->GetComponent()) { @@ -2337,7 +2337,7 @@ namespace AZ //========================================================================= bool SliceComponent::RemoveSliceInstance(SliceComponent::SliceInstanceAddress sliceAddress) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!sliceAddress.IsValid()) { AZ_Error("Slices", false, "Slice address is invalid."); @@ -2474,7 +2474,7 @@ namespace AZ bool SliceComponent::RemoveMetaDataEntity(EntityId metaDataEntityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); GetEntityInfoMap(); // Ensure map is built @@ -2567,7 +2567,7 @@ namespace AZ void SliceComponent::RemoveAllEntities(bool deleteEntities, bool removeEmptyInstances) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); // If we are deleting the entities, we need to do that one by one if (deleteEntities) @@ -2930,7 +2930,7 @@ namespace AZ //========================================================================= void SliceComponent::OnAssetReloaded(Data::Asset /*asset*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!m_myAsset) { @@ -3073,7 +3073,7 @@ namespace AZ /// Called right after we finish writing data to the instance pointed at by classPtr. void OnWriteEnd(void* classPtr) override { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); SliceComponent* sliceComponent = reinterpret_cast(classPtr); EBUS_EVENT(SliceAssetSerializationNotificationBus, OnWriteDataToSliceAssetEnd, *sliceComponent); @@ -3082,7 +3082,7 @@ namespace AZ // We can't broadcast this event for instanced entities yet, since they don't exist until instantiation. if (!sliceComponent->GetNewEntities().empty()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "SliceComponentSerializationEvents::OnWriteEnd:OnSliceEntitiesLoaded"); + AZ_PROFILE_SCOPE(AzCore, "SliceComponentSerializationEvents::OnWriteEnd:OnSliceEntitiesLoaded"); EBUS_EVENT(SliceAssetSerializationNotificationBus, OnSliceEntitiesLoaded, sliceComponent->GetNewEntities()); } } @@ -3093,7 +3093,7 @@ namespace AZ //========================================================================= void SliceComponent::PrepareSave() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (m_slicesAreInstantiated) { @@ -3262,7 +3262,7 @@ namespace AZ //========================================================================= void SliceComponent::BuildEntityInfoMap() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); m_entityInfoMap.clear(); m_metaDataEntityInfoMap.clear(); @@ -3425,7 +3425,7 @@ namespace AZ //========================================================================= void SliceComponent::BuildDataFlagsForInstances() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(IsInstantiated(), "Slice must be instantiated before the ancestry of its data flags can be calculated."); // Use lock since slice instantiation can occur from multiple threads @@ -3551,7 +3551,7 @@ namespace AZ { // if this function is a performance bottleneck, it could be optimized with caching // be wary not to create the cache in-game if the information is only needed by tools - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!IsInstantiated()) { @@ -3730,7 +3730,7 @@ namespace AZ //========================================================================= SliceComponent* SliceComponent::Clone(AZ::SerializeContext& serializeContext, SliceInstanceToSliceInstanceMap* sourceToCloneSliceInstanceMap) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); SliceComponent* clonedComponent = serializeContext.CloneObject(this); diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h index 7d55a88f19..4f58e0cb73 100644 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h @@ -24,7 +24,7 @@ #endif // #if defined(AZ_PROFILE_SCOPE) #define AZ_PROFILE_SCOPE(profiler, scopeNameId) \ - static_assert(profiler < AZ::Debug::ProfileCategory::Count, "Invalid profiler category"); \ + static_assert(profiler < Count, "Invalid profiler category"); \ static const AZStd::string AZ_JOIN(blockName, __LINE__)(scopeNameId); \ AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, AZ_JOIN(blockName, __LINE__)); @@ -34,7 +34,7 @@ namespace AZ { namespace Statistics { - using StatisticalProfilerId = AZ::Debug::ProfileCategory; + using StatisticalProfilerId = AZ::Name; //! This AZ::Interface<> (Yes, it is an application wide singleton) owns an array of StatisticalProfilers. //! When is this useful? @@ -124,8 +124,8 @@ namespace AZ StatisticalProfilerProxy() { - m_profilers.reserve(static_cast(AZ::Debug::ProfileCategory::Count)); - for (AZStd::size_t i = 0; i < static_cast(AZ::Debug::ProfileCategory::Count); i++) + m_profilers.reserve(static_cast(Count)); + for (AZStd::size_t i = 0; i < static_cast(Count); i++) { m_profilers.emplace_back(StatisticalProfilerType()); } @@ -162,7 +162,7 @@ namespace AZ } private: - AZStd::bitset(AZ::Debug::ProfileCategory::Count)> m_activeProfilersFlag; + AZStd::bitset(Count)> m_activeProfilersFlag; AZStd::vector m_profilers; }; //class StatisticalProfilerProxy diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h index c9adc4de2f..4b5c58f426 100644 --- a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h +++ b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h @@ -17,7 +17,7 @@ namespace AZ /** * @brief Specialization useful for data generated with AZ::Debug::FrameProfileComponent * - * Timer based data collection using AZ_PROFILE_TIMER(...), available in + * Timer based data collection using AZ_PROFILE_SCOPE(...), available in * AzCore/Debug/Profiler.h can be collected when using AZ::Debug::FrameProfilerComponent * and AZ::Debug::FrameProfilerBus. The method PushTimeDataSample(...) is a convenience * to convert those Timer registers into a RunningStatistic. diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 0c95b9d592..79d3e321ec 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -99,6 +99,7 @@ set(FILES Debug/FrameProfilerComponent.cpp Debug/FrameProfilerComponent.h Debug/IEventLogger.h + Debug/MemoryProfiler.h Debug/ProfileModuleInit.cpp Debug/ProfileModuleInit.h Debug/Profiler.cpp @@ -565,10 +566,6 @@ set(FILES Statistics/NamedRunningStatistic.h Statistics/RunningStatistic.cpp Statistics/RunningStatistic.h - Statistics/StatisticalProfiler.h - Statistics/StatisticalProfilerProxy.h - Statistics/StatisticalProfilerProxySystemComponent.cpp - Statistics/StatisticalProfilerProxySystemComponent.h Statistics/StatisticsManager.h Statistics/TimeDataStatisticsManager.cpp Statistics/TimeDataStatisticsManager.h diff --git a/Code/Framework/AzCore/AzCore/std/parallel/spin_mutex.h b/Code/Framework/AzCore/AzCore/std/parallel/spin_mutex.h index 926e404668..2fc4c331ee 100644 --- a/Code/Framework/AzCore/AzCore/std/parallel/spin_mutex.h +++ b/Code/Framework/AzCore/AzCore/std/parallel/spin_mutex.h @@ -8,7 +8,6 @@ #ifndef AZSTD_PARALLEL_SPIN_MUTEX_H #define AZSTD_PARALLEL_SPIN_MUTEX_H 1 -#include #include #include @@ -32,8 +31,6 @@ namespace AZStd bool expected = false; if (!m_flag.compare_exchange_weak(expected, true, memory_order_acq_rel, memory_order_acquire)) { - AZ_PROFILE_FUNCTION_STALL(AZ::Debug::ProfileCategory::AzCore); - exponential_backoff backoff; for (;; ) { diff --git a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h b/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h index 3337df9ede..7677c985c6 100644 --- a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h +++ b/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h @@ -35,21 +35,17 @@ namespace ProfileTelemetryInternal } } -#define AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category) (static_cast(1) << static_cast(category)) +#define AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category) (static_cast(1) << static_cast(category)) // Helpers -#define AZ_INTERNAL_PROF_VERIFY_CAT(category) static_assert(category < AZ::Debug::ProfileCategory::Count, "Invalid profile category") - #define AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category) (AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category) | \ AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(AZ::Debug::ProfileCategory::MemoryReserved)) #define AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) static_assert(sizeof(id) <= sizeof(tm_uint64), "Interval id must be a unique value no larger than 64-bits") #define AZ_INTERNAL_PROF_TM_FUNC_VERIFY_CAT(category, flags) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmFunction(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), flags) #define AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, flags, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmZone(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), flags, __VA_ARGS__) // AZ_PROFILE_FUNCTION @@ -91,28 +87,23 @@ namespace ProfileTelemetryInternal // For profiling events that do not start and stop in the same scope (they MUST start/stop on the same thread) // ALWAYS favor using scoped events (AZ_PROFILE_FUNCTION, AZ_PROFILE_SCOPE) as debugging an unmatched begin/end can be challenging #define AZ_PROFILE_EVENT_BEGIN(category, name) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmEnter(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), TMZF_NONE, name) #define AZ_PROFILE_EVENT_END(category) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmLeave(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category)) // AZ_PROFILE_INTERVAL (mapped to Telemetry Timespan APIs) // Note: using C-style casting as we allow either pointers or integral types as IDs #define AZ_PROFILE_INTERVAL_START(category, id, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ tmBeginTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id), TMZF_NONE, __VA_ARGS__) #define AZ_PROFILE_INTERVAL_START_COLORED(category, id, color, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ tmBeginColoredTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id), 0, ProfileTelemetryInternal::ConvertColor(color), TMZF_NONE, __VA_ARGS__) #define AZ_PROFILE_INTERVAL_END(category, id) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ tmEndTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id)) @@ -122,7 +113,6 @@ namespace ProfileTelemetryInternal // Note: the first variable argument must be a const format string // Usage: AZ_PROFILE_INTERVAL_SCOPED(AZ::Debug::ProfileCategory, , , format args...) #define AZ_PROFILE_INTERVAL_SCOPED(category, id, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ tmTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id), TM_MIN_TIME_SPAN_TRACK_ID + static_cast(category), 0, TMZF_NONE, __VA_ARGS__) @@ -131,29 +121,23 @@ namespace ProfileTelemetryInternal // Note: data points can have static or dynamic names, if using a dynamic name the first variable argument must be a const format string // Usage: AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory, , format args...) #define AZ_PROFILE_DATAPOINT(category, value, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmPlot(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), TM_PLOT_UNITS_REAL, TM_PLOT_DRAW_LINE, static_cast(value), __VA_ARGS__) #define AZ_PROFILE_DATAPOINT_PERCENT(category, value, ...) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmPlot(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), TM_PLOT_UNITS_PERCENTAGE_DIRECT, TM_PLOT_DRAW_LINE, static_cast(value), __VA_ARGS__) // AZ_PROFILE_MEMORY_ALLOC #define AZ_PROFILE_MEMORY_ALLOC(category, address, size, context) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmAlloc(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), address, size, context) #define AZ_PROFILE_MEMORY_ALLOC_EX(category, filename, lineNumber, address, size, context) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmAllocEx(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), filename, lineNumber, address, size, context) #define AZ_PROFILE_MEMORY_FREE(category, address) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmFree(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), address) #define AZ_PROFILE_MEMORY_FREE_EX(category, filename, lineNumber, address) \ - AZ_INTERNAL_PROF_VERIFY_CAT(category); \ tmFreeEx(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), filename, lineNumber, address) #endif diff --git a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp index 797f3e35e8..8f651a9559 100644 --- a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp +++ b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/IO/SystemFile_UnixLike.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -208,7 +209,7 @@ namespace Platform bool DeleteDir(const char* dirName) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "SystemFile::DeleteDir(util) - %s", dirName); + AZ_PROFILE_SCOPE(AzCore, "SystemFile::DeleteDir(util) - %s", dirName); if (dirName) { diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StorageDrive_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StorageDrive_Windows.cpp index 2489749b51..2462af861b 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StorageDrive_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StorageDrive_Windows.cpp @@ -169,7 +169,7 @@ namespace AZ::IO void StorageDriveWin::PrepareRequest(FileRequest* request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(request, "PrepareRequest was provided a null request."); if (AZStd::holds_alternative(request->GetCommand())) @@ -189,7 +189,7 @@ namespace AZ::IO void StorageDriveWin::QueueRequest(FileRequest* request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(request, "QueueRequest was provided a null request."); AZStd::visit([this, request](auto&& args) @@ -459,7 +459,7 @@ namespace AZ::IO // Adding explicit scope here for profiling file Open & Close { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "StorageDriveWin::ReadRequest OpenFile %s", m_name.c_str()); + AZ_PROFILE_SCOPE(AzCore, "StorageDriveWin::ReadRequest OpenFile %s", m_name.c_str()); TIMED_AVERAGE_WINDOW_SCOPE(m_fileOpenCloseTimeAverage); // All reads are overlapped (asynchronous). @@ -516,7 +516,7 @@ namespace AZ::IO bool StorageDriveWin::ReadRequest(FileRequest* request) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "StorageDriveWin::ReadRequest %s", m_name.c_str()); + AZ_PROFILE_SCOPE(AzCore, "StorageDriveWin::ReadRequest %s", m_name.c_str()); if (!m_cachesInitialized) { @@ -545,7 +545,7 @@ namespace AZ::IO bool StorageDriveWin::ReadRequest(FileRequest* request, size_t readSlot) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "StorageDriveWin::ReadRequest %s", m_name.c_str()); + AZ_PROFILE_SCOPE(AzCore, "StorageDriveWin::ReadRequest %s", m_name.c_str()); if (!m_context->GetStreamerThreadSynchronizer().AreEventHandlesAvailable()) { @@ -666,7 +666,7 @@ namespace AZ::IO bool result = false; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, "StorageDriveWin::ReadRequest ::ReadFile"); + AZ_PROFILE_SCOPE(AzCore, "StorageDriveWin::ReadRequest ::ReadFile"); result = ::ReadFile(file, output, readSize, nullptr, overlapped); } @@ -782,7 +782,7 @@ namespace AZ::IO { auto& fileExists = AZStd::get(request->GetCommand()); - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "StorageDriveWin::FileExistsRequest %s : %s", + AZ_PROFILE_SCOPE(AzCore, "StorageDriveWin::FileExistsRequest %s : %s", m_name.c_str(), fileExists.m_path.GetRelativePath()); TIMED_AVERAGE_WINDOW_SCOPE(m_getFileExistsTimeAverage); @@ -838,7 +838,7 @@ namespace AZ::IO { auto& command = AZStd::get(request->GetCommand()); - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, "StorageDriveWin::FileMetaDataRetrievalRequest %s : %s", + AZ_PROFILE_SCOPE(AzCore, "StorageDriveWin::FileMetaDataRetrievalRequest %s : %s", m_name.c_str(), command.m_path.GetRelativePath()); TIMED_AVERAGE_WINDOW_SCOPE(m_getFileMetaDataRetrievalTimeAverage); @@ -954,7 +954,7 @@ namespace AZ::IO bool StorageDriveWin::FinalizeReads() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); bool hasWorked = false; for (size_t readSlot = 0; readSlot < m_readSlots_active.size(); ++readSlot) diff --git a/Code/Framework/AzCore/Tests/Components.cpp b/Code/Framework/AzCore/Tests/Components.cpp index b14dcbbe53..45193f4d1e 100644 --- a/Code/Framework/AzCore/Tests/Components.cpp +++ b/Code/Framework/AzCore/Tests/Components.cpp @@ -1244,19 +1244,18 @@ namespace UnitTest int ChildFunction(int input) { - AZ_PROFILE_TIMER("UnitTest", nullptr, NamedRegister); + AZ_PROFILE_FUNCTION(System); int result = 5; for (int i = 0; i < 10000; ++i) { result += i % (input + 3); } - AZ_PROFILE_TIMER_END(NamedRegister); return result; } int ChildFunction1(int input) { - AZ_PROFILE_TIMER("UnitTest", "Child1"); + AZ_PROFILE_SCOPE(System, "Child1"); int result = 5; for (int i = 0; i < 10000; ++i) { @@ -1267,7 +1266,7 @@ namespace UnitTest int Profile1(int numIterations) { - AZ_PROFILE_TIMER("UnitTest", "Custom name"); + AZ_PROFILE_SCOPE(System, "Custom name"); int result = 0; for (int i = 0; i < numIterations; ++i) { diff --git a/Code/Framework/AzCore/Tests/Debug.cpp b/Code/Framework/AzCore/Tests/Debug.cpp index 6181823737..0d6e1a51e0 100644 --- a/Code/Framework/AzCore/Tests/Debug.cpp +++ b/Code/Framework/AzCore/Tests/Debug.cpp @@ -171,276 +171,6 @@ namespace UnitTest run(); } - class ProfilerTest - : public AllocatorsFixture - { - public: - int m_numRegistersReceived; - - bool ReadRegisterCallback(const ProfilerRegister& reg, const AZStd::thread_id& id) - { - (void)reg; - (void)id; - switch (reg.m_type) - { - case ProfilerRegister::PRT_TIME: - { - AZ_TEST_ASSERT(reg.m_timeData.m_time > 0); - AZ_TEST_ASSERT(reg.m_timeData.m_calls > 0); - } break; - case ProfilerRegister::PRT_VALUE: - { - AZ_TEST_ASSERT(reg.m_userValues.m_value1 == 1 || reg.m_userValues.m_value1 == 2); - AZ_TEST_ASSERT(reg.m_userValues.m_value2 == 0 || reg.m_userValues.m_value2 == 2 || reg.m_userValues.m_value2 == 4); - AZ_TEST_ASSERT(reg.m_userValues.m_value3 == 0 || reg.m_userValues.m_value3 == 3 || reg.m_userValues.m_value3 == 6); - AZ_TEST_ASSERT(reg.m_userValues.m_value4 == 0 || reg.m_userValues.m_value4 == 4 || reg.m_userValues.m_value4 == 8); - AZ_TEST_ASSERT(reg.m_userValues.m_value5 == 0 || reg.m_userValues.m_value5 == 5 || reg.m_userValues.m_value5 == 10); - } break; - } - - //AZ::u64 threadId = (AZ::u64)id.m_id; - //AZ_TracePrintf("Profiler","[%llu] '%s' '%s'(%d) %d Ms (Child calls: %d time: %d Ms) Parent: '%s'!\n",threadId, - // reg.m_name,reg.m_function,reg.m_line,reg.m_time.count(),reg.m_childrenCalls,reg.m_childrenTime.count(),reg.m_lastParent ? reg.m_lastParent->m_name : "No"); - ++m_numRegistersReceived; - return true; - } - - int ChildFunction(int input) - { - AZ_PROFILE_TIMER("UnitTest"); - - auto start = AZStd::chrono::system_clock::now(); - - int result = 5; - for (int i = 0; i < 30000; ++i) - { - result += i % (input + 3); - } - - auto end = AZStd::chrono::system_clock::now(); - AZ_TEST_ASSERT(end >= start); - while (end <= start) - { - end = AZStd::chrono::system_clock::now(); - } - return result; - } - - int ChildFunction1(int input) - { - AZ_PROFILE_TIMER("UnitTest", "Child1"); - - auto start = AZStd::chrono::system_clock::now(); - - int result = 5; - for (int i = 0; i < 30000; ++i) - { - result += i % (input + 1); - } - - - auto end = AZStd::chrono::system_clock::now(); - AZ_TEST_ASSERT(end >= start); - while (end <= start) - { - end = AZStd::chrono::system_clock::now(); - } - - return result; - } - - int Profile1(int numIterations) - { - AZ_PROFILE_TIMER("UnitTest", "Custom name"); - int result = 0; - for (int i = 0; i < numIterations; ++i) - { - result += ChildFunction(i); - } - - result += ChildFunction1(numIterations / 3); - return result; - } - - void UserValuesSet() - { - AZ_PROFILE_VALUE_SET("UnitTest", "UserValues1", 1); - AZ_PROFILE_VALUE_SET("UnitTest", "UserValues2", 1, 2); - AZ_PROFILE_VALUE_SET("UnitTest", "UserValues3", 1, 2, 3); - AZ::s64 v1 = 1, v2 = 2, v3 = 3, v4 = 4, v5 = 5; - AZ_PROFILE_VALUE_SET("UnitTest", "UserValues4", v1, v2, v3, v4); - AZ_PROFILE_VALUE_SET("UnitTest", "UserValues5", v1, v2, v3, v4, v5); - - // test named register - AZ_PROFILE_VALUE_SET_NAMED("UnitTest", "UserValues5", userValues5, v1, v2, v3, v4, v5); -#if defined(AZ_PROFILER_MACRO_DISABLE) - (void)v1; - (void)v2; - (void)v3; - (void)v4; - (void)v5; -#else - AZ_TEST_ASSERT(userValues5 != nullptr); -#endif // !defined(AZ_PROFILER_MACRO_DISABLE) - } - - void UserValuesAdd(int numAdditions) - { - for (int i = 0; i < numAdditions; ++i) - { - AZ_PROFILE_VALUE_ADD("UnitTest", "UserValues1", 1); - AZ_PROFILE_VALUE_ADD("UnitTest", "UserValues2", 1, 2); - AZ_PROFILE_VALUE_ADD("UnitTest", "UserValues3", 1, 2, 3); - AZ::s64 v1 = 1, v2 = 2, v3 = 3, v4 = 4, v5 = 5; - AZ_PROFILE_VALUE_ADD("UnitTest", "UserValues4", v1, v2, v3, v4); - AZ_PROFILE_VALUE_ADD("UnitTest", "UserValues5", v1, v2, v3, v4, v5); - - // test named register - AZ_PROFILE_VALUE_ADD_NAMED("UnitTest", "UserValues5", userValues5, v1, v2, v3, v4, v5); -#if defined(AZ_PROFILER_MACRO_DISABLE) - (void)v1; - (void)v2; - (void)v3; - (void)v4; - (void)v5; -#else - AZ_TEST_ASSERT(userValues5 != nullptr); -#endif // !defined(AZ_PROFILER_MACRO_DISABLE) - } - } - - void run() - { - AZ_TEST_ASSERT(!Profiler::IsReady()); - Profiler::Create(); - AZ_TEST_ASSERT(Profiler::IsReady()); - Profiler::Destroy(); - AZ_TEST_ASSERT(!Profiler::IsReady()); - -#if !defined(AZ_PROFILER_MACRO_DISABLE) - Profiler::Create(); - - //Profile1(); - - //Profiler::Instance().ReadRegisterValues(AZStd::bind(&ProfilerTest::ReadRegisterCallback,this,AZStd::placeholders::_1,AZStd::placeholders::_2)); - - //Profiler::Instance().ResetRegisters(); - - AZStd::thread_id removeThreadId; - AZStd::chrono::microseconds elapsed[2]; - int numIterations = 10000; - for (int i = 0; i < 2; ++i) - { - // for the second run we should not record any data - if (i == 1) - { - Profiler::Instance().DeactivateSystem("UnitTest"); - } - - AZStd::chrono::system_clock::time_point start = AZStd::chrono::system_clock::now(); - AZStd::thread t1(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t2(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t3(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t4(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t5(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t6(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t7(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - AZStd::thread t8(AZStd::bind(&ProfilerTest::Profile1, this, numIterations)); - - removeThreadId = t4.get_id(); - - t1.join(); - t2.join(); - t3.join(); - t4.join(); - t5.join(); - t6.join(); - t7.join(); - t8.join(); - elapsed[i] = AZStd::chrono::system_clock::now() - start; - //AZ_Printf("Profiler","Elapsed time %d\n",elapsed[i].count()); - - if (i == 0) - { - // just as test remove all associated data and registers. - Profiler::Instance().RemoveThreadData(removeThreadId); - } - - m_numRegistersReceived = 0; - Profiler::Instance().ReadRegisterValues(AZStd::bind(&ProfilerTest::ReadRegisterCallback, this, AZStd::placeholders::_1, AZStd::placeholders::_2)); - if (i == 0) - { - AZ_TEST_ASSERT(m_numRegistersReceived == 7 * 3); // 3 registers for each thread (8 threads - 1 we removed the data for 't4') - } - else - { - AZ_TEST_ASSERT(m_numRegistersReceived == 0); - } - } - Profiler::Destroy(); - - // Test user value registers - Profiler::Create(); - - for (int i = 0; i < 2; ++i) - { - // for the second run we should not record any data - if (i == 1) - { - Profiler::Instance().DeactivateSystem("UnitTest"); - } - - AZStd::thread t1(AZStd::bind(&ProfilerTest::UserValuesSet, this)); - AZStd::thread t2(AZStd::bind(&ProfilerTest::UserValuesSet, this)); - AZStd::thread t3(AZStd::bind(&ProfilerTest::UserValuesSet, this)); - AZStd::thread t4(AZStd::bind(&ProfilerTest::UserValuesSet, this)); - AZStd::thread t5(AZStd::bind(&ProfilerTest::UserValuesAdd, this, 2)); - AZStd::thread t6(AZStd::bind(&ProfilerTest::UserValuesAdd, this, 2)); - AZStd::thread t7(AZStd::bind(&ProfilerTest::UserValuesAdd, this, 2)); - AZStd::thread t8(AZStd::bind(&ProfilerTest::UserValuesAdd, this, 2)); - - removeThreadId = t4.get_id(); - - t1.join(); - t2.join(); - t3.join(); - t4.join(); - t5.join(); - t6.join(); - t7.join(); - t8.join(); - - if (i == 0) - { - // just as test remove all associated data and registers. - Profiler::Instance().RemoveThreadData(removeThreadId); - } - - m_numRegistersReceived = 0; - Profiler::Instance().ReadRegisterValues(AZStd::bind(&ProfilerTest::ReadRegisterCallback, this, AZStd::placeholders::_1, AZStd::placeholders::_2)); - if (i == 0) - { - AZ_TEST_ASSERT(m_numRegistersReceived == 7 * 6); // 6 registers for each thread (8 threads - 1 we removed the data for 't4' ) - } - else - { - AZ_TEST_ASSERT(m_numRegistersReceived == 0); - } - } - Profiler::Destroy(); -#endif - } - }; -#if AZ_TRAIT_DISABLE_FAILED_PROFILER_TEST - TEST_F(ProfilerTest, DISABLED_Test) -#else - TEST_F(ProfilerTest, Test) -#endif // AZ_TRAIT_DISABLE_FAILED_PROFILER_TEST - - { - run(); - } - TEST(Time, Test) { AZStd::sys_time_t ticksPerSecond = AZStd::GetTimeTicksPerSecond(); diff --git a/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp b/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp index 04e70d92a5..6d6023b872 100644 --- a/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp +++ b/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp @@ -317,7 +317,7 @@ namespace UnitTest AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); AZ::Statistics::StatisticalProfilerProxy profilerProxy; AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdPerformance = "PerformanceResult"; const AZStd::string statNamePerformance("PerformanceResult"); @@ -328,15 +328,15 @@ namespace UnitTest ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + proxy->ActivateProfiler(Terrain, true); const int iter_count = 10; { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdPerformance) + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdPerformance) int counter = 0; for (int i = 0; i < iter_count; i++) { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdBlock) + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdBlock) counter++; } } @@ -348,7 +348,7 @@ namespace UnitTest EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); //Clean Up - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + proxy->ActivateProfiler(Terrain, false); #undef CODE_PROFILER_PROXY_PUSH_TIME @@ -362,12 +362,12 @@ namespace UnitTest const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread1("simple_thread1"); const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread1_loop("simple_thread1_loop"); - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread1); + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread1); static int counter = 0; for (int i = 0; i < loop_cnt; i++) { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread1_loop); + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread1_loop); counter++; } } @@ -377,12 +377,12 @@ namespace UnitTest const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread2("simple_thread2"); const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread2_loop("simple_thread2_loop"); - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread2); + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread2); static int counter = 0; for (int i = 0; i < loop_cnt; i++) { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread2_loop); + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread2_loop); counter++; } } @@ -392,12 +392,12 @@ namespace UnitTest const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread3("simple_thread3"); const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread3_loop("simple_thread3_loop"); - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread3); + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread3); static int counter = 0; for (int i = 0; i < loop_cnt; i++) { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread3_loop); + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread3_loop); } } @@ -408,7 +408,7 @@ namespace UnitTest AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); AZ::Statistics::StatisticalProfilerProxy profilerProxy; AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1 = "simple_thread1"; const AZStd::string statNameThread1("simple_thread1"); @@ -432,7 +432,7 @@ namespace UnitTest ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + proxy->ActivateProfiler(Terrain, true); //Let's kickoff the threads to see how much contention affects the profiler's performance. const int iter_count = 10; @@ -459,7 +459,7 @@ namespace UnitTest EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); //Clean Up - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + proxy->ActivateProfiler(Terrain, false); } /** Trace message handler to track messages during tests @@ -745,7 +745,7 @@ namespace UnitTest AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); AZ::Statistics::StatisticalProfilerProxy profilerProxy; AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdPerformance = "PerformanceResult"; const AZStd::string statNamePerformance("PerformanceResult"); @@ -756,15 +756,15 @@ namespace UnitTest ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + proxy->ActivateProfiler(Terrain, true); const int iter_count = 1000000; { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdPerformance) + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdPerformance) int counter = 0; for (int i = 0; i < iter_count; i++) { - CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdBlock) + CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdBlock) counter++; } } @@ -778,7 +778,7 @@ namespace UnitTest profiler.LogAndResetStats("StatisticalProfilerProxy"); //Clean Up - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + proxy->ActivateProfiler(Terrain, false); } #undef CODE_PROFILER_PROXY_PUSH_TIME @@ -788,7 +788,7 @@ namespace UnitTest AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); AZ::Statistics::StatisticalProfilerProxy profilerProxy; AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1 = "simple_thread1"; const AZStd::string statNameThread1("simple_thread1"); @@ -812,7 +812,7 @@ namespace UnitTest ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + proxy->ActivateProfiler(Terrain, true); //Let's kickoff the threads to see how much contention affects the profiler's performance. const int iter_count = 1000000; @@ -841,7 +841,7 @@ namespace UnitTest profiler.LogAndResetStats("3_Threads_StatisticalProfilerProxy"); //Clean Up - proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + proxy->ActivateProfiler(Terrain, false); } }//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp index 50856b1df8..192d9dc7f6 100644 --- a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp +++ b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp @@ -83,7 +83,7 @@ namespace UnitTest int ChildFunction0(int numIterations, int sleepTimeMilliseconds) { - AZ_PROFILE_TIMER("UnitTest", CHILD_TIMER_STAT0); + AZ_PROFILE_SCOPE(AzCore, CHILD_TIMER_STAT0); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); int result = 5; for (int i = 0; i < numIterations; ++i) @@ -95,7 +95,7 @@ namespace UnitTest int ChildFunction1(int numIterations, int sleepTimeMilliseconds) { - AZ_PROFILE_TIMER("UnitTest", CHILD_TIMER_STAT1); + AZ_PROFILE_SCOPE(AzCore, CHILD_TIMER_STAT1); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); int result = 5; for (int i = 0; i < numIterations; ++i) @@ -107,7 +107,7 @@ namespace UnitTest int ParentFunction(int numIterations, int sleepTimeMilliseconds) { - AZ_PROFILE_TIMER("UnitTest", PARENT_TIMER_STAT); + AZ_PROFILE_SCOPE(AzCore, PARENT_TIMER_STAT); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); int result = 0; result += ChildFunction0(numIterations, sleepTimeMilliseconds); diff --git a/Code/Framework/AzCore/Tests/azcoretests_files.cmake b/Code/Framework/AzCore/Tests/azcoretests_files.cmake index ca0e2862fc..911eaa7b10 100644 --- a/Code/Framework/AzCore/Tests/azcoretests_files.cmake +++ b/Code/Framework/AzCore/Tests/azcoretests_files.cmake @@ -60,7 +60,6 @@ set(FILES SerializeContextFixture.h Slice.cpp State.cpp - StatisticalProfiler.cpp Statistics.cpp StreamerTests.cpp StringFunc.cpp diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp index 7b4c328af9..abd97aee0d 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -540,7 +541,7 @@ namespace AzFramework const AZStd::function& workForNewThread, const char* newThreadName) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); AZStd::thread_desc newThreadDesc; newThreadDesc.m_cpuId = AFFINITY_MASK_USERTHREADS; @@ -548,7 +549,7 @@ namespace AzFramework AZStd::binary_semaphore binarySemaphore; AZStd::thread newThread([&workForNewThread, &binarySemaphore, &newThreadName] { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzFramework, + AZ_PROFILE_SCOPE(AzFramework, "Application::PumpSystemEventLoopWhileDoingWorkInNewThread:ThreadWorker %s", newThreadName); workForNewThread(); @@ -559,7 +560,7 @@ namespace AzFramework PumpSystemEventLoopUntilEmpty(); } { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(AZ::Debug::ProfileCategory::AzFramework, + AZ_PROFILE_SCOPE(AzFramework, "Application::PumpSystemEventLoopWhileDoingWorkInNewThread:WaitOnThread %s", newThreadName); newThread.join(); } @@ -571,10 +572,14 @@ namespace AzFramework //////////////////////////////////////////////////////////////////////////// void Application::RunMainLoop() { + uint32_t frameCounter = 0; while (!m_exitMainLoopRequested) { PumpSystemEventLoopUntilEmpty(); + + AZ_PROFILE_SCOPE(AzCore, "Frame %i", frameCounter); Tick(); + ++frameCounter; } } diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index a3d2103650..d263ad3d0b 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -206,7 +207,7 @@ namespace AZ::IO::ArchiveInternal ////////////////////////////////////////////////////////////////////////// size_t ArchiveInternal::CZipPseudoFile::FRead(void* pDest, size_t nSize, size_t nCount, [[maybe_unused]] AZ::IO::HandleType fileHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!GetFile()) { @@ -271,7 +272,7 @@ namespace AZ::IO::ArchiveInternal ////////////////////////////////////////////////////////////////////////// void* ArchiveInternal::CZipPseudoFile::GetFileData(size_t& nFileSize, [[maybe_unused]] AZ::IO::HandleType fileHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); if (!GetFile()) { @@ -685,7 +686,7 @@ namespace AZ::IO ////////////////////////////////////////////////////////////////////////// AZ::IO::HandleType Archive::FOpen(AZStd::string_view pName, const char* szMode, uint32_t nInputFlags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); const size_t pathLen = pName.size(); if (pathLen == 0 || pathLen >= MaxPath) @@ -693,7 +694,7 @@ namespace AZ::IO return AZ::IO::InvalidHandle; } - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Game, "File: %.*s Archive: %p", + AZ_PROFILE_SCOPE(Game, "File: %.*s Archive: %p", aznumeric_cast(pName.size()), pName.data(), this); SAutoCollectFileAccessTime accessTime(this); @@ -716,7 +717,7 @@ namespace AZ::IO } const bool fileWritable = (nOSFlags & (AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeAppend | AZ::IO::OpenMode::ModeUpdate)) != AZ::IO::OpenMode::Invalid; - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Game, "File: %s Archive: %p", szFullPath->c_str(), this); + AZ_PROFILE_SCOPE(Game, "File: %s Archive: %p", szFullPath->c_str(), this); if (fileWritable) { // we need to open the file for writing, but we failed to do so. @@ -1094,8 +1095,8 @@ namespace AZ::IO ////////////////////////////////////////////////////////////////////////// size_t Archive::FReadRaw(void* pData, size_t nSize, size_t nCount, AZ::IO::HandleType fileHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Game, "Size: %d Archive: %p", nSize, this); + AZ_PROFILE_FUNCTION(AzCore); + AZ_PROFILE_SCOPE(Game, "Size: %d Archive: %p", nSize, this); SAutoCollectFileAccessTime accessTime(this); ArchiveInternal::CZipPseudoFile* pseudoFile = GetPseudoFile(fileHandle); @@ -1112,7 +1113,7 @@ namespace AZ::IO ////////////////////////////////////////////////////////////////////////// size_t Archive::FReadRawAll(void* pData, size_t nFileSize, AZ::IO::HandleType fileHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); SAutoCollectFileAccessTime accessTime(this); ArchiveInternal::CZipPseudoFile* pseudoFile = GetPseudoFile(fileHandle); @@ -1130,7 +1131,7 @@ namespace AZ::IO ////////////////////////////////////////////////////////////////////////// void* Archive::FGetCachedFileData(AZ::IO::HandleType fileHandle, size_t& nFileSize) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); SAutoCollectFileAccessTime accessTime(this); ArchiveInternal::CZipPseudoFile* pseudoFile = GetPseudoFile(fileHandle); diff --git a/Code/Framework/AzFramework/AzFramework/Entity/EntityContext.cpp b/Code/Framework/AzFramework/AzFramework/Entity/EntityContext.cpp index a323033001..c1283c9379 100644 --- a/Code/Framework/AzFramework/AzFramework/Entity/EntityContext.cpp +++ b/Code/Framework/AzFramework/AzFramework/Entity/EntityContext.cpp @@ -167,7 +167,7 @@ namespace AzFramework //========================================================================= void EntityContext::HandleEntitiesAdded(const EntityList& entities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); for (AZ::Entity* entity : entities) { @@ -184,7 +184,7 @@ namespace AzFramework //========================================================================= void EntityContext::HandleEntitiesRemoved(const EntityIdList& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); for (AZ::EntityId id : entityIds) { diff --git a/Code/Framework/AzFramework/AzFramework/Entity/SliceEntityOwnershipService.cpp b/Code/Framework/AzFramework/AzFramework/Entity/SliceEntityOwnershipService.cpp index 8ed89ee121..9a077cd611 100644 --- a/Code/Framework/AzFramework/AzFramework/Entity/SliceEntityOwnershipService.cpp +++ b/Code/Framework/AzFramework/AzFramework/Entity/SliceEntityOwnershipService.cpp @@ -155,7 +155,7 @@ namespace AzFramework void SliceEntityOwnershipService::CreateRootSlice() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); AZ_Assert(m_rootAsset && m_rootAsset.Get(), "Root slice asset has not been created yet."); @@ -164,7 +164,7 @@ namespace AzFramework void SliceEntityOwnershipService::CreateRootSlice(AZ::SliceAsset* rootSliceAsset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); AZ_Assert(m_rootAsset && m_rootAsset.Get(), "Root slice asset has not been created yet."); AZ::Entity* rootEntity = new AZ::Entity(); @@ -240,7 +240,7 @@ namespace AzFramework bool SliceEntityOwnershipService::LoadFromStream(AZ::IO::GenericStream& stream, bool remapIds, EntityIdToEntityIdMap* idRemapTable, const AZ::ObjectStream::FilterDescriptor& filterDesc) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); AZ_Assert(m_rootAsset, "The entity ownership service has not been initialized."); @@ -259,7 +259,7 @@ namespace AzFramework bool SliceEntityOwnershipService::HandleRootEntityReloadedFromStream(AZ::Entity* rootEntity, bool remapIds, AZ::SliceComponent::EntityIdToEntityIdMap* idRemapTable) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); if (!rootEntity) { @@ -385,7 +385,7 @@ namespace AzFramework void SliceEntityOwnershipService::OnAssetReady(AZ::Data::Asset readyAsset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); AZ_ASSET_ATTACH_TO_SCOPE(readyAsset.Get()); AZ_Assert(readyAsset.GetAs(), "Asset is not a slice!"); @@ -472,7 +472,7 @@ namespace AzFramework void SliceEntityOwnershipService::OnAssetReloaded(AZ::Data::Asset asset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); if (asset == m_rootAsset && asset.Get() != m_rootAsset.Get()) { Reset(); @@ -548,7 +548,7 @@ namespace AzFramework AZ::SliceComponent::SliceInstanceAddress SliceEntityOwnershipService::CloneSliceInstance( AZ::SliceComponent::SliceInstanceAddress sourceInstance, AZ::SliceComponent::EntityIdToEntityIdMap& sourceToCloneEntityIdMap) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); AZ_Assert(sourceInstance.IsValid(), "Source slice instance is invalid."); diff --git a/Code/Framework/AzFramework/AzFramework/IO/RemoteStorageDrive.cpp b/Code/Framework/AzFramework/AzFramework/IO/RemoteStorageDrive.cpp index 5b38a5e966..8db0c27475 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/RemoteStorageDrive.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/RemoteStorageDrive.cpp @@ -80,7 +80,7 @@ namespace AzFramework { using namespace AZ::IO; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); AZ_Assert(request, "PrepareRequest was provided a null request."); if (AZStd::holds_alternative(request->GetCommand())) @@ -278,7 +278,7 @@ namespace AzFramework { using namespace AZ::IO; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); auto data = AZStd::get_if(&request->GetCommand()); AZ_Assert(data, "Request doing reading in the RemoteStorageDrive didn't contain read data.") @@ -424,7 +424,7 @@ namespace AzFramework { using namespace AZ::IO; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore); + AZ_PROFILE_FUNCTION(AzCore); TIMED_AVERAGE_WINDOW_SCOPE(m_getFileMetaDataTimeAverage); AZ::u64 fileSize = 0; diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index 6b25c49b88..aaf2de3e58 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -619,7 +619,7 @@ namespace AzFramework //========================================================================= void ScriptComponent::LoadScript() { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Script, "Load: %s", m_script.GetHint().c_str()); + AZ_PROFILE_SCOPE(Script, "Load: %s", m_script.GetHint().c_str()); // Load the script, find the base table, create the entity table // find the Activate/Deactivate functions in the script and call them @@ -634,7 +634,7 @@ namespace AzFramework //========================================================================= void ScriptComponent::UnloadScript() { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Script, "Unload: %s", m_script.GetHint().c_str()); + AZ_PROFILE_SCOPE(Script, "Unload: %s", m_script.GetHint().c_str()); DestroyEntityTable(); } @@ -822,7 +822,7 @@ namespace AzFramework lua_rawget(lua, baseStackIndex); // ScriptTable[OnActivate] if (lua_isfunction(lua, -1)) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Script, "OnActivate"); + AZ_PROFILE_SCOPE(Script, "OnActivate"); lua_rawgeti(lua, LUA_REGISTRYINDEX, m_table); // push the entity table as the only argument AZ::Internal::LuaSafeCall(lua, 1, 0); // Call OnActivate } @@ -856,7 +856,7 @@ namespace AzFramework lua_rawget(lua, -2); // ScriptTable[OnDeactivte] if (lua_isfunction(lua, -1)) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Script, "OnDeactivate"); + AZ_PROFILE_SCOPE(Script, "OnDeactivate"); lua_pushvalue(lua, -3); // push the entity table as the only argument AZ::Internal::LuaSafeCall(lua, 1, 0); // Call OnDeactivate diff --git a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp index eec384a695..c1ce31613c 100644 --- a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp @@ -625,7 +625,7 @@ namespace AzFramework return; } - AZ_PROFILE_TIMER("TargetManager"); + AZ_PROFILE_SCOPE(AzFramework, "TargetManager::SendTmMessage"); AZStd::vector msgBuffer; AZ::IO::ByteContainerStream > outMsg(&msgBuffer); @@ -651,7 +651,7 @@ namespace AzFramework void TargetManagementComponent::DispatchMessages(MsgSlotId id) { - AZ_PROFILE_TIMER("TargetManager"); + AZ_PROFILE_SCOPE(AzFramework, "TargetManager::DispatchMessages"); AZStd::lock_guard lock(m_inboxMutex); size_t maxMsgsToProcess = m_inbox.size(); TmMsgQueue::iterator itMsg = m_inbox.begin(); @@ -684,7 +684,7 @@ namespace AzFramework { if (m_networkImpl->m_gridMate) { - AZ_PROFILE_TIMER("TargetManager"); + AZ_PROFILE_SCOPE(AzFramework, "TargetManager::Tick"); if (!m_networkImpl->m_session && !m_networkImpl->m_gridSearch) { if (AZStd::chrono::system_clock::now() > m_reconnectionTime) @@ -694,7 +694,7 @@ namespace AzFramework } { - AZ_PROFILE_TIMER("TargetManager", "Tick Gridmate"); + AZ_PROFILE_SCOPE(AzFramework, "TargetManager::Tick Gridmate"); m_networkImpl->m_gridMate->Update(); if (m_networkImpl->m_session && m_networkImpl->m_session->GetReplicaMgr()) { @@ -707,7 +707,7 @@ namespace AzFramework if (m_networkImpl->m_session) { - AZ_PROFILE_TIMER("TargetManager", "Send/Receive TmMsgs"); + AZ_PROFILE_SCOPE(AzFramework, "TargetManager::Tick Send/Receive TmMsgs"); // Receive for (unsigned int i = 0; i < m_networkImpl->m_session->GetNumberOfMembers(); ++i) diff --git a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp index c5253a8c89..bfa9dfcf9e 100644 --- a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp +++ b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp @@ -8,6 +8,7 @@ #include "EntityVisibilityBoundsUnionSystem.h" +#include #include #include @@ -42,7 +43,7 @@ namespace AzFramework void EntityVisibilityBoundsUnionSystem::OnEntityActivated(AZ::Entity* entity) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); // ignore any entity that might activate which does not have a TransformComponent if (entity->GetTransform() == nullptr) @@ -68,7 +69,7 @@ namespace AzFramework void EntityVisibilityBoundsUnionSystem::OnEntityDeactivated(AZ::Entity* entity) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); // ignore any entity that might deactivate which does not have a TransformComponent if (entity->GetTransform() == nullptr) @@ -89,7 +90,7 @@ namespace AzFramework void EntityVisibilityBoundsUnionSystem::UpdateVisibilitySystem(AZ::Entity* entity, EntityVisibilityBoundsUnionInstance& instance) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); if (const auto& localEntityBoundsUnions = instance.m_localEntityBoundsUnion; localEntityBoundsUnions.IsValid()) { @@ -136,7 +137,7 @@ namespace AzFramework void EntityVisibilityBoundsUnionSystem::ProcessEntityBoundsUnionRequests() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); // iterate over all entities whose bounds changed and recalculate them for (const auto& entity : m_entityBoundsDirty) @@ -155,7 +156,7 @@ namespace AzFramework void EntityVisibilityBoundsUnionSystem::OnTransformUpdated(AZ::Entity* entity) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); // update the world transform of the visibility bounds union if (auto instance_it = m_entityVisibilityBoundsUnionInstanceMapping.find(entity); diff --git a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityQuery.cpp b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityQuery.cpp index 2023cb969d..96d371fa12 100644 --- a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityQuery.cpp +++ b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityQuery.cpp @@ -34,7 +34,7 @@ namespace AzFramework { void EntityVisibilityQuery::UpdateVisibility(const AzFramework::CameraState& cameraState) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzFramework); + AZ_PROFILE_FUNCTION(AzFramework); auto* visSystem = AZ::Interface::Get(); if (!visSystem) diff --git a/Code/Framework/AzTest/AzTest/Platform/Android/AzTest_Traits_Android.h b/Code/Framework/AzTest/AzTest/Platform/Android/AzTest_Traits_Android.h index b210fb9b62..cfd04d2a8b 100644 --- a/Code/Framework/AzTest/AzTest/Platform/Android/AzTest_Traits_Android.h +++ b/Code/Framework/AzTest/AzTest/Platform/Android/AzTest_Traits_Android.h @@ -30,7 +30,6 @@ #define AZ_TRAIT_DISABLE_FAILED_MULTIPLAYER_GRIDMATE_TESTS true #define AZ_TRAIT_DISABLE_FAILED_NETWORKING_TESTS true #define AZ_TRAIT_DISABLE_FAILED_PHYSICS_TESTS true -#define AZ_TRAIT_DISABLE_FAILED_PROFILER_TEST true #define AZ_TRAIT_DISABLE_FAILED_SAVE_DATA_TESTS true #define AZ_TRAIT_DISABLE_FAILED_SERIALIZE_BASIC_TEST true #define AZ_TRAIT_DISABLE_FAILED_STREAMER_TESTS true diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp index 56ef749247..3e895465e5 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp @@ -95,7 +95,7 @@ namespace AzToolsFramework template void DeleteEntities(const IdContainerType& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entityIds.empty()) { @@ -141,7 +141,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities"); for (const auto& entityId : entityIds) { AZ::Entity* entity = NULL; @@ -160,7 +160,7 @@ namespace AzToolsFramework selCommand->SetParent(currentUndoBatch); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "Internal::DeleteEntities:RunRedo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:RunRedo"); selCommand->RunRedo(); } } @@ -458,7 +458,7 @@ namespace AzToolsFramework bool ToolsApplication::RemoveEntity(AZ::Entity* entity) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto undoCacheInterface = AZ::Interface::Get(); if (undoCacheInterface) @@ -472,7 +472,7 @@ namespace AzToolsFramework EBUS_EVENT(ToolsApplicationEvents::Bus, EntityDeregistered, entity->GetId()); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "ToolsApplication::RemoveEntity:CallApplicationRemoveEntity"); + AZ_PROFILE_SCOPE(AzToolsFramework, "ToolsApplication::RemoveEntity:CallApplicationRemoveEntity"); if (AzFramework::Application::RemoveEntity(entity)) { return true; @@ -545,7 +545,7 @@ namespace AzToolsFramework void ToolsApplication::MarkEntitySelected(AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(entityId.IsValid(), "Invalid entity Id being marked as selected."); EntityIdList::iterator foundIter = AZStd::find(m_selectedEntities.begin(), m_selectedEntities.end(), entityId); @@ -563,7 +563,7 @@ namespace AzToolsFramework void ToolsApplication::MarkEntitiesSelected(const EntityIdList& entitiesToSelect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EntityIdList entitiesSelected; entitiesSelected.reserve(entitiesToSelect.size()); @@ -587,11 +587,11 @@ namespace AzToolsFramework void ToolsApplication::MarkEntityDeselected(AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto foundIter = AZStd::find(m_selectedEntities.begin(), m_selectedEntities.end(), entityId); if (foundIter != m_selectedEntities.end()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "ToolsApplication::MarkEntityDeselected:Deselect"); + AZ_PROFILE_SCOPE(AzToolsFramework, "ToolsApplication::MarkEntityDeselected:Deselect"); ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::BeforeEntitySelectionChanged); m_selectedEntities.erase(foundIter); @@ -603,7 +603,7 @@ namespace AzToolsFramework void ToolsApplication::MarkEntitiesDeselected(const EntityIdList& entitiesToDeselect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::BeforeEntitySelectionChanged); @@ -633,14 +633,14 @@ namespace AzToolsFramework void ToolsApplication::SetEntityHighlighted(AZ::EntityId entityId, bool highlighted) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto foundIter = AZStd::find(m_highlightedEntities.begin(), m_highlightedEntities.end(), entityId); if (foundIter != m_highlightedEntities.end()) { if (!highlighted) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "ToolsApplication::SetEntityHighlighted:RemoveHighlight"); + AZ_PROFILE_SCOPE(AzToolsFramework, "ToolsApplication::SetEntityHighlighted:RemoveHighlight"); ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::BeforeEntityHighlightingChanged); m_highlightedEntities.erase(foundIter); ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::AfterEntityHighlightingChanged); @@ -648,7 +648,7 @@ namespace AzToolsFramework } else if (highlighted) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "ToolsApplication::SetEntityHighlighted:AddHighlight"); + AZ_PROFILE_SCOPE(AzToolsFramework, "ToolsApplication::SetEntityHighlighted:AddHighlight"); ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::BeforeEntityHighlightingChanged); m_highlightedEntities.push_back(entityId); ToolsApplicationEvents::Bus::Broadcast(&ToolsApplicationEvents::AfterEntityHighlightingChanged); @@ -657,7 +657,7 @@ namespace AzToolsFramework void ToolsApplication::SetSelectedEntities(const EntityIdList& selectedEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // We're setting the selection set as a batch from an external caller. // * Filter out any unselectable entities @@ -1535,7 +1535,7 @@ namespace AzToolsFramework void ToolsApplication::CreateUndosForDirtyEntities() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(!m_isDuringUndoRedo, "Cannot add dirty entities during undo/redo."); if (m_dirtyEntities.empty()) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/EntityStateCommand.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/EntityStateCommand.cpp index 9f251bee7a..b73e1ea5ac 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/EntityStateCommand.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/EntityStateCommand.cpp @@ -54,7 +54,7 @@ namespace AzToolsFramework void EntityStateCommand::Capture(AZ::Entity* pSourceEntity, bool captureUndo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_entityID = pSourceEntity->GetId(); EBUS_EVENT_ID_RESULT(m_entityContextId, m_entityID, AzFramework::EntityIdContextQueryBus, GetOwningContextId); @@ -114,7 +114,7 @@ namespace AzToolsFramework void EntityStateCommand::RestoreEntity(const AZ::u8* buffer, AZStd::size_t bufferSizeBytes, const AZ::SliceComponent::EntityRestoreInfo& sliceRestoreInfo) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(buffer, "No data to undo!"); AZ_Assert(bufferSizeBytes, "Undo data is empty."); @@ -259,7 +259,7 @@ namespace AzToolsFramework void EntityDeleteCommand::Redo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EBUS_EVENT(AZ::ComponentApplicationBus, DeleteEntity, m_entityID); PreemptiveUndoCache::Get()->PurgeCache(m_entityID); } @@ -277,7 +277,7 @@ namespace AzToolsFramework void EntityCreateCommand::Undo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EBUS_EVENT(AZ::ComponentApplicationBus, DeleteEntity, m_entityID); PreemptiveUndoCache::Get()->PurgeCache(m_entityID); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp index 4d84089a74..d4c4fa1e65 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp @@ -86,7 +86,7 @@ namespace AzToolsFramework void PreemptiveUndoCache::UpdateCache(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // capture it diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.cpp index b45ffdd31d..90657132ca 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityContextComponent.cpp @@ -312,7 +312,7 @@ namespace AzToolsFramework EntityList& resultEntities, EntityIdToEntityIdMap& sourceToCloneEntityIdMap) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); resultEntities.clear(); @@ -365,7 +365,7 @@ namespace AzToolsFramework const EntityList& entitiesInLayers, AZ::SliceComponent::SliceReferenceToInstancePtrs& instancesInLayers) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_isLegacySliceService) { @@ -390,7 +390,7 @@ namespace AzToolsFramework //========================================================================= bool EditorEntityContextComponent::SaveToStreamForGame(AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_isLegacySliceService) { SliceEditorEntityOwnershipService* editorEntityOwnershipService = @@ -409,7 +409,7 @@ namespace AzToolsFramework //========================================================================= bool EditorEntityContextComponent::LoadFromStream(AZ::IO::GenericStream& stream) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(stream.IsOpen(), "Invalid source stream."); AZ_Assert(m_entityOwnershipService->IsInitialized(), "The context has not been initialized."); @@ -427,7 +427,7 @@ namespace AzToolsFramework bool EditorEntityContextComponent::LoadFromStreamWithLayers(AZ::IO::GenericStream& stream, QString levelPakFile) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(stream.IsOpen(), "Invalid source stream."); AZ_Assert(m_entityOwnershipService->IsInitialized(), "The context has not been initialized."); @@ -477,7 +477,7 @@ namespace AzToolsFramework //========================================================================= void EditorEntityContextComponent::StartPlayInEditor() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnStartPlayInEditorBegin); @@ -513,7 +513,7 @@ namespace AzToolsFramework //========================================================================= void EditorEntityContextComponent::StopPlayInEditor() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_isRunningGame = false; @@ -696,13 +696,13 @@ namespace AzToolsFramework //========================================================================= void EditorEntityContextComponent::SetupEditorEntities(const EntityList& entities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Data::AssetManager::Instance().SuspendAssetRelease(); // All editor entities are automatically activated. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:ScrubEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:ScrubEntities"); // Scrub entities before initialization. // Anything could go wrong with entities loaded from disk. @@ -712,7 +712,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:InitEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:InitEntities"); for (AZ::Entity* entity : entities) { if (entity->GetState() == AZ::Entity::State::Constructed) @@ -723,7 +723,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:CreateEditorRepresentations"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:CreateEditorRepresentations"); for (AZ::Entity* entity : entities) { EditorRequests::Bus::Broadcast(&EditorRequests::CreateEditorRepresentation, entity); @@ -731,7 +731,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:ActivateEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityContextComponent::SetupEditorEntities:ActivateEntities"); for (AZ::Entity* entity : entities) { if (entity->GetState() == AZ::Entity::State::Init) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp index 17ea732103..0b0358d613 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp @@ -323,7 +323,7 @@ namespace AzToolsFramework void AddEntityIdToSortInfo(const AZ::EntityId parentId, const AZ::EntityId childId, bool forceAddToBack) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::EntityId sortEntityId = GetEntityIdForSortInfo(parentId); bool success = false; @@ -336,7 +336,7 @@ namespace AzToolsFramework void AddEntityIdToSortInfo(const AZ::EntityId parentId, const AZ::EntityId childId, const AZ::EntityId beforeEntity) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::EntityId sortEntityId = GetEntityIdForSortInfo(parentId); bool success = false; @@ -349,7 +349,7 @@ namespace AzToolsFramework bool RecoverEntitySortInfo(const AZ::EntityId parentId, const AZ::EntityId childId, AZ::u64 sortIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EntityOrderArray entityOrderArray; EditorEntitySortRequestBus::EventResult(entityOrderArray, GetEntityIdForSortInfo(parentId), &EditorEntitySortRequestBus::Events::GetChildEntityOrderArray); @@ -372,7 +372,7 @@ namespace AzToolsFramework void RemoveEntityIdFromSortInfo(const AZ::EntityId parentId, const AZ::EntityId childId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::EntityId sortEntityId = GetEntityIdForSortInfo(parentId); bool success = false; @@ -385,7 +385,7 @@ namespace AzToolsFramework bool SetEntityChildOrder(const AZ::EntityId parentId, const EntityIdList& children) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto sortEntityId = GetEntityIdForSortInfo(parentId); bool success = false; @@ -399,7 +399,7 @@ namespace AzToolsFramework EntityIdList GetEntityChildOrder(const AZ::EntityId parentId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EntityIdList children; EditorEntityInfoRequestBus::EventResult(children, parentId, &EditorEntityInfoRequestBus::Events::GetChildren); @@ -441,7 +441,7 @@ namespace AzToolsFramework //sort vector of entities by how they're arranged void SortEntitiesByLocationInHierarchy(EntityIdList& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //cache locations for faster sort AZStd::unordered_map> locations; for (auto entityId : entityIds) @@ -575,7 +575,7 @@ namespace AzToolsFramework bool IsSelected(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); bool selected = false; EditorEntityInfoRequestBus::EventResult( @@ -585,7 +585,7 @@ namespace AzToolsFramework bool IsSelectableInViewport(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); bool visible = false; EditorEntityInfoRequestBus::EventResult( @@ -602,7 +602,7 @@ namespace AzToolsFramework const AZ::EntityId entityId, const bool locked, const AZ::EntityId toggledEntityId, const bool toggledEntityWasLayer) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!entityId.IsValid()) { @@ -661,7 +661,7 @@ namespace AzToolsFramework // note: must be called on layer entity static void UnlockLayer(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EditorLockComponentRequestBus::Event( entityId, &EditorLockComponentRequestBus::Events::SetLocked, false); @@ -698,7 +698,7 @@ namespace AzToolsFramework void SetEntityLockState(const AZ::EntityId entityId, const bool locked) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // when an entity is unlocked, if it was in a locked layer(s), unlock those layers if (!locked) @@ -736,7 +736,7 @@ namespace AzToolsFramework void ToggleEntityLockState(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entityId.IsValid()) { @@ -772,7 +772,7 @@ namespace AzToolsFramework static void SetEntityVisibilityInternal(const AZ::EntityId entityId, const bool visibility) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); bool layerEntity = false; Layers::EditorLayerComponentRequestBus::EventResult( @@ -795,7 +795,7 @@ namespace AzToolsFramework // note: must be called on layer entity static void ShowLayer(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); SetEntityVisibilityInternal(entityId, true); @@ -830,7 +830,7 @@ namespace AzToolsFramework const AZ::EntityId entityId, const bool visible, const AZ::EntityId toggledEntityId, const bool toggledEntityWasLayer) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!entityId.IsValid()) { @@ -879,7 +879,7 @@ namespace AzToolsFramework void SetEntityVisibility(const AZ::EntityId entityId, const bool visible) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // when an entity is set to visible, if it was in an invisible layer(s), make that layer visible if (visible) @@ -917,7 +917,7 @@ namespace AzToolsFramework void ToggleEntityVisibility(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entityId.IsValid()) { @@ -969,7 +969,7 @@ namespace AzToolsFramework bool IsEntitySetToBeVisible(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Visibility state is tracked in 5 places, see OutlinerListModel::dataForLock for info on 3 of these ways. // Visibility's fourth state over lock is the EditorVisibilityRequestBus has two sets of @@ -1007,7 +1007,7 @@ namespace AzToolsFramework AZ::Vector3 GetWorldTranslation(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Vector3 worldTranslation = AZ::Vector3::CreateZero(); AZ::TransformBus::EventResult( @@ -1018,7 +1018,7 @@ namespace AzToolsFramework AZ::Vector3 GetLocalTranslation(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Vector3 localTranslation = AZ::Vector3::CreateZero(); AZ::TransformBus::EventResult( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityModel.cpp index 860c12b11a..8d96cc42fe 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityModel.cpp @@ -38,7 +38,7 @@ namespace bool HasDifferences(T* sourceElem, T* compareElem, bool isRoot, AZ::SerializeContext* serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!sourceElem || !compareElem) { @@ -146,7 +146,7 @@ namespace AzToolsFramework void EditorEntityModel::Reset() { m_preparingForContextReset = false; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //disconnect all entity ids EditorEntitySortNotificationBus::MultiHandler::BusDisconnect(); @@ -209,7 +209,7 @@ namespace AzToolsFramework sortedEntitiesToAdd.reserve(unsortedEntitiesToAdd.size()); { // Sort pending entities - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityModel::AddEntityBatch:Sort"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityModel::AddEntityBatch:Sort"); // Gather basic sorting data for each pending entity and // create map from parent ID to child entries. @@ -307,7 +307,7 @@ namespace AzToolsFramework } { // Add sorted entities - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityModel::AddEntityBatch:Add"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityModel::AddEntityBatch:Add"); for (AZ::EntityId entityId : sortedEntitiesToAdd) { AddEntity(entityId); @@ -325,7 +325,7 @@ namespace AzToolsFramework void EditorEntityModel::AddEntity(AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto& entityInfo = GetInfo(entityId); //initialize and connect this entry to the entity id @@ -374,7 +374,7 @@ namespace AzToolsFramework // Skip doing slow, unecessary work for this bulk operations. return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto& entityInfo = GetInfo(entityId); if (!entityInfo.IsConnected()) { @@ -404,7 +404,7 @@ namespace AzToolsFramework void EditorEntityModel::AddChildToParent(AZ::EntityId parentId, AZ::EntityId childId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(childId != parentId, "AddChildToParent called with same child and parent"); if (childId == parentId || !childId.IsValid()) { @@ -479,7 +479,7 @@ namespace AzToolsFramework void EditorEntityModel::RemoveChildFromParent(AZ::EntityId parentId, AZ::EntityId childId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(childId != parentId, "RemoveChildFromparent called with same child and parent"); AZ_Assert(childId.IsValid(), "RemoveChildFromparent called with an invalid child entity id"); if (childId == parentId || !childId.IsValid()) @@ -544,7 +544,7 @@ namespace AzToolsFramework void EditorEntityModel::ReparentChild(AZ::EntityId entityId, AZ::EntityId newParentId, AZ::EntityId oldParentId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(oldParentId != entityId, "ReparentChild gave us an oldParentId that is the same as the entityId. An entity cannot be a parent of itself, ignoring old parent"); AZ_Assert(newParentId != entityId, "ReparentChild gave us an newParentId that is the same as the entityId. An entity cannot be a parent of itself, ignoring old parent"); if (oldParentId != entityId && newParentId != entityId) @@ -573,7 +573,7 @@ namespace AzToolsFramework void EditorEntityModel::EntityRegistered(AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //when an editor entity is created and registered, add it to a pending list. //once all entities in the pending list are activated, add them to model. bool isEditorEntity = false; @@ -591,7 +591,7 @@ namespace AzToolsFramework void EditorEntityModel::EntityDeregistered(AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //when an editor entity is de-registered, stop tracking it if (m_entityInfoTable.find(entityId) != m_entityInfoTable.end()) { @@ -628,7 +628,7 @@ namespace AzToolsFramework void EditorEntityModel::EntityParentChanged(AZ::EntityId entityId, AZ::EntityId newParentId, AZ::EntityId oldParentId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (GetInfo(entityId).IsConnected()) { ReparentChild(entityId, newParentId, oldParentId); @@ -647,7 +647,7 @@ namespace AzToolsFramework void EditorEntityModel::ChildEntityOrderArrayUpdated() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //when notified that a parent has reordered its children, they must be updated if (m_enableChildReorderHandler) { @@ -671,14 +671,14 @@ namespace AzToolsFramework void EditorEntityModel::OnEditorEntitiesPromotedToSlicedEntities(const AzToolsFramework::EntityIdList& promotedEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); OnEditorEntitiesSliceOwnershipChanged(promotedEntities); } void EditorEntityModel::OnEditorEntitiesSliceOwnershipChanged(const AzToolsFramework::EntityIdList& entityIdList) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Need to update slice info from top of hierarchy down // as parent entity slice status will be querried and needs to be correct @@ -712,7 +712,7 @@ namespace AzToolsFramework void EditorEntityModel::OnEntityStreamLoadSuccess() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //block internal reorder event handling to avoid recursion since we're manually updating everything m_enableChildReorderHandler = false; @@ -722,7 +722,7 @@ namespace AzToolsFramework //refresh all order info while blocking related events (keeps UI observers from updating until refresh is complete) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityModel::OnEntityStreamLoadSuccess:UpdateChildOrderInfo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityModel::OnEntityStreamLoadSuccess:UpdateChildOrderInfo"); for (auto& entityInfoPair : m_entityInfoTable) { if (entityInfoPair.second.IsConnected()) @@ -733,7 +733,7 @@ namespace AzToolsFramework } } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityModel::OnEntityStreamLoadSuccess:UpdateOrderInfo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityModel::OnEntityStreamLoadSuccess:UpdateOrderInfo"); for (auto& entityInfoPair : m_entityInfoTable) { if (entityInfoPair.second.IsConnected()) @@ -778,7 +778,7 @@ namespace AzToolsFramework void EditorEntityModel::OnEntityTransformChanged(const AzToolsFramework::EntityIdList& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (const AZ::EntityId& entityId : entityIds) { @@ -846,7 +846,7 @@ namespace AzToolsFramework void EditorEntityModel::UpdateSliceInfoHierarchy(AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto& entityInfo = GetInfo(entityId); entityInfo.UpdateOrderInfo(false); entityInfo.UpdateSliceInfo(); @@ -896,7 +896,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::Connect() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); Disconnect(); EntityInfoRequestConnect(); @@ -946,7 +946,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::UpdateSliceInfo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //reset slice info m_sliceFlags = (m_sliceFlags & SliceFlag_OverridesMask); // only hold on to the override flags @@ -1037,7 +1037,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::UpdateOrderInfo(bool notify) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::u64 oldIndex = m_indexForSorting; AZ::u64 newIndex = 0; @@ -1061,7 +1061,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::UpdateChildOrderInfo(bool forceAddToBack) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //add order info if missing for (auto childId : m_children) { @@ -1475,7 +1475,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::OnEntityLockFlagChanged(bool locked) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_locked != locked) { @@ -1493,7 +1493,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::OnEntityVisibilityFlagChanged(bool visibility) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_visible != visibility) { @@ -1511,7 +1511,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::OnSelected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_selected) { m_selected = true; @@ -1522,7 +1522,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::OnDeselected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_selected) { m_selected = false; @@ -1533,7 +1533,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::OnEntityNameChanged(const AZStd::string& name) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_name != name) { m_name = name; @@ -1554,7 +1554,7 @@ namespace AzToolsFramework { if (CanProcessOverrides()) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); using TransformComponent = AzToolsFramework::Components::TransformComponent; @@ -1569,7 +1569,7 @@ namespace AzToolsFramework { if (CanProcessOverrides()) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); using EditorInspectorComponent = AzToolsFramework::Components::EditorInspectorComponent; @@ -1584,7 +1584,7 @@ namespace AzToolsFramework { if (CanProcessOverrides()) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Component* liveComponent = m_entity->FindComponent(componentId); AZ::Component* sourceComponent = m_sourceClone->FindComponent(componentId); @@ -1804,7 +1804,7 @@ namespace AzToolsFramework return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::u8 lastFlags = m_sliceFlags; @@ -1884,7 +1884,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::ModifyParentsOverriddenChildren(AZ::EntityId childEntityId, AZ::u8 lastFlags, bool childHasOverrides) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (((lastFlags & SliceFlag_EntityHasOverrides) == 0) != ((m_sliceFlags & SliceFlag_EntityHasOverrides) == 0)) { @@ -1916,7 +1916,7 @@ namespace AzToolsFramework void EditorEntityModel::EditorEntityModelEntry::UpdateCyclicDependencyInfo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Only check cyclic dependency if the current entity is a slice root if (!IsSliceRoot()) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntitySortComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntitySortComponent.cpp index 0e53c180d4..b747469f4d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntitySortComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntitySortComponent.cpp @@ -130,7 +130,7 @@ namespace AzToolsFramework bool EditorEntitySortComponent::SetChildEntityOrderArray(const EntityOrderArray& entityOrderArray) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_childEntityOrderArray != entityOrderArray) { m_childEntityOrderArray = entityOrderArray; @@ -143,7 +143,7 @@ namespace AzToolsFramework bool EditorEntitySortComponent::AddChildEntityInternal(const AZ::EntityId& entityId, bool addToBack, EntityOrderArray::iterator insertPosition) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto entityItr = m_childEntityOrderCache.find(entityId); if (entityItr == m_childEntityOrderCache.end()) { @@ -197,7 +197,7 @@ namespace AzToolsFramework bool EditorEntitySortComponent::RemoveChildEntity(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto entityItr = m_childEntityOrderCache.find(entityId); if (entityItr != m_childEntityOrderCache.end()) { @@ -222,7 +222,7 @@ namespace AzToolsFramework void EditorEntitySortComponent::OnEntityStreamLoadSuccess() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_childEntityOrderCache.clear(); if (!m_childEntityOrderArray.empty()) @@ -320,7 +320,7 @@ namespace AzToolsFramework void EditorEntitySortComponent::RebuildEntityOrderCache() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_childEntityOrderCache.clear(); for (auto entityId : m_childEntityOrderArray) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp index e22800498c..7ac3b7be8f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp @@ -77,7 +77,7 @@ namespace AzToolsFramework AzFramework::SliceInstantiationTicket SliceEditorEntityOwnershipService::InstantiateEditorSlice( const AZ::Data::Asset& sliceAsset, const AZ::Transform& worldTransform) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (sliceAsset.GetId().IsValid()) { @@ -97,7 +97,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::OnSlicePreInstantiate(const AZ::Data::AssetId& sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress& sliceAddress) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AzFramework::SliceInstantiationTicket ticket = *AzFramework::SliceInstantiationResultBus::GetCurrentBusId(); // Start an undo that will wrap the entire slice instantiation event (unable to do this at a higher level since this is queued up by AzFramework and there's no undo concept at that level) @@ -134,7 +134,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress& sliceAddress) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AzFramework::SliceInstantiationTicket ticket = *AzFramework::SliceInstantiationResultBus::GetCurrentBusId(); @@ -149,7 +149,7 @@ namespace AzToolsFramework // Close out the next ticket corresponding to this asset. for (auto instantiatingIter = m_instantiatingSlices.begin(); instantiatingIter != m_instantiatingSlices.end(); ++instantiatingIter) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityContextComponent::OnSliceInstantiated:CloseTicket"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityContextComponent::OnSliceInstantiated:CloseTicket"); if (instantiatingIter->first.GetId() == sliceAssetId) { const AZ::SliceComponent::EntityList& entities = sliceAddressCopy.GetInstance()->GetInstantiated()->m_entities; @@ -165,7 +165,7 @@ namespace AzToolsFramework // Create a slice instantiation undo command. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorEntityContextComponent::OnSliceInstantiated:CloseTicket:CreateInstantiateUndo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorEntityContextComponent::OnSliceInstantiated:CloseTicket:CreateInstantiateUndo"); ScopedUndoBatch undoBatch("Instantiate Slice"); for (AZ::Entity* entity : entities) { @@ -192,7 +192,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AzFramework::SliceInstantiationTicket ticket = *AzFramework::SliceInstantiationResultBus::GetCurrentBusId(); @@ -214,7 +214,7 @@ namespace AzToolsFramework AZ::SliceComponent::SliceInstanceAddress SliceEditorEntityOwnershipService::CloneEditorSliceInstance( AZ::SliceComponent::SliceInstanceAddress sourceInstance, AZ::SliceComponent::EntityIdToEntityIdMap& sourceToCloneEntityIdMap) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (sourceInstance.IsValid()) { @@ -330,7 +330,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::DetachSliceInstances(const AZ::SliceComponent::SliceInstanceAddressSet& instances) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const char* undoMsg = instances.size() == 1 ? "Detach Instance from Slice" : "Detach Instances from Slice"; @@ -359,7 +359,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::DetachSubsliceInstances(const AZ::SliceComponent::SliceInstanceEntityIdRemapList& subsliceRootList) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (subsliceRootList.empty()) { @@ -379,7 +379,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::DetachFromSlice(const AzToolsFramework::EntityIdList& entities, const char* undoMessage) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entities.empty()) { @@ -424,7 +424,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::OnAssetReady(AZ::Data::Asset asset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Data::AssetBus::MultiHandler::BusDisconnect(asset.GetId()); @@ -511,7 +511,7 @@ namespace AzToolsFramework //========================================================================= void SliceEditorEntityOwnershipService::OnAssetReloaded(AZ::Data::Asset asset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EntityIdList selectedEntities; ToolsApplicationRequests::Bus::BroadcastResult(selectedEntities, &ToolsApplicationRequests::GetSelectedEntities); @@ -524,7 +524,7 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::ResetEntitiesToSliceDefaults(EntityIdList entities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch("Resetting entities to slice defaults."); PreemptiveUndoCache* preemptiveUndoCache = nullptr; @@ -646,7 +646,7 @@ namespace AzToolsFramework bool SliceEditorEntityOwnershipService::SaveToStreamForEditor(AZ::IO::GenericStream& stream, const EntityList& entitiesInLayers, AZ::SliceComponent::SliceReferenceToInstancePtrs& instancesInLayers) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(stream.IsOpen(), "Invalid target stream."); AzFramework::RootSliceAsset rootSliceAsset = GetRootAsset(); @@ -685,7 +685,7 @@ namespace AzToolsFramework bool SliceEditorEntityOwnershipService::SaveToStreamForGame(AZ::IO::GenericStream& stream, AZ::DataStream::StreamType streamType) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::SliceComponent::EntityList sourceEntities; GetRootSlice()->GetEntities(sourceEntities); @@ -929,7 +929,7 @@ namespace AzToolsFramework bool SliceEditorEntityOwnershipService::LoadFromStreamWithLayers(AZ::IO::GenericStream& stream, QString levelPakFile) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::ObjectStream::FilterDescriptor filterDesc = AZ::ObjectStream::FilterDescriptor(&AZ::Data::AssetFilterSourceSlicesOnly); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BaseManipulator.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BaseManipulator.cpp index 1a7e7260c5..b514c3957f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BaseManipulator.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/BaseManipulator.cpp @@ -33,7 +33,7 @@ namespace AzToolsFramework bool BaseManipulator::OnLeftMouseDown(const ViewportInteraction::MouseInteraction& interaction, const float rayIntersectionDistance) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_onLeftMouseDownImpl) { @@ -59,7 +59,7 @@ namespace AzToolsFramework bool BaseManipulator::OnRightMouseDown(const ViewportInteraction::MouseInteraction& interaction, const float rayIntersectionDistance) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_onRightMouseDownImpl) { @@ -87,7 +87,7 @@ namespace AzToolsFramework // attached as no active manipulator will have been set in ManipulatorManager. void BaseManipulator::OnLeftMouseUp(const ViewportInteraction::MouseInteraction& interaction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); SetBoundsDirty(); @@ -98,7 +98,7 @@ namespace AzToolsFramework void BaseManipulator::OnRightMouseUp(const ViewportInteraction::MouseInteraction& interaction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); SetBoundsDirty(); @@ -109,7 +109,7 @@ namespace AzToolsFramework bool BaseManipulator::OnMouseOver(const ManipulatorId manipulatorId, const ViewportInteraction::MouseInteraction& interaction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); UpdateMouseOver(manipulatorId); OnMouseOverImpl(manipulatorId, interaction); @@ -125,7 +125,7 @@ namespace AzToolsFramework void BaseManipulator::OnMouseMove(const ViewportInteraction::MouseInteraction& interaction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_performingAction) { @@ -142,7 +142,7 @@ namespace AzToolsFramework void BaseManipulator::SetBoundsDirty() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); SetBoundsDirtyImpl(); } @@ -190,7 +190,7 @@ namespace AzToolsFramework void BaseManipulator::EndAction() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_performingAction) { @@ -235,7 +235,7 @@ namespace AzToolsFramework void BaseManipulator::NotifyEntityComponentPropertyChanged() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (const AZ::EntityComponentIdPair& entityComponentIdPair : m_entityComponentIdPairs) { @@ -268,7 +268,7 @@ namespace AzToolsFramework AZStd::unordered_set::iterator BaseManipulator::RemoveEntityId(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto afterErased = m_entityComponentIdPairs.end(); @@ -297,7 +297,7 @@ namespace AzToolsFramework AZStd::unordered_set::iterator BaseManipulator::RemoveEntityComponentIdPair( const AZ::EntityComponentIdPair& entityComponentIdPair) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto entityIdIt = m_entityComponentIdPairs.find(entityComponentIdPair); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp index fa4fb9ad31..f49df5d029 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp @@ -147,7 +147,7 @@ namespace AzToolsFramework const AZ::Vector3& localManipulatorStartPosition, const AZ::Vector3& localManipulatorOffset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // bind FixedVerticesRequestBus for improved performance typename AZ::FixedVerticesRequestBus::BusPtr fixedVertices; @@ -180,7 +180,7 @@ namespace AzToolsFramework template void InitializeVertexLookup(IndexedTranslationManipulator& translationManipulator, const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // bind FixedVerticesRequestBus for improved performance typename AZ::FixedVerticesRequestBus::BusPtr fixedVertices; @@ -210,7 +210,7 @@ namespace AzToolsFramework const Vertex& vertex, size_t vertexIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // if we have a vertex (translation) manipulator active, ensure // it gets removed when clicking on another selection manipulator @@ -342,7 +342,7 @@ namespace AzToolsFramework const EditorBoxSelect& editorBoxSelect, const AZStd::vector>& selectionManipulators) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // refresh selection manipulators and box select data when modifiers change // (switching from additive to subtractive) @@ -481,7 +481,7 @@ namespace AzToolsFramework const TranslationManipulators::Dimensions dimensions, const TranslationManipulatorConfiguratorFn translationManipulatorConfigurator) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_dimensions = dimensions; m_manipulatorManagerId = managerId; @@ -705,7 +705,7 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::ClearSelected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // if translation manipulator is active, remove it when receiving this event and enable // the hover manipulator bounds again so points can be inserted again @@ -736,7 +736,7 @@ namespace AzToolsFramework void EditorVertexSelectionBase::DisplayEntityViewport( const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_editorBoxSelect.DisplayScene(viewportInfo, debugDisplay); @@ -747,7 +747,7 @@ namespace AzToolsFramework void EditorVertexSelectionBase::DisplayViewport2d( const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_editorBoxSelect.Display2d(viewportInfo, debugDisplay); } @@ -756,7 +756,7 @@ namespace AzToolsFramework template::value>::type*> void EditorVertexSelectionBase::UpdateManipulatorSpace(const AzFramework::ViewportInfo& viewportInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // check if 'shift' is being held to move to parent space bool worldSpace = false; @@ -803,7 +803,7 @@ namespace AzToolsFramework template void EditorVertexSelectionVariable::DestroySelected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = EditorVertexSelectionBase::GetEntityId(); @@ -855,7 +855,7 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::SetSelectedPosition(const AZ::Vector3& localPosition) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_translationManipulator) { @@ -884,7 +884,7 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::RefreshTranslationManipulator() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // bind FixedVerticesRequestBus for improved performance typename AZ::FixedVerticesRequestBus::BusPtr fixedVertices; @@ -915,7 +915,7 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::RefreshLocal() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // we do not want to refresh our local state while a batch movement is in progress, // even if we have been signalled to do so by a callback @@ -955,7 +955,7 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::RefreshSpace(const AZ::Transform& worldFromLocal, const AZ::Vector3& nonUniformScale) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto& manipulator : m_selectionManipulators) { @@ -982,7 +982,7 @@ namespace AzToolsFramework template void EditorVertexSelectionBase::SetBoundsDirty() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto& manipulator : m_selectionManipulators) { @@ -1008,7 +1008,7 @@ namespace AzToolsFramework const AZ::EntityComponentIdPair& entityComponentIdPair, const ManipulatorManagerId managerId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); Vertex vertex; bool found = false; @@ -1078,7 +1078,7 @@ namespace AzToolsFramework const ManipulatorManagerId managerId, const size_t vertexIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // setup selection manipulator const AZStd::shared_ptr selectionView = AzToolsFramework::CreateManipulatorViewSphere( @@ -1115,7 +1115,7 @@ namespace AzToolsFramework const ManipulatorManagerId managerId, const size_t vertexIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // setup selection manipulator const AZStd::shared_ptr manipulatorView = AzToolsFramework::CreateManipulatorViewSphere( @@ -1223,7 +1223,7 @@ namespace AzToolsFramework Vertex EditorVertexSelectionVariable::InsertSelectedInPlace( AZStd::vector::VertexLookup>& manipulators) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // utility to calculate the center point of the selected vertices after duplication MidpointCalculator midpointCalculator; @@ -1267,7 +1267,7 @@ namespace AzToolsFramework template void EditorVertexSelectionVariable::DuplicateSelected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch duplicateUndo("Duplicate Vertices"); ScopedUndoBatch::MarkEntityDirty(EditorVertexSelectionBase::GetEntityId()); @@ -1346,7 +1346,7 @@ namespace AzToolsFramework template void InsertVertexAfter(const AZ::EntityComponentIdPair& entityComponentIdPair, const size_t vertexIndex, const Vertex& localPosition) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); size_t size = 0; AZ::VariableVerticesRequestBus::EventResult( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ManipulatorManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ManipulatorManager.cpp index e994e8e2cd..b07ac08d87 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ManipulatorManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/ManipulatorManager.cpp @@ -74,7 +74,7 @@ namespace AzToolsFramework Picking::RegisteredBoundId ManipulatorManager::UpdateBound( const ManipulatorId manipulatorId, const Picking::RegisteredBoundId boundId, const Picking::BoundRequestShapeBase& boundShapeData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (manipulatorId == InvalidManipulatorId) { @@ -124,7 +124,7 @@ namespace AzToolsFramework void ManipulatorManager::RefreshMouseOverState(const ViewportInteraction::MousePick& mousePick) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!Interacting()) { @@ -142,7 +142,7 @@ namespace AzToolsFramework const AzFramework::CameraState& cameraState, const ViewportInteraction::MouseInteraction& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (const auto& pair : m_manipulatorIdToPtrMap) { @@ -155,7 +155,7 @@ namespace AzToolsFramework AZStd::shared_ptr ManipulatorManager::PerformRaycast( const AZ::Vector3& rayOrigin, const AZ::Vector3& rayDirection, float& rayIntersectionDistance) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); Picking::RaySelectInfo raySelection; raySelection.m_origin = rayOrigin; @@ -255,7 +255,7 @@ namespace AzToolsFramework ManipulatorManager::ConsumeMouseMoveResult ManipulatorManager::ConsumeViewportMouseMove( const ViewportInteraction::MouseInteraction& interaction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_activeManipulator) { @@ -279,7 +279,7 @@ namespace AzToolsFramework void ManipulatorManager::OnEntityInfoUpdatedVisibility(const AZ::EntityId entityId, const bool visible) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto& pair : m_manipulatorIdToPtrMap) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index e618a11344..cdb1e9a2ad 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -996,12 +996,12 @@ namespace AzToolsFramework // the full nested hierarchy with what is returned from RetrieveAndSortPrefabEntitiesAndInstances AzToolsFramework::EntityIdSet duplicationSet = AzToolsFramework::GetCulledEntityHierarchy(entityIdsNoLevelInstance); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch("Duplicate Entities"); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "DuplicateEntitiesInInstance::UndoCaptureAndDuplicateEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "DuplicateEntitiesInInstance::UndoCaptureAndDuplicateEntities"); AZStd::vector entities; AZStd::vector instances; @@ -1123,7 +1123,7 @@ namespace AzToolsFramework // Retrieve entityList from entityIds EntityList inputEntityList = EntityIdListToEntityList(entityIdsNoLevelInstance); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch("Delete Selected"); @@ -1145,7 +1145,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities"); Prefab::PrefabDom instanceDomBefore; m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomBefore, commonOwningInstance->get()); @@ -1205,7 +1205,7 @@ namespace AzToolsFramework selCommand->SetParent(undoBatch.GetUndoBatch()); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "Internal::DeleteEntities:RunRedo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:RunRedo"); selCommand->RunRedo(); } @@ -1230,10 +1230,10 @@ namespace AzToolsFramework return AZ::Failure(AZStd::string("Input entity should be its owning Instance's container entity.")); } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "Internal::DetachPrefab:UndoCapture"); + AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DetachPrefab:UndoCapture"); ScopedUndoBatch undoBatch("Detach Prefab"); @@ -1294,7 +1294,7 @@ namespace AzToolsFramework command->Capture(instanceDomBefore, instanceDomAfter, parentTemplateId); command->SetParent(undoBatch.GetUndoBatch()); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "Internal::DetachPrefab:RunRedo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DetachPrefab:RunRedo"); command->RunRedo(); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoCache.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoCache.cpp index 3d22a35858..c83e0857a3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoCache.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoCache.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -111,7 +112,7 @@ namespace AzToolsFramework void PrefabUndoCache::UpdateCache(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Entity* entity = nullptr; AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, entityId); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceCompilation.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceCompilation.cpp index 3c7bab3e77..e9825f6f14 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceCompilation.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceCompilation.cpp @@ -274,7 +274,7 @@ namespace AzToolsFramework */ SliceCompilationResult CompileEditorSlice(const AZ::Data::Asset& sourceSliceAsset, const AZ::PlatformTagSet& platformTags, AZ::SerializeContext& serializeContext, const EditorOnlyEntityHandlers& editorOnlyEntityHandlers) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!sourceSliceAsset) { return AZ::Failure(AZStd::string("Source slice is invalid.")); @@ -657,7 +657,7 @@ namespace AzToolsFramework // tolerate ALL possible input errors (looping parents, invalid IDs, etc). void SortTransformParentsBeforeChildren(AZStd::vector& entities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // IDs of those present in 'entities'. Does not include parent ID if parent not found in 'entities' AZStd::unordered_set existingEntityIds; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceTransaction.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceTransaction.cpp index 15b330c65b..d8b5fe0a15 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceTransaction.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceTransaction.cpp @@ -63,7 +63,7 @@ namespace AzToolsFramework void Capture(const SliceTransaction::SliceAssetPtr& before, const SliceTransaction::SliceAssetPtr& after, const char* sliceAssetPath) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_sliceAssetPath = sliceAssetPath; m_isNewAsset = !before.GetId().IsValid(); @@ -74,7 +74,7 @@ namespace AzToolsFramework if (!m_isNewAsset) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDiskCommand::Capture:SaveBefore"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDiskCommand::Capture:SaveBefore"); AZ::SliceAsset* sliceBefore = before.Get(); AZ::Entity* sliceEntityBefore = sliceBefore->GetEntity(); AZ::IO::ByteContainerStream beforeStream(&m_sliceAssetBeforeBuffer); @@ -82,7 +82,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDiskCommand::Capture:SaveAfter"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDiskCommand::Capture:SaveAfter"); AZ::SliceAsset* sliceAfter = after.Get(); AZ::Entity* sliceEntityAfter = sliceAfter->GetEntity(); AZ::IO::ByteContainerStream afterStream(&m_sliceAssetAfterBuffer); @@ -105,13 +105,13 @@ namespace AzToolsFramework void Redo() override { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_redoResult = Internal::SaveSliceToDisk(m_sliceAssetPath.c_str(), m_sliceAssetAfterBuffer); } void Undo() override { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_isNewAsset) { // New asset means we didn't have an existing asset, so we should instead remove the newly created asset as our undo @@ -149,7 +149,7 @@ namespace AzToolsFramework AZ::SerializeContext* serializeContext, AZ::u32 sliceCreationFlags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!serializeContext) { @@ -179,7 +179,7 @@ namespace AzToolsFramework SliceTransaction::TransactionPtr SliceTransaction::BeginSliceOverwrite(const SliceAssetPtr& asset, const AZ::SliceComponent& overwriteComponent, AZ::SerializeContext* serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!serializeContext) { @@ -212,7 +212,7 @@ namespace AzToolsFramework AZ::SerializeContext* serializeContext, AZ::u32 /*slicePushFlags*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!serializeContext) { @@ -515,7 +515,7 @@ namespace AzToolsFramework SliceTransaction::PostSaveCallback postSaveCallback, AZ::u32 sliceCommitFlags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Clone asset for final modifications and save. // This also releases borrowed entities and slice instances. @@ -702,7 +702,7 @@ namespace AzToolsFramework SliceTransaction::PostSaveCallback postSaveCallback, AZ::u32 sliceCommitFlags) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::string sliceAssetPath; AZ::Data::AssetCatalogRequestBus::BroadcastResult(sliceAssetPath, &AZ::Data::AssetCatalogRequests::GetAssetPathById, targetAssetId); @@ -762,7 +762,7 @@ namespace AzToolsFramework //========================================================================= SliceTransaction::SliceAssetPtr SliceTransaction::CloneAssetForSave() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Move included slice instances to the target asset temporarily so that they are included in the clone for (auto& addedSliceInstanceIt : m_addedSliceInstances) @@ -868,7 +868,7 @@ namespace AzToolsFramework //========================================================================= SliceTransaction::Result SliceTransaction::PreSave(const char* fullPath, SliceAssetPtr& asset, PreSaveCallback preSaveCallback, AZ::u32 /*sliceCommitFlags*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Remap live Ids back to those of the asset. AZ::EntityUtils::SerializableEntityContainer assetEntities; @@ -904,7 +904,7 @@ namespace AzToolsFramework //========================================================================= AZ::EntityId SliceTransaction::FindTargetAncestorAndUpdateInstanceIdMap(AZ::EntityId entityId, AZ::SliceComponent::EntityIdToEntityIdMap& liveToAssetIdMap, const AZ::SliceComponent::SliceInstanceAddress* ignoreSliceInstance) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::SliceComponent* slice = m_targetAsset.Get()->GetComponent(); @@ -1036,7 +1036,7 @@ namespace AzToolsFramework //========================================================================= SliceTransaction::Result SaveSliceToDisk(const char* targetPath, AZStd::vector& sliceAssetEntityMemoryBuffer, AZ::SerializeContext* serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); AZ_Assert(fileIO, "File IO is not initialized."); @@ -1058,7 +1058,7 @@ namespace AzToolsFramework // Write the in-memory copy to file bool savedToFile; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:SaveToFileStream"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:SaveToFileStream"); memoryStream.Seek(0, AZ::IO::GenericStream::ST_SEEK_BEGIN); savedToFile = fileStream.Write(memoryStream.GetLength(), memoryStream.GetData()->data()) != 0; } @@ -1066,14 +1066,14 @@ namespace AzToolsFramework if (savedToFile) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement"); // Copy scratch file to target location. const bool targetFileExists = fileIO->Exists(targetPath); bool removedTargetFile; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement:RemoveTarget"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement:RemoveTarget"); removedTargetFile = fileIO->Remove(targetPath); } @@ -1083,7 +1083,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement:RenameTempFile"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement:RenameTempFile"); AZ::IO::Result renameResult = fileIO->Rename(tempFilePath.c_str(), targetPath); if (!renameResult) { @@ -1093,7 +1093,7 @@ namespace AzToolsFramework // Bump the slice asset up in the asset processor's queue. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement:GetAssetStatus"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::Internal::SaveSliceToDisk:TempToTargetFileReplacement:GetAssetStatus"); EBUS_EVENT(AzFramework::AssetSystemRequestBus, EscalateAssetBySearchTerm, targetPath); } return AZ::Success(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp index 6ef0c83991..02fc2c2c40 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp @@ -405,7 +405,7 @@ namespace AzToolsFramework bool QueryAndPruneMissingExternalReferences(AzToolsFramework::EntityIdSet& entities, AzToolsFramework::EntityIdSet& selectedAndReferencedEntities, bool& useReferencedEntities, bool defaultMoveExternalRefs = false) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:HandleNotIncludedReferences"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:HandleNotIncludedReferences"); useReferencedEntities = false; AZStd::string includedEntities; @@ -440,7 +440,7 @@ namespace AzToolsFramework { if (!defaultMoveExternalRefs) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:HandleNotIncludedReferences:UserDialog"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:HandleNotIncludedReferences:UserDialog"); const AZStd::string message = AZStd::string::format( "Entity references may not be valid if the entity IDs change or if the entities do not exist when the slice is instantiated.\r\n\r\nSelected Entities\n%s\nReferenced Entities\n%s\n", @@ -510,7 +510,7 @@ namespace AzToolsFramework while (true) { { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:SaveAsDialog"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:SaveAsDialog"); saveAs = QFileDialog::getSaveFileName(nullptr, QString("Save As..."), saveAsInitialSuggestedFullPath.c_str(), QString("Slices (*.slice)")); } @@ -608,7 +608,7 @@ namespace AzToolsFramework bool silenceWarningPopups, AZ::SerializeContext* serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entities.empty()) { @@ -702,7 +702,7 @@ namespace AzToolsFramework { if (inheritSlices) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:CloneExistingSliceEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:CloneExistingSliceEntities"); const AZ::EntityId dummyParentId; @@ -801,14 +801,14 @@ namespace AzToolsFramework // Setup and execute transaction for the new slice. // { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:SetupAndExecuteTransaction"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:SetupAndExecuteTransaction"); // PreSaveCallback for slice creation: Before saving slice, we ensure it has a single root by optionally auto-creating one for the user SliceTransaction::PreSaveCallback preSaveCallback = [&sliceName, &sliceRootEntityPosition, &sliceRootEntityRotation, &activeWindow, &defaultGenerateSharedRoot] (SliceTransaction::TransactionPtr transaction, const char* fullPath, SliceTransaction::SliceAssetPtr& asset) -> SliceTransaction::Result { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:PreSaveCallback"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:PreSaveCallback"); AZ::SliceComponent::EntityIdToEntityIdMap assetToLiveEntityIDMap; const AZ::SliceComponent::EntityIdToEntityIdMap& liveToAssetEntityIDMap = transaction->GetLiveToAssetEntityIdMap(); @@ -855,7 +855,7 @@ namespace AzToolsFramework // Add entities { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::MakeNewSlice:SetupAndExecuteTransaction:AddEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::MakeNewSlice:SetupAndExecuteTransaction:AddEntities"); for (const AZ::EntityId& entityId : entitiesToIncludeInAsset) { SliceTransaction::Result addResult = transaction->AddEntity(entityId, !inheritSlices ? SliceTransaction::SliceAddEntityFlags::DiscardSliceAncestry : 0); @@ -914,7 +914,7 @@ namespace AzToolsFramework void GatherAllReferencedEntities(AzToolsFramework::EntityIdSet& entitiesWithReferences, AZ::SerializeContext& serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::vector floodQueue; floodQueue.reserve(entitiesWithReferences.size()); @@ -1038,7 +1038,7 @@ namespace AzToolsFramework const AZ::SliceComponent::SliceInstance& instance, AZ::SerializeContext& serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(instance.GetEntityIdMap().find(sourceEntity.GetId()) != instance.GetEntityIdMap().end(), "Provided source entity is not a member of the provided slice instance."); @@ -1494,7 +1494,7 @@ namespace AzToolsFramework //========================================================================= SliceTransaction::Result SlicePreSaveCallbackForWorldEntities(SliceTransaction::TransactionPtr transaction, const char* fullPath, SliceTransaction::SliceAssetPtr& asset) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::SlicePreSaveCallbackForWorldEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::SlicePreSaveCallbackForWorldEntities"); // Apply standard root transform rules. Zero out root entity translation, ensure single root, ensure slice root has no parent in slice. SliceTransaction::Result worldTransformRulesResult = VerifyAndApplySliceWorldTransformRules(asset); @@ -1536,7 +1536,7 @@ namespace AzToolsFramework void SlicePostSaveCallbackForNewSlice(SliceTransaction::TransactionPtr transaction, const char* fullPath, const SliceTransaction::SliceAssetPtr& transactionAsset) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::SlicePostSaveCallbackForNewSlice"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::SlicePostSaveCallbackForNewSlice"); const char* undoMessage = "Create Slice Asset"; ScopedUndoBatch undoBatch(undoMessage); @@ -1568,7 +1568,7 @@ namespace AzToolsFramework bool CheckSliceAdditionCyclicDependencySafe(const AZ::SliceComponent::SliceInstanceAddress& instanceToAdd, const AZ::SliceComponent::SliceInstanceAddress& targetInstanceToAddTo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(instanceToAdd.IsValid(), "Invalid instanceToAdd passed to CheckSliceADditionCyclicDependencySafe."); @@ -1706,7 +1706,7 @@ namespace AzToolsFramework void PopulateSliceSubMenus(QMenu& outerMenu, const AzToolsFramework::EntityIdList& inputEntities, SliceSelectedCallback sliceSelectedCallback, SliceSelectedCallback sliceRelationshipViewCallback) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // The find slice menu only works with a single entity selected. if (inputEntities.size() != 1) { @@ -2244,7 +2244,7 @@ namespace AzToolsFramework //========================================================================= bool DoEntitiesHaveOverrides(const AzToolsFramework::EntityIdList& inputEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::SerializeContext* serializeContext = nullptr; AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext); @@ -2287,7 +2287,7 @@ namespace AzToolsFramework //========================================================================= bool IsReparentNonTrivial(const AZ::EntityId& entityId, const AZ::EntityId& newParentId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::EntityId oldParentId; AZ::TransformBus::EventResult(oldParentId, entityId, &AZ::TransformBus::Events::GetParentId); @@ -2358,7 +2358,7 @@ namespace AzToolsFramework void ReparentNonTrivialSliceInstanceHierarchy(const AZ::EntityId& entityId, const AZ::EntityId& newParentId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::SliceComponent::SliceInstanceEntityIdRemapList subslicesToDetach; AzToolsFramework::EntityIdList entitiesToDetach; @@ -2892,7 +2892,7 @@ namespace AzToolsFramework //========================================================================= void GenerateSuggestedSliceFilenameFromEntities(const AzToolsFramework::EntityIdList& entities, AZStd::string& outName) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Determine suggested save name for slice based on entity names // For example, with entities Entity0, Entity1, and Entity2, we would end up with @@ -2962,7 +2962,7 @@ namespace AzToolsFramework //========================================================================= void GenerateSuggestedSlicePath(const AZStd::string& sliceName, const AZStd::string& targetDirectory, AZStd::string& suggestedFullPath) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Generate full suggested path from sliceName - if given NewSlice as sliceName, // NewSlice_001.slice would be tried, and if that already existed we would suggest @@ -3079,7 +3079,7 @@ namespace AzToolsFramework QWidget* activeWindow, bool defaultGenerateSharedRoot) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::SerializeContext* serializeContext = nullptr; AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext); @@ -3105,7 +3105,7 @@ namespace AzToolsFramework { int response; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SliceUtilities::CheckAndAddSliceRoot:SingleRootUserQuery"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SliceUtilities::CheckAndAddSliceRoot:SingleRootUserQuery"); response = QMessageBox::warning(activeWindow, QStringLiteral("Cannot Create Slice"), QString("The slice cannot be created because no single transform root is defined. " diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorLayerComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorLayerComponent.cpp index 6b897efdf8..cca0071a4d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorLayerComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorLayerComponent.cpp @@ -345,7 +345,7 @@ namespace AzToolsFramework EntityList& entityList, AZ::SliceComponent::SliceReferenceToInstancePtrs& layerInstances) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EditorLayer layer; LayerResult layerPrepareResult = PrepareLayerForSaving(layer, entityList, layerInstances); if (!layerPrepareResult.IsSuccess()) @@ -373,7 +373,7 @@ namespace AzToolsFramework AZ::SliceComponent::SliceAssetToSliceInstancePtrs& sliceInstances, AZStd::unordered_map& uniqueEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // If this layer is being loaded, it won't have a level save dependency yet, so clear that flag. m_mustSaveLevelWhenLayerSaves = false; QString fullPathName = levelPakFile; @@ -518,7 +518,7 @@ namespace AzToolsFramework EntityList& entityList, AZ::SliceComponent::SliceReferenceToInstancePtrs& layerInstances) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Move the editable data into the data serialized to the layer, and not the layer component. layer.m_layerProperties = m_editableLayerProperties; layer.m_layerEntityId = GetEntityId(); @@ -640,7 +640,7 @@ namespace AzToolsFramework const EditorLayer& layer, AZ::IO::ByteContainerStream >& entitySaveStream) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_otherLayersToSave.clear(); m_mustSaveLevelWhenLayerSaves = false; @@ -662,7 +662,7 @@ namespace AzToolsFramework QString levelAbsoluteFolder, const AZ::IO::ByteContainerStream >& entitySaveStream) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::string layerBaseFileName(m_layerFileName); // Write to a temp file first. diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.cpp index ff9eb025d7..56b0177e94 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.cpp @@ -68,7 +68,7 @@ namespace AzToolsFramework AZStd::function accentRefreshCallback = [this]() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EditorSelectionAccentSystemComponent::QueueAccentRefresh:AccentRefreshCallback"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EditorSelectionAccentSystemComponent::QueueAccentRefresh:AccentRefreshCallback"); InvalidateAccents(); RecalculateAndApplyAccents(); m_isAccentRefreshQueued = false; @@ -79,14 +79,14 @@ namespace AzToolsFramework void EditorSelectionAccentSystemComponent::ForceSelectionAccentRefresh() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); InvalidateAccents(); RecalculateAndApplyAccents(); } void EditorSelectionAccentSystemComponent::InvalidateAccents() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (const AZ::EntityId& accentedEntity : m_currentlyAccentedEntities) { AzToolsFramework::ComponentEntityEditorRequestBus::Event(accentedEntity, &AzToolsFramework::ComponentEntityEditorRequests::SetSandboxObjectAccent, ComponentEntityAccentType::None); @@ -96,7 +96,7 @@ namespace AzToolsFramework void EditorSelectionAccentSystemComponent::RecalculateAndApplyAccents() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityIdList selectedEntities; AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntities, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities); AzToolsFramework::EntityIdSet selectedEntitiesSet; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.cpp index 3ccb4065bf..6f3727bdb4 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteUtil.cpp @@ -121,7 +121,7 @@ namespace AzToolsFramework ComponentDataTable &componentDataTable, ComponentIconTable &componentIconTable) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); serializeContext->EnumerateDerived( [&](const AZ::SerializeContext::ClassData* componentClass, const AZ::Uuid& knownType) -> bool { @@ -179,7 +179,7 @@ namespace AzToolsFramework const AZStd::vector& incompatibleServiceFilter ) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); bool containsEditable = false; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp index afa7edc565..67598f9fca 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/ComponentPalette/ComponentPaletteWidget.cpp @@ -130,7 +130,7 @@ namespace AzToolsFramework void ComponentPaletteWidget::UpdateContent() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_componentModel->clear(); bool applyRegExFilter = !m_searchRegExp.isEmpty(); @@ -321,7 +321,7 @@ namespace AzToolsFramework void ComponentPaletteWidget::UpdateSearch() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_searchRegExp = QRegExp(m_searchText->text(), Qt::CaseInsensitive, QRegExp::RegExp); m_searchText->setFocus(); UpdateContent(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index 4115fe409e..806170df6f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -936,7 +936,7 @@ namespace AzToolsFramework bool EntityOutlinerListModel::CanReparentEntities(const AZ::EntityId& newParentId, const EntityIdList &selectedEntityIds) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (selectedEntityIds.empty()) { return false; @@ -1025,7 +1025,7 @@ namespace AzToolsFramework bool EntityOutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const EntityIdList &selectedEntityIds, const AZ::EntityId& beforeEntityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!CanReparentEntities(newParentId, selectedEntityIds)) { return false; @@ -1105,7 +1105,7 @@ namespace AzToolsFramework QMimeData* EntityOutlinerListModel::mimeData(const QModelIndexList& indexes) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::TypeId uuid1 = AZ::AzTypeInfo::Uuid(); AZ::TypeId uuid2 = AZ::AzTypeInfo::Uuid(); @@ -1195,7 +1195,7 @@ namespace AzToolsFramework void EntityOutlinerListModel::ProcessEntityUpdates() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); m_entityChangeQueued = false; if (m_layoutResetQueued) { @@ -1203,7 +1203,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "EntityOutlinerListModel::ProcessEntityUpdates:ExpandQueue"); + AZ_PROFILE_SCOPE(Editor, "EntityOutlinerListModel::ProcessEntityUpdates:ExpandQueue"); for (auto entityId : m_entityExpandQueue) { emit ExpandEntity(entityId, IsExpanded(entityId)); @@ -1212,7 +1212,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "EntityOutlinerListModel::ProcessEntityUpdates:SelectQueue"); + AZ_PROFILE_SCOPE(Editor, "EntityOutlinerListModel::ProcessEntityUpdates:SelectQueue"); for (auto entityId : m_entitySelectQueue) { emit SelectEntity(entityId, IsSelected(entityId)); @@ -1222,7 +1222,7 @@ namespace AzToolsFramework if (!m_entityChangeQueue.empty()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "EntityOutlinerListModel::ProcessEntityUpdates:ChangeQueue"); + AZ_PROFILE_SCOPE(Editor, "EntityOutlinerListModel::ProcessEntityUpdates:ChangeQueue"); // its faster to just do a bulk data change than to carefully pick out indices // so we'll just merge all ranges into a single range rather than try to make gaps @@ -1255,7 +1255,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "EntityOutlinerListModel::ProcessEntityUpdates:LayoutChanged"); + AZ_PROFILE_SCOPE(Editor, "EntityOutlinerListModel::ProcessEntityUpdates:LayoutChanged"); if (m_entityLayoutQueued) { emit layoutAboutToBeChanged(); @@ -1265,7 +1265,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Editor, "EntityOutlinerListModel::ProcessEntityUpdates:InvalidateFilter"); + AZ_PROFILE_SCOPE(Editor, "EntityOutlinerListModel::ProcessEntityUpdates:InvalidateFilter"); if (m_isFilterDirty) { InvalidateFilter(); @@ -1288,7 +1288,7 @@ namespace AzToolsFramework void EntityOutlinerListModel::ProcessEntityInfoResetEnd() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_layoutResetQueued = false; m_entityChangeQueued = false; m_entityChangeQueue.clear(); @@ -1309,7 +1309,7 @@ namespace AzToolsFramework void EntityOutlinerListModel::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId parentId, AZ::EntityId childId) { (void)parentId; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); endInsertRows(); //expand ancestors if a new descendant is already selected @@ -1347,7 +1347,7 @@ namespace AzToolsFramework void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId) { (void)childId; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); endResetModel(); @@ -1366,7 +1366,7 @@ namespace AzToolsFramework void EntityOutlinerListModel::OnEntityInfoUpdatedOrderEnd(AZ::EntityId parentId, AZ::EntityId childId, AZ::u64 index) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); (void)index; m_entityLayoutQueued = true; QueueEntityUpdate(parentId); @@ -1425,7 +1425,7 @@ namespace AzToolsFramework QModelIndex EntityOutlinerListModel::GetIndexFromEntity(const AZ::EntityId& entityId, int column) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entityId.IsValid()) { @@ -1587,7 +1587,7 @@ namespace AzToolsFramework void EntityOutlinerListModel::ExpandAncestors(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //typically to reveal selected entities, expand all parent entities if (entityId.IsValid()) { @@ -1792,7 +1792,7 @@ namespace AzToolsFramework bool EntityOutlinerListModel::AreAllDescendantsSameLockState(const AZ::EntityId& entityId) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies bool isLocked = false; EditorEntityInfoRequestBus::EventResult(isLocked, entityId, &EditorEntityInfoRequestBus::Events::IsJustThisEntityLocked); @@ -1813,7 +1813,7 @@ namespace AzToolsFramework bool EntityOutlinerListModel::AreAllDescendantsSameVisibleState(const AZ::EntityId& entityId) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); //TODO result can be cached in mutable map and cleared when any descendant changes to avoid recursion in deep hierarchies bool isVisible = IsEntitySetToBeVisible(entityId); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp index c6d3c2f28f..4db235d073 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp @@ -98,7 +98,7 @@ namespace void SortEntityChildren(AZ::EntityId entityId, const EntityIdCompareFunc& comparer, AzToolsFramework::EntityOrderArray* newEntityOrder = nullptr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityOrderArray entityOrderArray = AzToolsFramework::GetEntityChildOrder(entityId); AZStd::sort(entityOrderArray.begin(), entityOrderArray.end(), comparer); @@ -112,7 +112,7 @@ namespace void SortEntityChildrenRecursively(AZ::EntityId entityId, const EntityIdCompareFunc& comparer) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EntityOrderArray entityOrderArray; SortEntityChildren(entityId, comparer, &entityOrderArray); @@ -325,7 +325,7 @@ namespace AzToolsFramework return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EntityIdList newlySelected; ExtractEntityIdsFromSelection(selected, newlySelected); @@ -472,7 +472,7 @@ namespace AzToolsFramework { if (m_selectionChangeQueued) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_selectionChangeInProgress = true; @@ -480,7 +480,7 @@ namespace AzToolsFramework { // Calling Deselect for a large number of items is very slow, // use a single ClearAndSelect call instead. - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EntityOutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EntityOutlinerWidget::ModelEntitySelectionChanged:ClearAndSelect"); EntityIdList selectedEntities; ToolsApplicationRequests::Bus::BroadcastResult(selectedEntities, &ToolsApplicationRequests::Bus::Events::GetSelectedEntities); @@ -491,12 +491,12 @@ namespace AzToolsFramework else { { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EntityOutlinerWidget::ModelEntitySelectionChanged:Deselect"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EntityOutlinerWidget::ModelEntitySelectionChanged:Deselect"); m_gui->m_objectTree->selectionModel()->select( BuildSelectionFromEntities(m_entitiesToDeselect), QItemSelectionModel::Deselect); } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EntityOutlinerWidget::ModelEntitySelectionChanged:Select"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EntityOutlinerWidget::ModelEntitySelectionChanged:Select"); m_gui->m_objectTree->selectionModel()->select( BuildSelectionFromEntities(m_entitiesToSelect), QItemSelectionModel::Select); } @@ -519,7 +519,7 @@ namespace AzToolsFramework template QItemSelection EntityOutlinerWidget::BuildSelectionFromEntities(const EntityIdCollection& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); QItemSelection selection; for (const auto& entityId : entityIds) @@ -539,7 +539,7 @@ namespace AzToolsFramework void EntityOutlinerWidget::OnOpenTreeContextMenu(const QPoint& pos) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); bool isDocumentOpen = false; EBUS_EVENT_RESULT(isDocumentOpen, EditorRequests::Bus, IsLevelDocumentOpen); @@ -1057,7 +1057,7 @@ namespace AzToolsFramework void EntityOutlinerWidget::OnSearchTextChanged(const QString& activeTextFilter) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::string filterString = activeTextFilter.toUtf8().data(); m_listModel->SearchStringChanged(filterString); @@ -1168,7 +1168,7 @@ namespace AzToolsFramework void EntityOutlinerWidget::SortContent() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_sortContentQueued = false; @@ -1204,7 +1204,7 @@ namespace AzToolsFramework if (sortMode != EntityOutliner::DisplaySortMode::Manually) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto comparer = AZStd::bind(&CompareEntitiesForSorting, AZStd::placeholders::_1, AZStd::placeholders::_2, sortMode); SortEntityChildrenRecursively(AZ::EntityId(), comparer); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp index 9f75abb32a..c17b96411e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp @@ -434,7 +434,7 @@ namespace AzToolsFramework void PrefabIntegrationManager::GenerateSuggestedFilenameFromEntities(const EntityIdList& entityIds, AZStd::string& outName) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::string suggestedName; @@ -515,7 +515,7 @@ namespace AzToolsFramework while (true) { { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); saveAs = QFileDialog::getSaveFileName(nullptr, QString("Save As..."), saveAsInitialSuggestedFullPath.c_str(), QString("Prefabs (*.prefab)")); } @@ -851,7 +851,7 @@ namespace AzToolsFramework void PrefabIntegrationManager::GatherAllReferencedEntities(EntityIdSet& entitiesWithReferences, AZ::SerializeContext& serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::vector floodQueue; floodQueue.reserve(entitiesWithReferences.size()); @@ -943,7 +943,7 @@ namespace AzToolsFramework bool PrefabIntegrationManager::QueryAndPruneMissingExternalReferences(EntityIdSet& entities, EntityIdSet& selectedAndReferencedEntities, bool& useReferencedEntities, bool defaultMoveExternalRefs) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); useReferencedEntities = false; AZStd::string includedEntities; @@ -978,7 +978,7 @@ namespace AzToolsFramework { if (!defaultMoveExternalRefs) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZStd::string message = AZStd::string::format( "Entity references may not be valid if the entity IDs change or if the entities do not exist when the prefab is instantiated.\r\n\r\nSelected Entities\n%s\nReferenced Entities\n%s\n", diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp index 5fa8e9adbe..fbbf55d0ad 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp @@ -527,7 +527,7 @@ namespace AzToolsFramework void ComponentEditor::SetComponentOverridden(const bool overridden) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto entityId = m_components[0]->GetEntityId(); AZ::SliceComponent::SliceInstanceAddress sliceInstanceAddress; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 2c46bb2d26..ec09275703 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -699,7 +699,7 @@ namespace AzToolsFramework void EntityPropertyEditor::BeforeEntitySelectionChanged() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (IsLockedToSpecificEntities()) { return; @@ -723,7 +723,7 @@ namespace AzToolsFramework const AzToolsFramework::EntityIdList& newlySelectedEntities, const AzToolsFramework::EntityIdList& newlyDeselectedEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (IsLockedToSpecificEntities()) { // ensure we refresh all entity property editors when @@ -951,7 +951,7 @@ namespace AzToolsFramework EntityPropertyEditor::SelectionEntityTypeInfo EntityPropertyEditor::GetSelectionEntityTypeInfo(const EntityIdList& selection) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); SelectionEntityTypeInfo result = SelectionEntityTypeInfo::None; InspectorLayout layout = GetCurrentInspectorLayout(); @@ -1069,7 +1069,7 @@ namespace AzToolsFramework void EntityPropertyEditor::UpdateContents() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); setUpdatesEnabled(false); m_isBuildingProperties = true; @@ -1921,7 +1921,7 @@ namespace AzToolsFramework void EntityPropertyEditor::QueuePropertyRefresh() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_isAlreadyQueuedRefresh) { m_isAlreadyQueuedRefresh = true; @@ -3234,7 +3234,7 @@ namespace AzToolsFramework void EntityPropertyEditor::UpdateActions() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_disabled) { @@ -3282,7 +3282,7 @@ namespace AzToolsFramework // Even though this causes two loops on the selected entity list, calling GetSelectionEntityTypeInfo avoids duplicating code. SelectionEntityTypeInfo selectionTypeInfo; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "EntityPropertyEditor::UpdateActions GetSelectionEntityTypeInfo"); + AZ_PROFILE_SCOPE(AzToolsFramework, "EntityPropertyEditor::UpdateActions GetSelectionEntityTypeInfo"); selectionTypeInfo = GetSelectionEntityTypeInfo(m_selectedEntityIds); } m_actionToAddComponents->setEnabled(CanAddComponentsToSelection(selectionTypeInfo)); @@ -3907,7 +3907,7 @@ namespace AzToolsFramework void EntityPropertyEditor::ClearComponentEditorDragging() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto componentEditor : m_componentEditors) { componentEditor->SetDragged(false); @@ -3918,7 +3918,7 @@ namespace AzToolsFramework void EntityPropertyEditor::ClearComponentEditorSelection() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto componentEditor : m_componentEditors) { componentEditor->SetSelected(false); @@ -4043,7 +4043,7 @@ namespace AzToolsFramework void EntityPropertyEditor::UpdateSelectionCache() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_selectedComponentEditors.clear(); m_selectedComponentEditors.reserve(m_componentEditors.size()); for (auto componentEditor : m_componentEditors) @@ -4070,7 +4070,7 @@ namespace AzToolsFramework void EntityPropertyEditor::SaveComponentEditorState() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // SaveComponentEditorState can be called when adding or removing a // component, the components list stored by the component editor @@ -5584,14 +5584,14 @@ namespace AzToolsFramework void EntityPropertyEditor::ConnectToEntityBuses(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EditorInspectorComponentNotificationBus::MultiHandler::BusConnect(entityId); AzToolsFramework::PropertyEditorEntityChangeNotificationBus::MultiHandler::BusConnect(entityId); } void EntityPropertyEditor::DisconnectFromEntityBuses(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::EditorInspectorComponentNotificationBus::MultiHandler::BusDisconnect(entityId); AzToolsFramework::PropertyEditorEntityChangeNotificationBus::MultiHandler::BusDisconnect(entityId); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp index 2e697a7398..fccabbf205 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp @@ -603,7 +603,7 @@ namespace AzToolsFramework //----------------------------------------------------------------------------- void InstanceDataHierarchy::Build(AZ::SerializeContext* sc, unsigned int accessFlags, DynamicEditDataProvider dynamicEditDataProvider, ComponentEditor* editorParent) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(sc, "sc can't be NULL!"); AZ_Assert(m_rootInstances.size() > 0, "No root instances have been added to this hierarchy!"); @@ -761,7 +761,7 @@ namespace AzToolsFramework //----------------------------------------------------------------------------- void InstanceDataHierarchy::FixupEditData(InstanceDataNode* node, int siblingIdx) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); bool mergeElementEditData = node->m_classElement && node->m_classElement->m_editData && node->GetElementEditMetadata() != node->m_classElement->m_editData; bool mergeContainerEditData = node->m_parent && node->m_parent->m_classData->m_container && node->m_parent->GetElementEditMetadata() && (node->m_classElement->m_flags & AZ::SerializeContext::ClassElement::FLG_POINTER) == 0; @@ -915,7 +915,7 @@ namespace AzToolsFramework //----------------------------------------------------------------------------- bool InstanceDataHierarchy::BeginNode(void* ptr, const AZ::SerializeContext::ClassData* classData, const AZ::SerializeContext::ClassElement* classElement, DynamicEditDataProvider dynamicEditDataProvider) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::Edit::ElementData* elementEditData = nullptr; @@ -1140,7 +1140,7 @@ namespace AzToolsFramework //----------------------------------------------------------------------------- bool InstanceDataHierarchy::EndNode() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ_Assert(m_curParentNode, "EndEnum called without a matching BeginNode call!"); @@ -1177,7 +1177,7 @@ namespace AzToolsFramework //----------------------------------------------------------------------------- bool InstanceDataHierarchy::RefreshComparisonData(unsigned int accessFlags, DynamicEditDataProvider dynamicEditDataProvider) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_root || m_comparisonInstances.empty()) { @@ -1438,7 +1438,7 @@ namespace AzToolsFramework RemovedNodeCB removedNodeCallback, ChangedNodeCB changedNodeCallback) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); targetNode->m_comparisonNode = sourceNode; @@ -1582,7 +1582,7 @@ namespace AzToolsFramework ContainerChildNodeBeingCreatedCB containerChildNodeBeingCreatedCB, const InstanceDataNode::Address& filterElementAddress) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!context) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h index 3c72e8bc9c..415a87f984 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h @@ -161,7 +161,7 @@ namespace AzToolsFramework virtual void ReadValuesIntoGUI_Internal(QWidget* widget, InstanceDataNode* node) override { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (size_t i = 0; i < node->GetNumInstances(); ++i) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h index 15506c1a50..8b53121776 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h @@ -15,6 +15,7 @@ // A user is expected to derive from PropertyHandler // and implement that interface, then register it with the property manager. +#include #include #include #include @@ -257,7 +258,7 @@ namespace AzToolsFramework virtual void ReadValuesIntoGUI_Internal(QWidget* widget, InstanceDataNode* node) override { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); WidgetType* wid = static_cast(widget); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorApi.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorApi.cpp index 8693ca2d48..096fb6c7c1 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorApi.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorApi.cpp @@ -98,7 +98,7 @@ namespace AzToolsFramework //----------------------------------------------------------------------------- NodeDisplayVisibility CalculateNodeDisplayVisibility(const InstanceDataNode& node, bool isSlicePushUI) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); NodeDisplayVisibility visibility = NodeDisplayVisibility::NotVisible; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp index 604c6141d7..44e71daf71 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyRowWidget.cpp @@ -458,7 +458,7 @@ namespace AzToolsFramework void PropertyRowWidget::OnValuesUpdated() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_sourceNode) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp index 5d5b00e83d..87df1eff1b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp @@ -1038,12 +1038,12 @@ namespace AzToolsFramework void ReflectedPropertyEditor::InvalidateValues() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_releasePrompt = true; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "ReflectedPropertyEditor::InvalidateValues:InstancesRefreshDataCompare"); + AZ_PROFILE_SCOPE(AzToolsFramework, "ReflectedPropertyEditor::InvalidateValues:InstancesRefreshDataCompare"); for (InstanceDataHierarchy& instance : m_impl->m_instances) { const bool dataIdentical = instance.RefreshComparisonData( @@ -1057,7 +1057,7 @@ namespace AzToolsFramework } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "ReflectedPropertyEditor::InvalidateValues:RowWidgetGuiUpdate"); + AZ_PROFILE_SCOPE(AzToolsFramework, "ReflectedPropertyEditor::InvalidateValues:RowWidgetGuiUpdate"); for (auto it = m_impl->m_userWidgetsToData.begin(); it != m_impl->m_userWidgetsToData.end(); ++it) { auto rowWidget = m_impl->m_widgets.find(it->second); @@ -2294,7 +2294,7 @@ namespace AzToolsFramework void ReflectedPropertyEditor::DoRefresh() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_impl->m_preventRefresh || (m_impl->m_queuedRefreshLevel == Refresh_None)) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp index b2c378181e..ff13bce531 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp @@ -23,7 +23,7 @@ namespace AzToolsFramework { void EditorContextMenuUpdate(EditorContextMenu& contextMenu, const ViewportInteraction::MouseInteractionEvent& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // could potentially show the context menu if (mouseInteraction.m_mouseInteraction.m_mouseButtons.Right() && diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp index d4d53c5907..c39b2c0ebc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorBoxSelect.cpp @@ -22,7 +22,7 @@ namespace AzToolsFramework void EditorBoxSelect::HandleMouseInteraction( const ViewportInteraction::MouseInteractionEvent& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_cursorState.SetCurrentPosition(mouseInteraction.m_mouseInteraction.m_mousePick.m_screenCoordinates); @@ -74,7 +74,7 @@ namespace AzToolsFramework void EditorBoxSelect::Display2d(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_cursorState.Update(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp index 304a4df31f..7abff230e3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorHelpers.cpp @@ -64,7 +64,7 @@ namespace AzToolsFramework // note: this is mostly likely distance from the camera static float GetIconScale(const float distSq) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return s_iconMinScale + (s_iconMaxScale - s_iconMinScale) * @@ -74,7 +74,7 @@ namespace AzToolsFramework static void DisplayComponents( const AZ::EntityId entityId, const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::Entity* entity = AZ::Interface::Get()->FindEntity(entityId); AzFramework::EntityDebugDisplayEventBus::Event( @@ -114,7 +114,7 @@ namespace AzToolsFramework AZ::EntityId EditorHelpers::HandleMouseInteraction( const AzFramework::CameraState& cameraState, const ViewportInteraction::MouseInteractionEvent& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const int viewportId = mouseInteraction.m_mouseInteraction.m_interactionId.m_viewportId; @@ -185,7 +185,7 @@ namespace AzToolsFramework AzFramework::DebugDisplayRequests& debugDisplay, const AZStd::function& showIconCheck) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (HelpersVisible()) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp index 696cf6b184..7002436d13 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.cpp @@ -85,7 +85,7 @@ namespace AzToolsFramework void EditorInteractionSystemComponent::DisplayViewport( const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // calculate which entities are in the view and can be interacted with // and cache that data to make iterating/looking it up much faster diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorPickEntitySelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorPickEntitySelection.cpp index 7cd0170989..ea1bc73056 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorPickEntitySelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorPickEntitySelection.cpp @@ -37,7 +37,7 @@ namespace AzToolsFramework static void HandleAccents( const AZ::EntityId entityIdUnderCursor, AZ::EntityId& hoveredEntityId, const ViewportInteraction::MouseButtons mouseButtons) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const bool invalidMouseButtonHeld = mouseButtons.Middle() || mouseButtons.Right(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorSelectionUtil.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorSelectionUtil.cpp index 8e08dc9d97..7cb0e718a8 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorSelectionUtil.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorSelectionUtil.cpp @@ -50,7 +50,7 @@ namespace AzToolsFramework AzFramework::ScreenPoint GetScreenPosition(const int viewportId, const AZ::Vector3& worldTranslation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto screenPosition = AzFramework::ScreenPoint(0, 0); ViewportInteraction::ViewportInteractionRequestBus::EventResult( @@ -62,7 +62,7 @@ namespace AzToolsFramework bool AabbIntersectMouseRay(const ViewportInteraction::MouseInteraction& mouseInteraction, const AZ::Aabb& aabb) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::Vector3 rayScaledDir = mouseInteraction.m_mousePick.m_rayDirection * s_pickRayLength; @@ -78,7 +78,7 @@ namespace AzToolsFramework float& closestDistance, const int viewportId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool entityPicked = false; EditorComponentSelectionRequestsBus::EnumerateHandlersId( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index b05dfd0676..d315243697 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -276,7 +276,7 @@ namespace AzToolsFramework static void DestroyManipulators(EntityIdManipulators& manipulators) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (manipulators.m_manipulators) { @@ -306,7 +306,7 @@ namespace AzToolsFramework { static_assert(AZStd::is_same::value, "Container type is not an EntityId"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return AZStd::vector(entityIdContainer.begin(), entityIdContainer.end()); } @@ -316,7 +316,7 @@ namespace AzToolsFramework { static_assert(AZStd::is_same::value, "Container key type is not an EntityId"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::vector entityIds; entityIds.reserve(entityIdMap.size()); @@ -348,7 +348,7 @@ namespace AzToolsFramework EntitySelectFuncType selectFunc2, Compare outgoingCheck) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (boxSelect->contains(ViewportInteraction::QPointFromScreenPoint(screenPosition))) { @@ -385,7 +385,7 @@ namespace AzToolsFramework const ViewportInteraction::KeyboardModifiers currentKeyboardModifiers, const ViewportInteraction::KeyboardModifiers& previousKeyboardModifiers) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (boxSelect) { @@ -449,7 +449,7 @@ namespace AzToolsFramework static void InitializeTranslationLookup(EntityIdManipulators& entityIdManipulators) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto& entityIdLookup : entityIdManipulators.m_lookups) { @@ -498,7 +498,7 @@ namespace AzToolsFramework // return either center or entity pivot static AZ::Vector3 CalculatePivotTranslation(const AZ::EntityId entityId, const EditorTransformComponentSelectionRequests::Pivot pivot) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity(); AZ::TransformBus::EventResult(worldFromLocal, entityId, &AZ::TransformBus::Events::GetWorldTM); @@ -539,7 +539,7 @@ namespace AzToolsFramework { PivotOrientationResult CalculatePivotOrientation(const AZ::EntityId entityId, const ReferenceFrame referenceFrame) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // initialize to world space, no parent PivotOrientationResult result{ AZ::Quaternion::CreateIdentity(), AZ::EntityId() }; @@ -577,7 +577,7 @@ namespace AzToolsFramework template static ETCS::PivotOrientationResult CalculateParentSpace(EntityIdMapIterator begin, EntityIdMapIterator end) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // initialize to world with no parent ETCS::PivotOrientationResult result{ AZ::Quaternion::CreateIdentity(), AZ::EntityId() }; @@ -629,7 +629,7 @@ namespace AzToolsFramework { static_assert(AZStd::is_same::value, "Container key type is not an EntityId"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!entityIdMap.empty()) { @@ -656,7 +656,7 @@ namespace AzToolsFramework { static_assert(AZStd::is_same::value, "Container key type is not an EntityId"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // simple case with one entity if (entityIdMap.size() == 1) @@ -689,7 +689,7 @@ namespace AzToolsFramework AZStd::is_same::value, "Container value type is not an EntityIdManipulators::Lookup"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // start - calculate orientation without considering current overrides/modifications PivotOrientationResult pivot = CalculatePivotOrientationForEntityIds(entityIdMap, referenceFrame); @@ -747,7 +747,7 @@ namespace AzToolsFramework const OptionalFrame& pivotOverrideFrame, const EditorTransformComponentSelectionRequests::Pivot pivot) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return pivotOverrideFrame.m_translationOverride.value_or(CalculatePivotTranslationForEntityIds(entityIdMap, pivot)); } @@ -756,7 +756,7 @@ namespace AzToolsFramework static AZ::Quaternion RecalculateAverageManipulatorOrientation( const EntityIdMap& entityIdMap, const OptionalFrame& pivotOverrideFrame, const ReferenceFrame referenceFrame) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return ETCS::CalculateSelectionPivotOrientation(entityIdMap, pivotOverrideFrame, referenceFrame).m_worldOrientation; } @@ -768,7 +768,7 @@ namespace AzToolsFramework const EditorTransformComponentSelectionRequests::Pivot pivot, const ReferenceFrame referenceFrame) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // return final transform, if we have an override for translation use that, otherwise // use centered translation of selection @@ -825,7 +825,7 @@ namespace AzToolsFramework bool& transformChangedInternally, const AZStd::optional spaceLock) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); entityIdManipulators.m_manipulators->SetLocalPosition(action.LocalPosition()); @@ -914,7 +914,7 @@ namespace AzToolsFramework const ViewportInteraction::MouseButtons mouseButtons, const bool usingBoxSelect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const bool invalidMouseButtonHeld = mouseButtons.Middle() || mouseButtons.Right(); @@ -942,7 +942,7 @@ namespace AzToolsFramework static AZ::Vector3 PickTerrainPosition(const ViewportInteraction::MouseInteraction& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const int viewportId = mouseInteraction.m_interactionId.m_viewportId; // get unsnapped terrain position (world space) @@ -964,14 +964,14 @@ namespace AzToolsFramework template static bool IsEntitySelectedInternal(AZ::EntityId entityId, const EntityIdContainer& selectedEntityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto entityIdIt = selectedEntityIds.find(entityId); return entityIdIt != selectedEntityIds.end(); } static EntityIdTransformMap RecordTransformsBefore(const EntityIdList& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // save initial transforms - this is necessary in cases where entities exist // in a hierarchy. We want to make sure a parent transform does not affect @@ -1202,7 +1202,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::BeginRecordManipulatorCommand() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // we must have an existing parent undo batch active when beginning to record // a manipulator command @@ -1219,7 +1219,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::EndRecordManipulatorCommand() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_manipulatorMoveCommand) { @@ -1245,7 +1245,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CreateTranslationManipulators() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::unique_ptr translationManipulators = AZStd::make_unique( TranslationManipulators::Dimensions::Three, AZ::Transform::CreateIdentity(), AZ::Vector3::CreateOne()); @@ -1372,7 +1372,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CreateRotationManipulators() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::unique_ptr rotationManipulators = AZStd::make_unique(AZ::Transform::CreateIdentity()); @@ -1542,7 +1542,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CreateScaleManipulators() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::unique_ptr scaleManipulators = AZStd::make_unique(AZ::Transform::CreateIdentity()); @@ -1680,7 +1680,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::DeselectEntities() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!UndoRedoOperationInProgress()) { @@ -1708,7 +1708,7 @@ namespace AzToolsFramework bool EditorTransformComponentSelection::SelectDeselect(const AZ::EntityId entityIdUnderCursor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entityIdUnderCursor.IsValid()) { @@ -1760,7 +1760,7 @@ namespace AzToolsFramework bool EditorTransformComponentSelection::HandleMouseInteraction(const ViewportInteraction::MouseInteractionEvent& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); CheckDirtyEntityIds(); @@ -2024,7 +2024,7 @@ namespace AzToolsFramework const QString& statusTip, const T& callback) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); actions.emplace_back(AZStd::make_unique(nullptr)); @@ -2080,11 +2080,11 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RegisterActions() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto lockUnlock = [this](const bool lock) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_lockSelectionUndoRedoDesc); @@ -2122,7 +2122,7 @@ namespace AzToolsFramework const auto showHide = [this](const bool show) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_hideSelectionUndoRedoDesc); @@ -2163,7 +2163,7 @@ namespace AzToolsFramework m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L) }, UnlockAll, s_unlockAllTitle, s_unlockAllDesc, []() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_unlockAllUndoRedoDesc); @@ -2180,7 +2180,7 @@ namespace AzToolsFramework m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H) }, ShowAll, s_showAllTitle, s_showAllDesc, []() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_showAllEntitiesUndoRedoDesc); @@ -2197,7 +2197,7 @@ namespace AzToolsFramework m_actions, { QKeySequence(Qt::CTRL + Qt::Key_A) }, SelectAll, s_selectAllTitle, s_selectAllDesc, [this]() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_selectAllEntitiesUndoRedoDesc); @@ -2237,7 +2237,7 @@ namespace AzToolsFramework m_actions, { QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I) }, InvertSelect, s_invertSelectionTitle, s_invertSelectionDesc, [this]() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_invertSelectionUndoRedoDesc); @@ -2284,7 +2284,7 @@ namespace AzToolsFramework m_actions, { QKeySequence(Qt::CTRL + Qt::Key_D) }, DuplicateSelect, s_duplicateTitle, s_duplicateDesc, []() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // Clear Widget selection - Prevents issues caused by cloning entities while a property in the Reflected Property Editor // is being edited. @@ -2309,7 +2309,7 @@ namespace AzToolsFramework m_actions, { QKeySequence(Qt::Key_Delete) }, DeleteSelect, s_deleteTitle, s_deleteDesc, [this]() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_deleteUndoRedoDesc); @@ -2419,7 +2419,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::UnregisterManipulator() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators && m_entityIdManipulators.m_manipulators->Registered()) { @@ -2429,7 +2429,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RegisterManipulator() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators && !m_entityIdManipulators.m_manipulators->Registered()) { @@ -2439,7 +2439,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CreateEntityIdManipulators() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_selectedEntityIds.empty()) { @@ -2469,7 +2469,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RegenerateManipulators() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // note: create/destroy pattern to be addressed DestroyManipulators(m_entityIdManipulators); @@ -2636,7 +2636,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::SnapSelectedEntitiesToWorldGrid(const float gridSize) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZStd::array snapAxes = { AZ::Vector3::CreateAxisX(), AZ::Vector3::CreateAxisY(), AZ::Vector3::CreateAxisZ() }; @@ -2658,7 +2658,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::SetTransformMode(const Mode mode) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (mode == m_mode) { @@ -2725,7 +2725,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::AddEntityToSelection(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_selectedEntityIds.insert(entityId); AZ::TransformNotificationBus::MultiHandler::BusConnect(entityId); @@ -2733,7 +2733,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RemoveEntityFromSelection(const AZ::EntityId entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_selectedEntityIds.erase(entityId); AZ::TransformNotificationBus::MultiHandler::BusDisconnect(entityId); @@ -2746,7 +2746,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::SetSelectedEntities(const EntityIdList& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // we are responsible for updating the current selection m_didSetSelectedEntities = true; @@ -2755,7 +2755,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RefreshManipulators(const RefreshType refreshType) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators) { @@ -2793,7 +2793,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::OverrideManipulatorOrientation(const AZ::Quaternion& orientation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_pivotOverrideFrame.m_orientationOverride = orientation; @@ -2808,7 +2808,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::OverrideManipulatorTranslation(const AZ::Vector3& translation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_pivotOverrideFrame.m_translationOverride = translation; @@ -2821,7 +2821,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::ClearManipulatorTranslationOverride() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators) { @@ -2847,7 +2847,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::ClearManipulatorOrientationOverride() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators) { @@ -2875,7 +2875,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::ToggleCenterPivotSelection() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_pivotMode = TogglePivotMode(m_pivotMode); RefreshManipulators(RefreshType::Translation); } @@ -2883,7 +2883,7 @@ namespace AzToolsFramework template static bool ShouldUpdateEntityTransform(const AZ::EntityId entityId, const EntityIdMap& entityIdMap) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); static_assert(AZStd::is_same::value, "Container key type is not an EntityId"); @@ -2907,7 +2907,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CopyTranslationToSelectedEntitiesGroup(const AZ::Vector3& translation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_mode != Mode::Translation) { @@ -2963,7 +2963,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CopyTranslationToSelectedEntitiesIndividual(const AZ::Vector3& translation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_mode != Mode::Translation) { @@ -3008,7 +3008,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CopyScaleToSelectedEntitiesIndividualWorld(float scale) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_dittoScaleIndividualWorldUndoRedoDesc); @@ -3042,7 +3042,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CopyScaleToSelectedEntitiesIndividualLocal(float scale) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_dittoScaleIndividualLocalUndoRedoDesc); @@ -3061,7 +3061,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CopyOrientationToSelectedEntitiesIndividual(const AZ::Quaternion& orientation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators) { @@ -3099,7 +3099,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::CopyOrientationToSelectedEntitiesGroup(const AZ::Quaternion& orientation) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators) { @@ -3147,7 +3147,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::ResetOrientationForSelectedEntitiesLocal() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); ScopedUndoBatch undoBatch(s_resetOrientationToParentUndoRedoDesc); for (const auto& entityIdLookup : m_entityIdManipulators.m_lookups) @@ -3166,7 +3166,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::ResetTranslationForSelectedEntitiesLocal() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (m_entityIdManipulators.m_manipulators) { @@ -3236,7 +3236,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::AfterEntitySelectionChanged( [[maybe_unused]] const EntityIdList& newlySelectedEntities, [[maybe_unused]] const EntityIdList& newlyDeselectedEntities) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // EditorTransformComponentSelection was not responsible for the change in selection if (!m_didSetSelectedEntities) @@ -3265,7 +3265,7 @@ namespace AzToolsFramework const float axisLength, const AzFramework::CameraState& cameraState) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const int prevState = display.GetState(); @@ -3318,7 +3318,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::DisplayViewportSelection( const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); CheckDirtyEntityIds(); @@ -3536,7 +3536,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::DisplayViewportSelection2d( const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); DrawAxisGizmo(viewportInfo, debugDisplay); @@ -3545,7 +3545,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RefreshSelectedEntityIds() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // check what the 'authoritative' selected entity ids are after an undo/redo EntityIdList selectedEntityIds; @@ -3556,7 +3556,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::RefreshSelectedEntityIds(const EntityIdList& selectedEntityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::TransformNotificationBus::MultiHandler::BusDisconnect(); for (const AZ::EntityId& entityId : selectedEntityIds) @@ -3573,7 +3573,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::OnTransformChanged( [[maybe_unused]] const AZ::Transform& localTM, [[maybe_unused]] const AZ::Transform& worldTM) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_transformChangedInternally) { @@ -3583,7 +3583,7 @@ namespace AzToolsFramework void EditorTransformComponentSelection::OnViewportViewEntityChanged(const AZ::EntityId& newViewId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // if a viewport view entity has been set (e.g. we have set EditorCameraComponent to // match the editor camera translation/orientation), record the entity id if we have diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.cpp index f371805997..c65f494b72 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorVisibleEntityDataCache.cpp @@ -157,7 +157,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::CalculateVisibleEntityDatas(const AzFramework::ViewportInfo& viewportInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // request list of visible entities from authoritative system EntityIdList nextVisibleEntityIds; @@ -288,7 +288,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnEntityVisibilityChanged(const bool visibility) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *EditorEntityVisibilityNotificationBus::GetCurrentBusId(); @@ -300,7 +300,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnEntityLockChanged(const bool locked) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *EditorEntityLockComponentNotificationBus::GetCurrentBusId(); @@ -312,7 +312,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *AZ::TransformNotificationBus::GetCurrentBusId(); @@ -324,7 +324,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnAccentTypeChanged(const EntityAccentType accent) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *EditorComponentSelectionNotificationsBus::GetCurrentBusId(); @@ -336,7 +336,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnSelected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *EntitySelectionEvents::Bus::GetCurrentBusId(); @@ -348,7 +348,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnDeselected() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *EntitySelectionEvents::Bus::GetCurrentBusId(); @@ -360,7 +360,7 @@ namespace AzToolsFramework void EditorVisibleEntityDataCache::OnEntityIconChanged(const AZ::Data::AssetId& /*entityIconAssetId*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::EntityId entityId = *EditorEntityIconComponentNotificationBus::GetCurrentBusId(); diff --git a/Code/Framework/GridMate/GridMate/Replica/Replica.cpp b/Code/Framework/GridMate/GridMate/Replica/Replica.cpp index 5d0949bbe8..c1de3b71f2 100644 --- a/Code/Framework/GridMate/GridMate/Replica/Replica.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/Replica.cpp @@ -40,7 +40,7 @@ namespace GridMate , m_priority(0) , m_revision(1) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); m_upstreamHop = nullptr; m_dirtyHook.m_next = m_dirtyHook.m_prev = nullptr; @@ -86,7 +86,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::PreDestruct() { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); for (auto chunk : m_chunks) { @@ -137,7 +137,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool Replica::AttachReplicaChunk(const ReplicaChunkPtr& chunk) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); // Check for duplicate attach if (!chunk->GetReplica()) @@ -174,7 +174,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool Replica::DetachReplicaChunk(const ReplicaChunkPtr& chunk) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); if (!IsActive()) { @@ -213,7 +213,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::UpdateReplica(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); for (auto chunk : m_chunks) { @@ -226,7 +226,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::UpdateFromReplica(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); for (auto chunk : m_chunks) { @@ -239,7 +239,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool Replica::AcceptChangeOwnership(PeerId requestor, const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); for (auto chunk : m_chunks) { @@ -274,7 +274,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::OnDeactivate(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); EBUS_EVENT_ID(rc.m_rm->GetGridMate(), ReplicaMgrCallbackBus, OnDeactivateReplica, GetRepId(), rc.m_rm); EBUS_EVENT(Debug::ReplicaDrillerBus, OnDeactivateReplica, this); @@ -294,7 +294,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::OnChangeOwnership(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); for (auto chunk : m_chunks) { @@ -319,7 +319,7 @@ namespace GridMate { (void) rpcContext; - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); if (IsActive()) { @@ -382,7 +382,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::Activate(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); // Resolve whether we're migratable or not from the chunks // present when we're attached to the network. @@ -410,7 +410,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::Deactivate(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); if (IsActive()) { @@ -440,7 +440,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool Replica::ProcessRPCs(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); bool isProcessed = true; for (auto chunk : m_chunks) @@ -508,7 +508,7 @@ namespace GridMate //----------------------------------------------------------------------------- PrepareDataResult Replica::PrepareData(EndianType endianType, AZ::u32 marshalFlags) { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); PrepareDataResult pdr(false, false, false, false); bool dataSetChange = false; @@ -536,7 +536,7 @@ namespace GridMate //----------------------------------------------------------------------------- void Replica::Marshal(MarshalContext& mc) { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); // We are going to replace the outBuffer with a temporary chunk buffer for each chunk, // hold on to the original so we can restore it later and write the chunk buffers into @@ -639,7 +639,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool Replica::Unmarshal(UnmarshalContext& mc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); UnmarshalContext chunkContext(mc); ReadBuffer& buffer = *mc.m_iBuf; @@ -715,7 +715,7 @@ namespace GridMate //----------------------------------------------------------------------------- ReplicaChunkPtr Replica::CreateReplicaChunkFromStream(ReplicaChunkClassId classId, UnmarshalContext& mc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); ReplicaChunkPtr chunk = nullptr; ReplicaChunkDescriptor* pDesc = ReplicaChunkDescriptorTable::Get().FindReplicaChunkDescriptor(classId); diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaChunk.cpp b/Code/Framework/GridMate/GridMate/Replica/ReplicaChunk.cpp index 07b056d3bb..ee42ff2ad0 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaChunk.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaChunk.cpp @@ -152,7 +152,7 @@ namespace GridMate //----------------------------------------------------------------------------- PrepareDataResult ReplicaChunkBase::PrepareData(EndianType endianType, AZ::u32 marshalFlags) { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); PrepareDataResult pdr(false, false, false, false); bool forceDatasetsReliable = !!(marshalFlags & ReplicaMarshalFlags::ForceReliable); @@ -250,7 +250,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool ReplicaChunkBase::ShouldSendToPeer(ReplicaPeer* peer) const { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); // Only send chunks to the same zone as the peer return !!(peer->GetZoneMask() & GetDescriptor()->GetZoneMask()); @@ -258,7 +258,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::Marshal(MarshalContext& mc, AZ::u32 chunkIndex) { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); SafeGuardWrite(mc.m_outBuffer, [this, &mc, &chunkIndex]() { @@ -269,7 +269,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::Unmarshal(UnmarshalContext& mc, AZ::u32 chunkIndex) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); SafeGuardRead(mc.m_iBuf, [this, &mc, &chunkIndex]() { @@ -334,7 +334,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::MarshalDataSets(MarshalContext& mc, AZ::u32 chunkIndex) { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); AZ::u32 dirtyDataSetMask = CalculateDirtyDataSetMask(mc); AZStd::bitset changebits(dirtyDataSetMask); ReplicaChunkDescriptor* descriptor = GetDescriptor(); @@ -382,7 +382,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::UnmarshalDataSets(UnmarshalContext& mc, AZ::u32 chunkIndex) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); AZStd::bitset changebits; if (!mc.m_iBuf->Read(*changebits.data(), VlqU32Marshaler())) @@ -438,7 +438,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::MarshalRpcs(MarshalContext& mc, AZ::u32 chunkIndex) { - //AZ_PROFILE_TIMER("GridMate"); + //AZ_PROFILE_SCOPE("GridMate"); bool isAuthoritative = (mc.m_marshalFlags & ReplicaMarshalFlags::Authoritative) == ReplicaMarshalFlags::Authoritative; bool isReliable = (mc.m_marshalFlags & ReplicaMarshalFlags::Reliable) == ReplicaMarshalFlags::Reliable; @@ -496,7 +496,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::UnmarshalRpcs(UnmarshalContext& mc, AZ::u32 chunkIndex) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); // Unmarshal RPCs AZ::u32 rpcCount; @@ -629,7 +629,7 @@ namespace GridMate //----------------------------------------------------------------------------- bool ReplicaChunkBase::ProcessRPCs(const ReplicaContext& rc) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); // Process incoming RPCs for (RPCQueue::iterator iRPC = m_rpcQueue.begin(); iRPC != m_rpcQueue.end(); ) @@ -733,7 +733,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::AttachedToReplica(Replica* replica) { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); AZ_Assert(!m_replica, "Should not be attached to a replica"); @@ -748,7 +748,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaChunkBase::DetachedFromReplica() { - AZ_PROFILE_TIMER("GridMate"); + AZ_PROFILE_FUNCTION(GridMate); AZ_Assert(m_replica, "Should be attached to a replica"); EBUS_EVENT(Debug::ReplicaDrillerBus, OnDetachReplicaChunk, this); diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp index b8eea00871..f1b91fa1ad 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp @@ -700,7 +700,7 @@ namespace GridMate { if (IsUsingFixedTimeStep()) { - return static_cast(m_fixedTimeStep.GetCurrentTime()); + return static_cast(m_fixedTimeStep.CurrentTime()); } else { @@ -867,7 +867,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaManager::UpdateFromReplicas() { - AZ_PROFILE_TIMER("GridMate", __FUNCTION__); + AZ_PROFILE_FUNCTION(GridMate); if (!IsInitialized()) { @@ -888,7 +888,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaManager::UpdateReplicas() { - AZ_PROFILE_TIMER("GridMate", __FUNCTION__); + AZ_PROFILE_FUNCTION(GridMate); if (!IsInitialized()) { @@ -940,7 +940,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaManager::Marshal() { - AZ_PROFILE_TIMER("GridMate", __FUNCTION__); + AZ_PROFILE_FUNCTION(GridMate); if (!IsReady()) { @@ -1287,7 +1287,7 @@ namespace GridMate //----------------------------------------------------------------------------- void ReplicaManager::Unmarshal() { - AZ_PROFILE_TIMER("GridMate", __FUNCTION__); + AZ_PROFILE_FUNCTION(GridMate); if (!IsInitialized()) { diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h index bd9f1a1ee9..bedff54939 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h @@ -302,7 +302,7 @@ namespace GridMate // this could allow for changing on the fly but it would need to ensure that if it were in the middle of a second, that the new rate would result in landing on the } - AZ::u64 GetCurrentTime() const + AZ::u64 CurrentTime() const { return m_currentTime; } diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaUtils.h b/Code/Framework/GridMate/GridMate/Replica/ReplicaUtils.h index 6833aa9234..8de2abab6e 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaUtils.h +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaUtils.h @@ -81,7 +81,7 @@ namespace GridMate #define GM_ENABLE_PROFILE_USER_CALLBACKS 1 #if (GM_ENABLE_PROFILE_USER_CALLBACKS) -#define GM_PROFILE_USER_CALLBACK(callback) AZ_PROFILE_TIMER("GridMate User Code", callback); +#define GM_PROFILE_USER_CALLBACK(callback) AZ_PROFILE_SCOPE(GridMate, "GridMate User Code: %s", callback); #else #define GM_PROFILE_USER_CALLBACK(callback) #endif diff --git a/Code/Legacy/CryCommon/FrameProfiler.h b/Code/Legacy/CryCommon/FrameProfiler.h index 12eb6a34a1..ac6d3a52a1 100644 --- a/Code/Legacy/CryCommon/FrameProfiler.h +++ b/Code/Legacy/CryCommon/FrameProfiler.h @@ -43,32 +43,25 @@ enum EProfiledSubsystem }; #undef X -static_assert(static_cast(PROFILE_LAST_SUBSYSTEM) == AZ::Debug::ProfileCategory::LegacyLast, "Mismatched AZ and Legacy profile categories"); #include #define FUNCTION_PROFILER_LEGACYONLY(pISystem, subsystem) -#define FUNCTION_PROFILER(pISystem, subsystem) \ - AZ_PROFILE_FUNCTION(static_cast(subsystem)); +#define FUNCTION_PROFILER(pISystem, subsystem) -#define FUNCTION_PROFILER_FAST(pISystem, subsystem, bProfileEnabled) \ - AZ_PROFILE_FUNCTION(static_cast(subsystem)); +#define FUNCTION_PROFILER_FAST(pISystem, subsystem, bProfileEnabled) -#define FUNCTION_PROFILER_ALWAYS(pISystem, subsystem) \ - AZ_PROFILE_FUNCTION(static_cast(subsystem)); +#define FUNCTION_PROFILER_ALWAYS(pISystem, subsystem) #define FRAME_PROFILER_LEGACYONLY(szProfilerName, pISystem, subsystem) -#define FRAME_PROFILER(szProfilerName, pISystem, subsystem) \ - AZ_PROFILE_SCOPE(static_cast(subsystem), szProfilerName); +#define FRAME_PROFILER(szProfilerName, pISystem, subsystem) -#define FRAME_PROFILER_FAST(szProfilerName, pISystem, subsystem, bProfileEnabled) \ - AZ_PROFILE_SCOPE(static_cast(subsystem), szProfilerName); +#define FRAME_PROFILER_FAST(szProfilerName, pISystem, subsystem, bProfileEnabled) -#define FUNCTION_PROFILER_SYS(subsystem) \ - FUNCTION_PROFILER(gEnv->pSystem, PROFILE_##subsystem) +#define FUNCTION_PROFILER_SYS(subsystem) #define STALL_PROFILER(cause) diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h index ff72c2e60f..d8aba337d5 100644 --- a/Code/Legacy/CryCommon/ISystem.h +++ b/Code/Legacy/CryCommon/ISystem.h @@ -1151,10 +1151,10 @@ struct DiskOperationInfo #if defined(ENABLE_LOADING_PROFILER) && AZ_PROFILE_TELEMETRY -#define LOADING_TIME_PROFILE_SECTION AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore) -#define LOADING_TIME_PROFILE_SECTION_ARGS(...) AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, __VA_ARGS__) -#define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName) AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, sectionName) -#define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...) AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, sectionName, __VA_ARGS__) +#define LOADING_TIME_PROFILE_SECTION AZ_PROFILE_FUNCTION(AzCore) +#define LOADING_TIME_PROFILE_SECTION_ARGS(...) AZ_PROFILE_SCOPE(AzCore, __VA_ARGS__) +#define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName) AZ_PROFILE_SCOPE(AzCore, sectionName) +#define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...) AZ_PROFILE_SCOPE(AzCore, sectionName, __VA_ARGS__) #else diff --git a/Code/Legacy/CryCommon/LegacyAllocator.h b/Code/Legacy/CryCommon/LegacyAllocator.h index 074c183de4..18af1400d5 100644 --- a/Code/Legacy/CryCommon/LegacyAllocator.h +++ b/Code/Legacy/CryCommon/LegacyAllocator.h @@ -69,7 +69,7 @@ namespace AZ } pointer_type ptr = m_schema->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord); - AZ_PROFILE_MEMORY_ALLOC_EX(AZ::Debug::ProfileCategory::MemoryReserved, fileName, lineNum, ptr, byteSize, name ? name : GetName()); + AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, ptr, byteSize, name ? name : GetName()); AZ_MEMORY_PROFILE(ProfileAllocation(ptr, byteSize, alignment, name, fileName, lineNum, suppressStackRecord)); AZ_Assert(ptr || byteSize == 0, "OOM - Failed to allocate %zu bytes from LegacyAllocator", byteSize); return ptr; @@ -78,7 +78,7 @@ namespace AZ // DeAllocate with file/line, to track when allocs were freed from Cry void DeAllocate(pointer_type ptr, [[maybe_unused]] const char* file, [[maybe_unused]] const int line, size_type byteSize = 0, size_type alignment = 0) { - AZ_PROFILE_MEMORY_FREE_EX(AZ::Debug::ProfileCategory::MemoryReserved, file, line, ptr); + AZ_PROFILE_MEMORY_FREE_EX(MemoryReserved, file, line, ptr); AZ_MEMORY_PROFILE(ProfileDeallocation(ptr, byteSize, alignment, nullptr)); m_schema->DeAllocate(ptr, byteSize, alignment); } @@ -94,9 +94,9 @@ namespace AZ } AZ_MEMORY_PROFILE(ProfileReallocationBegin(ptr, newSize)); - AZ_PROFILE_MEMORY_FREE_EX(AZ::Debug::ProfileCategory::MemoryReserved, file, line, ptr); + AZ_PROFILE_MEMORY_FREE_EX(MemoryReserved, file, line, ptr); pointer_type newPtr = m_schema->ReAllocate(ptr, newSize, newAlignment); - AZ_PROFILE_MEMORY_ALLOC_EX(AZ::Debug::ProfileCategory::MemoryReserved, file, line, newPtr, newSize, "LegacyAllocator Realloc"); + AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, file, line, newPtr, newSize, "LegacyAllocator Realloc"); AZ_MEMORY_PROFILE(ProfileReallocationEnd(ptr, newPtr, newSize, newAlignment)); AZ_Assert(newPtr || newSize == 0, "OOM - Failed to reallocate %zu bytes from LegacyAllocator", newSize); return newPtr; diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index 4263d813b7..dc8a555286 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -203,7 +203,7 @@ void __stl_debug_message(const char* format_str, ...) ////////////////////////////////////////////////////////////////////////// void CrySleep(unsigned int dwMilliseconds) { - AZ_PROFILE_FUNCTION_IDLE(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); Sleep(dwMilliseconds); } diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 3673088695..d848160b3e 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -701,7 +701,7 @@ void CSystem::SleepIfNeeded() int sleepMS = (int)(1000.0f * sleepTime + 0.5f); if (sleepMS > 0) { - AZ_PROFILE_FUNCTION_IDLE(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); Sleep(sleepMS); } diff --git a/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidget.cpp b/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidget.cpp index 6cec14a9c5..eba43d2e36 100644 --- a/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidget.cpp +++ b/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidget.cpp @@ -40,7 +40,7 @@ namespace AZ void ManifestWidget::BuildFromScene(const AZStd::shared_ptr& scene) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); ui->m_tabs->clear(); m_pages.clear(); @@ -80,7 +80,7 @@ namespace AZ bool ManifestWidget::AddObject(const AZStd::shared_ptr& object) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); for (ManifestWidgetPage* page : m_pages) { if (page->SupportsType(object)) diff --git a/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidgetPage.cpp b/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidgetPage.cpp index 118db8217e..cd80b68509 100644 --- a/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidgetPage.cpp +++ b/Code/Tools/SceneAPI/SceneUI/SceneWidgets/ManifestWidgetPage.cpp @@ -76,7 +76,7 @@ namespace AZ bool ManifestWidgetPage::AddObject(const AZStd::shared_ptr& object) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); if (!SupportsType(object)) { return false; @@ -218,7 +218,7 @@ namespace AZ void ManifestWidgetPage::RefreshPage() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor); + AZ_PROFILE_FUNCTION(Editor); m_propertyEditor->InvalidateAll(); m_propertyEditor->ExpandAll(); } diff --git a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp index c672e4414a..fef31aaaf3 100644 --- a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp +++ b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp @@ -231,14 +231,14 @@ namespace AreaChart void AreaChart::AddPoint(size_t seriesId, int position, unsigned int value) { - AZ_PROFILE_TIMER("Standalone Tools", __FUNCTION__); + AZ_PROFILE_FUNCTION(AzToolsFramework); LinePoint linePoint(position,value); AddPoint(seriesId,linePoint); } void AreaChart::AddPoint(size_t seriesId, const LinePoint& linePoint) { - AZ_PROFILE_TIMER("Standalone Tools", __FUNCTION__); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!IsValidSeriesId(seriesId)) { AZ_Error("AreaChart", false, "Invalid SeriesId given."); @@ -419,7 +419,7 @@ namespace AreaChart void AreaChart::paintEvent(QPaintEvent* event) { - AZ_PROFILE_TIMER("Standalone Tools", __FUNCTION__); + AZ_PROFILE_FUNCTION(AzToolsFramework); (void)event; if (m_sizingDirty) @@ -435,7 +435,7 @@ namespace AreaChart if (m_regenGraph) { - AZ_PROFILE_TIMER("Standalone Tools", "Generating Graph Data"); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_regenGraph = false; if (m_verticalAxis) diff --git a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h index 8b7e3f36af..2db8966a2e 100644 --- a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h +++ b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h @@ -203,7 +203,7 @@ namespace Driller void RedrawGraph() { - AZ_PROFILE_TIMER("Standalone Tools", __FUNCTION__); + AZ_PROFILE_FUNCTION(AzToolsFramework); switch (m_displayMode) { case DisplayMode::Active: @@ -518,7 +518,7 @@ namespace Driller void RefreshView(FrameNumberType frameId) { - AZ_PROFILE_TIMER("Standalone Tools", __FUNCTION__); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::unordered_set< Key > discoveredSet; m_tableViewOrdering.clear(); diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp index e538b47429..be4c7d14ff 100644 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp +++ b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp @@ -1628,7 +1628,7 @@ namespace Driller void ReplicaDataView::ParseFrameData(FrameNumberType frameId) { - AZ_PROFILE_TIMER("Standalone Tools", __FUNCTION__); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (frameId < 0 || frameId >= m_aggregator->GetFrameCount() || m_parsedFrames.find(frameId) != m_parsedFrames.end()) { return; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h index cb6c742722..fc89abfc9a 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h @@ -73,3 +73,4 @@ namespace ImageProcessingAtom using ImageBuilderRequestBus = AZ::EBus; } // namespace ImageProcessingAtom + diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h index 0d6ac5d959..0df628e9cd 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h @@ -94,3 +94,4 @@ namespace ImageProcessingAtom AZStd::vector> m_assetHandlers; }; }// namespace ImageProcessingAtom + diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/AuxGeomDrawQueue.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/AuxGeomDrawQueue.cpp index 7f9bae7e49..214643505a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/AuxGeomDrawQueue.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/AuxGeomDrawQueue.cpp @@ -649,7 +649,7 @@ namespace AZ AZ::u8 width, int32_t viewProjOverrideIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); // grab a mutex lock for the rest of this function so that a commit cannot happen during it and // other threads can't add geometry during it @@ -720,7 +720,7 @@ namespace AZ AZ::u8 width, int32_t viewProjOverrideIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("AuxGeom", "AuxGeomDrawQueue: DrawPrimitiveWithSharedVerticesCommon"); AZ_Assert(indexCount >= verticesPerPrimitiveType && (indexCount % verticesPerPrimitiveType == 0), diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp index f2b3a93a53..698b7e1e37 100644 --- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/FixedShapeProcessor.cpp @@ -127,7 +127,7 @@ namespace AZ void FixedShapeProcessor::ProcessObjects(const AuxGeomBufferData* bufferData, const RPI::FeatureProcessor::RenderPacket& fpPacket) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("AuxGeom", "FixedShapeProcessor: ProcessObjects"); RHI::DrawPacketBuilder drawPacketBuilder; diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp index bda7e2463b..90fd926b99 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp @@ -145,7 +145,7 @@ namespace AZ void DecalTextureArrayFeatureProcessor::Simulate(const RPI::FeatureProcessor::SimulatePacket& packet) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender) + AZ_PROFILE_FUNCTION(AzRender); AZ_UNUSED(packet); if (m_deviceBufferNeedsUpdate) @@ -159,7 +159,7 @@ namespace AZ void DecalTextureArrayFeatureProcessor::Render(const RPI::FeatureProcessor::RenderPacket& packet) { // Note that decals are rendered as part of the forward shading pipeline. We only need to bind the decal buffers/textures in here. - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender) + AZ_PROFILE_FUNCTION(AzRender); for (const RPI::ViewPtr& view : packet.m_views) { @@ -295,7 +295,7 @@ namespace AZ void DecalTextureArrayFeatureProcessor::SetDecalMaterial(const DecalHandle handle, const AZ::Data::AssetId material) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Renderer); + AZ_PROFILE_FUNCTION(Renderer); if (handle.IsNull()) { AZ_Warning("DecalTextureArrayFeatureProcessor", false, "Invalid handle passed to DecalTextureArrayFeatureProcessor::SetDecalMaterial()."); @@ -365,7 +365,7 @@ namespace AZ void DecalTextureArrayFeatureProcessor::OnAssetReady(const Data::Asset asset) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Renderer); + AZ_PROFILE_FUNCTION(Renderer); const Data::AssetId& assetId = asset->GetId(); const RPI::MaterialAsset* materialAsset = asset.GetAs(); diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridFeatureProcessor.cpp index 378e1923f7..543851da0f 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGridFeatureProcessor.cpp @@ -111,7 +111,7 @@ namespace AZ void DiffuseProbeGridFeatureProcessor::Simulate([[maybe_unused]] const FeatureProcessor::SimulatePacket& packet) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); // update pipeline states if (m_needUpdatePipelineStates) @@ -149,7 +149,7 @@ namespace AZ // if the volumes changed we need to re-sort the probe list if (m_probeGridSortRequired) { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "Sort diffuse probe grids"); + AZ_PROFILE_SCOPE(AzRender, "Sort diffuse probe grids"); // sort the probes by descending inner volume size, so the smallest volumes are rendered last auto sortFn = [](AZStd::shared_ptr const& probe1, AZStd::shared_ptr const& probe2) -> bool diff --git a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp index cd781390a3..f87a9b30e9 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp @@ -582,7 +582,7 @@ namespace AZ void ImGuiPass::BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("Pass", "ImGuiPass: Execute"); context.GetCommandList()->SetViewport(m_viewportState); @@ -612,7 +612,7 @@ namespace AZ uint32_t ImGuiPass::UpdateImGuiResources() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("Pass", "ImGuiPass: UpdateImGuiResources"); auto imguiContextScope = ImguiContextScope(m_imguiContext); diff --git a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp index 8e2c6f2e9b..58541da92a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp @@ -75,7 +75,7 @@ namespace AZ void MeshFeatureProcessor::Simulate(const FeatureProcessor::SimulatePacket& packet) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RPI", "MeshFeatureProcessor: Simulate"); AZ_UNUSED(packet); @@ -87,7 +87,7 @@ namespace AZ { const auto jobLambda = [&]() -> void { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "MeshFP::Simulate() Lambda"); + AZ_PROFILE_SCOPE(AzRender, "MeshFP::Simulate() Lambda"); for (auto meshDataIter = iteratorRange.first; meshDataIter != iteratorRange.second; ++meshDataIter) { if (!meshDataIter->m_model) @@ -149,7 +149,7 @@ namespace AZ const MeshHandleDescriptor& descriptor, const MaterialAssignmentMap& materials) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); // don't need to check the concurrency during emplace() because the StableDynamicArray won't move the other elements during insertion MeshHandle meshDataHandle = m_meshData.emplace(); @@ -478,7 +478,7 @@ namespace AZ : m_modelAsset(modelAsset) , m_parent(parent) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (!m_modelAsset.GetId().IsValid()) { @@ -507,7 +507,7 @@ namespace AZ //! AssetBus::Handler overrides... void MeshDataInstance::MeshLoader::OnAssetReady(Data::Asset asset) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); Data::Asset modelAsset = asset; // Assign the fully loaded asset back to the mesh handle to not only hold asset id, but the actual data as well. @@ -579,7 +579,7 @@ namespace AZ void MeshDataInstance::Init(Data::Instance model) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); m_model = model; const size_t modelLodCount = m_model->GetLodCount(); @@ -611,7 +611,7 @@ namespace AZ void MeshDataInstance::BuildDrawPacketList(size_t modelLodIndex) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); RPI::ModelLod& modelLod = *m_model->GetLods()[modelLodIndex]; const size_t meshCount = modelLod.GetMeshes().size(); @@ -985,7 +985,7 @@ namespace AZ void MeshDataInstance::UpdateDrawPackets(bool forceUpdate /*= false*/) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); for (auto& drawPacketList : m_drawPacketListsByLod) { for (auto& drawPacket : drawPacketList) @@ -1000,7 +1000,7 @@ namespace AZ void MeshDataInstance::BuildCullable() { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(m_cullableNeedsRebuild, "This function only needs to be called if the cullable to be rebuilt"); AZ_Assert(m_model, "The model has not finished loading yet"); @@ -1079,7 +1079,7 @@ namespace AZ void MeshDataInstance::UpdateCullBounds(const TransformServiceFeatureProcessor* transformService) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(m_cullBoundsNeedsUpdate, "This function only needs to be called if the culling bounds need to be rebuilt"); AZ_Assert(m_model, "The model has not finished loading yet"); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbeFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbeFeatureProcessor.cpp index c0e25e3da9..341d1a0274 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbeFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbeFeatureProcessor.cpp @@ -154,7 +154,7 @@ namespace AZ void ReflectionProbeFeatureProcessor::Simulate([[maybe_unused]] const FeatureProcessor::SimulatePacket& packet) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("ReflectionProbe", "ReflectionProbeFeatureProcessor: Simulate"); // update pipeline states @@ -193,7 +193,7 @@ namespace AZ // if the volumes changed we need to re-sort the probe list if (m_probeSortRequired) { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "Sort reflection probes"); + AZ_PROFILE_SCOPE(AzRender, "Sort reflection probes"); AZ_ATOM_PROFILE_FUNCTION("ReflectionProbe", "ReflectionProbeFeatureProcessor: Sort reflection probes"); // sort the probes by descending inner volume size, so the smallest volumes are rendered last diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshFeatureProcessor.cpp index ebe52cdafe..0aa72bf2ca 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshFeatureProcessor.cpp @@ -69,13 +69,13 @@ namespace AZ void SkinnedMeshFeatureProcessor::Render(const FeatureProcessor::RenderPacket& packet) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("SkinnedMesh", "SkinnedMeshFeatureProcessor: Render"); #if 0 //[GFX_TODO][ATOM-13564] Temporarily disable skinning culling until we figure out how to hook up visibility & lod selection with skinning: //Setup the culling workgroup (it will be re-used for each view) { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "set up skinned culling workgroup"); + AZ_PROFILE_SCOPE(AzRender, "set up skinned culling workgroup"); azsnprintf(m_workgroup.m_name, AZ_ARRAY_SIZE(m_workgroup.m_name), "SkinnedMeshFP workgroup"); m_workgroup.m_drawListMask.reset(); m_workgroup.m_cullPackets.clear(); @@ -118,11 +118,11 @@ namespace AZ Job* processWorkgroupJob = AZ::CreateJobFunction( [this, cullingSystem, viewPtr](AZ::Job& thisJob) { - AZ_PROFILE_SCOPE_DYNAMIC(Debug::ProfileCategory::AzRender, "skinningMeshFP processWorkgroupJob - View: %s", viewPtr->GetName().GetCStr()); + AZ_PROFILE_SCOPE(AzRender, "skinningMeshFP processWorkgroupJob - View: %s", viewPtr->GetName().GetCStr()); auto dispatchSkinningComputeProgramsCallback = [this](AZStd::shared_ptr results) -> void { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "dispatchSkinningComputePrograms"); + AZ_PROFILE_SCOPE(AzRender, "dispatchSkinningComputePrograms"); //the [1][1] element of a projection matrix stores cot(FovY/2) (equal to 2*nearPlaneDistance/nearPlaneHeight), //which is used to determine the (vertical) projected size in screen space diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp index af427eb554..58c8b3a4a3 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp @@ -532,7 +532,7 @@ namespace AZ // lod0 Positions[^ ^] lod0Normals[^ ^] lod1Positions[^ ^] lod1Normals[^ ^] // lod0 subMesh0+1 Positions[^ ^^ ^] lod0 subMesh0+1 Normals[^ ^^ ^] lod1 sm0+1 pos[^ ^^ ^] lod1 sm0+1 norm[^ ^^ ^] - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZStd::intrusive_ptr instance = aznew SkinnedMeshInstance; // Each model gets a unique, random ID, so if the same source model is used for multiple instances, multiple target models will be created. diff --git a/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp b/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp index d74ce558cd..a32301276e 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp @@ -7,6 +7,8 @@ */ #include +#include + namespace AZ { namespace RHI @@ -124,7 +126,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION_IDLE(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZStd::unique_lock lock(m_waitWorkItemMutex); m_waitWorkItemCondition.wait(lock, [&]() {return HasFinishedWork(workHandle); }); diff --git a/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp index ae6a645440..2474967dab 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp @@ -22,7 +22,7 @@ namespace AZ ResultCode CommandQueue::Init(Device& device, const CommandQueueDescriptor& descriptor) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); #if defined (AZ_RHI_ENABLE_VALIDATION) if (IsInitialized()) @@ -116,7 +116,7 @@ namespace AZ //run a command { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "RHI::CommandQueue - Execute Command"); + AZ_PROFILE_SCOPE(AzRender, "RHI::CommandQueue - Execute Command"); command(GetNativeQueue()); } } diff --git a/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp b/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp index 838beb0863..868d2e3317 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp @@ -81,7 +81,7 @@ namespace AZ return ResultCode::InvalidOperation; } - AZ_PROFILE_FUNCTION_IDLE(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); WaitOnCpuInternal(); return ResultCode::Success; } diff --git a/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp b/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp index 795ab591eb..0793c1ffd0 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp @@ -137,7 +137,7 @@ namespace AZ ResultCode FrameScheduler::ImportScopeProducer(ScopeProducer& scopeProducer) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (!ValidateIsProcessing()) { @@ -216,7 +216,7 @@ namespace AZ void FrameScheduler::PrepareProducers() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: PrepareProducers"); for (ScopeProducer* scopeProducer : m_scopeProducers) @@ -237,7 +237,7 @@ namespace AZ void FrameScheduler::CompileProducers() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: CompileProducers"); for (ScopeProducer* scopeProducer : m_scopeProducers) @@ -249,12 +249,12 @@ namespace AZ void FrameScheduler::CompileShaderResourceGroups() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: CompileShaderResourceGroups"); // Execute all queued resource invalidations, which will mark SRG's for compilation. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Invalidate Resources"); + AZ_PROFILE_SCOPE(AzRender, "Invalidate Resources"); ResourceInvalidateBus::ExecuteQueuedEvents(); } @@ -322,7 +322,7 @@ namespace AZ void FrameScheduler::BuildRayTracingShaderTables() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: BuildRayTracingShaderTables"); for (auto rayTracingShaderTable : m_rayTracingShaderTablesToBuild) @@ -341,7 +341,7 @@ namespace AZ ResultCode FrameScheduler::BeginFrame() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: BeginFrame"); if (!ValidateIsInitialized()) @@ -376,7 +376,7 @@ namespace AZ ResultCode FrameScheduler::EndFrame() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: EndFrame"); if (Validation::IsEnabled()) @@ -417,13 +417,13 @@ namespace AZ void FrameScheduler::ExecuteContextInternal(FrameGraphExecuteGroup& group, uint32_t index) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); FrameGraphExecuteContext* executeContext = group.BeginContext(index); { ScopeProducer* scopeProducer = FindScopeProducer(executeContext->GetScopeId()); - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzRender, "ScopeProducer: %s", scopeProducer->GetScopeId().GetCStr()); + AZ_PROFILE_SCOPE(AzRender, "ScopeProducer: %s", scopeProducer->GetScopeId().GetCStr()); scopeProducer->BuildCommandList(*executeContext); } @@ -432,7 +432,7 @@ namespace AZ void FrameScheduler::ExecuteGroupInternal(AZ::Job* parentJob, uint32_t groupIndex) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: ExecuteGroupInternal"); FrameGraphExecuteGroup* executeGroup = m_frameGraphExecuter->BeginGroup(groupIndex); @@ -475,7 +475,7 @@ namespace AZ void FrameScheduler::Execute(JobPolicy overrideJobPolicy) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: Execute"); const uint32_t groupCount = m_frameGraphExecuter->GetGroupCount(); diff --git a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp index 0210d941dc..69eee86108 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp @@ -272,7 +272,7 @@ namespace AZ const PipelineState* PipelineStateCache::AcquirePipelineState(PipelineLibraryHandle handle, const PipelineStateDescriptor& descriptor) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (handle.IsNull()) { diff --git a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp index 49244f776f..5e08696ec2 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp @@ -209,11 +209,11 @@ namespace AZ void RHISystem::FrameUpdate(FrameGraphCallback frameGraphCallback) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RHI", "RHISystem: FrameUpdate"); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "main per-frame work"); + AZ_PROFILE_SCOPE(AzRender, "main per-frame work"); m_frameScheduler.BeginFrame(); frameGraphCallback(m_frameScheduler); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp index 70c6aa0b7c..81e52d6d3f 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp @@ -152,21 +152,21 @@ namespace AZ m_copyQueue->QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Upload Buffer"); + AZ_PROFILE_SCOPE(AzRender, "Upload Buffer"); size_t pendingByteOffset = 0; size_t pendingByteCount = byteCount; ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); while (pendingByteCount > 0) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Upload Buffer Chunk"); + AZ_PROFILE_SCOPE(AzRender, "Upload Buffer Chunk"); FramePacket* framePacket = BeginFramePacket(); const size_t bytesToCopy = AZStd::min(pendingByteCount, m_descriptor.m_stagingSizeInBytes); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Copy CPU buffer"); + AZ_PROFILE_SCOPE(AzRender, "Copy CPU buffer"); memcpy(framePacket->m_stagingResourceData, sourceData + pendingByteOffset, bytesToCopy); } @@ -196,7 +196,7 @@ namespace AZ AsyncUploadQueue::FramePacket* AsyncUploadQueue::BeginFramePacket() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(!m_recordingFrame, "The previous frame packet isn't ended"); FramePacket* framePacket = &m_framePackets[m_frameIndex]; @@ -212,7 +212,7 @@ namespace AZ void AsyncUploadQueue::EndFramePacket(ID3D12CommandQueue* commandQueue) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(m_recordingFrame, "The frame packet wasn't started. You need to call StartFramePacket first."); AssertSuccess(m_commandList->Close()); @@ -229,7 +229,7 @@ namespace AZ // [GFX TODO][ATOM-4205] Stage/Upload 3D streaming images more efficiently. uint64_t AsyncUploadQueue::QueueUpload(const RHI::StreamingImageExpandRequest& request, uint32_t residentMip) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); uint64_t fenceValue = m_uploadFence.Increment(); @@ -243,7 +243,7 @@ namespace AZ m_copyQueue->QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Upload Image"); + AZ_PROFILE_SCOPE(AzRender, "Upload Image"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); FramePacket* framePacket = BeginFramePacket(); @@ -314,7 +314,7 @@ namespace AZ // Copy subresource data to staging memory. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); uint8_t* stagingDataStart = framePacket->m_stagingResourceData + framePacket->m_dataOffset; const uint8_t* subresourceSliceDataStart = static_cast(subresource.m_data) + (depth * subresourceSlicePitch); @@ -385,7 +385,7 @@ namespace AZ // Copy subresource data to staging memory { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); for (uint32_t row = startRow; row < endRow; row++) { uint8_t* stagingDataStart = framePacket->m_stagingResourceData + framePacket->m_dataOffset; @@ -476,7 +476,7 @@ namespace AZ void AsyncUploadQueue::WaitForUpload(uint64_t fenceValue) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (!IsUploadFinished(fenceValue)) { @@ -490,7 +490,7 @@ namespace AZ void AsyncUploadQueue::ProcessCallbacks(uint64_t fenceValue) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZStd::lock_guard lock(m_callbackMutex); while (m_callbacks.size() > 0 && m_callbacks.front().second <= fenceValue) { @@ -504,7 +504,7 @@ namespace AZ { m_copyQueue->QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "QueueTileMapping"); + AZ_PROFILE_SCOPE(AzRender, "QueueTileMapping"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); const uint32_t tileCount = request.m_sourceRegionSize.NumTiles; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp index 7aa9f5391a..a8ae753294 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp @@ -33,7 +33,7 @@ namespace AZ void CommandListBase::Reset(ID3D12CommandAllocator* commandAllocator) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(m_queuedBarriers.empty(), "Unflushed barriers in command list."); m_commandList->Reset(commandAllocator, nullptr); @@ -95,7 +95,7 @@ namespace AZ { if (m_queuedBarriers.size()) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRenderDetailed); + AZ_PROFILE_FUNCTION(AzRenderDetailed); m_commandList->ResourceBarrier((UINT)m_queuedBarriers.size(), m_queuedBarriers.data()); m_queuedBarriers.clear(); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.h b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.h index 5337228614..5f3e4dce1e 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.h +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.h @@ -7,11 +7,15 @@ */ #pragma once +// NOTE: We are careful to include platform headers *before* we include AzCore/Debug/Profiler.h to ensure that d3d12 symbols +// are defined prior to the inclusion of the pix3 runtime. +#include + #include #include +#include #include #include -#include namespace AZ { diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp index 9de706cbe1..b73228e717 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp @@ -110,7 +110,7 @@ namespace AZ { QueueCommand([this, &fence](void* commandQueue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "SignalFence"); + AZ_PROFILE_SCOPE(AzRender, "SignalFence"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); dx12CommandQueue->Signal(fence.Get(), fence.GetPendingValue()); }); @@ -138,7 +138,7 @@ namespace AZ QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "ExecuteWork"); + AZ_PROFILE_SCOPE(AzRender, "ExecuteWork"); AZ_PROFILE_RHI_VARIABLE(m_lastExecuteDuration); static const uint32_t CommandListCountMax = 128; @@ -195,7 +195,7 @@ namespace AZ void CommandQueue::UpdateTileMappings(CommandList& commandList) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); for (const CommandList::TileMapRequest& request : commandList.GetTileMapRequests()) { const uint32_t tileCount = request.m_sourceRegionSize.NumTiles; @@ -229,7 +229,7 @@ namespace AZ void CommandQueue::WaitForIdle() { - AZ_PROFILE_FUNCTION_IDLE(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); Fence fence; fence.Init(m_device.get(), RHI::FenceState::Reset); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp index 1c5fd6fa05..f35f66f3e8 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp @@ -101,7 +101,7 @@ namespace AZ void CommandQueueContext::WaitForIdle() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); for (uint32_t hardwareQueueIdx = 0; hardwareQueueIdx < RHI::HardwareQueueClassCount; ++hardwareQueueIdx) { if (m_commandQueues[hardwareQueueIdx]) @@ -113,10 +113,10 @@ namespace AZ void CommandQueueContext::Begin() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Clearing Command Queue Timers"); + AZ_PROFILE_SCOPE(AzRender, "Clearing Command Queue Timers"); for (const RHI::Ptr& commandQueue : m_commandQueues) { commandQueue->ClearTimers(); @@ -131,7 +131,7 @@ namespace AZ void CommandQueueContext::End() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("DX12", "CommandQueueContext: End"); QueueGpuSignals(m_frameFences[m_currentFrameIndex]); @@ -145,7 +145,7 @@ namespace AZ m_currentFrameIndex = (m_currentFrameIndex + 1) % aznumeric_cast(m_frameFences.size()); { - AZ_PROFILE_SCOPE_IDLE(AZ::Debug::ProfileCategory::AzRender, "Wait and Reset Fence"); + AZ_PROFILE_SCOPE(AzRender, "Wait and Reset Fence"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("DX12", "CommandQueueContext: Wait on Fences"); FenceEvent event("FrameFence"); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp index f61aa3f67f..6244089d93 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp @@ -60,7 +60,7 @@ namespace AZ { if (fenceValue > GetCompletedValue()) { - AZ_PROFILE_SCOPE_IDLE_DYNAMIC(AZ::Debug::ProfileCategory::AzRender, "Fence Wait: %s", fenceEvent.GetName()); + AZ_PROFILE_SCOPE(AzRender, "Fence Wait: %s", fenceEvent.GetName()); m_fence->SetEventOnCompletion(fenceValue, fenceEvent.m_EventHandle); WaitForSingleObject(fenceEvent.m_EventHandle, INFINITE); } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h index 064efe5722..133b8aa664 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h @@ -7,12 +7,13 @@ */ #pragma once +#include + #include #include #include #include #include -#include namespace AZ { diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp index 6f35bb32ae..c00dcced58 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp @@ -144,7 +144,7 @@ namespace AZ #ifdef AZ_RHI_USE_TILED_RESOURCES { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "StreamImagePool::CreateHeap"); + AZ_PROFILE_SCOPE(AzRender, "StreamImagePool::CreateHeap"); CD3DX12_HEAP_DESC heapDesc(descriptor.m_budgetInBytes, D3D12_HEAP_TYPE_DEFAULT, 0, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp index 5db3cfb0d3..4bde063d63 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp @@ -114,7 +114,7 @@ namespace AZ //Autoreleasepool is to ensure that the driver is not leaking memory related to the command buffer and encoder @autoreleasepool { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "ExecuteWork"); + AZ_PROFILE_SCOPE(AzRender, "ExecuteWork"); AZ_PROFILE_RHI_VARIABLE(m_lastExecuteDuration); if (request.m_signalFenceValue > 0) diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp index 814610b4d5..f0ec98be89 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp @@ -79,7 +79,7 @@ namespace AZ void CommandQueueContext::End() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); QueueGpuSignals(m_frameFences[m_currentFrameIndex]); for (uint32_t hardwareQueueIdx = 0; hardwareQueueIdx < RHI::HardwareQueueClassCount; ++hardwareQueueIdx) @@ -91,7 +91,7 @@ namespace AZ m_currentFrameIndex = (m_currentFrameIndex + 1) % aznumeric_cast(m_frameFences.size()); { - AZ_PROFILE_SCOPE_IDLE(AZ::Debug::ProfileCategory::AzRender, "Wait and Reset Fence"); + AZ_PROFILE_SCOPE(AzRender, "Wait and Reset Fence"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RHI", "CommandQueueContext: Wait on Fences"); //Synchronize the CPU with the GPU by waiting on the fence until signalled by the GPU. CPU can only go upto diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp index 18b5d83ed3..12e14f6134 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp @@ -96,7 +96,7 @@ namespace AZ uploadFence->Init(device, RHI::FenceState::Reset); CommandQueue::Command command = [=, &device](void* queue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Upload Buffer"); + AZ_PROFILE_SCOPE(AzRender, "Upload Buffer"); size_t pendingByteOffset = 0; size_t pendingByteCount = byteCount; FramePacket* framePacket = nullptr; @@ -110,7 +110,7 @@ namespace AZ while (pendingByteCount > 0) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Upload Buffer Chunk"); + AZ_PROFILE_SCOPE(AzRender, "Upload Buffer Chunk"); framePacket = BeginFramePacket(vulkanQueue); const size_t bytesToCopy = AZStd::min(pendingByteCount, m_descriptor.m_stagingSizeInBytes); @@ -181,7 +181,7 @@ namespace AZ CommandQueue::Command command = [=, &device](void* queue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Upload Image"); + AZ_PROFILE_SCOPE(AzRender, "Upload Image"); Queue* vulkanQueue = static_cast(queue); FramePacket* framePacket = BeginFramePacket(vulkanQueue); @@ -257,7 +257,7 @@ namespace AZ // Copy subresource data to staging memory. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); uint8_t* stagingDataStart = reinterpret_cast(framePacket->m_stagingBuffer->GetBufferMemoryView()->Map(RHI::HostMemoryAccess::Write)) + framePacket->m_dataOffset; for (uint32_t row = 0; row < subresourceLayout.m_rowCount; ++row) { @@ -332,7 +332,7 @@ namespace AZ // Copy subresource data to staging memory. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); uint8_t* stagingDataStart = reinterpret_cast(framePacket->m_stagingBuffer->GetBufferMemoryView()->Map(RHI::HostMemoryAccess::Write)); stagingDataStart += framePacket->m_dataOffset; @@ -458,7 +458,7 @@ namespace AZ AsyncUploadQueue::FramePacket* AsyncUploadQueue::BeginFramePacket(Queue* queue) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(!m_recordingFrame, "The previous frame packet isn't ended."); auto& device = static_cast(GetDevice()); @@ -478,7 +478,7 @@ namespace AZ void AsyncUploadQueue::EndFramePacket(Queue* queue, Semaphore* semaphoreToSignal /*=nullptr*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_Assert(m_recordingFrame, "The frame packet wasn't started. You need to call StartFramePacket first."); m_commandList->EndCommandBuffer(); @@ -644,7 +644,7 @@ namespace AZ void AsyncUploadQueue::ProcessCallback(const RHI::AsyncWorkHandle& handle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZStd::unique_lock lock(m_callbackListMutex); auto findIter = m_callbackList.find(handle); if (findIter != m_callbackList.end()) diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp index 84b4964235..6929b63ac4 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp @@ -54,7 +54,7 @@ namespace AZ const ExecuteWorkRequest& request = static_cast(rhiRequest); QueueCommand([=](void* queue) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "ExecuteWork"); + AZ_PROFILE_SCOPE(AzRender, "ExecuteWork"); AZ_PROFILE_RHI_VARIABLE(m_lastExecuteDuration); Queue* vulkanQueue = static_cast(queue); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp index 8635e8edcf..9457a765fa 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp @@ -42,7 +42,7 @@ namespace AZ void CommandQueueContext::End() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); for (auto& commandQueue : m_commandQueues) { @@ -54,7 +54,7 @@ namespace AZ m_currentFrameIndex = (m_currentFrameIndex + 1) % GetFrameCount(); { - AZ_PROFILE_SCOPE_IDLE(AZ::Debug::ProfileCategory::AzRender, "Wait on Fences"); + AZ_PROFILE_SCOPE(AzRender, "Wait on Fences"); AZ_ATOM_PROFILE_FUNCTION("RHI", "CommandQueueContext: Wait on Fences"); FencesPerQueue& nextFences = m_frameFences[m_currentFrameIndex]; @@ -79,7 +79,7 @@ namespace AZ void CommandQueueContext::WaitForIdle() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); for (auto& commandQueue : m_commandQueues) { commandQueue->WaitForIdle(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp index c630fe0e5d..841607404a 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp @@ -299,7 +299,7 @@ namespace AZ //work function void Process() override { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); const View::UsageFlags viewFlags = m_jobData->m_view->GetUsageFlags(); const RHI::DrawListMask drawListMask = m_jobData->m_view->GetDrawListMask(); @@ -312,7 +312,7 @@ namespace AZ bool nodeIsContainedInFrustum = ShapeIntersection::Contains(m_jobData->m_frustum, nodeData.m_bounds); #ifdef AZ_CULL_PROFILE_VERBOSE - AZ_PROFILE_SCOPE_DYNAMIC(Debug::ProfileCategory::AzRender, "process node (view: %s, skip fine cull: %d", + AZ_PROFILE_SCOPE(AzRender, "process node (view: %s, skip fine cull: %d", m_view->GetName().GetCStr(), nodeIsContainedInFrustum ? 1 : 0); #endif @@ -385,7 +385,7 @@ namespace AZ if (m_jobData->m_debugCtx->m_debugDraw && (m_jobData->m_view->GetName() == m_jobData->m_debugCtx->m_currentViewSelectionName)) { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "debug draw culling"); + AZ_PROFILE_SCOPE(AzRender, "debug draw culling"); AuxGeomDrawPtr auxGeomPtr = AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(m_jobData->m_scene); if (auxGeomPtr) @@ -507,7 +507,7 @@ namespace AZ void CullingScene::ProcessCullables(const Scene& scene, View& view, AZ::Job& parentJob) { - AZ_PROFILE_SCOPE_DYNAMIC(Debug::ProfileCategory::AzRender, "CullingScene::ProcessCullables() - %s", view.GetName().GetCStr()); + AZ_PROFILE_SCOPE(AzRender, "CullingScene::ProcessCullables() - %s", view.GetName().GetCStr()); const Matrix4x4& worldToClip = view.GetWorldToClipMatrix(); Frustum frustum = Frustum::CreateFromMatrixColumnMajor(worldToClip); @@ -598,7 +598,7 @@ namespace AZ auto nodeVisitorLambda = [this, jobData, &parentJob, &frustum, &worklist](const AzFramework::IVisibilityScene::NodeData& nodeData) -> void { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "nodeVisitorLambda()"); + AZ_PROFILE_SCOPE(AzRender, "nodeVisitorLambda()"); AZ_Assert(nodeData.m_entries.size() > 0, "should not get called with 0 entries"); AZ_Assert(worklist.size() < worklist.capacity(), "we should always have room to push a node on the queue"); @@ -645,7 +645,7 @@ namespace AZ uint32_t AddLodDataToView(const Vector3& pos, const Cullable::LodData& lodData, RPI::View& view) { #ifdef AZ_CULL_PROFILE_DETAILED - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); #endif const Matrix4x4& viewToClip = view.GetViewToClipMatrix(); @@ -663,7 +663,7 @@ namespace AZ auto addLodToDrawPacket = [&](const Cullable::LodData::Lod& lod) { #ifdef AZ_CULL_PROFILE_VERBOSE - AZ_PROFILE_SCOPE_DYNAMIC(Debug::ProfileCategory::AzRender, "add draw packets: %zu", lod.m_drawPackets.size()); + AZ_PROFILE_SCOPE(AzRender, "add draw packets: %zu", lod.m_drawPackets.size()); #endif numVisibleDrawPackets += static_cast(lod.m_drawPackets.size()); //don't want to pay the cost of aznumeric_cast<> here so using static_cast<> instead for (const RHI::DrawPacket* drawPacket : lod.m_drawPackets) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp index 4f941463eb..1de6776d9c 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp @@ -310,7 +310,7 @@ namespace AZ if (NeedsCompile() && CanCompile()) { - AZ_PROFILE_EVENT_BEGIN(Debug::ProfileCategory::AzRender, "Material::Compile() Processing Functors"); + AZ_PROFILE_BEGIN(AzRender, "Material::Compile() Processing Functors"); for (const Ptr& functor : m_materialAsset->GetMaterialFunctors()) { if (functor) @@ -339,7 +339,7 @@ namespace AZ AZ_Error(s_debugTraceName, false, "Material functor is null."); } } - AZ_PROFILE_EVENT_END(Debug::ProfileCategory::AzRender); + AZ_PROFILE_END(); m_propertyDirtyFlags.reset(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp index 5762720913..7fd7133cee 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp @@ -124,7 +124,7 @@ namespace AZ bool MeshDrawPacket::DoUpdate(const Scene& parentScene) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); const ModelLod::Mesh& mesh = m_modelLod->GetMeshes()[m_modelLodMeshIndex]; if (!m_material) @@ -155,7 +155,7 @@ namespace AZ auto appendShader = [&](const ShaderCollection::Item& shaderItem) { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "appendShader()"); + AZ_PROFILE_SCOPE(AzRender, "appendShader()"); // Skip the shader item without creating the shader instance // if the mesh is not going to be rendered based on the draw tag @@ -256,7 +256,7 @@ namespace AZ Data::Instance drawSrg; if (drawSrgLayout) { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "create drawSrg"); + AZ_PROFILE_SCOPE(AzRender, "create drawSrg"); // If the DrawSrg exists we must create and bind it, otherwise the CommandList will fail validation for SRG being null drawSrg = RPI::ShaderResourceGroup::Create(shader->GetAsset(), shader->GetSupervariantIndex(), drawSrgLayout->GetName()); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp index 32fe297c57..0cbcdbf5f4 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp @@ -42,7 +42,7 @@ namespace AZ Data::Instance Model::CreateInternal(const Data::Asset& modelAsset) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); Data::Instance model = aznew Model(); const RHI::ResultCode resultCode = model->Init(modelAsset); @@ -56,7 +56,7 @@ namespace AZ RHI::ResultCode Model::Init(const Data::Asset& modelAsset) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); m_lods.resize(modelAsset->GetLodAssets().size()); @@ -107,7 +107,7 @@ namespace AZ { if (m_isUploadPending) { - AZ_PROFILE_SCOPE_STALL_DYNAMIC(Debug::ProfileCategory::AzRender, "Model::WaitForUpload - %s", GetDatabaseName()); + AZ_PROFILE_SCOPE(AzRender, "Model::WaitForUpload - %s", GetDatabaseName()); for (const Data::Instance& lod : m_lods) { lod->WaitForUpload(); @@ -128,7 +128,7 @@ namespace AZ bool Model::LocalRayIntersection(const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (!GetModelAsset()) { @@ -171,7 +171,7 @@ namespace AZ float& distanceNormalized, AZ::Vector3& normal) const { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); const AZ::Vector3 clampedScale = nonUniformScale.GetMax(AZ::Vector3(AZ::MinTransformScale)); const AZ::Transform inverseTM = modelTransform.GetInverse(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp index dc39200a65..cfe0d08270 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp @@ -264,7 +264,7 @@ namespace AZ const MaterialModelUvOverrideMap& materialModelUvMap, const MaterialUvNameMap& materialUvNameMap) const { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); streamBufferViewsOut.clear(); @@ -366,7 +366,7 @@ namespace AZ const MaterialModelUvOverrideMap& materialModelUvMap, const MaterialUvNameMap& materialUvNameMap) const { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); const Mesh& mesh = m_meshes[meshIndex]; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp index dc5c1f5c4d..0fe035dd85 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp @@ -27,7 +27,7 @@ namespace AZ ModelLodIndex SelectLod(const View* view, const Vector3& position, const Model& model, ModelLodIndex lodOverride) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); ModelLodIndex lodIndex; if (model.GetLodCount() == 1) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp index d73521763f..4cf952ee01 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp @@ -189,7 +189,7 @@ namespace AZ void PassSystem::BuildPasses() { m_state = PassSystemState::BuildingPasses; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: BuildPassAttachments"); m_passHierarchyChanged = m_passHierarchyChanged || !m_buildPassList.empty(); @@ -239,7 +239,7 @@ namespace AZ void PassSystem::InitializePasses() { m_state = PassSystemState::InitializingPasses; - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: BuildPassAttachments"); m_passHierarchyChanged = m_passHierarchyChanged || !m_initializePassList.empty(); @@ -286,7 +286,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); PassValidationResults validationResults; m_rootPass->Validate(validationResults); @@ -307,7 +307,7 @@ namespace AZ void PassSystem::FrameUpdate(RHI::FrameGraphBuilder& frameGraphBuilder) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: FrameUpdate"); ResetFrameStatistics(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp index ce02e1c570..d37002eb6b 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp @@ -216,7 +216,7 @@ namespace AZ void RasterPass::CompileResources(const RHI::FrameGraphCompileContext& context) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (m_shaderResourceGroup == nullptr) { @@ -230,7 +230,7 @@ namespace AZ void RasterPass::BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); RHI::CommandList* commandList = context.GetCommandList(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp index d2a32784ce..efc050eb68 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp @@ -270,7 +270,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZ_ATOM_PROFILE_FUNCTION("RPI", "RPISystem: RenderTick"); // Query system update is to increment the frame count diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp index 89f7da11e3..a552ac86f2 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp @@ -377,7 +377,7 @@ namespace AZ void RenderPipeline::OnStartFrame(const TickTimeInfo& tick) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); m_lastRenderStartTime = tick.m_currentGameTime; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp index 02a03ee853..4d3dcba36e 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp @@ -399,7 +399,7 @@ namespace AZ AZ_ATOM_PROFILE_FUNCTION("RPI", "Scene: PrepareRender"); { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "WaitForSimulationCompletion"); + AZ_PROFILE_SCOPE(AzRender, "WaitForSimulationCompletion"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "WaitForSimulationCompletion"); WaitAndCleanCompletionJob(m_simulationCompletion); } @@ -407,7 +407,7 @@ namespace AZ SceneNotificationBus::Event(GetId(), &SceneNotification::OnBeginPrepareRender); { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "m_srgCallback"); + AZ_PROFILE_SCOPE(AzRender, "m_srgCallback"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "ShaderResourceGroupCallback: SrgCallback"); // Set values for scene srg if (m_srg && m_srgCallback) @@ -483,7 +483,7 @@ namespace AZ } { - AZ_PROFILE_SCOPE(Debug::ProfileCategory::AzRender, "CollectDrawPackets"); + AZ_PROFILE_SCOPE(AzRender, "CollectDrawPackets"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "CollectDrawPackets"); AZ::JobCompletion* collectDrawPacketsCompletion = aznew AZ::JobCompletion(); @@ -533,7 +533,7 @@ namespace AZ } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzRender, "FinalizeDrawLists"); + AZ_PROFILE_BEGIN(AzRender, "FinalizeDrawLists"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "FinalizeDrawLists"); if (jobPolicy == RHI::JobPolicy::Serial) { @@ -556,7 +556,7 @@ namespace AZ finalizeDrawListsJob->SetDependent(finalizeDrawListsCompletion); finalizeDrawListsJob->Start(); } - AZ_PROFILE_EVENT_END(Debug::ProfileCategory::AzRender); + AZ_PROFILE_END(); WaitAndCleanCompletionJob(finalizeDrawListsCompletion); } } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp index d0d76e62de..c0f0e20714 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp @@ -113,7 +113,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); AZStd::lock_guard lock(m_metricsMutex); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp index ff277c5cad..f6dcd02804 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp @@ -297,7 +297,7 @@ namespace AZ const ShaderVariant& Shader::GetVariant(const ShaderVariantId& shaderVariantId) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); Data::Asset shaderVariantAsset = m_asset->GetVariant(shaderVariantId, m_supervariantIndex); if (!shaderVariantAsset || shaderVariantAsset->IsRootVariant()) { @@ -314,14 +314,14 @@ namespace AZ ShaderVariantSearchResult Shader::FindVariantStableId(const ShaderVariantId& shaderVariantId) const { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); ShaderVariantSearchResult variantSearchResult = m_asset->FindVariantStableId(shaderVariantId); return variantSearchResult; } const ShaderVariant& Shader::GetVariant(ShaderVariantStableId shaderVariantStableId) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (!shaderVariantStableId.IsValid() || shaderVariantStableId == ShaderAsset::RootShaderVariantStableId) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp index 1937afc240..f1f25e3303 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp @@ -237,7 +237,7 @@ namespace AZ void View::FinalizeDrawLists() { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); m_drawListContext.FinalizeLists(); SortFinalizedDrawLists(); } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp index 275b056514..e1da50d2fb 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp @@ -96,7 +96,7 @@ namespace AZ const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, bool allowBruteForce, float& distanceNormalized, AZ::Vector3& normal) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (!m_modelTriangleCount) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp index f2d82918ea..adeb564675 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp @@ -172,7 +172,7 @@ namespace AZ Data::Asset ShaderAsset::GetVariant( const ShaderVariantId& shaderVariantId, SupervariantIndex supervariantIndex) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); auto variantFinder = AZ::Interface::Get(); AZ_Assert(variantFinder, "The IShaderVariantFinder doesn't exist"); @@ -189,7 +189,7 @@ namespace AZ ShaderVariantSearchResult ShaderAsset::FindVariantStableId(const ShaderVariantId& shaderVariantId) { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); uint32_t dynamicOptionCount = aznumeric_cast(GetShaderOptionGroupLayout()->GetShaderOptions().size()); ShaderVariantSearchResult variantSearchResult{RootShaderVariantStableId, dynamicOptionCount }; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp index 46873dc62d..bd0cad9f4d 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp @@ -72,7 +72,7 @@ namespace AZ ShaderVariantSearchResult ShaderVariantTreeAsset::FindVariantStableId(const ShaderOptionGroupLayout* shaderOptionGroupLayout, const ShaderVariantId& shaderVariantId) const { - AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); struct NodeToVisit { diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h index 454a6d4086..e73f641b96 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h @@ -130,6 +130,7 @@ namespace AZ template struct StableDynamicArray::Page { + static constexpr size_t PageSize = ElementsPerPage * sizeof(T); static constexpr size_t InvalidPage = -1; static constexpr uint64_t FullBits = 0xFFFFFFFFFFFFFFFFull; static constexpr size_t NumUint64_t = ElementsPerPage / 64; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/SurfaceData/SurfaceDataMeshComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/SurfaceData/SurfaceDataMeshComponent.cpp index 3c5d45abc2..be4d5186c8 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/SurfaceData/SurfaceDataMeshComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/SurfaceData/SurfaceDataMeshComponent.cpp @@ -147,7 +147,7 @@ namespace SurfaceData bool SurfaceDataMeshComponent::DoRayTrace(const AZ::Vector3& inPosition, AZ::Vector3& outPosition, AZ::Vector3& outNormal) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); @@ -233,7 +233,7 @@ namespace SurfaceData void SurfaceDataMeshComponent::UpdateMeshData() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool meshValidBeforeUpdate = false; bool meshValidAfterUpdate = false; diff --git a/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp b/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp index e4933728d4..738806a912 100644 --- a/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp +++ b/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp @@ -374,7 +374,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// void CAudioSystemImpl_wwise::Update([[maybe_unused]] const float updateIntervalMS) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); if (AK::SoundEngine::IsInitialized()) { @@ -731,7 +731,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// EAudioRequestStatus CAudioSystemImpl_wwise::UpdateAudioObject(IATLAudioObjectData* const audioObjectData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); EAudioRequestStatus result = eARS_FAILURE; diff --git a/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp b/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp index 30084565d6..bfb1254e52 100644 --- a/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp +++ b/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp @@ -265,7 +265,7 @@ namespace Audio auto callback = [&transferInfo](AZ::IO::FileRequestHandle request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); AZ::IO::IStreamerTypes::RequestStatus status = AZ::Interface::Get()->GetRequestStatus(request); switch (status) { diff --git a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp index e6700ea610..ff56300b85 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp @@ -148,7 +148,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// void CAudioTranslationLayer::Update() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); auto current = AZStd::chrono::system_clock::now(); m_elapsedTime = AZStd::chrono::duration_cast(current - m_lastUpdateTime); @@ -2016,7 +2016,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// void CAudioTranslationLayer::DrawAudioSystemDebugInfo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); // ToDo: Update to work with Atom? LYN-3677 /*if (CVars::s_debugDrawOptions.GetRawFlags() != 0) diff --git a/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp b/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp index 7010012e87..91340ca9bb 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -304,7 +305,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// void CAudioObjectManager::Update(const float fUpdateIntervalMS, const SATLWorldPosition& rListenerPosition) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); m_fTimeSinceLastVelocityUpdateMS += fUpdateIntervalMS; const bool bUpdateVelocity = m_fTimeSinceLastVelocityUpdateMS > s_fVelocityUpdateIntervalMS; @@ -317,7 +318,7 @@ namespace Audio if (pObject->HasActiveEvents()) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Audio, "Inner Per-Object CAudioObjectManager::Update"); + AZ_PROFILE_SCOPE(Audio, "Inner Per-Object CAudioObjectManager::Update"); pObject->Update(fUpdateIntervalMS, rListenerPosition); @@ -936,7 +937,7 @@ namespace Audio void CAudioEventListenerManager::NotifyListener(const SAudioRequestInfo* const pResultInfo) { // This should always be on the main thread! - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); auto found = AZStd::find_if(m_cListeners.begin(), m_cListeners.end(), [pResultInfo](const SAudioEventListener& currentListener) diff --git a/Gems/AudioSystem/Code/Source/Engine/ATLUtils.h b/Gems/AudioSystem/Code/Source/Engine/ATLUtils.h index c1bb8251f9..97266e95c3 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATLUtils.h +++ b/Gems/AudioSystem/Code/Source/Engine/ATLUtils.h @@ -16,6 +16,7 @@ #include #include #include +#include #define ATL_FLOAT_EPSILON (1.0e-6) diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp index 30d815cbec..43ab47266a 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp @@ -115,7 +115,7 @@ namespace Audio void CAudioSystem::PushRequestBlocking(const SAudioRequest& audioRequestData) { // Main Thread! - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); CAudioRequestInternal request(audioRequestData); @@ -201,7 +201,7 @@ namespace Audio void CAudioSystem::InternalUpdate() { // Audio Thread! - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); auto startUpdateTime = AZStd::chrono::system_clock::now(); // stamp the start time @@ -225,7 +225,7 @@ namespace Audio #if !defined(AUDIO_RELEASE) #if defined(PROVIDE_GETNAME_SUPPORT) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Audio, "Sync Debug Name Changes"); + AZ_PROFILE_SCOPE(Audio, "Sync Debug Name Changes"); AZStd::lock_guard lock(m_debugNameStoreMutex); m_debugNameStore.SyncChanges(m_oATL.GetDebugStore()); } @@ -238,7 +238,7 @@ namespace Audio auto elapsedUpdateTime = AZStd::chrono::duration_cast(endUpdateTime - startUpdateTime); if (elapsedUpdateTime < m_targetUpdatePeriod) { - AZ_PROFILE_SCOPE_IDLE(AZ::Debug::ProfileCategory::Audio, "Wait Remaining Time in Update Period"); + AZ_PROFILE_SCOPE(Audio, "Wait Remaining Time in Update Period"); m_processingEvent.try_acquire_for(m_targetUpdatePeriod - elapsedUpdateTime); } } @@ -596,7 +596,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// void CAudioSystem::ProcessRequestBlocking(CAudioRequestInternal& request) { - AZ_PROFILE_FUNCTION_STALL(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); if (m_oATL.CanProcessRequests()) { @@ -616,7 +616,7 @@ namespace Audio void CAudioSystem::ProcessRequestThreadSafe(CAudioRequestInternal request) { // Audio Thread! - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Audio, "Thread-Safe Request: %s", request.ToString().c_str()); + AZ_PROFILE_SCOPE(Audio, "Thread-Safe Request: %s", request.ToString().c_str()); if (m_oATL.CanProcessRequests()) { @@ -641,7 +641,7 @@ namespace Audio { // Todo: This should handle request priority, use request priority as bus Address and process in priority order. - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Audio, "Normal Request: %s", request.ToString().c_str()); + AZ_PROFILE_SCOPE(Audio, "Normal Request: %s", request.ToString().c_str()); AZ_Assert(g_mainThreadId != AZStd::this_thread::get_id(), "AudioSystem::ProcessRequestByPriority - called from Main thread!"); @@ -672,7 +672,7 @@ namespace Audio { if (!(request.nInternalInfoFlags & eARIF_WAITING_FOR_REMOVAL)) { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Audio, "Blocking Request: %s", request.ToString().c_str()); + AZ_PROFILE_SCOPE(Audio, "Blocking Request: %s", request.ToString().c_str()); if (request.eStatus == eARS_NONE) { diff --git a/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp b/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp index f1a360fd7d..791c86eba8 100644 --- a/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -61,7 +62,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////// void CFileCacheManager::Update() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); AudioFileCacheManagerNotficationBus::ExecuteQueuedEvents(); UpdatePreloadRequestsStatus(); @@ -538,7 +539,7 @@ namespace Audio bool CFileCacheManager::FinishCachingFileInternal(CATLAudioFileEntry* const audioFileEntry, [[maybe_unused]] AZ::IO::SizeType bytesRead, AZ::IO::IStreamerTypes::RequestStatus requestState) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); bool success = false; audioFileEntry->m_asyncStreamRequest.reset(); @@ -640,7 +641,7 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////// bool CFileCacheManager::AllocateMemoryBlockInternal(CATLAudioFileEntry* const audioFileEntry) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); // Must not have valid memory yet. AZ_Assert(!audioFileEntry->m_memoryBlock, "FileCacheManager AllocateMemoryBlockInternal - Memory appears to be set already!"); @@ -786,7 +787,7 @@ namespace Audio const bool overrideUseCount /* = false */, const size_t useCount /* = 0 */) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); bool success = false; @@ -842,7 +843,7 @@ namespace Audio audioFileEntry->m_asyncStreamRequest, [this](AZ::IO::FileRequestHandle request) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Audio); + AZ_PROFILE_FUNCTION(Audio); AudioFileCacheManagerNotficationBus::QueueBroadcast( &AudioFileCacheManagerNotficationBus::Events::FinishAsyncStreamRequest, request); diff --git a/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp b/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp index d05a679733..ec6e7bbbb9 100644 --- a/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp +++ b/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp @@ -187,7 +187,7 @@ namespace Blast void BlastFamilyComponent::Activate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); AZ_Assert(m_blastAsset.GetId().IsValid(), "BlastFamilyComponent created with invalid blast asset."); @@ -199,7 +199,7 @@ namespace Blast void BlastFamilyComponent::Deactivate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); // cleanup collision handlers for (auto& itr : m_collisionHandlers) @@ -216,7 +216,7 @@ namespace Blast void BlastFamilyComponent::Spawn() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (!m_blastAsset.IsReady()) { @@ -297,7 +297,7 @@ namespace Blast void BlastFamilyComponent::Despawn() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); m_isSpawned = false; @@ -414,7 +414,7 @@ namespace Blast void BlastFamilyComponent::OnCollisionBegin(const AzPhysics::CollisionEvent& collisionEvent) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); for (const auto* body : {collisionEvent.m_body1, collisionEvent.m_body2}) { @@ -493,7 +493,7 @@ namespace Blast void BlastFamilyComponent::ApplyStressDamage() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (m_solver) { @@ -589,7 +589,7 @@ namespace Blast // Update positions of entities with render meshes corresponding to their right dynamic bodies. void BlastFamilyComponent::SyncMeshes() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (m_actorRenderManager) { diff --git a/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp b/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp index bee94ed116..711d3a0087 100644 --- a/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp +++ b/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp @@ -112,7 +112,7 @@ namespace Blast void BlastSystemComponent::Activate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); auto blastAssetHandler = aznew BlastAssetHandler(); blastAssetHandler->Register(); m_assetHandlers.emplace_back(blastAssetHandler); @@ -141,7 +141,7 @@ namespace Blast void BlastSystemComponent::Deactivate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); CrySystemEventBus::Handler::BusDisconnect(); AZ::TickBus::Handler::BusDisconnect(); BlastSystemRequestBus::Handler::BusDisconnect(); @@ -185,7 +185,7 @@ namespace Blast void BlastSystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); AZ::JobCompletion jobCompletion; @@ -226,18 +226,18 @@ namespace Blast for (auto& group : m_groups) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "ExtGroupTaskManager::process"); + AZ_PROFILE_SCOPE(Physics, "ExtGroupTaskManager::process"); group.m_extGroupTaskManager->process(); } for (auto& group : m_groups) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "ExtGroupTaskManager::wait"); + AZ_PROFILE_SCOPE(Physics, "ExtGroupTaskManager::wait"); group.m_extGroupTaskManager->wait(); } // Clean up damage descriptions and program params now that groups have run. { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "BlastSystemComponent::OnTick::Cleanup"); + AZ_PROFILE_SCOPE(Physics, "BlastSystemComponent::OnTick::Cleanup"); m_radialDamageDescs.clear(); m_capsuleDamageDescs.clear(); m_shearDamageDescs.clear(); @@ -248,7 +248,7 @@ namespace Blast if (gEnv && m_debugRenderMode) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "BlastSystemComponent::OnTick::DebugRender"); + AZ_PROFILE_SCOPE(Physics, "BlastSystemComponent::OnTick::DebugRender"); DebugRenderBuffer buffer; BlastFamilyComponentRequestBus::Broadcast( &BlastFamilyComponentRequests::FillDebugRenderBuffer, buffer, m_debugRenderMode); @@ -428,12 +428,12 @@ namespace Blast void BlastSystemComponent::AZBlastProfilerCallback::zoneStart(const char* eventName) { - AZ_PROFILE_EVENT_BEGIN(AZ::Debug::ProfileCategory::Physics, eventName); + AZ_PROFILE_BEGIN(Physics, eventName); } void BlastSystemComponent::AZBlastProfilerCallback::zoneEnd() { - AZ_PROFILE_EVENT_END(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_END(); } static void CmdToggleBlastDebugVisualization(IConsoleCmdArgs* args) diff --git a/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp b/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp index 58f28ed32a..3bc6da4297 100644 --- a/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp +++ b/Gems/Blast/Code/Source/Editor/EditorBlastFamilyComponent.cpp @@ -96,7 +96,7 @@ namespace Blast void EditorBlastFamilyComponent::Activate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); if (m_blastAsset.GetId().IsValid()) { @@ -107,7 +107,7 @@ namespace Blast void EditorBlastFamilyComponent::Deactivate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); AZ::Data::AssetBus::MultiHandler::BusDisconnect(); } diff --git a/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp b/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp index 23ec5ae524..9d0e4fe2ff 100644 --- a/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp +++ b/Gems/Blast/Code/Source/Editor/EditorBlastMeshDataComponent.cpp @@ -86,7 +86,7 @@ namespace Blast void EditorBlastMeshDataComponent::Activate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); OnMeshAssetsChanged(); m_meshFeatureProcessor = @@ -100,7 +100,7 @@ namespace Blast void EditorBlastMeshDataComponent::Deactivate() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::System); + AZ_PROFILE_FUNCTION(System); EditorComponentBase::Deactivate(); AZ::Render::MaterialComponentNotificationBus::Handler::BusDisconnect(GetEntityId()); AZ::TransformNotificationBus::Handler::BusDisconnect(GetEntityId()); diff --git a/Gems/Blast/Code/Source/Family/ActorRenderManager.cpp b/Gems/Blast/Code/Source/Family/ActorRenderManager.cpp index 98ea7d6741..aca1e94d16 100644 --- a/Gems/Blast/Code/Source/Family/ActorRenderManager.cpp +++ b/Gems/Blast/Code/Source/Family/ActorRenderManager.cpp @@ -33,7 +33,7 @@ namespace Blast void ActorRenderManager::OnActorCreated(const BlastActor& actor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); const AZStd::vector& chunkIndices = actor.GetChunkIndices(); @@ -47,7 +47,7 @@ namespace Blast void ActorRenderManager::OnActorDestroyed(const BlastActor& actor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); const AZStd::vector& chunkIndices = actor.GetChunkIndices(); @@ -62,7 +62,7 @@ namespace Blast { // It is more natural to have chunk entities be transform children of rigid body entity, // however having them separate and manually synchronizing transform is more efficient. - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); for (auto chunkId = 0u; chunkId < m_chunkCount; ++chunkId) { diff --git a/Gems/Blast/Code/Source/Family/ActorTracker.cpp b/Gems/Blast/Code/Source/Family/ActorTracker.cpp index 4c81c2d934..e441e7a074 100644 --- a/Gems/Blast/Code/Source/Family/ActorTracker.cpp +++ b/Gems/Blast/Code/Source/Family/ActorTracker.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -46,7 +47,7 @@ namespace Blast BlastActor* ActorTracker::FindClosestActor(const AZ::Vector3& position) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); const auto candidate = std::min_element( m_actors.begin(), m_actors.end(), diff --git a/Gems/Blast/Code/Source/Family/BlastFamilyImpl.cpp b/Gems/Blast/Code/Source/Family/BlastFamilyImpl.cpp index 2690a12f24..56c785b310 100644 --- a/Gems/Blast/Code/Source/Family/BlastFamilyImpl.cpp +++ b/Gems/Blast/Code/Source/Family/BlastFamilyImpl.cpp @@ -122,7 +122,7 @@ namespace Blast void BlastFamilyImpl::HandleEvents(const Nv::Blast::TkEvent* events, uint32_t eventCount) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); AZStd::vector newActors; AZStd::unordered_set actorsToDelete; @@ -150,7 +150,7 @@ namespace Blast const Nv::Blast::TkSplitEvent* splitEvent, AZStd::vector& newActors, AZStd::unordered_set& actorsToDelete) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); AZ_Assert(splitEvent, "Received null TkSplitEvent from the Blast library."); if (!splitEvent) @@ -256,7 +256,7 @@ namespace Blast void BlastFamilyImpl::CreateActors(const AZStd::vector& actorDescs) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); for (auto& actorDesc : actorDescs) { @@ -268,7 +268,7 @@ namespace Blast void BlastFamilyImpl::DestroyActors(const AZStd::unordered_set& actors) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); for (const auto actor : actors) { @@ -294,14 +294,14 @@ namespace Blast void BlastFamilyImpl::DispatchActorCreated(const BlastActor& actor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); m_listener->OnActorCreated(*this, actor); } void BlastFamilyImpl::DispatchActorDestroyed(const BlastActor& actor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); m_listener->OnActorDestroyed(*this, actor); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp index 82b06c8171..300543c896 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp @@ -190,7 +190,7 @@ namespace EMotionFX // update void EMotionFXManager::Update(float timePassedInSeconds) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Animation, "EMotionFXManager::Update"); + AZ_PROFILE_SCOPE(Animation, "EMotionFXManager::Update"); m_debugDraw->Clear(); m_recorder->UpdatePlayMode(timePassedInSeconds); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp index 6f07936fe7..8b7fbad316 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp @@ -165,7 +165,7 @@ namespace EMotionFX AZ::JobContext* jobContext = nullptr; AZ::Job* job = AZ::CreateJobFunction([this, timePassedInSeconds, actorInstance]() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Animation, "MultiThreadScheduler::Execute::ActorInstanceUpdateJob"); + AZ_PROFILE_SCOPE(Animation, "MultiThreadScheduler::Execute::ActorInstanceUpdateJob"); const AZ::u32 threadIndex = AZ::JobContext::GetGlobalContext()->GetJobManager().GetWorkerThreadId(); actorInstance->SetThreadIndex(threadIndex); diff --git a/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp index 303a7e118b..da4c72b70a 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp @@ -542,7 +542,7 @@ namespace EMotionFX ////////////////////////////////////////////////////////////////////////// void ActorComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Animation); + AZ_PROFILE_FUNCTION(Animation); if (!m_actorInstance || !m_actorInstance->GetIsEnabled()) { diff --git a/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp b/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp index 42ac124e6e..09b7bf878b 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp +++ b/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp @@ -8,6 +8,7 @@ #include +#include #include #include #include @@ -251,7 +252,7 @@ namespace ExpressionEvaluation AZ::Outcome ExpressionEvaluationSystemComponent::ParseRestrictedExpressionInPlace(const AZStd::unordered_set& parsers, AZStd::string_view expressionString, ExpressionTree& expressionTree) const { - AZ_PROFILE_TIMER("ExpressionEvaluation", __FUNCTION__); + AZ_PROFILE_FUNCTION(ExpressionEvaluation); expressionTree.ClearTree(); @@ -513,7 +514,7 @@ namespace ExpressionEvaluation ExpressionResult ExpressionEvaluationSystemComponent::Evaluate(const ExpressionTree& expressionTree) const { - AZ_PROFILE_TIMER("ExpressionEvaluation", __FUNCTION__); + AZ_PROFILE_SCOPE("ExpressionEvaluation", __FUNCTION__); ExpressionResultStack resultStack; diff --git a/Gems/GradientSignal/Code/Include/GradientSignal/GradientSampler.h b/Gems/GradientSignal/Code/Include/GradientSignal/GradientSampler.h index a7b0338ac1..c06265fb24 100644 --- a/Gems/GradientSignal/Code/Include/GradientSignal/GradientSampler.h +++ b/Gems/GradientSignal/Code/Include/GradientSignal/GradientSampler.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -87,7 +88,7 @@ namespace GradientSignal inline float GradientSampler::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (m_opacity <= 0.0f || !m_gradientId.IsValid()) { diff --git a/Gems/GradientSignal/Code/Source/Components/DitherGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/DitherGradientComponent.cpp index 3b71278f86..dbc2cd2827 100644 --- a/Gems/GradientSignal/Code/Source/Components/DitherGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/DitherGradientComponent.cpp @@ -224,7 +224,7 @@ namespace GradientSignal float DitherGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const AZ::Vector3& coordinate = sampleParams.m_position; diff --git a/Gems/GradientSignal/Code/Source/Components/GradientSurfaceDataComponent.cpp b/Gems/GradientSignal/Code/Source/Components/GradientSurfaceDataComponent.cpp index d07f3a2e66..bdda0e48d2 100644 --- a/Gems/GradientSignal/Code/Source/Components/GradientSurfaceDataComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/GradientSurfaceDataComponent.cpp @@ -263,7 +263,7 @@ namespace GradientSignal void GradientSurfaceDataComponent::OnCompositionChanged() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); UpdateRegistryAndCache(m_modifierHandle); } diff --git a/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp b/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp index af92a0e16c..38936dc302 100644 --- a/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/GradientTransformComponent.cpp @@ -324,7 +324,7 @@ namespace GradientSignal void GradientTransformComponent::TransformPositionToUVW(const AZ::Vector3& inPosition, AZ::Vector3& outUVW, const bool shouldNormalizeOutput, bool& wasPointRejected) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); @@ -415,7 +415,7 @@ namespace GradientSignal void GradientTransformComponent::UpdateFromShape() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); diff --git a/Gems/GradientSignal/Code/Source/Components/ImageGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/ImageGradientComponent.cpp index 650dba209a..9e01b690e0 100644 --- a/Gems/GradientSignal/Code/Source/Components/ImageGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/ImageGradientComponent.cpp @@ -190,7 +190,7 @@ namespace GradientSignal float ImageGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::Vector3 uvw = sampleParams.m_position; diff --git a/Gems/GradientSignal/Code/Source/Components/LevelsGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/LevelsGradientComponent.cpp index 97dd8faa3c..af26ba494d 100644 --- a/Gems/GradientSignal/Code/Source/Components/LevelsGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/LevelsGradientComponent.cpp @@ -172,7 +172,7 @@ namespace GradientSignal float LevelsGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); float output = 0.0f; diff --git a/Gems/GradientSignal/Code/Source/Components/MixedGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/MixedGradientComponent.cpp index ddf349645b..5f6a18c7fb 100644 --- a/Gems/GradientSignal/Code/Source/Components/MixedGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/MixedGradientComponent.cpp @@ -257,7 +257,7 @@ namespace GradientSignal float MixedGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //accumulate the mixed/combined result of all layers and operations float result = 0.0f; diff --git a/Gems/GradientSignal/Code/Source/Components/PerlinGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/PerlinGradientComponent.cpp index 6bc7108c64..e150ff4305 100644 --- a/Gems/GradientSignal/Code/Source/Components/PerlinGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/PerlinGradientComponent.cpp @@ -172,7 +172,7 @@ namespace GradientSignal float PerlinGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (m_perlinImprovedNoise) { diff --git a/Gems/GradientSignal/Code/Source/Components/RandomGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/RandomGradientComponent.cpp index 4e02e92db3..d28fe13aff 100644 --- a/Gems/GradientSignal/Code/Source/Components/RandomGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/RandomGradientComponent.cpp @@ -137,7 +137,7 @@ namespace GradientSignal float RandomGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::Vector3 uvw = sampleParams.m_position; diff --git a/Gems/GradientSignal/Code/Source/Components/ReferenceGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/ReferenceGradientComponent.cpp index 3c1fea6563..28ffaad7d3 100644 --- a/Gems/GradientSignal/Code/Source/Components/ReferenceGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/ReferenceGradientComponent.cpp @@ -131,7 +131,7 @@ namespace GradientSignal float ReferenceGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); float output = 0.0f; diff --git a/Gems/GradientSignal/Code/Source/Components/ShapeAreaFalloffGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/ShapeAreaFalloffGradientComponent.cpp index 3a3b9a2efd..cdf542bf51 100644 --- a/Gems/GradientSignal/Code/Source/Components/ShapeAreaFalloffGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/ShapeAreaFalloffGradientComponent.cpp @@ -157,7 +157,7 @@ namespace GradientSignal float ShapeAreaFalloffGradientComponent::GetValue(const GradientSampleParams& sampleParams) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); float distance = 0.0f; LmbrCentral::ShapeComponentRequestsBus::EventResult(distance, m_configuration.m_shapeEntityId, &LmbrCentral::ShapeComponentRequestsBus::Events::DistanceFromPoint, sampleParams.m_position); diff --git a/Gems/GradientSignal/Code/Source/Components/SurfaceAltitudeGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/SurfaceAltitudeGradientComponent.cpp index c321fe2a54..476e0971f4 100644 --- a/Gems/GradientSignal/Code/Source/Components/SurfaceAltitudeGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/SurfaceAltitudeGradientComponent.cpp @@ -244,7 +244,7 @@ namespace GradientSignal void SurfaceAltitudeGradientComponent::UpdateFromShape() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); diff --git a/Gems/GradientSignal/Code/Source/Components/SurfaceMaskGradientComponent.cpp b/Gems/GradientSignal/Code/Source/Components/SurfaceMaskGradientComponent.cpp index 389fcf3678..7f46ad6e98 100644 --- a/Gems/GradientSignal/Code/Source/Components/SurfaceMaskGradientComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Components/SurfaceMaskGradientComponent.cpp @@ -161,7 +161,7 @@ namespace GradientSignal float SurfaceMaskGradientComponent::GetValue(const GradientSampleParams& params) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); float result = 0.0f; diff --git a/Gems/GradientSignal/Code/Source/ImageAsset.cpp b/Gems/GradientSignal/Code/Source/ImageAsset.cpp index 5d3397bbbd..c67f86c6b8 100644 --- a/Gems/GradientSignal/Code/Source/ImageAsset.cpp +++ b/Gems/GradientSignal/Code/Source/ImageAsset.cpp @@ -153,7 +153,7 @@ namespace GradientSignal float GetValueFromImageAsset(const AZ::Data::Asset& imageAsset, const AZ::Vector3& uvw, float tilingX, float tilingY, float defaultValue) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (imageAsset.IsReady()) { diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Editor/GraphCanvasProfiler.h b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Editor/GraphCanvasProfiler.h index 60c147e98e..ae55baa681 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Editor/GraphCanvasProfiler.h +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Editor/GraphCanvasProfiler.h @@ -9,12 +9,12 @@ #include -#define GRAPH_CANVAS_PROFILE_FUNCTION() AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); -#define GRAPH_CANVAS_PROFILE_SCOPE(message) AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, message); +#define GRAPH_CANVAS_PROFILE_FUNCTION() AZ_PROFILE_FUNCTION(AzToolsFramework); +#define GRAPH_CANVAS_PROFILE_SCOPE(message) AZ_PROFILE_SCOPE(AzToolsFramework, message); #if GRAPH_CANVAS_ENABLE_DETAILED_PROFILING -#define GRAPH_CANVAS_DETAILED_PROFILE_FUNCTION() AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); -#define GRAPH_CANVAS_DETAILED_PROFILE_SCOPE(message) AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, message); +#define GRAPH_CANVAS_DETAILED_PROFILE_FUNCTION() AZ_PROFILE_FUNCTION(AzToolsFramework); +#define GRAPH_CANVAS_DETAILED_PROFILE_SCOPE(message) AZ_PROFILE_SCOPE(AzToolsFramework, message); #else #define GRAPH_CANVAS_DETAILED_PROFILE_FUNCTION() #define GRAPH_CANVAS_DETAILED_PROFILE_SCOPE(message) diff --git a/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.h b/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.h index 4e6e85250a..230655a455 100644 --- a/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.h +++ b/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.inl b/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.inl index d6ad18325a..cc4a3e2740 100644 --- a/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.inl +++ b/Gems/LmbrCentral/Code/include/LmbrCentral/Dependency/DependencyMonitor.inl @@ -15,7 +15,7 @@ namespace LmbrCentral inline void DependencyMonitor::Reset() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::Data::AssetBus::MultiHandler::BusDisconnect(); AZ::EntityBus::MultiHandler::BusDisconnect(); @@ -35,7 +35,7 @@ namespace LmbrCentral inline void DependencyMonitor::ConnectDependency(const AZ::EntityId& entityId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (entityId.IsValid()) { AZ::EntityBus::MultiHandler::BusConnect(entityId); @@ -47,7 +47,7 @@ namespace LmbrCentral inline void DependencyMonitor::ConnectDependencies(const AZStd::vector& entityIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); for (const auto& entityId : entityIds) { @@ -57,7 +57,7 @@ namespace LmbrCentral inline void DependencyMonitor::ConnectDependency(const AZ::Data::AssetId& assetId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (assetId.IsValid()) { @@ -120,7 +120,7 @@ namespace LmbrCentral inline void DependencyMonitor::SendNotification() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //test if notification is in progress to prevent recursion in case of nested dependencies if (!m_notificationInProgress) diff --git a/Gems/LyShine/Code/Editor/PropertiesContainer.cpp b/Gems/LyShine/Code/Editor/PropertiesContainer.cpp index 21b3b99b02..9f9023f84d 100644 --- a/Gems/LyShine/Code/Editor/PropertiesContainer.cpp +++ b/Gems/LyShine/Code/Editor/PropertiesContainer.cpp @@ -595,7 +595,7 @@ bool PropertiesContainer::DoesIntersectNonSelectedComponentEditor(const QRect& g void PropertiesContainer::ClearComponentEditorSelection() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (auto componentEditor : m_componentEditors) { componentEditor->SetSelected(false); diff --git a/Gems/LyShine/Code/Editor/UiSliceManager.cpp b/Gems/LyShine/Code/Editor/UiSliceManager.cpp index c86da38d80..97e9a51e11 100644 --- a/Gems/LyShine/Code/Editor/UiSliceManager.cpp +++ b/Gems/LyShine/Code/Editor/UiSliceManager.cpp @@ -158,7 +158,7 @@ bool UiSliceManager::MakeNewSlice( bool inheritSlices, AZ::SerializeContext* serializeContext) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (entities.empty()) { @@ -240,7 +240,7 @@ bool UiSliceManager::MakeNewSlice( // Setup and execute transaction for the new slice. // { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "UiSliceManager::MakeNewSlice:SetupAndExecuteTransaction"); + AZ_PROFILE_SCOPE(AzToolsFramework, "UiSliceManager::MakeNewSlice:SetupAndExecuteTransaction"); using AzToolsFramework::SliceUtilities::SliceTransaction; @@ -249,7 +249,7 @@ bool UiSliceManager::MakeNewSlice( [this, &entitiesToInclude, &commonParent, &insertBefore] (SliceTransaction::TransactionPtr transaction, const char* fullPath, const SliceTransaction::SliceAssetPtr& /*asset*/) -> void { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "UiSliceManager::MakeNewSlice:PostSaveCallback"); + AZ_PROFILE_SCOPE(AzToolsFramework, "UiSliceManager::MakeNewSlice:PostSaveCallback"); // Once the asset is processed and ready, we can replace the source entities with an instance of the new slice. UiEditorEntityContextRequestBus::Event(m_entityContextId, &UiEditorEntityContextRequestBus::Events::QueueSliceReplacement, @@ -260,7 +260,7 @@ bool UiSliceManager::MakeNewSlice( // Add entities { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "UiSliceManager::MakeNewSlice:SetupAndExecuteTransaction:AddEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "UiSliceManager::MakeNewSlice:SetupAndExecuteTransaction:AddEntities"); for (const AZ::EntityId& entityId : orderedEntityList) { SliceTransaction::Result addResult = transaction->AddEntity(entityId, !inheritSlices ? SliceTransaction::SliceAddEntityFlags::DiscardSliceAncestry : 0); @@ -348,7 +348,7 @@ AzToolsFramework::SliceUtilities::SliceTransaction::Result SlicePreSaveCallbackF [[maybe_unused]] const char* fullPath, AzToolsFramework::SliceUtilities::SliceTransaction::SliceAssetPtr& asset) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzToolsFramework, "SlicePreSaveCallbackForUiEntities"); + AZ_PROFILE_SCOPE(AzToolsFramework, "SlicePreSaveCallbackForUiEntities"); // we want to ensure that "bad" data never gets pushed to a slice // This mostly relates to the m_childEntityIdOrder array since this is something that diff --git a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp index 91839b1e23..5a3304fecd 100644 --- a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp +++ b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp index 8baea091a2..ef42aba7f0 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp @@ -233,7 +233,7 @@ namespace NvCloth void ActorClothSkinningLinear::UpdateSkinning() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); m_skinningMatrices = Internal::ObtainSkinningMatrices(m_entityId); } @@ -250,7 +250,7 @@ namespace NvCloth return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); const size_t vertexCount = m_simulatedVertices.size(); for (size_t index = 0; index < vertexCount; ++index) @@ -274,7 +274,7 @@ namespace NvCloth return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); for (const AZ::u32 index : m_nonSimulatedVertices) { @@ -342,7 +342,7 @@ namespace NvCloth void ActorClothSkinningDualQuaternion::UpdateSkinning() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); m_skinningDualQuaternions = Internal::ObtainSkinningDualQuaternions(m_entityId, m_jointIndices); } @@ -359,7 +359,7 @@ namespace NvCloth return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); const size_t vertexCount = m_simulatedVertices.size(); for (size_t index = 0; index < vertexCount; ++index) @@ -383,7 +383,7 @@ namespace NvCloth return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); for (const AZ::u32 index : m_nonSimulatedVertices) { diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp index 5a7564d72a..54e9619eea 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ClothComponentMesh.cpp @@ -250,7 +250,7 @@ namespace NvCloth [[maybe_unused]] ClothId clothId, float deltaTime) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); UpdateSimulationCollisions(); @@ -267,7 +267,7 @@ namespace NvCloth [[maybe_unused]] float deltaTime, const AZStd::vector& updatedParticles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); // Next buffer index of the render data m_renderDataBufferIndex = (m_renderDataBufferIndex + 1) % RenderDataBufferSize; @@ -326,7 +326,7 @@ namespace NvCloth { if (m_actorClothColliders) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); m_actorClothColliders->Update(); @@ -342,7 +342,7 @@ namespace NvCloth { if (m_actorClothSkinning) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); m_actorClothSkinning->UpdateSkinning(); @@ -376,7 +376,7 @@ namespace NvCloth void ClothComponentMesh::UpdateSimulationConstraints() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); m_motionConstraints = m_clothConstraints->GetMotionConstraints(); m_separationConstraints = m_clothConstraints->GetSeparationConstraints(); @@ -396,7 +396,7 @@ namespace NvCloth void ClothComponentMesh::UpdateRenderData(const AZStd::vector& particles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); if (!m_cloth) { @@ -449,7 +449,7 @@ namespace NvCloth void ClothComponentMesh::CopyRenderDataToModel() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); // Previous buffer index of the render data const AZ::u32 previousBufferIndex = (m_renderDataBufferIndex + RenderDataBufferSize - 1) % RenderDataBufferSize; diff --git a/Gems/NvCloth/Code/Source/System/Cloth.cpp b/Gems/NvCloth/Code/Source/System/Cloth.cpp index 2aad4c402f..c71d1bd584 100644 --- a/Gems/NvCloth/Code/Source/System/Cloth.cpp +++ b/Gems/NvCloth/Code/Source/System/Cloth.cpp @@ -165,7 +165,7 @@ namespace NvCloth void Cloth::Update() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); ResolveStaticParticles(); diff --git a/Gems/NvCloth/Code/Source/System/FabricCooker.cpp b/Gems/NvCloth/Code/Source/System/FabricCooker.cpp index 668675aeaa..e9da64f970 100644 --- a/Gems/NvCloth/Code/Source/System/FabricCooker.cpp +++ b/Gems/NvCloth/Code/Source/System/FabricCooker.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -304,7 +305,7 @@ namespace NvCloth const AZ::Vector3& fabricGravity, bool useGeodesicTether) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); return Internal::Cook(particles, indices, fabricGravity, useGeodesicTether); } @@ -317,7 +318,7 @@ namespace NvCloth AZStd::vector& remappedVertices, bool removeStaticTriangles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); // Weld vertices together AZStd::vector weldedParticles; diff --git a/Gems/NvCloth/Code/Source/System/Solver.cpp b/Gems/NvCloth/Code/Source/System/Solver.cpp index 6c20631409..3db9d3a1d9 100644 --- a/Gems/NvCloth/Code/Source/System/Solver.cpp +++ b/Gems/NvCloth/Code/Source/System/Solver.cpp @@ -110,7 +110,7 @@ namespace NvCloth AZ_Assert(!m_isSimulating, "Please make sure the ongoing simulation is finished before attempting to start a new one"); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); m_deltaTime = deltaTime; m_simulationCompletion.Reset(true /*isClearDependent*/); @@ -147,7 +147,7 @@ namespace NvCloth return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); // Waiting for the simulation pass completition. m_simulationCompletion.StartAndWaitForCompletion(); @@ -191,14 +191,14 @@ namespace NvCloth void Solver::ClothsSimulationJob::Process() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Cloth, "NvCloth::BeginSimulationJob"); + AZ_PROFILE_SCOPE(Cloth, "NvCloth::BeginSimulationJob"); if (m_solver->beginSimulation(m_deltaTime)) { // Setup the end simulation job. AZ::Job* endSimulationJob = AZ::CreateJobFunction([solver = m_solver] { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Cloth, "NvCloth::EndSimulationJob"); + AZ_PROFILE_SCOPE(Cloth, "NvCloth::EndSimulationJob"); solver->endSimulation(); }, true /*isAutoDelete*/); @@ -209,7 +209,7 @@ namespace NvCloth { AZ::Job* chunkSimulationJob = AZ::CreateJobFunction([solver = m_solver, chunkIndex] { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Cloth, "NvCloth::ChunkSimulationJob"); + AZ_PROFILE_SCOPE(Cloth, "NvCloth::ChunkSimulationJob"); solver->simulateChunk(chunkIndex); }, true /*isAutoDelete*/); @@ -241,7 +241,7 @@ namespace NvCloth { AZ::Job* eventSignalJob = AZ::CreateJobFunction([cloth, deltaTime = m_deltaTime] { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Cloth, "NvCloth::PostSimulationJob"); + AZ_PROFILE_SCOPE(Cloth, "NvCloth::PostSimulationJob"); // Update the cloth data after the simulation cloth->Update(); @@ -270,7 +270,7 @@ namespace NvCloth { AZ::Job* eventSignalJob = AZ::CreateJobFunction([cloth, deltaTime = m_deltaTime] { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Cloth, "NvCloth::PreSimulationJob"); + AZ_PROFILE_SCOPE(Cloth, "NvCloth::PreSimulationJob"); // Issue pre-simulation events cloth->m_preSimulationEvent.Signal(cloth->GetId(), deltaTime); diff --git a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp index 083a866a4e..02a57cea6f 100644 --- a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp +++ b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp @@ -106,11 +106,11 @@ namespace NvCloth { if (detached) { - AZ_PROFILE_INTERVAL_START(AZ::Debug::ProfileCategory::Cloth, AZ::Crc32(eventName), eventName); + AZ_PROFILE_INTERVAL_START(Cloth, AZ::Crc32(eventName), eventName); } else { - AZ_PROFILE_EVENT_BEGIN(AZ::Debug::ProfileCategory::Cloth, eventName); + AZ_PROFILE_BEGIN(Cloth, eventName); } return nullptr; } @@ -121,11 +121,11 @@ namespace NvCloth { if (detached) { - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::Cloth, AZ::Crc32(eventName)); + AZ_PROFILE_INTERVAL_END(Cloth, AZ::Crc32(eventName)); } else { - AZ_PROFILE_EVENT_END(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_END(); } } }; @@ -309,7 +309,7 @@ namespace NvCloth const AZStd::vector& initialParticles, const FabricCookedData& fabricCookedData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); FabricId fabricId = FindOrCreateFabric(fabricCookedData); if (!fabricId.IsValid()) @@ -403,7 +403,7 @@ namespace NvCloth float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); for (auto& solverIt : m_solvers) { diff --git a/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp b/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp index 3c47ad46fd..17d8c629e6 100644 --- a/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp +++ b/Gems/NvCloth/Code/Source/System/TangentSpaceHelper.cpp @@ -8,6 +8,8 @@ #include +#include + namespace NvCloth { namespace @@ -20,7 +22,7 @@ namespace NvCloth const AZStd::vector& indices, AZStd::vector& outNormals) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); if ((indices.size() % 3) != 0) { @@ -86,7 +88,7 @@ namespace NvCloth AZStd::vector& outTangents, AZStd::vector& outBitangents) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); if ((indices.size() % 3) != 0) { @@ -174,7 +176,7 @@ namespace NvCloth AZStd::vector& outBitangents, AZStd::vector& outNormals) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); if ((indices.size() % 3) != 0) { diff --git a/Gems/NvCloth/Code/Source/Utils/MeshAssetHelper.cpp b/Gems/NvCloth/Code/Source/Utils/MeshAssetHelper.cpp index da48485dfa..c95c8896ab 100644 --- a/Gems/NvCloth/Code/Source/Utils/MeshAssetHelper.cpp +++ b/Gems/NvCloth/Code/Source/Utils/MeshAssetHelper.cpp @@ -66,7 +66,7 @@ namespace NvCloth MeshNodeInfo& meshNodeInfo, MeshClothInfo& meshClothInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Cloth); + AZ_PROFILE_FUNCTION(Cloth); AZ::Data::Asset modelDataAsset; AZ::Render::MeshComponentRequestBus::EventResult( diff --git a/Gems/PhysX/Code/Source/ForceRegionComponent.cpp b/Gems/PhysX/Code/Source/ForceRegionComponent.cpp index af929bbab3..f8f5f1991e 100644 --- a/Gems/PhysX/Code/Source/ForceRegionComponent.cpp +++ b/Gems/PhysX/Code/Source/ForceRegionComponent.cpp @@ -115,7 +115,7 @@ namespace PhysX void ForceRegionComponent::PostPhysicsSubTick(float fixedDeltaTime) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); for (auto entityId : m_entities) { diff --git a/Gems/PhysX/Code/Source/Pipeline/HeightFieldAssetHandler.cpp b/Gems/PhysX/Code/Source/Pipeline/HeightFieldAssetHandler.cpp index d21bd02737..e4d64d4139 100644 --- a/Gems/PhysX/Code/Source/Pipeline/HeightFieldAssetHandler.cpp +++ b/Gems/PhysX/Code/Source/Pipeline/HeightFieldAssetHandler.cpp @@ -106,7 +106,7 @@ namespace PhysX AZStd::shared_ptr stream, [[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); HeightFieldAsset* physXHeightFieldAsset = asset.GetAs(); if (!physXHeightFieldAsset) @@ -166,7 +166,7 @@ namespace PhysX bool HeightFieldAssetHandler::SaveAssetData(const AZ::Data::Asset& asset, AZ::IO::GenericStream* stream) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); HeightFieldAsset* physXHeightFieldAsset = asset.GetAs(); if (!physXHeightFieldAsset) diff --git a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp index a47f0ba16f..bdd253d70c 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -529,7 +529,7 @@ namespace PhysX void PhysXScene::StartSimulation(float deltatime) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::StartSimulation"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::StartSimulation"); if (!IsEnabled()) { @@ -537,7 +537,7 @@ namespace PhysX } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "OnSceneSimulationStartEvent::Signaled"); + AZ_PROFILE_SCOPE(Physics, "OnSceneSimulationStartEvent::Signaled"); m_sceneSimuationStartEvent.Signal(m_sceneHandle, deltatime); } @@ -549,7 +549,7 @@ namespace PhysX void PhysXScene::FinishSimulation() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::FinishSimulation"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::FinishSimulation"); if (!IsEnabled()) { @@ -557,7 +557,7 @@ namespace PhysX } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::CheckResults"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::CheckResults"); // Wait for the simulation to complete. // In the multithreaded environment we need to make sure we don't lock the scene for write here. @@ -569,7 +569,7 @@ namespace PhysX bool activeActorsEnabled = false; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::FetchResults"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::FetchResults"); PHYSX_SCENE_WRITE_LOCK(m_pxScene); activeActorsEnabled = m_pxScene->getFlags() & physx::PxSceneFlag::eENABLE_ACTIVE_ACTORS; @@ -580,7 +580,7 @@ namespace PhysX if (activeActorsEnabled) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::ActiveActors"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::ActiveActors"); PHYSX_SCENE_READ_LOCK(m_pxScene); @@ -602,7 +602,7 @@ namespace PhysX ClearDeferedDeletions(); { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "OnSceneSimulationFinishedEvent::Signaled"); + AZ_PROFILE_SCOPE(Physics, "OnSceneSimulationFinishedEvent::Signaled"); m_sceneSimuationFinishEvent.Signal(m_sceneHandle, m_currentDeltaTime); } @@ -1108,7 +1108,7 @@ namespace PhysX void PhysXScene::ProcessTriggerEvents() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::ProcessTriggerEvents"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::ProcessTriggerEvents"); AzPhysics::TriggerEventList& triggers = m_simulationEventCallback.GetQueuedTriggerEvents(); if (triggers.empty()) @@ -1135,7 +1135,7 @@ namespace PhysX void PhysXScene::ProcessCollisionEvents() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::ProcessCollisionEvents"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::ProcessCollisionEvents"); AzPhysics::CollisionEventList& collisions = m_simulationEventCallback.GetQueuedCollisionEvents(); if (collisions.empty()) @@ -1181,7 +1181,7 @@ namespace PhysX return; } - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysX::Statistics"); + AZ_PROFILE_SCOPE(Physics, "PhysX::Statistics"); physx::PxSimulationStatistics stats; @@ -1193,33 +1193,33 @@ namespace PhysX [[maybe_unused]] const char* RootCategory = "PhysX/%s/%s"; [[maybe_unused]] const char* ShapesSubCategory = "Shapes"; - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::eSPHERE], RootCategory, ShapesSubCategory, "Sphere"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::ePLANE], RootCategory, ShapesSubCategory, "Plane"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::eCAPSULE], RootCategory, ShapesSubCategory, "Capsule"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::eBOX], RootCategory, ShapesSubCategory, "Box"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::eCONVEXMESH], RootCategory, ShapesSubCategory, "ConvexMesh"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::eTRIANGLEMESH], RootCategory, ShapesSubCategory, "TriangleMesh"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbShapes[PxGeometryType::eHEIGHTFIELD], RootCategory, ShapesSubCategory, "Heightfield"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::eSPHERE], RootCategory, ShapesSubCategory, "Sphere"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::ePLANE], RootCategory, ShapesSubCategory, "Plane"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::eCAPSULE], RootCategory, ShapesSubCategory, "Capsule"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::eBOX], RootCategory, ShapesSubCategory, "Box"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::eCONVEXMESH], RootCategory, ShapesSubCategory, "ConvexMesh"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::eTRIANGLEMESH], RootCategory, ShapesSubCategory, "TriangleMesh"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbShapes[PxGeometryType::eHEIGHTFIELD], RootCategory, ShapesSubCategory, "Heightfield"); [[maybe_unused]] const char* ObjectsSubCategory = "Objects"; - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbActiveConstraints, RootCategory, ObjectsSubCategory, "ActiveConstraints"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbActiveDynamicBodies, RootCategory, ObjectsSubCategory, "ActiveDynamicBodies"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbActiveKinematicBodies, RootCategory, ObjectsSubCategory, "ActiveKinematicBodies"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbStaticBodies, RootCategory, ObjectsSubCategory, "StaticBodies"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbDynamicBodies, RootCategory, ObjectsSubCategory, "DynamicBodies"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbKinematicBodies, RootCategory, ObjectsSubCategory, "KinematicBodies"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbAggregates, RootCategory, ObjectsSubCategory, "Aggregates"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbArticulations, RootCategory, ObjectsSubCategory, "Articulations"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbActiveConstraints, RootCategory, ObjectsSubCategory, "ActiveConstraints"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbActiveDynamicBodies, RootCategory, ObjectsSubCategory, "ActiveDynamicBodies"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbActiveKinematicBodies, RootCategory, ObjectsSubCategory, "ActiveKinematicBodies"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbStaticBodies, RootCategory, ObjectsSubCategory, "StaticBodies"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbDynamicBodies, RootCategory, ObjectsSubCategory, "DynamicBodies"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbKinematicBodies, RootCategory, ObjectsSubCategory, "KinematicBodies"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbAggregates, RootCategory, ObjectsSubCategory, "Aggregates"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbArticulations, RootCategory, ObjectsSubCategory, "Articulations"); [[maybe_unused]] const char* SolverSubCategory = "Solver"; - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbAxisSolverConstraints, RootCategory, SolverSubCategory, "AxisSolverConstraints"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.compressedContactSize, RootCategory, SolverSubCategory, "CompressedContactSize"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.requiredContactConstraintMemory, RootCategory, SolverSubCategory, "RequiredContactConstraintMemory"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.peakConstraintMemory, RootCategory, SolverSubCategory, "PeakConstraintMemory"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbAxisSolverConstraints, RootCategory, SolverSubCategory, "AxisSolverConstraints"); + AZ_PROFILE_DATAPOINT(Physics, stats.compressedContactSize, RootCategory, SolverSubCategory, "CompressedContactSize"); + AZ_PROFILE_DATAPOINT(Physics, stats.requiredContactConstraintMemory, RootCategory, SolverSubCategory, "RequiredContactConstraintMemory"); + AZ_PROFILE_DATAPOINT(Physics, stats.peakConstraintMemory, RootCategory, SolverSubCategory, "PeakConstraintMemory"); [[maybe_unused]] const char* BroadphaseSubCategory = "Broadphase"; - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.getNbBroadPhaseAdds(), RootCategory, BroadphaseSubCategory, "BroadPhaseAdds"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.getNbBroadPhaseRemoves(), RootCategory, BroadphaseSubCategory, "BroadPhaseRemoves"); + AZ_PROFILE_DATAPOINT(Physics, stats.getNbBroadPhaseAdds(), RootCategory, BroadphaseSubCategory, "BroadPhaseAdds"); + AZ_PROFILE_DATAPOINT(Physics, stats.getNbBroadPhaseRemoves(), RootCategory, BroadphaseSubCategory, "BroadPhaseRemoves"); // Compute pair stats for all geometry types AZ::u32 ccdPairs = 0; @@ -1240,16 +1240,16 @@ namespace PhysX } [[maybe_unused]] const char* CollisionsSubCategory = "Collisions"; - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, ccdPairs, RootCategory, CollisionsSubCategory, "CCDPairs"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, modifiedPairs, RootCategory, CollisionsSubCategory, "ModifiedPairs"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, triggerPairs, RootCategory, CollisionsSubCategory, "TriggerPairs"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbDiscreteContactPairsTotal, RootCategory, CollisionsSubCategory, "DiscreteContactPairsTotal"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbDiscreteContactPairsWithCacheHits, RootCategory, CollisionsSubCategory, "DiscreteContactPairsWithCacheHits"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbDiscreteContactPairsWithContacts, RootCategory, CollisionsSubCategory, "DiscreteContactPairsWithContacts"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbNewPairs, RootCategory, CollisionsSubCategory, "NewPairs"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbLostPairs, RootCategory, CollisionsSubCategory, "LostPairs"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbNewTouches, RootCategory, CollisionsSubCategory, "NewTouches"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbLostTouches, RootCategory, CollisionsSubCategory, "LostTouches"); - AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory::Physics, stats.nbPartitions, RootCategory, CollisionsSubCategory, "Partitions"); + AZ_PROFILE_DATAPOINT(Physics, ccdPairs, RootCategory, CollisionsSubCategory, "CCDPairs"); + AZ_PROFILE_DATAPOINT(Physics, modifiedPairs, RootCategory, CollisionsSubCategory, "ModifiedPairs"); + AZ_PROFILE_DATAPOINT(Physics, triggerPairs, RootCategory, CollisionsSubCategory, "TriggerPairs"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbDiscreteContactPairsTotal, RootCategory, CollisionsSubCategory, "DiscreteContactPairsTotal"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbDiscreteContactPairsWithCacheHits, RootCategory, CollisionsSubCategory, "DiscreteContactPairsWithCacheHits"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbDiscreteContactPairsWithContacts, RootCategory, CollisionsSubCategory, "DiscreteContactPairsWithContacts"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbNewPairs, RootCategory, CollisionsSubCategory, "NewPairs"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbLostPairs, RootCategory, CollisionsSubCategory, "LostPairs"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbNewTouches, RootCategory, CollisionsSubCategory, "NewTouches"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbLostTouches, RootCategory, CollisionsSubCategory, "LostTouches"); + AZ_PROFILE_DATAPOINT(Physics, stats.nbPartitions, RootCategory, CollisionsSubCategory, "Partitions"); } } diff --git a/Gems/PhysX/Code/Source/System/PhysXJob.cpp b/Gems/PhysX/Code/Source/System/PhysXJob.cpp index d65f2b756e..597c8bea98 100644 --- a/Gems/PhysX/Code/Source/System/PhysXJob.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXJob.cpp @@ -19,7 +19,7 @@ namespace PhysX void PhysXJob::Process() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, m_pxTask.getName()); + AZ_PROFILE_SCOPE(Physics, m_pxTask.getName()); m_pxTask.run(); m_pxTask.release(); } diff --git a/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp b/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp index f0182cdbcc..28981722b6 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp @@ -45,11 +45,11 @@ namespace PhysX { if (!detached) { - AZ_PROFILE_EVENT_BEGIN(AZ::Debug::ProfileCategory::Physics, eventName); + AZ_PROFILE_BEGIN(Physics, eventName); } else { - AZ_PROFILE_INTERVAL_START(AZ::Debug::ProfileCategory::Physics, AZ::Crc32(eventName), eventName); + AZ_PROFILE_INTERVAL_START(Physics, AZ::Crc32(eventName), eventName); } return nullptr; } @@ -59,11 +59,11 @@ namespace PhysX { if (!detached) { - AZ_PROFILE_EVENT_END(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_END(); } else { - AZ_PROFILE_INTERVAL_END(AZ::Debug::ProfileCategory::Physics, AZ::Crc32(eventName)); + AZ_PROFILE_INTERVAL_END(Physics, AZ::Crc32(eventName)); } } } diff --git a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp index cc55255e24..ba9cc58011 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp @@ -130,7 +130,7 @@ namespace PhysX void PhysXSystem::Simulate(float deltaTime) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (m_state != State::Initialized) { diff --git a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp index 831a7fdf1d..f9f5d63b2c 100644 --- a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp +++ b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp @@ -347,7 +347,7 @@ namespace PhysXDebug static const physx::PxRenderBuffer& GetRenderBuffer(physx::PxScene* physxScene) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); PHYSX_SCENE_READ_LOCK(physxScene); return physxScene->getRenderBuffer(); } @@ -439,7 +439,7 @@ namespace PhysXDebug return; } - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); m_currentTime = time; bool dirty = true; @@ -620,7 +620,7 @@ namespace PhysXDebug void SystemComponent::ConfigurePhysXVisualizationParameters() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (physx::PxScene* physxScene = GetCurrentPxScene()) { @@ -667,7 +667,7 @@ namespace PhysXDebug void SystemComponent::ConfigureCullingBox() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); // Currently using the Cry view camera to support Editor, Game and Launcher modes. This will be updated in due course. const AZ::Vector3 cameraTranslation = GetViewCameraPosition(); @@ -694,7 +694,7 @@ namespace PhysXDebug void SystemComponent::GatherTriangles(const physx::PxRenderBuffer& rb) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (!m_settings.m_visualizationEnabled) { return; @@ -728,7 +728,7 @@ namespace PhysXDebug void SystemComponent::GatherLines(const physx::PxRenderBuffer& rb) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (!m_settings.m_visualizationEnabled) { @@ -763,7 +763,7 @@ namespace PhysXDebug void SystemComponent::GatherJointLimits() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); physx::PxScene* scene = GetCurrentPxScene(); @@ -824,7 +824,7 @@ namespace PhysXDebug void SystemComponent::DrawDebugCullingBox(const AZ::Aabb& cullingBoxAabb) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); if (m_settings.m_visualizationEnabled && m_culling.m_boxWireframe) { @@ -842,7 +842,7 @@ namespace PhysXDebug AZ::Color SystemComponent::MapOriginalPhysXColorToUserDefinedValues(const physx::PxU32& originalColor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); // color mapping from PhysX to LY user preference: \PhysX_3.4\Include\common\PxRenderBuffer.h switch (static_cast(originalColor)) @@ -878,7 +878,7 @@ namespace PhysXDebug void SystemComponent::InitPhysXColorMappings() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Physics); + AZ_PROFILE_FUNCTION(Physics); m_colorMappings.m_defaultColor.FromU32(physx::PxDebugColor::eARGB_GREEN); m_colorMappings.m_black.FromU32(physx::PxDebugColor::eARGB_BLACK); m_colorMappings.m_red.FromU32(physx::PxDebugColor::eARGB_RED); diff --git a/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp b/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp index b76d36d189..7e38f76592 100644 --- a/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp +++ b/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp @@ -312,7 +312,7 @@ namespace RADTelemetry using MaskType = AZ::Debug::ProfileCategoryPrimitiveType; // Set all the category bits "below" FirstDetailedCategory and do not enable memory capture by default - return (static_cast(1) << static_cast(AZ::Debug::ProfileCategory::FirstDetailedCategory)) - 1; + return (static_cast(1) << static_cast(FirstDetailedCategory)) - 1; } AZ::Debug::ProfileCategoryPrimitiveType ProfileTelemetryComponent::GetDefaultCaptureMask() diff --git a/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp b/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp index 56dc8f310a..dc23505833 100644 --- a/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp +++ b/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp @@ -48,7 +48,7 @@ namespace RADTelemetry } // Mask off the memory capture flag and add it back if memory capture is enabled - const MaskType fullCaptureMask = (maskCvarValue & ~AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(AZ::Debug::ProfileCategory::MemoryReserved)) | (s_memCaptureEnabled ? AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(AZ::Debug::ProfileCategory::MemoryReserved) : 0); + const MaskType fullCaptureMask = (maskCvarValue & ~AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(MemoryReserved)) | (s_memCaptureEnabled ? AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(MemoryReserved) : 0); TelemetryRequestBus::Broadcast(&TelemetryRequests::SetCaptureMask, fullCaptureMask); } diff --git a/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshBuilder.cpp b/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshBuilder.cpp index acbc9ee46e..0f967f644e 100644 --- a/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshBuilder.cpp +++ b/Gems/SceneProcessing/Code/Source/Generation/Components/MeshOptimizer/MeshBuilder.cpp @@ -250,7 +250,7 @@ namespace AZ::MeshBuilder AZ::JobContext* jobContext = nullptr; AZ::Job* job = AZ::CreateJobFunction([&subMesh]() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Animation, "MeshBuilder::GenerateSubMeshVertexOrders::SubMeshJob"); + AZ_PROFILE_SCOPE(Animation, "MeshBuilder::GenerateSubMeshVertexOrders::SubMeshJob"); subMesh->GenerateVertexOrder(); }, true, jobContext); diff --git a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp index 43ef9b3d3a..e7dc2343f2 100644 --- a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp @@ -706,7 +706,7 @@ namespace ScriptCanvasEditor bool savedSuccess; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvasAssetHandler::SaveAssetData"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvasAssetHandler::SaveAssetData"); ScriptCanvasMemoryAsset cloneAsset; m_sourceAsset->CloneTo(cloneAsset); @@ -716,14 +716,14 @@ namespace ScriptCanvasEditor stream.Close(); if (savedSuccess) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "AssetTracker::SaveAssetPostSourceControl : TempToTargetFileReplacement"); + AZ_PROFILE_SCOPE(ScriptCanvas, "AssetTracker::SaveAssetPostSourceControl : TempToTargetFileReplacement"); AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); const bool targetFileExists = fileIO->Exists(m_saveInfo.m_streamName.data()); bool removedTargetFile; { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "AssetTracker::SaveAssetPostSourceControl : TempToTargetFileReplacement : RemoveTarget"); + AZ_PROFILE_SCOPE(ScriptCanvas, "AssetTracker::SaveAssetPostSourceControl : TempToTargetFileReplacement : RemoveTarget"); removedTargetFile = fileIO->Remove(m_saveInfo.m_streamName.data()); } @@ -733,7 +733,7 @@ namespace ScriptCanvasEditor } else { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "AssetTracker::SaveAssetPostSourceControl : TempToTargetFileReplacement : RenameTempFile"); + AZ_PROFILE_SCOPE(ScriptCanvas, "AssetTracker::SaveAssetPostSourceControl : TempToTargetFileReplacement : RenameTempFile"); AZ::IO::Result renameResult = fileIO->Rename(tempPath.data(), m_saveInfo.m_streamName.data()); if (!renameResult) { diff --git a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasUndoHelper.cpp b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasUndoHelper.cpp index 24daf5b2b0..388da67987 100644 --- a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasUndoHelper.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasUndoHelper.cpp @@ -103,7 +103,7 @@ namespace ScriptCanvasEditor void UndoHelper::Undo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); SceneUndoState* sceneUndoState = m_memoryAsset.GetUndoState(); if (sceneUndoState) @@ -123,7 +123,7 @@ namespace ScriptCanvasEditor void UndoHelper::Redo() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); SceneUndoState* sceneUndoState = m_memoryAsset.GetUndoState(); if (sceneUndoState) diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp index 15df6b0261..bb3a28099e 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp @@ -99,7 +99,7 @@ namespace ScriptCanvasEditor::Nodes AZStd::pair CreateAndGetNode(const AZ::Uuid& classId, const ScriptCanvas::ScriptCanvasId& scriptCanvasId, const StyleConfiguration& styleConfiguration, AZStd::function onCreateCallback) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIdPair; ScriptCanvas::Node* node{}; @@ -134,7 +134,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateObjectMethodNode(AZStd::string_view className, AZStd::string_view methodName, const ScriptCanvas::ScriptCanvasId& scriptCanvasId, ScriptCanvas::PropertyStatus propertyStatus) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIds; ScriptCanvas::Node* node = nullptr; @@ -161,7 +161,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateObjectMethodOverloadNode(AZStd::string_view className, AZStd::string_view methodName, const ScriptCanvas::ScriptCanvasId& scriptCanvasGraphId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIds; ScriptCanvas::Node* node = nullptr; @@ -188,7 +188,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateGlobalMethodNode(AZStd::string_view methodName, const ScriptCanvas::ScriptCanvasId& scriptCanvasId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIds; ScriptCanvas::Node* node = nullptr; @@ -215,7 +215,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateEbusWrapperNode(AZStd::string_view busName, const ScriptCanvas::ScriptCanvasId& scriptCanvasId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIdPair; ScriptCanvas::Node* node = nullptr; @@ -241,7 +241,7 @@ namespace ScriptCanvasEditor::Nodes { AZ_Assert(assetId.IsValid(), "CreateScriptEventReceiverNode asset Id must be valid"); - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIdPair; AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::Data::AssetLoadBehavior::Default); @@ -276,7 +276,7 @@ namespace ScriptCanvasEditor::Nodes { AZ_Assert(assetId.IsValid(), "CreateScriptEventSenderNode asset Id must be valid"); - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIdPair; AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::Data::AssetLoadBehavior::Default); @@ -302,7 +302,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateGetVariableNode(const ScriptCanvas::VariableId& variableId, ScriptCanvas::ScriptCanvasId scriptCanvasId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); const AZ::Uuid k_VariableNodeTypeId = azrtti_typeid(); NodeIdPair nodeIds; @@ -333,7 +333,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateSetVariableNode(const ScriptCanvas::VariableId& variableId, ScriptCanvas::ScriptCanvasId scriptCanvasId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); const AZ::Uuid k_VariableNodeTypeId = azrtti_typeid(); NodeIdPair nodeIds; @@ -366,7 +366,7 @@ namespace ScriptCanvasEditor::Nodes { AZ_Assert(assetId.IsValid(), "CreateFunctionNode source asset Id must be valid"); - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIdPair; AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::Data::AssetLoadBehavior::PreLoad); @@ -394,7 +394,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateAzEventHandlerNode(const AZ::BehaviorMethod& methodWithAzEventReturn, ScriptCanvas::ScriptCanvasId scriptCanvasId, AZ::EntityId connectingMethodNodeId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeIdPair nodeIdPair; // Make sure the method returns an AZ::Event by reference or pointer diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp index c045a1c0da..65129e4054 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp @@ -57,7 +57,7 @@ namespace ScriptCanvasEditor::Nodes // Handles the creation of a node through the node configurations for most nodes. AZ::EntityId DisplayGeneralScriptCanvasNode(AZ::EntityId, const ScriptCanvas::Node* node, const NodeConfiguration& nodeConfiguration) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); AZ::Entity* graphCanvasEntity = nullptr; @@ -445,7 +445,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplayEbusEventNode(AZ::EntityId, const AZStd::string& busName, const AZStd::string& eventName, const ScriptCanvas::EBusEventId& eventId) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); AZ::EntityId graphCanvasNodeId; @@ -668,7 +668,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplayScriptEventNode(AZ::EntityId, const AZ::Data::AssetId assetId, const ScriptEvents::Method& methodDefinition) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); AZ::EntityId graphCanvasNodeId; @@ -1001,7 +1001,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplayGetVariableNode(AZ::EntityId graphCanvasGraphId, const ScriptCanvas::Nodes::Core::GetVariableNode* variableNode) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeConfiguration nodeConfiguration; nodeConfiguration.PopulateComponentDescriptors(); @@ -1033,7 +1033,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplaySetVariableNode(AZ::EntityId graphCanvasGraphId, const ScriptCanvas::Nodes::Core::SetVariableNode* variableNode) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); NodeConfiguration nodeConfiguration; nodeConfiguration.PopulateComponentDescriptors(); @@ -1069,7 +1069,7 @@ namespace ScriptCanvasEditor::Nodes /////////////////// AZ::EntityId DisplayScriptCanvasNode(AZ::EntityId graphCanvasGraphId, const ScriptCanvas::Node* node) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); AZ::EntityId graphCanvasNodeId; if (azrtti_istypeof(node)) @@ -1122,7 +1122,7 @@ namespace ScriptCanvasEditor::Nodes static void RegisterAndActivateGraphCanvasSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::SlotId& slotId, AZ::Entity* slotEntity) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); if (slotEntity) { slotEntity->Init(); @@ -1166,7 +1166,7 @@ namespace ScriptCanvasEditor::Nodes return AZ::EntityId(); } - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); AZ::Entity* slotEntity = nullptr; AZ::Uuid typeId = ScriptCanvas::Data::ToAZType(slot.GetDataType()); @@ -1258,7 +1258,7 @@ namespace ScriptCanvasEditor::Nodes::SlotDisplayHelper { AZ::EntityId DisplayPropertySlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::VisualExtensionSlotConfiguration& propertyConfiguration) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); GraphCanvas::SlotConfiguration graphCanvasConfiguration; @@ -1284,7 +1284,7 @@ namespace ScriptCanvasEditor::Nodes::SlotDisplayHelper AZ::EntityId DisplayExtendableSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::VisualExtensionSlotConfiguration& extenderConfiguration) { - AZ_PROFILE_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); GraphCanvas::ExtenderSlotConfiguration graphCanvasConfiguration; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.cpp index d878415341..bd19482dd8 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.cpp @@ -115,7 +115,7 @@ namespace ScriptCanvas void EBusHandler::OnEventGenericHook(void* userData, const char* eventName, int eventIndex, AZ::BehaviorValueParameter* result, int numParameters, AZ::BehaviorValueParameter* parameters) { AZ_UNUSED(eventName); - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::ScriptCanvas, "EBusEventHandler::OnEvent %s", eventName); + AZ_PROFILE_SCOPE(ScriptCanvas, "EBusEventHandler::OnEvent %s", eventName); auto handler = reinterpret_cast(userData); SCRIPT_CANVAS_PERFORMANCE_SCOPE_LATENT(handler->GetScriptCanvasId(), handler->GetAssetId()); handler->OnEvent(nullptr, eventIndex, result, numParameters, parameters); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp index 6e87e52f87..5aac3715eb 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp @@ -1022,7 +1022,7 @@ namespace ScriptCanvas void Node::SetToDefaultValueOfType(const SlotId& slotId) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::SetToDefaultValueOfType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::SetToDefaultValueOfType"); Slot* slot = GetSlot(slotId); @@ -1616,7 +1616,7 @@ namespace ScriptCanvas Data::Type Node::GetSlotDataType(const SlotId& slotId) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetSlotDataType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetSlotDataType"); const auto* slot = GetSlot(slotId); @@ -1631,7 +1631,7 @@ namespace ScriptCanvas VariableId Node::GetSlotVariableId(const SlotId& slotId) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetSlotVariableId"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetSlotVariableId"); Slot* slot = GetSlot(slotId); @@ -1645,7 +1645,7 @@ namespace ScriptCanvas void Node::SetSlotVariableId(const SlotId& slotId, const VariableId& variableId) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::SetSlotVariableId"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::SetSlotVariableId"); Slot* slot = GetSlot(slotId); @@ -1664,7 +1664,7 @@ namespace ScriptCanvas void Node::ClearSlotVariableId(const SlotId& slotId) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::ResetSlotVariableId"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::ResetSlotVariableId"); SetSlotVariableId(slotId, VariableId()); } @@ -1861,7 +1861,7 @@ namespace ScriptCanvas AZStd::vector Node::GetAllSlotsByDescriptor(const SlotDescriptor& slotDescriptor, bool allowLatentSlots) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetSlotsByType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetSlotsByType"); AZStd::vector slots; @@ -1879,7 +1879,7 @@ namespace ScriptCanvas AZStd::vector Node::GetAllEndpointsByDescriptor(const SlotDescriptor& slotDescriptor, bool allowLatentSlots) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetEndpointsByType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetEndpointsByType"); AZStd::vector endpoints; @@ -1898,7 +1898,7 @@ namespace ScriptCanvas AZStd::vector Node::GetSlotIds(AZStd::string_view slotName) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetSlotIds"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetSlotIds"); auto nameSlotRange = m_slotNameMap.equal_range(slotName); AZStd::vector result; @@ -1911,7 +1911,7 @@ namespace ScriptCanvas Slot* Node::GetSlot(const SlotId& slotId) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetSlot"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetSlot"); if (slotId.IsValid()) { @@ -1994,7 +1994,7 @@ namespace ScriptCanvas AZStd::vector Node::GetAllSlots() const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetAllSlots"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetAllSlots"); const SlotList& slots = GetSlots(); @@ -2011,7 +2011,7 @@ namespace ScriptCanvas AZStd::vector Node::ModAllSlots() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::ModAllSlots"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::ModAllSlots"); SlotList& slots = GetSlots(); @@ -2408,7 +2408,7 @@ namespace ScriptCanvas NodePtrConstList Node::FindConnectedNodesByDescriptor(const SlotDescriptor& slotDescriptor, bool followLatentConnections) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetConnectedNodesByType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetConnectedNodesByType"); NodePtrConstList connectedNodes; @@ -2427,7 +2427,7 @@ namespace ScriptCanvas AZStd::vector> Node::FindConnectedNodesAndSlotsByDescriptor(const SlotDescriptor& slotDescriptor, bool followLatentConnections) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetConnectedNodesAndSlotsByType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetConnectedNodesAndSlotsByType"); AZStd::vector> connectedNodes; @@ -2593,7 +2593,7 @@ namespace ScriptCanvas void Node::OnDatumEdited(const Datum* datum) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::OnDatumChanged"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::OnDatumChanged"); SlotId slotId; @@ -2788,7 +2788,7 @@ namespace ScriptCanvas SlotId Node::FindSlotIdForDescriptor(AZStd::string_view slotName, const SlotDescriptor& descriptor) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::FindSlotIdForDescriptor"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::FindSlotIdForDescriptor"); auto slotNameRange = m_slotNameMap.equal_range(slotName); auto nameSlotIt = AZStd::find_if(slotNameRange.first, slotNameRange.second, [descriptor](const AZStd::pair& nameSlotPair) @@ -2801,7 +2801,7 @@ namespace ScriptCanvas int Node::FindSlotIndex(const SlotId& slotId) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::FindSlotIndex"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::FindSlotIndex"); auto slotIdIter = m_slotIdIteratorCache.find(slotId); @@ -2816,7 +2816,7 @@ namespace ScriptCanvas bool Node::IsConnected(const Slot& slot) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::IsConnected"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::IsConnected"); return slot.IsVariableReference() || m_graphRequestBus->IsEndpointConnected(slot.GetEndpoint()); } @@ -2862,7 +2862,7 @@ namespace ScriptCanvas EndpointsResolved Node::GetConnectedNodes(const Slot& slot) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetConnectedNodes"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetConnectedNodes"); EndpointsResolved connectedNodes; @@ -2906,7 +2906,7 @@ namespace ScriptCanvas AZStd::vector> Node::ModConnectedNodes(const Slot& slot) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::ModConnectedNodes"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::ModConnectedNodes"); AZStd::vector> connectedNodes; ModConnectedNodes(slot, connectedNodes); return connectedNodes; @@ -3481,7 +3481,7 @@ namespace ScriptCanvas AZStd::vector Node::GetSlotsByType(CombinedSlotType slotType) const { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::Node::GetSlotsByType"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::Node::GetSlotsByType"); AZStd::vector slots; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp index ac19028fd5..89c69ee4c5 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp @@ -61,7 +61,7 @@ namespace ScriptCanvas void RuntimeComponent::Execute() { - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::ScriptCanvas, "RuntimeComponent::Execute (%s)", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().c_str()); + AZ_PROFILE_SCOPE(ScriptCanvas, "RuntimeComponent::Execute (%s)", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().c_str()); AZ_Assert(m_executionState, "RuntimeComponent::Execute called without an execution state"); SC_EXECUTION_TRACE_GRAPH_ACTIVATED(CreateActivationInfo()); SCRIPT_CANVAS_PERFORMANCE_SCOPE_EXECUTION(m_executionState->GetScriptCanvasId(), m_runtimeOverrides.m_runtimeAsset.GetId()); @@ -117,7 +117,7 @@ namespace ScriptCanvas AZ_Assert(m_runtimeAsset.Get(), "RuntimeComponent::m_runtimeAsset AssetId: %s was valid, but the data was not pre-loaded, so this script will not run", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().data()); #endif - AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::ScriptCanvas, "RuntimeComponent::InitializeExecution (%s)", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().c_str()); + AZ_PROFILE_SCOPE(ScriptCanvas, "RuntimeComponent::InitializeExecution (%s)", m_runtimeOverrides.m_runtimeAsset.GetId().ToString().c_str()); SCRIPT_CANVAS_PERFORMANCE_SCOPE_INITIALIZATION(m_scriptCanvasId, m_runtimeOverrides.m_runtimeAsset.GetId()); m_executionState = ExecutionState::Create(ExecutionStateConfig(m_runtimeOverrides.m_runtimeAsset, *this)); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodeables/BaseTimer.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodeables/BaseTimer.cpp index 8c8eac5e1b..d6454ef4a4 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodeables/BaseTimer.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodeables/BaseTimer.cpp @@ -46,7 +46,7 @@ namespace ScriptCanvas void BaseTimer::OnTick(float delta, AZ::ScriptTimePoint) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); SCRIPT_CANVAS_PERFORMANCE_SCOPE_LATENT(GetScriptCanvasId(), GetAssetId()); switch (m_timeUnits) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp index b2741f4498..552e04a850 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp @@ -191,7 +191,7 @@ namespace ScriptCanvas AZStd::string StringFormatted::ProcessFormat() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::ScriptCanvas, "ScriptCanvas::StringFormatted::ProcessFormat"); + AZ_PROFILE_SCOPE(ScriptCanvas, "ScriptCanvas::StringFormatted::ProcessFormat"); AZStd::string text; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorMul.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorMul.cpp index abbb4d8b6c..06ccb617ff 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorMul.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorMul.cpp @@ -58,7 +58,7 @@ namespace ScriptCanvas void OperatorMul::Operator(Data::eType type, const ArithmeticOperands& operands, Datum& result) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); switch (type) { diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp index 168b6d825a..c7842f28fd 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DelayNodeable.cpp @@ -49,7 +49,7 @@ namespace ScriptCanvas void DelayNodeable::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); SCRIPT_CANVAS_PERFORMANCE_SCOPE_LATENT(GetScriptCanvasId(), GetAssetId()); m_currentTime -= static_cast(deltaTime); if (m_currentTime <= 0.f) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp index 942271ad3a..f7f08874db 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/DurationNodeable.cpp @@ -28,7 +28,7 @@ namespace ScriptCanvas void DurationNodeable::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); SCRIPT_CANVAS_PERFORMANCE_SCOPE_LATENT(GetScriptCanvasId(), GetAssetId()); if (m_elapsedTime <= m_duration) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/TimerNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/TimerNodeable.cpp index db50f66f35..37d4d026c1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/TimerNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Time/TimerNodeable.cpp @@ -16,7 +16,7 @@ namespace ScriptCanvas { void TimerNodeable::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ScriptCanvas); + AZ_PROFILE_FUNCTION(ScriptCanvas); SCRIPT_CANVAS_PERFORMANCE_SCOPE_LATENT(GetScriptCanvasId(), GetAssetId()); double milliseconds = time.GetMilliseconds() - m_start.GetMilliseconds(); double seconds = time.GetSeconds() - m_start.GetSeconds(); diff --git a/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h b/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h index 18899ac3b1..c72f725a07 100644 --- a/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h +++ b/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include #include #include @@ -33,7 +34,7 @@ namespace SurfaceData AZ::Vector3& outPosition, AZ::Vector3& outNormal) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const size_t vertexCount = vertices.size(); if (vertexCount > 0 && vertexCount % 4 == 0) diff --git a/Gems/SurfaceData/Code/Source/Components/SurfaceDataColliderComponent.cpp b/Gems/SurfaceData/Code/Source/Components/SurfaceDataColliderComponent.cpp index 22328fc73f..eef9179194 100644 --- a/Gems/SurfaceData/Code/Source/Components/SurfaceDataColliderComponent.cpp +++ b/Gems/SurfaceData/Code/Source/Components/SurfaceDataColliderComponent.cpp @@ -184,7 +184,7 @@ namespace SurfaceData bool SurfaceDataColliderComponent::DoRayTrace(const AZ::Vector3& inPosition, bool queryPointOnly, AZ::Vector3& outPosition, AZ::Vector3& outNormal) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); @@ -249,7 +249,7 @@ namespace SurfaceData void SurfaceDataColliderComponent::ModifySurfacePoints(SurfacePointList& surfacePointList) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); @@ -303,7 +303,7 @@ namespace SurfaceData void SurfaceDataColliderComponent::UpdateColliderData() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool colliderValidBeforeUpdate = false; bool colliderValidAfterUpdate = false; diff --git a/Gems/SurfaceData/Code/Source/Components/SurfaceDataShapeComponent.cpp b/Gems/SurfaceData/Code/Source/Components/SurfaceDataShapeComponent.cpp index 6129094115..890f8fba54 100644 --- a/Gems/SurfaceData/Code/Source/Components/SurfaceDataShapeComponent.cpp +++ b/Gems/SurfaceData/Code/Source/Components/SurfaceDataShapeComponent.cpp @@ -143,7 +143,7 @@ namespace SurfaceData void SurfaceDataShapeComponent::GetSurfacePoints(const AZ::Vector3& inPosition, SurfacePointList& surfacePointList) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); @@ -168,7 +168,7 @@ namespace SurfaceData void SurfaceDataShapeComponent::ModifySurfacePoints(SurfacePointList& surfacePointList) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_cacheMutex); @@ -221,7 +221,7 @@ namespace SurfaceData void SurfaceDataShapeComponent::UpdateShapeData() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool shapeValidBeforeUpdate = false; bool shapeValidAfterUpdate = false; diff --git a/Gems/SurfaceData/Code/Source/SurfaceDataSystemComponent.cpp b/Gems/SurfaceData/Code/Source/SurfaceDataSystemComponent.cpp index 356785df35..7638b6720e 100644 --- a/Gems/SurfaceData/Code/Source/SurfaceDataSystemComponent.cpp +++ b/Gems/SurfaceData/Code/Source/SurfaceDataSystemComponent.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -180,7 +181,7 @@ namespace SurfaceData void SurfaceDataSystemComponent::GetSurfacePoints(const AZ::Vector3& inPosition, const SurfaceTagVector& desiredTags, SurfacePointList& surfacePointList) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const bool hasDesiredTags = HasValidTags(desiredTags); const bool hasModifierTags = hasDesiredTags && HasMatchingTags(desiredTags, m_registeredModifierTags); @@ -228,7 +229,7 @@ namespace SurfaceData void SurfaceDataSystemComponent::GetSurfacePointsFromRegion(const AZ::Aabb& inRegion, const AZ::Vector2 stepSize, const SurfaceTagVector& desiredTags, SurfacePointListPerPosition& surfacePointListPerPosition) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard registrationLock(m_registrationMutex); @@ -317,7 +318,7 @@ namespace SurfaceData void SurfaceDataSystemComponent::CombineSortAndFilterNeighboringPoints(SurfacePointList& sourcePointList, bool hasDesiredTags, const SurfaceTagVector& desiredTags) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (sourcePointList.empty()) { diff --git a/Gems/SurfaceData/Code/Source/SurfaceDataUtility.cpp b/Gems/SurfaceData/Code/Source/SurfaceDataUtility.cpp index d55f79faea..ba21d0a616 100644 --- a/Gems/SurfaceData/Code/Source/SurfaceDataUtility.cpp +++ b/Gems/SurfaceData/Code/Source/SurfaceDataUtility.cpp @@ -17,7 +17,7 @@ namespace SurfaceData const AZ::Vector3& rayStart, const AZ::Vector3& rayEnd, AZ::Vector3& outPosition, AZ::Vector3& outNormal) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const AZ::Vector3 clampedScale = nonUniformScale.GetMax(AZ::Vector3(AZ::MinTransformScale)); diff --git a/Gems/SurfaceData/Code/Source/SurfaceTag.cpp b/Gems/SurfaceData/Code/Source/SurfaceTag.cpp index 70a2669b19..f986509140 100644 --- a/Gems/SurfaceData/Code/Source/SurfaceTag.cpp +++ b/Gems/SurfaceData/Code/Source/SurfaceTag.cpp @@ -88,7 +88,7 @@ namespace SurfaceData AZStd::vector> SurfaceTag::GetRegisteredTags() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); SurfaceTagNameSet labels; SurfaceDataTagProviderRequestBus::Broadcast(&SurfaceDataTagProviderRequestBus::Events::GetRegisteredSurfaceTagNames, labels); @@ -134,7 +134,7 @@ namespace SurfaceData AZStd::vector> SurfaceTag::BuildSelectableTagList() const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::vector> selectableTags = GetRegisteredTags(); @@ -152,7 +152,7 @@ namespace SurfaceData AZStd::string SurfaceTag::GetDisplayName() const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::string name; FindDisplayName(GetRegisteredTags(), name); diff --git a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp index 7ce1a2c0a3..4ffed260de 100644 --- a/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/AreaSystemComponent.cpp @@ -617,7 +617,7 @@ namespace Vegetation void AreaSystemComponent::EnumerateInstancesInOverlappingSectors(const AZ::Aabb& bounds, AreaSystemEnumerateCallback callback) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (!bounds.IsValid()) { @@ -644,7 +644,7 @@ namespace Vegetation void AreaSystemComponent::EnumerateInstancesInAabb(const AZ::Aabb& bounds, AreaSystemEnumerateCallback callback) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (!bounds.IsValid()) { @@ -723,7 +723,7 @@ namespace Vegetation void AreaSystemComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (m_configuration.m_sectorSizeInMeters < 0) { @@ -792,7 +792,7 @@ namespace Vegetation m_threadData.m_vegetationThreadState = PersistentThreadData::VegetationThreadState::Running; auto job = AZ::CreateJobFunction([this]() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Entity, "Vegetation::AreaSystemComponent::VegetationThread"); + AZ_PROFILE_SCOPE(Entity, "Vegetation::AreaSystemComponent::VegetationThread"); UpdateContext context; context.Run(&m_threadData, &m_vegTasks, &m_cachedMainThreadData); @@ -830,7 +830,7 @@ namespace Vegetation bool AreaSystemComponent::CalculateViewRect() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //Get the active camera. bool cameraPositionIsValid = false; @@ -983,7 +983,7 @@ namespace Vegetation void AreaSystemComponent::OnSystemEvent(ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); switch (event) { @@ -1016,7 +1016,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::ProcessVegetationThreadTasks(UpdateContext* context, PersistentThreadData* threadData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); VegetationThreadTasks::VegetationThreadTaskList tasks; { @@ -1056,7 +1056,7 @@ namespace Vegetation const AreaSystemComponent::SectorInfo* AreaSystemComponent::VegetationThreadTasks::GetSector(const SectorId& sectorId) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_sectorRollingWindowMutex); auto itSector = m_sectorRollingWindow.find(sectorId); @@ -1065,7 +1065,7 @@ namespace Vegetation AreaSystemComponent::SectorInfo* AreaSystemComponent::VegetationThreadTasks::GetSector(const SectorId& sectorId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_sectorRollingWindowMutex); auto itSector = m_sectorRollingWindow.find(sectorId); @@ -1074,7 +1074,7 @@ namespace Vegetation AreaSystemComponent::SectorInfo* AreaSystemComponent::VegetationThreadTasks::CreateSector(const SectorId& sectorId, int sectorDensity, int sectorSizeInMeters, SnapMode sectorPointSnapMode) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); SectorInfo sectorInfo; sectorInfo.m_id = sectorId; @@ -1089,7 +1089,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::UpdateSectorPoints(SectorInfo& sectorInfo, int sectorDensity, int sectorSizeInMeters, SnapMode sectorPointSnapMode) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const float vegStep = sectorSizeInMeters / static_cast(sectorDensity); //build a free list of all points in the sector for areas to consume @@ -1190,7 +1190,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::DeleteSector(const SectorId& sectorId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_sectorRollingWindowMutex); auto itSector = m_sectorRollingWindow.find(sectorId); @@ -1249,7 +1249,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::ReleaseUnregisteredClaims(SectorInfo& sectorInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (!m_unregisteredVegetationAreaSet.empty()) { @@ -1275,7 +1275,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::ReleaseUnusedClaims(SectorInfo& sectorInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::unordered_map> claimsToRelease; @@ -1310,7 +1310,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::FillSector(SectorInfo& sectorInfo, const VegetationAreaVector& activeAreas) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); VEG_PROFILE_METHOD(DebugNotificationBus::TryQueueBroadcast(&DebugNotificationBus::Events::FillSectorStart, sectorInfo.GetSectorX(), sectorInfo.GetSectorY(), AZStd::chrono::system_clock::now())); ReleaseUnregisteredClaims(sectorInfo); @@ -1352,7 +1352,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::EmptySector(SectorInfo& sectorInfo) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::unordered_map> claimsToRelease; @@ -1384,7 +1384,7 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::ClearSectors() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_sectorRollingWindowMutex); for (auto& sectorPair : m_sectorRollingWindow) @@ -1399,13 +1399,13 @@ namespace Vegetation void AreaSystemComponent::VegetationThreadTasks::CreateClaim(SectorInfo& sectorInfo, const ClaimHandle handle, const InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); sectorInfo.m_claimedWorldPoints[handle] = instanceData; } ClaimHandle AreaSystemComponent::VegetationThreadTasks::CreateClaimHandle(const SectorInfo& sectorInfo, uint32_t index) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); ClaimHandle handle = 0; AreaSystemUtil::hash_combine_64(handle, sectorInfo.m_id.first); @@ -1456,7 +1456,7 @@ namespace Vegetation void AreaSystemComponent::UpdateContext::Run(PersistentThreadData* threadData, VegetationThreadTasks* vegTasks, CachedMainThreadData* cachedMainThreadData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); // Ensure that the main thread doesn't activate or deactivate the component until after this thread finishes. // Note that this does *not* prevent the main thread from running OnTick, which can communicate data changes @@ -1466,7 +1466,7 @@ namespace Vegetation bool keepProcessing = true; while (keepProcessing && (threadData->m_vegetationThreadState != PersistentThreadData::VegetationThreadState::InterruptRequested)) { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Entity, "Vegetation::AreaSystemComponent::UpdateContext::Run-InnerLoop"); + AZ_PROFILE_SCOPE(Entity, "Vegetation::AreaSystemComponent::UpdateContext::Run-InnerLoop"); // Update thread state if its dirty PersistentThreadData::VegetationDataSyncState expected = PersistentThreadData::VegetationDataSyncState::Dirty; if (threadData->m_vegetationDataSyncState.compare_exchange_strong(expected, PersistentThreadData::VegetationDataSyncState::Updating)) @@ -1501,7 +1501,7 @@ namespace Vegetation void AreaSystemComponent::UpdateContext::UpdateActiveVegetationAreas(PersistentThreadData* threadData, const ViewRect& viewRect) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //build a priority sorted list of all active areas if (threadData->m_activeAreasDirty) @@ -1553,7 +1553,7 @@ namespace Vegetation bool AreaSystemComponent::UpdateContext::UpdateSectorWorkLists(PersistentThreadData* threadData, VegetationThreadTasks* vegTasks) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); auto& worldToSector = m_cachedMainThreadData.m_worldToSector; auto& currViewRect = m_cachedMainThreadData.m_currViewRect; @@ -1761,7 +1761,7 @@ namespace Vegetation bool AreaSystemComponent::UpdateContext::UpdateOneSector(PersistentThreadData* threadData, VegetationThreadTasks* vegTasks) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); // This chooses work in the following order: // 1) Delete if we have more sectors than the total that should be in the view rectangle diff --git a/Gems/Vegetation/Code/Source/Components/AreaBlenderComponent.cpp b/Gems/Vegetation/Code/Source/Components/AreaBlenderComponent.cpp index d31a6be69d..8bf48de58e 100644 --- a/Gems/Vegetation/Code/Source/Components/AreaBlenderComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/AreaBlenderComponent.cpp @@ -220,7 +220,7 @@ namespace Vegetation bool AreaBlenderComponent::PrepareToClaim(EntityIdStack& stackIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool result = true; @@ -257,7 +257,7 @@ namespace Vegetation void AreaBlenderComponent::ClaimPositions(EntityIdStack& stackIds, ClaimContext& context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (context.m_availablePoints.empty()) { @@ -293,7 +293,7 @@ namespace Vegetation void AreaBlenderComponent::UnclaimPosition(const ClaimHandle handle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ_WarningOnce("Vegetation", !m_isRequestInProgress, "Detected cyclic dependences with vegetation entity references"); if (!m_isRequestInProgress) @@ -311,7 +311,7 @@ namespace Vegetation AZ::Aabb AreaBlenderComponent::GetEncompassingAabb() const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::Aabb bounds = AZ::Aabb::CreateNull(); @@ -340,7 +340,7 @@ namespace Vegetation AZ::u32 AreaBlenderComponent::GetProductCount() const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::u32 count = 0; diff --git a/Gems/Vegetation/Code/Source/Components/AreaComponentBase.cpp b/Gems/Vegetation/Code/Source/Components/AreaComponentBase.cpp index 6e87154e5b..6a9060c6d4 100644 --- a/Gems/Vegetation/Code/Source/Components/AreaComponentBase.cpp +++ b/Gems/Vegetation/Code/Source/Components/AreaComponentBase.cpp @@ -279,13 +279,13 @@ namespace Vegetation void AreaComponentBase::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& /*world*/) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); OnCompositionChanged(); } void AreaComponentBase::OnShapeChanged([[maybe_unused]] ShapeComponentNotifications::ShapeChangeReasons reasons) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); OnCompositionChanged(); } } diff --git a/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp b/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp index d980f7e45a..e26f1aee47 100644 --- a/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp @@ -185,7 +185,7 @@ namespace Vegetation bool BlockerComponent::ClaimPosition(EntityIdStack& processedIds, const ClaimPoint& point, InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); #if VEG_BLOCKER_ENABLE_CACHING { @@ -245,7 +245,7 @@ namespace Vegetation void BlockerComponent::ClaimPositions(EntityIdStack& stackIds, ClaimContext& context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //adding entity id to the stack of entity ids affecting vegetation EntityIdStack emptyIds; @@ -285,7 +285,7 @@ namespace Vegetation AZ::Aabb BlockerComponent::GetEncompassingAabb() const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::Aabb bounds = AZ::Aabb::CreateNull(); LmbrCentral::ShapeComponentRequestsBus::EventResult(bounds, GetEntityId(), &LmbrCentral::ShapeComponentRequestsBus::Events::GetEncompassingAabb); diff --git a/Gems/Vegetation/Code/Source/Components/DescriptorListCombinerComponent.cpp b/Gems/Vegetation/Code/Source/Components/DescriptorListCombinerComponent.cpp index bcb42fb2e3..abdec31b98 100644 --- a/Gems/Vegetation/Code/Source/Components/DescriptorListCombinerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/DescriptorListCombinerComponent.cpp @@ -187,7 +187,7 @@ namespace Vegetation void DescriptorListCombinerComponent::GetDescriptors(DescriptorPtrVec& descriptors) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); for (const auto& entityId : m_configuration.m_descriptorProviders) { @@ -200,7 +200,7 @@ namespace Vegetation void DescriptorListCombinerComponent::GetInclusionSurfaceTags(SurfaceData::SurfaceTagVector& tags, bool& includeAll) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); for (const auto& entityId : m_configuration.m_descriptorProviders) { @@ -213,7 +213,7 @@ namespace Vegetation void DescriptorListCombinerComponent::GetExclusionSurfaceTags(SurfaceData::SurfaceTagVector& tags) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); for (const auto& entityId : m_configuration.m_descriptorProviders) { diff --git a/Gems/Vegetation/Code/Source/Components/DescriptorWeightSelectorComponent.cpp b/Gems/Vegetation/Code/Source/Components/DescriptorWeightSelectorComponent.cpp index 5e4781302d..093de396dd 100644 --- a/Gems/Vegetation/Code/Source/Components/DescriptorWeightSelectorComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/DescriptorWeightSelectorComponent.cpp @@ -144,7 +144,7 @@ namespace Vegetation void DescriptorWeightSelectorComponent::SelectDescriptors(const DescriptorSelectorParams& params, DescriptorPtrVec& descriptors) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); switch (m_configuration.m_sortBehavior) { diff --git a/Gems/Vegetation/Code/Source/Components/DistanceBetweenFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/DistanceBetweenFilterComponent.cpp index 489862a797..e6d5701f64 100644 --- a/Gems/Vegetation/Code/Source/Components/DistanceBetweenFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/DistanceBetweenFilterComponent.cpp @@ -187,7 +187,7 @@ namespace Vegetation bool DistanceBetweenFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool intersects = false; diff --git a/Gems/Vegetation/Code/Source/Components/DistributionFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/DistributionFilterComponent.cpp index 18a83347d4..2505b243ad 100644 --- a/Gems/Vegetation/Code/Source/Components/DistributionFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/DistributionFilterComponent.cpp @@ -188,7 +188,7 @@ namespace Vegetation bool DistributionFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const GradientSignal::GradientSampleParams sampleParams(instanceData.m_position); const float noise = m_configuration.m_gradientSampler.GetValue(sampleParams); diff --git a/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp b/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp index 58f23bff72..52461e691c 100644 --- a/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp @@ -197,7 +197,7 @@ namespace Vegetation bool MeshBlockerComponent::PrepareToClaim([[maybe_unused]] EntityIdStack& stackIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard cacheLock(m_cacheMutex); @@ -217,7 +217,7 @@ namespace Vegetation bool MeshBlockerComponent::ClaimPosition(EntityIdStack& processedIds, const ClaimPoint& point, InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard cacheLock(m_cacheMutex); @@ -283,7 +283,7 @@ namespace Vegetation void MeshBlockerComponent::ClaimPositions(EntityIdStack& stackIds, ClaimContext& context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //adding entity id to the stack of entity ids affecting vegetation EntityIdStack emptyIds; @@ -371,7 +371,7 @@ namespace Vegetation void MeshBlockerComponent::UpdateMeshData() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard cacheLock(m_cacheMutex); diff --git a/Gems/Vegetation/Code/Source/Components/PositionModifierComponent.cpp b/Gems/Vegetation/Code/Source/Components/PositionModifierComponent.cpp index 4d3b4f9867..17457786f2 100644 --- a/Gems/Vegetation/Code/Source/Components/PositionModifierComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/PositionModifierComponent.cpp @@ -281,7 +281,7 @@ namespace Vegetation void PositionModifierComponent::Execute(InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const GradientSignal::GradientSampleParams sampleParams(instanceData.m_position); float factorX = m_configuration.m_gradientSamplerX.GetValue(sampleParams); diff --git a/Gems/Vegetation/Code/Source/Components/RotationModifierComponent.cpp b/Gems/Vegetation/Code/Source/Components/RotationModifierComponent.cpp index df52222edb..1c13c08c2f 100644 --- a/Gems/Vegetation/Code/Source/Components/RotationModifierComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/RotationModifierComponent.cpp @@ -239,7 +239,7 @@ namespace Vegetation void RotationModifierComponent::Execute(InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const GradientSignal::GradientSampleParams sampleParams(instanceData.m_position); float factorX = m_configuration.m_gradientSamplerX.GetValue(sampleParams); diff --git a/Gems/Vegetation/Code/Source/Components/ScaleModifierComponent.cpp b/Gems/Vegetation/Code/Source/Components/ScaleModifierComponent.cpp index 74d11d6f6c..8c8099599d 100644 --- a/Gems/Vegetation/Code/Source/Components/ScaleModifierComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/ScaleModifierComponent.cpp @@ -162,7 +162,7 @@ namespace Vegetation void ScaleModifierComponent::Execute(InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const GradientSignal::GradientSampleParams sampleParams(instanceData.m_position); float factor = m_configuration.m_gradientSampler.GetValue(sampleParams); diff --git a/Gems/Vegetation/Code/Source/Components/ShapeIntersectionFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/ShapeIntersectionFilterComponent.cpp index 27dabfd76e..968d711e04 100644 --- a/Gems/Vegetation/Code/Source/Components/ShapeIntersectionFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/ShapeIntersectionFilterComponent.cpp @@ -147,7 +147,7 @@ namespace Vegetation bool ShapeIntersectionFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool inside = false; LmbrCentral::ShapeComponentRequestsBus::EventResult(inside, m_configuration.m_shapeEntityId, &LmbrCentral::ShapeComponentRequestsBus::Events::IsPointInside, instanceData.m_position); diff --git a/Gems/Vegetation/Code/Source/Components/SlopeAlignmentModifierComponent.cpp b/Gems/Vegetation/Code/Source/Components/SlopeAlignmentModifierComponent.cpp index 75a468b751..5e8e784bc6 100644 --- a/Gems/Vegetation/Code/Source/Components/SlopeAlignmentModifierComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SlopeAlignmentModifierComponent.cpp @@ -159,7 +159,7 @@ namespace Vegetation void SlopeAlignmentModifierComponent::Execute(InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const bool useOverrides = m_configuration.m_allowOverrides && instanceData.m_descriptorPtr && instanceData.m_descriptorPtr->m_surfaceAlignmentOverrideEnabled; const float min = useOverrides ? instanceData.m_descriptorPtr->m_surfaceAlignmentMin : m_configuration.m_rangeMin; diff --git a/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp b/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp index b373edf051..404e425489 100644 --- a/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SpawnerComponent.cpp @@ -206,7 +206,7 @@ namespace Vegetation bool SpawnerComponent::PrepareToClaim(EntityIdStack& stackIds) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //adding entity id to the stack of entity ids affecting vegetation EntityIdStack emptyIds; @@ -259,7 +259,7 @@ namespace Vegetation bool SpawnerComponent::CreateInstance([[maybe_unused]] const ClaimPoint &point, InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); instanceData.m_instanceId = InvalidInstanceId; if (instanceData.m_descriptorPtr && instanceData.m_descriptorPtr->IsSpawnable()) @@ -279,7 +279,7 @@ namespace Vegetation bool SpawnerComponent::EvaluateFilters(EntityIdStack& processedIds, InstanceData& instanceData, const FilterStage intendedStage) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); bool accepted = true; for (const auto& id : processedIds) @@ -302,7 +302,7 @@ namespace Vegetation bool SpawnerComponent::ProcessInstance(EntityIdStack& processedIds, const ClaimPoint& point, InstanceData& instanceData, DescriptorPtr descriptorPtr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (!descriptorPtr) { @@ -353,7 +353,7 @@ namespace Vegetation bool SpawnerComponent::ClaimPosition(EntityIdStack& processedIds, const ClaimPoint& point, InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); #if VEG_SPAWNER_ENABLE_CACHING { @@ -413,7 +413,7 @@ namespace Vegetation void SpawnerComponent::ClaimPositions(EntityIdStack& stackIds, ClaimContext& context) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //reject entire spawner if there are inclusion tags to consider that don't exist in the context if (SurfaceData::HasValidTags(context.m_masks) && @@ -497,7 +497,7 @@ namespace Vegetation void SpawnerComponent::UnclaimPosition(const ClaimHandle handle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); InstanceId instanceId = InvalidInstanceId; { @@ -518,7 +518,7 @@ namespace Vegetation AZ::Aabb SpawnerComponent::GetEncompassingAabb() const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZ::Aabb bounds = AZ::Aabb::CreateNull(); LmbrCentral::ShapeComponentRequestsBus::EventResult(bounds, GetEntityId(), &LmbrCentral::ShapeComponentRequestsBus::Events::GetEncompassingAabb); @@ -533,7 +533,7 @@ namespace Vegetation void SpawnerComponent::OnCompositionChanged() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AreaComponentBase::OnCompositionChanged(); #if VEG_SPAWNER_ENABLE_CACHING @@ -546,7 +546,7 @@ namespace Vegetation void SpawnerComponent::DestroyAllInstances() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); ClaimInstanceMapping claimInstanceMapping; { diff --git a/Gems/Vegetation/Code/Source/Components/SurfaceAltitudeFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/SurfaceAltitudeFilterComponent.cpp index e2a1404bf1..1f1dfd7a54 100644 --- a/Gems/Vegetation/Code/Source/Components/SurfaceAltitudeFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SurfaceAltitudeFilterComponent.cpp @@ -175,7 +175,7 @@ namespace Vegetation bool SurfaceAltitudeFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const bool useOverrides = m_configuration.m_allowOverrides && instanceData.m_descriptorPtr && instanceData.m_descriptorPtr->m_altitudeFilterOverrideEnabled; const float min = useOverrides ? instanceData.m_descriptorPtr->m_altitudeFilterMin : m_configuration.m_altitudeMin; diff --git a/Gems/Vegetation/Code/Source/Components/SurfaceMaskDepthFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/SurfaceMaskDepthFilterComponent.cpp index f4bd07e816..b4e65beb3f 100644 --- a/Gems/Vegetation/Code/Source/Components/SurfaceMaskDepthFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SurfaceMaskDepthFilterComponent.cpp @@ -203,7 +203,7 @@ namespace Vegetation bool SurfaceMaskDepthFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const bool useOverrides = m_configuration.m_allowOverrides && instanceData.m_descriptorPtr && !instanceData.m_descriptorPtr->m_surfaceTagDistance.m_tags.empty(); const SurfaceData::SurfaceTagVector& surfaceTagsToCompare = useOverrides ? instanceData.m_descriptorPtr->m_surfaceTagDistance.m_tags : m_configuration.m_depthComparisonTags; diff --git a/Gems/Vegetation/Code/Source/Components/SurfaceMaskFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/SurfaceMaskFilterComponent.cpp index 8dd9821cb1..9be6764460 100644 --- a/Gems/Vegetation/Code/Source/Components/SurfaceMaskFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SurfaceMaskFilterComponent.cpp @@ -268,7 +268,7 @@ namespace Vegetation bool SurfaceMaskFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //determine if tags provided by the component should be considered bool useCompTags = !m_configuration.m_allowOverrides || (instanceData.m_descriptorPtr && instanceData.m_descriptorPtr->m_surfaceFilterOverrideMode != OverrideMode::Replace); diff --git a/Gems/Vegetation/Code/Source/Components/SurfaceSlopeFilterComponent.cpp b/Gems/Vegetation/Code/Source/Components/SurfaceSlopeFilterComponent.cpp index b99c2b7c81..fb0673bdf2 100644 --- a/Gems/Vegetation/Code/Source/Components/SurfaceSlopeFilterComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/SurfaceSlopeFilterComponent.cpp @@ -162,7 +162,7 @@ namespace Vegetation bool SurfaceSlopeFilterComponent::Evaluate(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); const bool useOverrides = m_configuration.m_allowOverrides && instanceData.m_descriptorPtr && instanceData.m_descriptorPtr->m_slopeFilterOverrideEnabled; const float min = useOverrides ? instanceData.m_descriptorPtr->m_slopeFilterMin : m_configuration.m_slopeMin; diff --git a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp index 74fb2696ea..d4185fde6c 100644 --- a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp @@ -169,7 +169,7 @@ namespace Vegetation DescriptorPtr InstanceSystemComponent::RegisterUniqueDescriptor(const Descriptor& descriptor) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_uniqueDescriptorsMutex); @@ -217,7 +217,7 @@ namespace Vegetation void InstanceSystemComponent::ReleaseUniqueDescriptor(DescriptorPtr descriptorPtr) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard lock(m_uniqueDescriptorsMutex); @@ -267,7 +267,7 @@ namespace Vegetation void InstanceSystemComponent::CreateInstance(InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (!IsDescriptorValid(instanceData.m_descriptorPtr)) { @@ -299,7 +299,7 @@ namespace Vegetation void InstanceSystemComponent::DestroyInstance(InstanceId instanceId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (instanceId == InvalidInstanceId) { @@ -439,7 +439,7 @@ namespace Vegetation bool InstanceSystemComponent::IsInstanceSkippable(const InstanceData& instanceData) const { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); //if the instance was queued for deletion before its creation task executed then skip it AZStd::lock_guard instanceDeletionSet(m_instanceDeletionSetMutex); @@ -448,7 +448,7 @@ namespace Vegetation void InstanceSystemComponent::CreateInstanceNode(const InstanceData& instanceData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); if (IsInstanceSkippable(instanceData)) { @@ -489,7 +489,7 @@ namespace Vegetation void InstanceSystemComponent::ReleaseInstanceNode(InstanceId instanceId) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); DescriptorPtr descriptor = nullptr; InstancePtr opaqueInstanceData = nullptr; @@ -521,7 +521,7 @@ namespace Vegetation void InstanceSystemComponent::AddTask(const Task& task) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard mainThreadTaskLock(m_mainThreadTaskMutex); if (m_mainThreadTaskQueue.empty() || m_mainThreadTaskQueue.back().size() >= m_configuration.m_maxInstanceTaskBatchSize) @@ -534,7 +534,7 @@ namespace Vegetation void InstanceSystemComponent::ClearTasks() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard mainThreadTaskInProgressLock(m_mainThreadTaskInProgressMutex); AZStd::lock_guard mainThreadTaskLock(m_mainThreadTaskMutex); @@ -546,7 +546,7 @@ namespace Vegetation bool InstanceSystemComponent::GetTasks(TaskList& removedTasks) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard mainThreadTaskLock(m_mainThreadTaskMutex); if (!m_mainThreadTaskQueue.empty()) @@ -559,7 +559,7 @@ namespace Vegetation void InstanceSystemComponent::ExecuteTasks() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); AZStd::lock_guard scopedLock(m_mainThreadTaskInProgressMutex); @@ -588,7 +588,7 @@ namespace Vegetation void InstanceSystemComponent::ProcessMainThreadTasks() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Entity); + AZ_PROFILE_FUNCTION(Entity); ExecuteTasks(); } diff --git a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp index 3bcd2dbd94..5ed409cd0d 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -253,7 +253,7 @@ namespace OpenMesh::IO // return binary size of the value static size_t size_of(const value_type& _v) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (_v.empty()) { @@ -274,7 +274,7 @@ namespace OpenMesh::IO static size_t store(std::ostream& _os, const value_type& _v, bool _swap = false) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); size_t bytes = 0; const auto count = static_cast(_v.size()); @@ -291,7 +291,7 @@ namespace OpenMesh::IO static size_t restore(std::istream& _is, value_type& _v, bool _swap = false) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); size_t bytes = 0; uint32_t count = 0; @@ -325,7 +325,7 @@ namespace OpenMesh::IO // return binary size of the value static size_t size_of(const value_type& _v) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (_v.empty()) { @@ -347,7 +347,7 @@ namespace OpenMesh::IO static size_t store(std::ostream& _os, const value_type& _v, bool _swap = false) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); size_t bytes = 0; const auto count = static_cast(_v.size()); @@ -365,7 +365,7 @@ namespace OpenMesh::IO static size_t restore(std::istream& _is, value_type& _v, bool _swap = false) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); size_t bytes = 0; uint32_t count = 0; @@ -483,7 +483,7 @@ namespace WhiteBox FaceHandlesInternal InternalFaceHandlesFromPolygon(const Api::PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); FaceHandlesInternal faceHandlesInternal; faceHandlesInternal.reserve(polygonHandle.m_faceHandles.size()); @@ -586,7 +586,7 @@ namespace WhiteBox VertexHandles MeshVertexHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); VertexHandles vertexHandles; vertexHandles.reserve(whiteBox.mesh.n_vertices()); @@ -600,7 +600,7 @@ namespace WhiteBox FaceHandles MeshFaceHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); FaceHandles faceHandles; faceHandles.reserve(whiteBox.mesh.n_faces()); @@ -614,7 +614,7 @@ namespace WhiteBox PolygonHandles MeshPolygonHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); PolygonPropertyHandle polygonPropsHandle; whiteBox.mesh.get_property_handle(polygonPropsHandle, PolygonProps); @@ -637,7 +637,7 @@ namespace WhiteBox EdgeHandlesCollection PolygonBorderEdgeHandles(const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const HalfedgeHandlesCollection halfedgeHandlesCollection = PolygonBorderHalfedgeHandles(whiteBox, polygonHandle); @@ -663,7 +663,7 @@ namespace WhiteBox EdgeHandles PolygonBorderEdgeHandlesFlattened(const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const EdgeHandlesCollection borderEdgeHandlesCollection = PolygonBorderEdgeHandles(whiteBox, polygonHandle); @@ -679,7 +679,7 @@ namespace WhiteBox EdgeHandles MeshPolygonEdgeHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto polygonHandles = MeshPolygonHandles(whiteBox); @@ -698,7 +698,7 @@ namespace WhiteBox EdgeHandles MeshEdgeHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EdgeHandles edgeHandles; edgeHandles.reserve(whiteBox.mesh.n_edges()); @@ -712,7 +712,7 @@ namespace WhiteBox EdgeTypes MeshUserEdgeHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EdgeHandles userEdgeHandles = MeshPolygonEdgeHandles(whiteBox); AZStd::sort(userEdgeHandles.begin(), userEdgeHandles.end()); @@ -732,7 +732,7 @@ namespace WhiteBox AZStd::vector MeshVertexPositions(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return VertexPositions(whiteBox, MeshVertexHandles(whiteBox)); } @@ -794,7 +794,7 @@ namespace WhiteBox AZStd::vector FacesPositions(const WhiteBoxMesh& whiteBox, const FaceHandles& faceHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::vector triangles; triangles.reserve(faceHandles.size() * 3); @@ -866,7 +866,7 @@ namespace WhiteBox HalfedgeHandles VertexHalfedgeHandles(const WhiteBoxMesh& whiteBox, const VertexHandle vertexHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); HalfedgeHandles outgoingHandles = VertexOutgoingHalfedgeHandles(whiteBox, vertexHandle); HalfedgeHandles incomingHandles = VertexIncomingHalfedgeHandles(whiteBox, vertexHandle); @@ -881,7 +881,7 @@ namespace WhiteBox EdgeHandles VertexEdgeHandles(const WhiteBoxMesh& whiteBox, const VertexHandle vertexHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto omVertexHandle = om_vh(vertexHandle); @@ -898,7 +898,7 @@ namespace WhiteBox const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle, FaceHandles& faceHandles, const AZ::Vector3& normal) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto* const found_fh = AZStd::find(faceHandles.cbegin(), faceHandles.cend(), faceHandle); @@ -917,7 +917,7 @@ namespace WhiteBox static FaceHandle OppositeFaceHandle(const WhiteBoxMesh& whiteBox, const HalfedgeHandle halfedgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const HalfedgeHandle oppositeHalfedgeHandle = HalfedgeOppositeHalfedgeHandle(whiteBox, halfedgeHandle); @@ -936,7 +936,7 @@ namespace WhiteBox const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle, FaceHandles& faceHandles, const AZ::Vector3& normal) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (BuildFaceHandles(whiteBox, faceHandle, faceHandles, normal)) { @@ -957,7 +957,7 @@ namespace WhiteBox FaceHandles SideFaceHandles(const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); FaceHandles faceHandles; SideFaceHandlesInternal( @@ -969,7 +969,7 @@ namespace WhiteBox static HalfedgeHandlesCollection BorderHalfedgeHandles( const WhiteBoxMesh& whiteBox, const FaceHandles& faceHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // build all possible halfedge handles HalfedgeHandles halfedgeHandles; @@ -1069,7 +1069,7 @@ namespace WhiteBox HalfedgeHandlesCollection SideBorderHalfedgeHandles(const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // find all face handles for a side return BorderHalfedgeHandles(whiteBox, SideFaceHandles(whiteBox, faceHandle)); @@ -1078,7 +1078,7 @@ namespace WhiteBox static VertexHandlesCollection BorderVertexHandles( const WhiteBoxMesh& whiteBox, const HalfedgeHandlesCollection& halfedgeHandlesCollection) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); VertexHandlesCollection orderedVertexHandlesCollection; orderedVertexHandlesCollection.reserve(halfedgeHandlesCollection.size()); @@ -1101,14 +1101,14 @@ namespace WhiteBox VertexHandlesCollection SideBorderVertexHandles(const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return BorderVertexHandles(whiteBox, SideBorderHalfedgeHandles(whiteBox, faceHandle)); } static VertexHandles FacesVertexHandles(const WhiteBoxMesh& whiteBox, const FaceHandles& faceHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); VertexHandles vertexHandles; for (const FaceHandle faceHandle : faceHandles) @@ -1132,7 +1132,7 @@ namespace WhiteBox VertexHandles SideVertexHandles(const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return FacesVertexHandles(whiteBox, SideFaceHandles(whiteBox, faceHandle)); } @@ -1252,7 +1252,7 @@ namespace WhiteBox static bool EdgeIsUser( const WhiteBoxMesh& whiteBox, const HalfedgeHandle halfedgeHandle, const EdgeHandle edgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto polygonEdgeHandles = PolygonBorderEdgeHandlesFlattened( whiteBox, FacePolygonHandle(whiteBox, HalfedgeFaceHandle(whiteBox, halfedgeHandle))); @@ -1276,7 +1276,7 @@ namespace WhiteBox EdgeHandles EdgeGrouping(const WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // a non-user ('mesh') edge is never part of a grouping so if one is passed // in ensure we return an empty group @@ -1349,7 +1349,7 @@ namespace WhiteBox bool EdgeIsHidden(const WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const EdgeHandles userEdgeHandles = MeshPolygonEdgeHandles(whiteBox); return AZStd::find(userEdgeHandles.cbegin(), userEdgeHandles.cend(), edgeHandle) == userEdgeHandles.cend(); @@ -1357,7 +1357,7 @@ namespace WhiteBox AZStd::vector EdgeFaceHandles(const WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto openMeshEdgeHandle = om_eh(edgeHandle); const auto firstHalfedgeHandle = whiteBox.mesh.halfedge_handle(openMeshEdgeHandle, 0); @@ -1405,7 +1405,7 @@ namespace WhiteBox HalfedgeHandles EdgeHalfedgeHandles(const WhiteBoxMesh& whiteBox, EdgeHandle edgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZStd::array halfedgeHandles = { EdgeHalfedgeHandle(whiteBox, edgeHandle, EdgeHalfedge::First), @@ -1429,7 +1429,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "TranslateEdge eh(%s) %s", ToString(edgeHandle).c_str(), AZ::ToString(displacement).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto vertexHandles = EdgeVertexHandles(whiteBox, edgeHandle); for (const auto& vertexHandle : vertexHandles) @@ -1450,7 +1450,7 @@ namespace WhiteBox static HalfedgeHandle FindBestFitHalfedge( WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle, const AZ::Vector3& displacement) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // get both halfedge handles for the edge (0 and 1 just correspond to each halfedge) const HalfedgeHandle firstHalfedgeHandle = EdgeHalfedgeHandle(whiteBox, edgeHandle, EdgeHalfedge::First); @@ -1495,7 +1495,7 @@ namespace WhiteBox static Internal::EdgeAppendVertexHandles CalculateEdgeAppendVertexHandles( WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle, const AZ::Vector3& displacement) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // based on the displacement find which halfedge is a better fit (which direction did we move in) const HalfedgeHandle halfedgeHandle = FindBestFitHalfedge(whiteBox, edgeHandle, displacement); @@ -1575,7 +1575,7 @@ namespace WhiteBox static Internal::EdgeAppendPolygonHandles AddNewPolygonsForEdgeAppend( WhiteBoxMesh& whiteBox, const Internal::EdgeAppendVertexHandles& edgeAppendVertexHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); Internal::EdgeAppendPolygonHandles edgeAppendPolygonHandles; @@ -1636,7 +1636,7 @@ namespace WhiteBox static EdgeHandle FindSelectedEdgeHandle( const WhiteBoxMesh& whiteBox, const PolygonHandle& nearPolygonHandle, const PolygonHandle& farPolygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // actually find the new edge we created const EdgeHandles nearEdgeHandles = PolygonBorderEdgeHandlesFlattened(whiteBox, nearPolygonHandle); @@ -1670,7 +1670,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "TranslateEdgeAppend eh(%s) %s", ToString(edgeHandle).c_str(), AZ::ToString(displacement).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // the new and existing handles required for an edge append const Internal::EdgeAppendVertexHandles edgeAppendVertexHandles = @@ -1698,7 +1698,7 @@ namespace WhiteBox AZ::Vector3 PolygonNormal(const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return AZStd::accumulate( polygonHandle.m_faceHandles.cbegin(), polygonHandle.m_faceHandles.cend(), @@ -1712,7 +1712,7 @@ namespace WhiteBox PolygonHandle FacePolygonHandle(const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); PolygonPropertyHandle polygonPropsHandle; whiteBox.mesh.get_property_handle(polygonPropsHandle, PolygonProps); @@ -1730,7 +1730,7 @@ namespace WhiteBox VertexHandles PolygonVertexHandles(const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return FacesVertexHandles(whiteBox, polygonHandle.m_faceHandles); } @@ -1738,7 +1738,7 @@ namespace WhiteBox VertexHandlesCollection PolygonBorderVertexHandles( const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return BorderVertexHandles(whiteBox, PolygonBorderHalfedgeHandles(whiteBox, polygonHandle)); } @@ -1746,7 +1746,7 @@ namespace WhiteBox VertexHandles PolygonBorderVertexHandlesFlattened( const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const VertexHandlesCollection borderVertexHandlesCollection = BorderVertexHandles(whiteBox, PolygonBorderHalfedgeHandles(whiteBox, polygonHandle)); @@ -1764,7 +1764,7 @@ namespace WhiteBox HalfedgeHandles PolygonBorderHalfedgeHandlesFlattened( const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const HalfedgeHandlesCollection borderHalfedgeHandlesCollection = PolygonBorderHalfedgeHandles(whiteBox, polygonHandle); @@ -1781,7 +1781,7 @@ namespace WhiteBox HalfedgeHandles PolygonHalfedgeHandles(const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return AZStd::accumulate( polygonHandle.m_faceHandles.cbegin(), polygonHandle.m_faceHandles.cend(), HalfedgeHandles{}, @@ -1802,7 +1802,7 @@ namespace WhiteBox AZStd::vector PolygonVertexPositions( const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return VertexPositions(whiteBox, PolygonVertexHandles(whiteBox, polygonHandle)); } @@ -1810,7 +1810,7 @@ namespace WhiteBox VertexPositionsCollection PolygonBorderVertexPositions( const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto polygonBorderVertexHandlesCollection = PolygonBorderVertexHandles(whiteBox, polygonHandle); VertexPositionsCollection polygonBorderVertexPositionsCollection; @@ -1827,7 +1827,7 @@ namespace WhiteBox AZStd::vector PolygonFacesPositions( const WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return FacesPositions(whiteBox, polygonHandle.m_faceHandles); } @@ -1854,7 +1854,7 @@ namespace WhiteBox EdgeHandles VertexUserEdgeHandles(const WhiteBoxMesh& whiteBox, const VertexHandle vertexHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto vertexEdgeHandles = VertexEdgeHandles(whiteBox, vertexHandle); @@ -1874,7 +1874,7 @@ namespace WhiteBox static AZStd::vector VertexUserEdges( const WhiteBoxMesh& whiteBox, const VertexHandle vertexHandle, EdgeFn&& edgeFn) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto vertexEdgeHandles = VertexUserEdgeHandles(whiteBox, vertexHandle); @@ -1931,13 +1931,13 @@ namespace WhiteBox AZ::Vector3 FaceNormal(const WhiteBoxMesh& whiteBox, const FaceHandle faceHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return whiteBox.mesh.normal(om_fh(faceHandle)); } AZ::Vector2 HalfedgeUV(const WhiteBoxMesh& whiteBox, const HalfedgeHandle halfedgeHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return whiteBox.mesh.texcoord2D(om_heh(halfedgeHandle)); } @@ -1964,7 +1964,7 @@ namespace WhiteBox Faces MeshFaces(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); Faces faces; faces.reserve(MeshFaceCount(whiteBox)); @@ -1989,7 +1989,7 @@ namespace WhiteBox void CalculatePlanarUVs(WhiteBoxMesh& whiteBox, const FaceHandles& faceHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto& mesh = whiteBox.mesh; for (const auto faceHandle : faceHandles) @@ -2012,7 +2012,7 @@ namespace WhiteBox void CalculatePlanarUVs(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); CalculatePlanarUVs(whiteBox, MeshFaceHandles(whiteBox)); } @@ -2022,7 +2022,7 @@ namespace WhiteBox const HalfedgeHandle oppositeHalfedgeHandle, const HalfedgeHandles& borderHalfedgeHandles, const EdgeHandles& buildingEdgeHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // the polygon handle to build PolygonHandle polygonHandle; @@ -2119,7 +2119,7 @@ namespace WhiteBox WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle, EdgeHandles& restoringEdgeHandles) { WHITEBOX_LOG("White Box", "RestoreEdge eh(%s)", ToString(edgeHandle).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // check we're not selecting an existing user edge if (!EdgeIsHidden(whiteBox, edgeHandle)) @@ -2231,7 +2231,7 @@ namespace WhiteBox PolygonHandle HideEdge(WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle) { WHITEBOX_LOG("White Box", "HideEdge eh(%s)", ToString(edgeHandle).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (MeshHalfedgeCount(whiteBox) == 0) { @@ -2296,7 +2296,7 @@ namespace WhiteBox VertexHandle SplitFace(WhiteBoxMesh& whiteBox, const FaceHandle faceHandle, const AZ::Vector3& position) { WHITEBOX_LOG("White Box", "SplitFace fh(%s)", ToString(faceHandle).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto omFaceHandle = om_fh(faceHandle); const auto omVertexHandle = whiteBox.mesh.split_copy(omFaceHandle, position); @@ -2340,7 +2340,7 @@ namespace WhiteBox VertexHandle SplitEdge(WhiteBoxMesh& whiteBox, const EdgeHandle edgeHandle, const AZ::Vector3& position) { WHITEBOX_LOG("White Box", "SplitEdge eh(%s)", ToString(edgeHandle).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const HalfedgeHandle halfedgeHandle = EdgeHalfedgeHandle(whiteBox, edgeHandle, EdgeHalfedge::First); const VertexHandle tailVertexHandle = HalfedgeVertexHandleAtTail(whiteBox, halfedgeHandle); @@ -2441,7 +2441,7 @@ namespace WhiteBox void Clear(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); PolygonPropertyHandle polygonPropsHandle; whiteBox.mesh.get_property_handle(polygonPropsHandle, PolygonProps); @@ -2462,7 +2462,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "AddTriPolygon vh(%s), vh(%s), vh(%s)", ToString(vh0).c_str(), ToString(vh1).c_str(), ToString(vh2).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return AddPolygon(whiteBox, AZStd::vector{{vh0, vh1, vh2}}); } @@ -2474,7 +2474,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "AddQuadPolygon vh(%s), vh(%s), vh(%s), vh(%s)", ToString(vh0).c_str(), ToString(vh1).c_str(), ToString(vh2).c_str(), ToString(vh3).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return AddPolygon(whiteBox, AZStd::vector{{vh0, vh1, vh2}, {vh0, vh2, vh3}}); } @@ -2482,7 +2482,7 @@ namespace WhiteBox PolygonHandle AddPolygon(WhiteBoxMesh& whiteBox, const FaceVertHandlesList& faceVertHandles) { WHITEBOX_LOG("White Box", "AddPolygon [%s]", ToString(faceVertHandles).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); PolygonPropertyHandle polygonPropsHandle; whiteBox.mesh.get_property_handle(polygonPropsHandle, PolygonProps); @@ -2510,7 +2510,7 @@ namespace WhiteBox PolygonHandles InitializeAsUnitCube(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // generate vertices VertexHandle vertexHandles[8]; @@ -2550,7 +2550,7 @@ namespace WhiteBox PolygonHandle InitializeAsUnitQuad(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // generate vertices VertexHandle vertexHandles[4]; @@ -2573,7 +2573,7 @@ namespace WhiteBox PolygonHandle InitializeAsUnitTriangle(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // generate vertices VertexHandle vertexHandles[3]; @@ -2602,7 +2602,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "SetVertexPosition vh(%s) %s", ToString(vertexHandle).c_str(), AZ::ToString(position).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); whiteBox.mesh.set_point(om_vh(vertexHandle), position); } @@ -2613,7 +2613,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "SetVertexPositionAndUpdateUVs vh(%s) %s", ToString(vertexHandle).c_str(), AZ::ToString(position).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); SetVertexPosition(whiteBox, vertexHandle, position); CalculatePlanarUVs(whiteBox); @@ -2622,7 +2622,7 @@ namespace WhiteBox VertexHandle AddVertex(WhiteBoxMesh& whiteBox, const AZ::Vector3& vertex) { WHITEBOX_LOG("White Box", "AddVertex %s", AZ::ToString(vertex).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return wb_vh(whiteBox.mesh.add_vertex(vertex)); } @@ -2632,21 +2632,21 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "AddFace vh(%s), vh(%s), vh(%s)", ToString(v0).c_str(), ToString(v1).c_str(), ToString(v2).c_str()); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return wb_fh(whiteBox.mesh.add_face(om_vh(v0), om_vh(v1), om_vh(v2))); } void CalculateNormals(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); whiteBox.mesh.update_normals(); } void ZeroUVs(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); for (const Mesh::FaceHandle faceHandle : whiteBox.mesh.faces()) { @@ -2692,7 +2692,7 @@ namespace WhiteBox AZ::Vector3 VerticesMidpoint(const WhiteBoxMesh& whiteBox, const VertexHandles& vertexHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AzToolsFramework::MidpointCalculator midpointCalculator; for (const auto vertexHandle : vertexHandles) @@ -2707,7 +2707,7 @@ namespace WhiteBox const WhiteBoxMesh& whiteBox, const Internal::VertexHandlePair vertexHandlePair, const PolygonHandle& selectedPolygonHandle, const PolygonHandle& adjacentPolygonHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto selectedPolygonEdgeHandles = PolygonBorderEdgeHandlesFlattened(whiteBox, selectedPolygonHandle); const auto adjacentPolygonEdgeHandles = PolygonBorderEdgeHandlesFlattened(whiteBox, adjacentPolygonHandle); @@ -2744,7 +2744,7 @@ namespace WhiteBox const PolygonHandle& selectedPolygonHandle, const PolygonHandle& adjacentPolygonHandle, FaceVertHandlesCollection& vertsForLinkingAdjacentPolygons) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // if we found a valid halfedge if (const HalfedgeHandle foundHalfedgeHandle = FindHalfedgeInAdjacentPolygon( @@ -2851,7 +2851,7 @@ namespace WhiteBox FaceVertHandlesCollection& vertsForExistingAdjacentPolygons, FaceVertHandlesCollection& vertsForLinkingAdjacentPolygons) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // adjacent faces for (size_t index = 0; index < borderVertexHandles.size(); ++index) @@ -2912,7 +2912,7 @@ namespace WhiteBox // during garbage_collect void RemoveFaces(WhiteBoxMesh& whiteBox, const FaceHandles& faceHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); whiteBox.mesh.request_face_status(); whiteBox.mesh.request_edge_status(); @@ -3014,7 +3014,7 @@ namespace WhiteBox AZStd::vector BuildNewVertexFaceHandles( WhiteBoxMesh& whiteBox, const Internal::AppendedVerts& appendedVerts, const FaceHandles& existingFaces) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::vector faces; faces.reserve(existingFaces.size()); @@ -3068,7 +3068,7 @@ namespace WhiteBox WhiteBoxMesh& whiteBox, const VertexHandles& existingVertexHandles, const PolygonHandle& polygonHandle, AppendVertFn&& appendFn) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::Vector3 polygonNormal = PolygonNormal(whiteBox, polygonHandle); const auto polygonHalfedgeHandles = PolygonHalfedgeHandles(whiteBox, polygonHandle); @@ -3146,7 +3146,7 @@ namespace WhiteBox static AppendedPolygonHandles Extrude( WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle, AppendVertexFn&& appendFn) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // find border vertex handles for polygon const auto polygonBorderVertexHandlesCollection = PolygonBorderVertexHandles(whiteBox, polygonHandle); @@ -3261,7 +3261,7 @@ namespace WhiteBox WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle, const float distance) { WHITEBOX_LOG("White Box", "TranslatePolygonAppend ph(%s) %f", ToString(polygonHandle).c_str(), distance) - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); return TranslatePolygonAppendAdvanced(whiteBox, polygonHandle, distance).m_appendedPolygonHandle; } @@ -3271,7 +3271,7 @@ namespace WhiteBox { WHITEBOX_LOG( "White Box", "TranslatePolygonAppendAdvanced ph(%s) %f", ToString(polygonHandle).c_str(), distance) - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // check mesh has faces if (whiteBox.mesh.n_faces() == 0) @@ -3288,7 +3288,7 @@ namespace WhiteBox void TranslatePolygon(WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle, const float distance) { WHITEBOX_LOG("White Box", "TranslatePolygon ph(%s) %d", ToString(polygonHandle).c_str(), distance) - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto vertexHandles = PolygonVertexHandles(whiteBox, polygonHandle); const auto vertexPositions = VertexPositions(whiteBox, vertexHandles); @@ -3306,7 +3306,7 @@ namespace WhiteBox WhiteBoxMesh& whiteBox, const PolygonHandle& polygonHandle, const float scale) { WHITEBOX_LOG("White Box", "ScalePolygonAppendRelative ph(%s) %f", ToString(polygonHandle).c_str(), scale); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // check mesh has faces if (whiteBox.mesh.n_faces() == 0) @@ -3329,7 +3329,7 @@ namespace WhiteBox static AZ::Transform BuildSpace(const AZ::Vector3& normal, const AZ::Vector3& pivot) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZ::Vector3 axis1; AZ::Vector3 axis2; @@ -3359,7 +3359,7 @@ namespace WhiteBox WHITEBOX_LOG( "White Box", "ScalePolygonRelative ph(%s) pivot %s scale: %f", ToString(polygonHandle).c_str(), AZ::ToString(pivot).c_str(), scaleDelta); - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const AZ::Transform polygonSpace = PolygonSpace(whiteBox, polygonHandle, pivot); for (const auto vertexHandle : PolygonVertexHandles(whiteBox, polygonHandle)) @@ -3375,7 +3375,7 @@ namespace WhiteBox bool WriteMesh(const WhiteBoxMesh& whiteBox, WhiteBoxMeshStream& output) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); AZStd::lock_guard lg(g_omSerializationLock); @@ -3399,7 +3399,7 @@ namespace WhiteBox ReadResult ReadMesh(WhiteBoxMesh& whiteBox, const WhiteBoxMeshStream& input) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (input.empty()) { @@ -3434,7 +3434,7 @@ namespace WhiteBox WhiteBoxMeshPtr CloneMesh(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); WhiteBoxMeshStream clonedData; if (!WriteMesh(whiteBox, clonedData)) diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp index ad59da63d5..61796bde58 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp @@ -61,7 +61,7 @@ namespace WhiteBox // to be used to generate concrete render mesh static WhiteBoxRenderData CreateWhiteBoxRenderData(const WhiteBoxMesh& whiteBox, const WhiteBoxMaterial& material) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); WhiteBoxRenderData renderData; WhiteBoxFaces& faceData = renderData.m_faces; @@ -407,7 +407,7 @@ namespace WhiteBox void EditorWhiteBoxComponent::RebuildRenderMesh() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // reset caches when the mesh changes m_worldAabb.reset(); @@ -474,7 +474,7 @@ namespace WhiteBox void EditorWhiteBoxComponent::OnTransformChanged( [[maybe_unused]] const AZ::Transform& local, const AZ::Transform& world) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); m_worldAabb.reset(); m_localAabb.reset(); @@ -490,7 +490,7 @@ namespace WhiteBox void EditorWhiteBoxComponent::RebuildPhysicsMesh() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); EditorWhiteBoxColliderRequestBus::Event( GetEntityId(), &EditorWhiteBoxColliderRequests::CreatePhysics, *GetWhiteBoxMesh()); @@ -673,7 +673,7 @@ namespace WhiteBox AZ::Aabb EditorWhiteBoxComponent::GetWorldBounds() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_worldAabb.has_value()) { @@ -686,7 +686,7 @@ namespace WhiteBox AZ::Aabb EditorWhiteBoxComponent::GetLocalBounds() { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_localAabb.has_value()) { @@ -708,7 +708,7 @@ namespace WhiteBox [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src, const AZ::Vector3& dir, float& distance) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (!m_faces.has_value()) { @@ -905,7 +905,7 @@ namespace WhiteBox void EditorWhiteBoxComponent::DisplayEntityViewport( [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (DebugDrawingEnabled()) { diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp index 3d04c87e6a..cd9e8090cd 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp @@ -209,7 +209,7 @@ namespace WhiteBox bool EditorWhiteBoxComponentMode::HandleMouseInteraction( const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); WhiteBoxMesh* whiteBox = nullptr; EditorWhiteBoxComponentRequestBus::EventResult( @@ -301,7 +301,7 @@ namespace WhiteBox void EditorWhiteBoxComponentMode::DisplayEntityViewport( [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const auto modifiers = m_keyboardMofifierQueryFn(); @@ -374,7 +374,7 @@ namespace WhiteBox void EditorWhiteBoxComponentMode::RecalculateWhiteBoxIntersectionData(const EdgeSelectionType edgeSelectionMode) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); WhiteBoxMesh* whiteBox = nullptr; EditorWhiteBoxComponentRequestBus::EventResult( diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp index 239c8a3066..cbde5f4f4b 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp @@ -8,6 +8,7 @@ #include "EditorWhiteBoxComponentModeTypes.h" +#include #include namespace WhiteBox @@ -16,7 +17,7 @@ namespace WhiteBox AzFramework::DebugDisplayRequests& debugDisplay, const AZ::Color& color, const AZStd::vector& edgeBoundsWithHandle, const Api::EdgeHandles& excludedEdgeHandles) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); debugDisplay.SetColor(color); for (const EdgeBoundWithHandle& edge : edgeBoundsWithHandle) diff --git a/Gems/WhiteBox/Code/Source/SubComponentModes/EditorWhiteBoxDefaultMode.cpp b/Gems/WhiteBox/Code/Source/SubComponentModes/EditorWhiteBoxDefaultMode.cpp index 136db8802c..3d6d9a4c0a 100644 --- a/Gems/WhiteBox/Code/Source/SubComponentModes/EditorWhiteBoxDefaultMode.cpp +++ b/Gems/WhiteBox/Code/Source/SubComponentModes/EditorWhiteBoxDefaultMode.cpp @@ -212,7 +212,7 @@ namespace WhiteBox AzFramework::DebugDisplayRequests& debugDisplay, const AZ::Transform& worldFromLocal, const AzFramework::CameraState& cameraState, const IntersectionAndRenderData& renderData) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); const float vertexIndicatorLength = cl_whiteBoxVertexIndicatorLength; const float vertexIndicatorWidth = cl_whiteBoxVertexIndicatorWidth; @@ -252,7 +252,7 @@ namespace WhiteBox const IntersectionAndRenderData& renderData, [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); TryDestroyModifier(m_polygonTranslationModifier); TryDestroyModifier(m_edgeTranslationModifier); @@ -276,7 +276,7 @@ namespace WhiteBox Api::EdgeHandles DefaultMode::FindInteractiveEdgeHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // get all edge handles for hovered polygon const Api::EdgeHandles polygonHoveredEdgeHandles = m_polygonTranslationModifier @@ -322,7 +322,7 @@ namespace WhiteBox const WhiteBoxMesh& whiteBox, const PolygonScaleModifier* polygonScaleModifier, const EdgeScaleModifier* edgeScaleModifier, const Api::VertexHandle vertexHandle) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (Api::VertexIsHidden(whiteBox, vertexHandle)) { @@ -371,7 +371,7 @@ namespace WhiteBox const AZStd::optional& polygonIntersection, const AZStd::optional& vertexIntersection) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); WhiteBoxMesh* whiteBox = nullptr; EditorWhiteBoxComponentRequestBus::EventResult( From a5f072f7a9eaba93ca3830fa580480689ffcd2cb Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Tue, 17 Aug 2021 14:51:29 -0600 Subject: [PATCH 090/100] Remove statistics profiler Signed-off-by: Jeremy Ong --- Code/Framework/AzCore/AzCore/Debug/Profiler.h | 18 +- .../Statistics/RunningStatisticsManager.cpp | 106 --- .../AzCore/Statistics/StatisticalProfiler.h | 255 ------ .../Statistics/StatisticalProfilerProxy.h | 170 ---- ...tatisticalProfilerProxySystemComponent.cpp | 66 -- .../StatisticalProfilerProxySystemComponent.h | 67 -- .../AzCore/Statistics/StatisticsManager.h | 200 ----- .../Statistics/TimeDataStatisticsManager.cpp | 49 - .../Statistics/TimeDataStatisticsManager.h | 51 -- .../AzCore/AzCore/azcore_files.cmake | 3 - Code/Framework/AzCore/Tests/Components.cpp | 4 +- Code/Framework/AzCore/Tests/Math/ObbTests.cpp | 14 +- .../AzCore/Tests/StatisticalProfiler.cpp | 847 ------------------ Code/Framework/AzCore/Tests/Statistics.cpp | 263 ------ .../AzCore/Tests/TimeDataStatistics.cpp | 207 ----- .../AzCore/Tests/azcoretests_files.cmake | 2 - Code/Framework/AzFramework/CMakeLists.txt | 9 - .../GridMate/GridMate/Replica/ReplicaMgr.cpp | 2 +- .../GridMate/GridMate/Replica/ReplicaMgr.h | 2 +- .../Atom/ImageProcessing/ImageProcessingBus.h | 1 - .../DecalTextureArrayFeatureProcessor.cpp | 4 +- .../Atom/RPI/Code/Source/RPI.Public/Scene.cpp | 2 + .../Code/EMotionFX/Source/MotionInstance.h | 3 + .../Code/Tests/MultiplayerCompressionTest.cpp | 2 +- .../Code/Source/System/SystemComponent.cpp | 2 +- .../Code/Editor/Nodes/NodeDisplayUtils.cpp | 20 +- cmake/3rdParty/FindPIX.cmake | 2 +- .../Platform/Windows/pix_windows.cmake | 2 +- 28 files changed, 41 insertions(+), 2332 deletions(-) delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h delete mode 100644 Code/Framework/AzCore/Tests/StatisticalProfiler.cpp delete mode 100644 Code/Framework/AzCore/Tests/Statistics.cpp delete mode 100644 Code/Framework/AzCore/Tests/TimeDataStatistics.cpp diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index faf511e375..5cb6142ebf 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -13,9 +13,6 @@ #ifdef USE_PIX #include #include -// The pix3 header unfortunately brings in other Windows macros we need to undef -#undef DeleteFile -#undef LoadImage #endif #ifdef AZ_PROFILE_TELEMETRY @@ -32,11 +29,11 @@ * Macro to declare a profile section for the current scope { }. * format is: AZ_PROFILE_SCOPE(categoryName, const char* formatStr, ...) */ -# define AZ_PROFILE_SCOPE(category, formatStr, ...) ::AZ::ProfileScope AZ_JOIN(azProfileScope, __LINE__){ #category, formatStr, __VA_ARGS__ } +# define AZ_PROFILE_SCOPE(category, ...) ::AZ::ProfileScope AZ_JOIN(azProfileScope, __LINE__){ #category, __VA_ARGS__ } # define AZ_PROFILE_FUNCTION(category) AZ_PROFILE_SCOPE(category, AZ_FUNCTION_SIGNATURE) // Prefer using the scoped macros which automatically end the event (AZ_PROFILE_SCOPE/AZ_PROFILE_FUNCTION) -# define AZ_PROFILE_BEGIN(category, name, ...) ::AZ::ProfileScope::BeginRegion(#category, name, __VA_ARGS__) +# define AZ_PROFILE_BEGIN(category, ...) ::AZ::ProfileScope::BeginRegion(#category, __VA_ARGS__) # define AZ_PROFILE_END() ::AZ::ProfileScope::EndRegion() #endif // AZ_PROFILER_MACRO_DISABLE @@ -67,14 +64,11 @@ namespace AZ static uint32_t GetSystemID(const char* system); template - static void BeginRegion(const char* system, char const* eventName, [[maybe_unused]] T const&... args) + static void BeginRegion([[maybe_unused]] const char* system, [[maybe_unused]] char const* eventName, [[maybe_unused]] T const&... args) { // TODO: Verification that the supplied system name corresponds to a known budget #if defined(USE_PIX) PIXBeginEvent(PIX_COLOR_INDEX(GetSystemID(system) & 0xff), eventName, args...); -#else - (void)system; - (void)eventName; #endif // TODO: injecting instrumentation for other profilers } @@ -395,3 +389,9 @@ namespace AZ } } // namespace AZ +#ifdef USE_PIX +// The pix3 header unfortunately brings in other Windows macros we need to undef +#undef DeleteFile +#undef LoadImage +#undef GetCurrentTime +#endif diff --git a/Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp b/Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp deleted file mode 100644 index 52085d98e7..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "RunningStatisticsManager.h" - -namespace AzFramework -{ - namespace Statistics - { - bool RunningStatisticsManager::ContainsStatistic(const AZStd::string& name) - { - auto iterator = m_statisticsNamesToIndexMap.find(name); - return iterator != m_statisticsNamesToIndexMap.end(); - } - - bool RunningStatisticsManager::AddStatistic(const AZStd::string& name, const AZStd::string& units) - { - if (ContainsStatistic(name)) - { - return false; - } - AddStatisticValidated(name, units); - return true; - } - - void RunningStatisticsManager::RemoveStatistic(const AZStd::string& name) - { - auto iterator = m_statisticsNamesToIndexMap.find(name); - if (iterator == m_statisticsNamesToIndexMap.end()) - { - return; - } - AZ::u32 itemIndex = iterator->second; - m_statistics.erase(m_statistics.begin() + itemIndex); - m_statisticsNamesToIndexMap.erase(iterator); - //Update the indices in m_statisticsNamesToIndexMap. - while (itemIndex < m_statistics.size()) - { - const AZStd::string& statName = m_statistics[itemIndex].GetName(); - m_statisticsNamesToIndexMap[statName] = itemIndex; - ++itemIndex; - } - } - - void RunningStatisticsManager::ResetStatistic(const AZStd::string& name) - { - NamedRunningStatistic* stat = GetStatistic(name); - if (!stat) - { - return; - } - stat->Reset(); - } - - void RunningStatisticsManager::ResetAllStatistics() - { - for (NamedRunningStatistic& stat : m_statistics) - { - stat.Reset(); - } - } - - void RunningStatisticsManager::PushSampleForStatistic(const AZStd::string& name, double value) - { - NamedRunningStatistic* stat = GetStatistic(name); - if (!stat) - { - return; - } - stat->PushSample(value); - } - - NamedRunningStatistic* RunningStatisticsManager::GetStatistic(const AZStd::string& name, AZ::u32* indexOut) - { - auto iterator = m_statisticsNamesToIndexMap.find(name); - if (iterator == m_statisticsNamesToIndexMap.end()) - { - return nullptr; - } - const AZ::u32 index = iterator->second; - if (indexOut) - { - *indexOut = index; - } - return &m_statistics[index]; - } - - const AZStd::vector& RunningStatisticsManager::GetAllStatistics() const - { - return m_statistics; - } - - void RunningStatisticsManager::AddStatisticValidated(const AZStd::string& name, const AZStd::string& units) - { - m_statistics.emplace_back(NamedRunningStatistic(name, units)); - const AZ::u32 itemIndex = static_cast(m_statistics.size() - 1); - m_statisticsNamesToIndexMap[name] = itemIndex; - } - - }//namespace Statistics -}//namespace AzFramework diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h deleted file mode 100644 index 2d8823c6e8..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include //Just to get AZ::NullMutex -#include -#include -#include - -namespace AZ -{ - namespace Statistics - { - //! A helper class that facilitates collecting time spent in blocks (scopes) of code - //! and aggregating the measured times as running statistics. - //! - //! See "StatisticalProfilerProxy.h" for more explanations on the meaning of Statistical Profiling. - //! - //! The StatisticalProfiler was made as a template to accommodate for several performance needs... - //! If all the code that is being profiled is single threaded and you want to identify - //! each statistic by its string name, then the default StatisticalProfiler<> works for you. - //! If using a map is too much of what you can afford, then index your - //! statistics with an integer or crc32 and your code profiler should be declared as - //! StatisticalProfiler. - //! For multi-threaded cases and indexing statistic with Crc32 you can have a profiler like this: - //! StatisticalProfiler. - //! The UnitTests mentioned in the first paragraph do benchmarks of different combinations - //! of indexing and synchronization primitives. - //! - //! Even though you can create, subclass and use your own StatisticalProfiler<*,*>, there - //! are some things to consider when working with the StatisticalProfilerProxy: - //! The StatisticalProfilerProxy OWNS an array of StatisticalProfiler. - //! You can "manage" one of those StatisticalProfiler by getting a reference to it and - //! add Running statistics etc. See The TerrainProfilers mentioned above to see concrete use - //! cases on how to work with the StatisticalProfilerProxy. - template - class StatisticalProfiler - { - public: - - //! A Convenience class used to measure time performance of scopes of code - //! with constructor/destructor. Suitable to be used as part of a macro - //! to facilitate its usage. - class TimedScope - { - public: - TimedScope() = delete; - - TimedScope(StatisticalProfiler& profiler, const StatIdType& statId) - : m_profiler(profiler), m_statId(statId) - { - m_startTime = AZStd::chrono::high_resolution_clock::now(); - } - - ~TimedScope() - { - AZStd::chrono::system_clock::time_point stopTime = AZStd::chrono::high_resolution_clock::now(); - AZStd::chrono::microseconds duration = stopTime - m_startTime; - m_profiler.PushSample(m_statId, static_cast(duration.count())); - } - - private: - StatisticalProfiler& m_profiler; - const StatIdType& m_statId; - AZStd::chrono::system_clock::time_point m_startTime; - }; //class TimedScope - - friend class TimedScope; - - StatisticalProfiler() - { - } - - StatisticalProfiler(const StatisticalProfiler& other) - { - m_statisticsManager = other.m_statisticsManager; - m_statsVector.clear(); - m_perFrameAggregates.clear(); - } - - StatisticalProfiler(StatisticalProfiler&& other) - { - m_statisticsManager = AZStd::move(other.m_statisticsManager); - m_perFrameAggregates = AZStd::move(other.m_perFrameAggregates); - } - - virtual ~StatisticalProfiler() - { - } - - AZ::Statistics::StatisticsManager& GetStatsManager() - { - return m_statisticsManager; - } - - //! Should be called once per frame, it runs over all existing timed stats in m_statsForPerFrameCalculation - //! and accumulates all the values as a single stat per frame. - double SummarizePerFrameStats() - { - AZStd::scoped_lock lock(m_mutex); - - if (m_perFrameAggregates.size() < 1) - { - return 0.0; - } - - double allStatsSumMicroSecs = 0.0; - - for (StatisticalAggregate& aggregate : m_perFrameAggregates) - { - double statsSumMicroSecs = 0.0; - for (const AZ::Statistics::NamedRunningStatistic* stat : aggregate.m_statsForPerFrameCalculation) - { - statsSumMicroSecs += stat->GetSum(); - } - - const double frameTime = statsSumMicroSecs - aggregate.m_prevAccumulatedSums; - if (frameTime > 0.0) - { - aggregate.m_statPerFrame->PushSample(frameTime); - aggregate.m_prevAccumulatedSums = statsSumMicroSecs; - } - allStatsSumMicroSecs += statsSumMicroSecs; - } - - return allStatsSumMicroSecs; - } - - void LogAndResetStats(const char* windowName) - { - AZStd::scoped_lock lock(m_mutex); - - if (m_statsVector.size() != m_statisticsManager.GetCount()) - { - m_statsVector.clear(); - m_statisticsManager.GetAllStatistics(m_statsVector); - } - - for (AZ::Statistics::NamedRunningStatistic* stat : m_statsVector) - { - if (stat->GetNumSamples() == 0) - { - continue; - } - const AZStd::string& statReport = stat->GetFormatted(); - AZ_Printf(windowName, "%s\n", statReport.c_str()); - stat->Reset(); - } - for (StatisticalAggregate& aggregate : m_perFrameAggregates) - { - aggregate.m_prevAccumulatedSums = 0.0; - } - } - - void PushSample(const StatIdType& statId, double value) - { - AZStd::scoped_lock lock(m_mutex); - AZ::Statistics::NamedRunningStatistic* stat = m_statisticsManager.GetStatistic(statId); - if (!stat) - { - return; - } - stat->PushSample(value); - } - - const AZ::Statistics::NamedRunningStatistic* GetStatistic(const StatIdType& statId) - { - return m_statisticsManager.GetStatistic(statId); - } - - int AddPerFrameStatisticalAggregate(const AZStd::vector& statIds, - const StatIdType& timePerFrameStatId, - const AZStd::string& timePerFrameStatName) - { - AZStd::scoped_lock lock(m_mutex); - - m_perFrameAggregates.push_back(StatisticalAggregate()); - StatisticalAggregate& aggregate = m_perFrameAggregates[m_perFrameAggregates.size() - 1]; - - int added_count = 0; - for (const StatIdType& statId : statIds) - { - AZ::Statistics::NamedRunningStatistic* stat = m_statisticsManager.GetStatistic(statId); - if (!stat) - { - continue; - } - auto const& itor = AZStd::find(aggregate.m_statsForPerFrameCalculation.begin(), aggregate.m_statsForPerFrameCalculation.end(), stat); - if (itor != aggregate.m_statsForPerFrameCalculation.end()) - { - continue; - } - aggregate.m_statsForPerFrameCalculation.push_back(stat); - added_count++; - } - - if (added_count < 1) - { - m_perFrameAggregates.pop_back(); - return 0; - } - - aggregate.m_statPerFrame = m_statisticsManager.AddStatistic(timePerFrameStatId, timePerFrameStatName, "us", true); - if (!aggregate.m_statPerFrame) - { - AZ_Warning("StatisticalProfiler", false, "Per frame stat with name %s already exists\n", timePerFrameStatName.c_str()); - m_perFrameAggregates.pop_back(); - return 0; - } - - return added_count; - } - - const AZ::Statistics::NamedRunningStatistic* GetFirstStatPerFrame() const - { - if (m_perFrameAggregates.size() < 1) - { - return nullptr; - } - return m_perFrameAggregates[0].m_statPerFrame; - } - - protected: - //! Lock this before reading/writing to m_timeStatisticsManager, or else... - MutexType m_mutex; - AZ::Statistics::StatisticsManager m_statisticsManager; - AZStd::vector m_statsVector; - - - struct StatisticalAggregate - { - StatisticalAggregate() : m_statPerFrame(nullptr), m_prevAccumulatedSums(0.0) - { - - } - AZ::Statistics::NamedRunningStatistic* m_statPerFrame; - AZStd::vector m_statsForPerFrameCalculation; - - //! This one is needed because running statistics are collected many times across - //! several frames. This value is used to calculate a per frame sample for @m_totalTimePerFrameStat, - //! by subtracting @m_prevAccumulatedSums from the accumulated sum in @m_statisticsManager. - double m_prevAccumulatedSums; - }; - - AZStd::vector m_perFrameAggregates; - - }; //class StatisticalProfiler - - }; //namespace Statistics -}; //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h deleted file mode 100644 index 4f58e0cb73..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - - -#if !defined(AZ_PROFILE_TELEMETRY) && defined(AZ_STATISTICAL_PROFILING_ENABLED) - -#if defined(AZ_PROFILE_SCOPE) -#undef AZ_PROFILE_SCOPE -#endif // #if defined(AZ_PROFILE_SCOPE) - -#define AZ_PROFILE_SCOPE(profiler, scopeNameId) \ - static_assert(profiler < Count, "Invalid profiler category"); \ - static const AZStd::string AZ_JOIN(blockName, __LINE__)(scopeNameId); \ - AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, AZ_JOIN(blockName, __LINE__)); - -#endif //#if !defined(AZ_PROFILE_TELEMETRY) - -namespace AZ -{ - namespace Statistics - { - using StatisticalProfilerId = AZ::Name; - - //! This AZ::Interface<> (Yes, it is an application wide singleton) owns an array of StatisticalProfilers. - //! When is this useful? - //! When you need to statistically profile code that runs across DLL boundaries. - //! - //! What is the meaning of "statistically profile" code? - //! In regular profiling with tools like RAD Telemetry, every execution of a profiled - //! scope of code will be captured when using AZ_PROFILE_SCOPE(). You can collect - //! very large amounts of data and do your own post processing and analysis in tools like Excel,etc. - //! In contrast, "statistical profiling" means that everytime AZ_PROFILE_SCOPE() is called, - //! the time spent in the given scope of code will be mathematically accumulated as part of a unique - //! Running statistic. Common statistical parameters like min, max, average, variance and standard deviation - //! are calculated on the fly. This approach reduces considerably the amount of data that is collected. - //! The data is recorded in the Game/Editor Log file. - //! - //! This StatisticalProfilerProxy should be used via the AZ_PROFILE_SCOPE() macro, and by using - //! this macro the developer gains the flexibility of switching at compile time between profiling - //! the code via RAD Telemetry or through statistical profiling. - //! - //! When creating a new statistical profiler add your category (aka profiler id) in Profiler.h (enum class ProfileCategory). - //! Get a reference of the statistical profiler with "GetProfiler(const StatisticalProfilerId& id)" using the profiler Id. - //! Once you get a reference to the profiler you can customize it, add Running statistics to it, etc. - //! Some class in your code will manage the reference to the statistical profiler and will determine - //! the policy on how often to log data to the game logs, etc. For example, by subclassing the TickBus Handler, etc. - //! - //! The StatisticalProfilerProxySystemComponent guarantees that the StatisticalProfilerProxy singleton exists - //! as soon as the AZ::Environment is fully initialized. - //! See StatisticalProfiler.h for more details and info. - class StatisticalProfilerProxy - { - public: - AZ_TYPE_INFO(StatisticalProfilerProxy, "{1103D0EB-1C32-4854-B9D9-40A2D65BDBD2}"); - - using StatIdType = AZStd::string; - using StatisticalProfilerType = StatisticalProfiler; - - //! A Convenience class used to measure time performance of scopes of code - //! with constructor/destructor. Suitable to be used as part of a macro - //! to facilitate its usage. - class TimedScope - { - public: - TimedScope() = delete; - - TimedScope(const StatisticalProfilerId profilerId, const StatIdType& statId) - : m_profilerId(profilerId), m_statId(statId) - { - if (!m_profilerProxy) - { - m_profilerProxy = AZ::Interface::Get(); - if (!m_profilerProxy) - { - return; - } - } - if (!m_profilerProxy->IsProfilerActive(profilerId)) - { - return; - } - m_startTime = AZStd::chrono::high_resolution_clock::now(); - } - ~TimedScope() - { - if (!m_profilerProxy) - { - return; - } - AZStd::chrono::system_clock::time_point stopTime = AZStd::chrono::high_resolution_clock::now(); - AZStd::chrono::microseconds duration = stopTime - m_startTime; - m_profilerProxy->PushSample(m_profilerId, m_statId, static_cast(duration.count())); - } - - //! Required only for UnitTests - static void ClearCachedProxy() - { - m_profilerProxy = nullptr; - } - - private: - static StatisticalProfilerProxy* m_profilerProxy; - const StatisticalProfilerId m_profilerId; - const StatIdType& m_statId; - AZStd::chrono::system_clock::time_point m_startTime; - }; //class TimedScope - - friend class TimedScope; - - StatisticalProfilerProxy() - { - m_profilers.reserve(static_cast(Count)); - for (AZStd::size_t i = 0; i < static_cast(Count); i++) - { - m_profilers.emplace_back(StatisticalProfilerType()); - } - AZ::Interface::Register(this); - } - - virtual ~StatisticalProfilerProxy() - { - AZ::Interface::Unregister(this); - } - - // Note that you have to delete these for safety reasons, you will trip a static_assert if you do not - StatisticalProfilerProxy(StatisticalProfilerProxy&&) = delete; - StatisticalProfilerProxy& operator=(StatisticalProfilerProxy&&) = delete; - - bool IsProfilerActive(StatisticalProfilerId id) const - { - return m_activeProfilersFlag[static_cast(id)]; - } - - StatisticalProfilerType& GetProfiler(StatisticalProfilerId id) - { - return m_profilers[static_cast(id)]; - } - - void ActivateProfiler(StatisticalProfilerId id, bool activate) - { - m_activeProfilersFlag[static_cast(id)] = activate; - } - - void PushSample(StatisticalProfilerId id, const StatIdType& statId, double value) - { - m_profilers[static_cast(id)].PushSample(statId, value); - } - - private: - AZStd::bitset(Count)> m_activeProfilersFlag; - AZStd::vector m_profilers; - }; //class StatisticalProfilerProxy - - }; //namespace Statistics -}; //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp deleted file mode 100644 index 00bb97b745..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include "StatisticalProfilerProxySystemComponent.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -namespace AZ -{ - namespace Statistics - { - StatisticalProfilerProxy* StatisticalProfilerProxy::TimedScope::m_profilerProxy = nullptr; - - //////////////////////////////////////////////////////////////////////////////////////////////// - void StatisticalProfilerProxySystemComponent::Reflect(AZ::ReflectContext* context) - { - if (AZ::SerializeContext* serializeContext = azrtti_cast(context)) - { - serializeContext->Class() - ->Version(1); - } - } - - //////////////////////////////////////////////////////////////////////////////////////////////// - void StatisticalProfilerProxySystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) - { - provided.push_back(AZ_CRC("StatisticalProfilerService", 0x20066f73)); - } - - //////////////////////////////////////////////////////////////////////////////////////////////// - void StatisticalProfilerProxySystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) - { - incompatible.push_back(AZ_CRC("StatisticalProfilerService", 0x20066f73)); - } - - //////////////////////////////////////////////////////////////////////////////////////////////// - StatisticalProfilerProxySystemComponent::StatisticalProfilerProxySystemComponent() - : m_StatisticalProfilerProxy(nullptr) - { - } - - //////////////////////////////////////////////////////////////////////////////////////////////// - StatisticalProfilerProxySystemComponent::~StatisticalProfilerProxySystemComponent() - { - } - - //////////////////////////////////////////////////////////////////////////////////////////////// - void StatisticalProfilerProxySystemComponent::Activate() - { - m_StatisticalProfilerProxy = new StatisticalProfilerProxy; - } - - //////////////////////////////////////////////////////////////////////////////////////////////// - void StatisticalProfilerProxySystemComponent::Deactivate() - { - delete m_StatisticalProfilerProxy; - } - } //namespace Statistics -} // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h deleted file mode 100644 index 333e29e3b9..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include "StatisticalProfilerProxy.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -namespace AZ -{ - namespace Statistics - { - //////////////////////////////////////////////////////////////////////////////////////////////// - //! This system component manages the globally unique StatisticalProfilerProxy instance. - //! And this is all this component does... it simply makes sure the StatisticalProfilerProxy exists. - class StatisticalProfilerProxySystemComponent : public AZ::Component - { - public: - //////////////////////////////////////////////////////////////////////////////////////////// - // AZ::Component Setup - AZ_COMPONENT(StatisticalProfilerProxySystemComponent, "{1E15565F-A5C1-4BF2-8AEE-D3880AC9E1EB}") - - //////////////////////////////////////////////////////////////////////////////////////////// - //! \ref AZ::ComponentDescriptor::Reflect - static void Reflect(AZ::ReflectContext* reflection); - - //////////////////////////////////////////////////////////////////////////////////////////// - //! \ref AZ::ComponentDescriptor::GetProvidedServices - static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); - - //////////////////////////////////////////////////////////////////////////////////////////// - //! \ref AZ::ComponentDescriptor::GetIncompatibleServices - static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); - - //////////////////////////////////////////////////////////////////////////////////////////// - //! Constructor - StatisticalProfilerProxySystemComponent(); - - //////////////////////////////////////////////////////////////////////////////////////////// - //! Destructor - ~StatisticalProfilerProxySystemComponent() override; - - protected: - //////////////////////////////////////////////////////////////////////////////////////////// - //! \ref AZ::Component::Activate - void Activate() override; - - //////////////////////////////////////////////////////////////////////////////////////////// - //! \ref AZ::Component::Deactivate - void Deactivate() override; - - private: - //////////////////////////////////////////////////////////////////////////////////////////// - // Disable copy constructor - StatisticalProfilerProxySystemComponent(const StatisticalProfilerProxySystemComponent&) = delete; - - //////////////////////////////////////////////////////////////////////////////////////////// - // The one and only StatisticalProfilerProxy (Which is itself an AZ::Interface<>) - StatisticalProfilerProxy* m_StatisticalProfilerProxy; - }; - } //namespace Statistics -} // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h deleted file mode 100644 index 5984701f4e..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include - -#include "NamedRunningStatistic.h" - -namespace AZ -{ - namespace Statistics - { - /** - * @brief A Collection of Running Statistics, addressable by a hashable - * class/primitive. e.g. AZ::Crc32, int, AZStd::string, etc. - * - */ - template - class StatisticsManager - { - public: - StatisticsManager() = default; - - StatisticsManager(const StatisticsManager& other) - { - m_statistics.reserve(other.m_statistics.size()); - for (auto const& it : other.m_statistics) - { - const StatIdType& statId = it.first; - const NamedRunningStatistic* stat = it.second; - m_statistics[statId] = new NamedRunningStatistic(*stat); - } - } - - virtual ~StatisticsManager() - { - Clear(); - } - - bool ContainsStatistic(const StatIdType& statId) const - { - auto iterator = m_statistics.find(statId); - return iterator != m_statistics.end(); - } - - AZ::u32 GetCount() const - { - return static_cast(m_statistics.size()); - } - - void GetAllStatistics(AZStd::vector& vector) - { - for (auto const& it : m_statistics) - { - NamedRunningStatistic* stat = it.second; - vector.push_back(stat); - } - } - - //! Helper method to apply units to statistics with empty units string. - AZ::u32 ApplyUnits(const AZStd::string& units) - { - AZ::u32 updatedCount = 0; - for (auto& it : m_statistics) - { - NamedRunningStatistic* stat = it.second; - if (stat->GetUnits().empty()) - { - stat->UpdateUnits(units); - updatedCount++; - } - } - return updatedCount; - } - - void Clear() - { - for (auto& it : m_statistics) - { - NamedRunningStatistic* stat = it.second; - delete stat; - } - m_statistics.clear(); - } - - /** - * Returns nullptr if a statistic with such name doesn't exist, - * otherwise returns a pointer to the statistic. - */ - NamedRunningStatistic* GetStatistic(const StatIdType& statId) - { - auto iterator = m_statistics.find(statId); - if (iterator == m_statistics.end()) - { - return nullptr; - } - return iterator->second; - } - - //! Returns false if a NamedRunningStatistic with such id already exists. - NamedRunningStatistic* AddStatistic(const StatIdType& statId, const bool failIfExist = true) - { - if (failIfExist) - { - NamedRunningStatistic* prevStat = GetStatistic(statId); - if (prevStat) - { - return nullptr; - } - } - NamedRunningStatistic* stat = new NamedRunningStatistic(); - m_statistics[statId] = stat; - return stat; - } - - //! Returns false if a NamedRunningStatistic with such id already exists. - NamedRunningStatistic* AddStatistic(const StatIdType& statId, const AZStd::string& name, const AZStd::string& units, const bool failIfExist = true) - { - if (failIfExist) - { - NamedRunningStatistic* prevStat = GetStatistic(statId); - if (prevStat) - { - return nullptr; - } - } - NamedRunningStatistic* stat = new NamedRunningStatistic(name, units); - m_statistics[statId] = stat; - return stat; - } - - virtual void RemoveStatistic(const StatIdType& statId) - { - auto iterator = m_statistics.find(statId); - if (iterator == m_statistics.end()) - { - return; - } - NamedRunningStatistic* prevStat = iterator->second; - delete prevStat; - m_statistics.erase(iterator); - } - - void ResetStatistic(const StatIdType& statId) - { - NamedRunningStatistic* stat = GetStatistic(statId); - if (!stat) - { - return; - } - stat->Reset(); - } - - void ResetAllStatistics() - { - for (auto& it : m_statistics) - { - NamedRunningStatistic* stat = it.second; - stat->Reset(); - } - } - - void PushSampleForStatistic(const StatIdType& statId, double value) - { - NamedRunningStatistic* stat = GetStatistic(statId); - if (!stat) - { - return; - } - stat->PushSample(value); - } - - //! Expensive function because it does a reverse lookup - bool GetStatId(NamedRunningStatistic* searchStat, StatIdType& statIdOut) const - { - for (auto& it : m_statistics) - { - NamedRunningStatistic* stat = it.second; - if (stat == searchStat) - { - statIdOut = it.first; - return true; - } - } - return false; - } - - - private: - ///Key: StatIdType, Value: NamedRunningStatistic* - AZStd::unordered_map m_statistics; - };//class StatisticsManager - }//namespace Statistics -}//namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp deleted file mode 100644 index 0e9b36a8b6..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "TimeDataStatisticsManager.h" - -namespace AZ -{ - namespace Statistics - { - void TimeDataStatisticsManager::PushTimeDataSample(const char * registerName, const AZ::Debug::ProfilerRegister::TimeData& timeData) - { - const AZStd::string statName(registerName); - NamedRunningStatistic* statistic = GetStatistic(statName); - if (!statistic) - { - const AZStd::string units("us"); - AddStatistic(statName, statName, units, false); - AZ::Debug::ProfilerRegister::TimeData zeroTimeData; - memset(&zeroTimeData, 0, sizeof(AZ::Debug::ProfilerRegister::TimeData)); - m_previousTimeData[statName] = zeroTimeData; - statistic = GetStatistic(statName); - AZ_Assert(statistic != nullptr, "Fatal error adding a new statistic object"); - } - - const AZ::u64 accumulatedTime = timeData.m_time; - const AZ::s64 totalNumCalls = timeData.m_calls; - const AZ::u64 previousAccumulatedTime = m_previousTimeData[statName].m_time; - const AZ::s64 previousTotalNumCalls = m_previousTimeData[statName].m_calls; - const AZ::u64 deltaTime = accumulatedTime - previousAccumulatedTime; - const AZ::s64 deltaCalls = totalNumCalls - previousTotalNumCalls; - - if (deltaCalls == 0) - { - //This is the same old data. Let's skip it - return; - } - - double newSample = static_cast(deltaTime) / deltaCalls; - - statistic->PushSample(newSample); - m_previousTimeData[statName] = timeData; - } - } //namespace Statistics -} //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h deleted file mode 100644 index 4b5c58f426..0000000000 --- a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include - -namespace AZ -{ - namespace Statistics - { - /** - * @brief Specialization useful for data generated with AZ::Debug::FrameProfileComponent - * - * Timer based data collection using AZ_PROFILE_SCOPE(...), available in - * AzCore/Debug/Profiler.h can be collected when using AZ::Debug::FrameProfilerComponent - * and AZ::Debug::FrameProfilerBus. The method PushTimeDataSample(...) is a convenience - * to convert those Timer registers into a RunningStatistic. - * - * - */ - class TimeDataStatisticsManager : public StatisticsManager<> - { - public: - TimeDataStatisticsManager() = default; - virtual ~TimeDataStatisticsManager() = default; - - /** - * @brief Adds one sample data to a specific running stat by name. - * - * This method is specialized to work with ProfilerRegister::TimeData that can be intercepted - * during AZ::Debug::FrameProfilerBus::OnFrameProfilerData(). - * For each @param registerName a new RunningStat object is created if it doesn't exist. - * - * Adds the TimeData as one sample for its RunningStatistic. - */ - void PushTimeDataSample(const char * registerName, const AZ::Debug::ProfilerRegister::TimeData& timeData); - - protected: - ///We store here the previous value from the previous timer frame data. - ///This is necessary because AZ_PROFILER_TIMER is cumulative - ///and we need the time spent for each call. - AZStd::unordered_map m_previousTimeData; - }; - } //namespace Statistics -} //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 79d3e321ec..c49c93f220 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -566,9 +566,6 @@ set(FILES Statistics/NamedRunningStatistic.h Statistics/RunningStatistic.cpp Statistics/RunningStatistic.h - Statistics/StatisticsManager.h - Statistics/TimeDataStatisticsManager.cpp - Statistics/TimeDataStatisticsManager.h StringFunc/StringFunc.cpp StringFunc/StringFunc.h UserSettings/UserSettings.cpp diff --git a/Code/Framework/AzCore/Tests/Components.cpp b/Code/Framework/AzCore/Tests/Components.cpp index 45193f4d1e..37bb783642 100644 --- a/Code/Framework/AzCore/Tests/Components.cpp +++ b/Code/Framework/AzCore/Tests/Components.cpp @@ -1255,7 +1255,7 @@ namespace UnitTest int ChildFunction1(int input) { - AZ_PROFILE_SCOPE(System, "Child1"); + AZ_PROFILE_SCOPE(AzCore, "Child1"); int result = 5; for (int i = 0; i < 10000; ++i) { @@ -1266,7 +1266,7 @@ namespace UnitTest int Profile1(int numIterations) { - AZ_PROFILE_SCOPE(System, "Custom name"); + AZ_PROFILE_SCOPE(AzCore, "Custom name"); int result = 0; for (int i = 0; i < numIterations; ++i) { diff --git a/Code/Framework/AzCore/Tests/Math/ObbTests.cpp b/Code/Framework/AzCore/Tests/Math/ObbTests.cpp index b0012ee93c..de285343f6 100644 --- a/Code/Framework/AzCore/Tests/Math/ObbTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/ObbTests.cpp @@ -6,16 +6,16 @@ * */ -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include using namespace AZ; -namespace UnitTest +namespace UnitTest::ObbTests { const Vector3 position(1.0f, 2.0f, 3.0f); const Quaternion rotation = Quaternion::CreateRotationZ(Constants::QuarterPi); @@ -151,4 +151,4 @@ namespace UnitTest EXPECT_NEAR(obb.GetDistanceSq(Vector3(2.4f, 0.5f, 1.5f)), 0.5532f, 1e-3f); EXPECT_NEAR(obb.GetDistanceSq(Vector3(1.1f, 7.3f, 5.8f)), 1.3612f, 1e-3f); } -} +} // namespace UnitTest::ObbTests diff --git a/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp b/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp deleted file mode 100644 index 6d6023b872..0000000000 --- a/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp +++ /dev/null @@ -1,847 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -//REMARK: The macros CODE_PROFILER_PROXY_PUSH_TIME and CODE_PROFILER_PUSH_TIME will be redefined -//several times in this file to accommodate for the different specializations of the StatisticalProfiler<> -//template. -#ifdef CODE_PROFILER_PROXY_PUSH_TIME -#undef CODE_PROFILER_PROXY_PUSH_TIME -#endif - -#ifdef CODE_PROFILER_PUSH_TIME -#undef CODE_PROFILER_PUSH_TIME -#endif - -namespace UnitTest -{ - class StatisticalProfilerTest - : public AllocatorsFixture - { - public: - - StatisticalProfilerTest() - { - } - - void SetUp() override - { - AllocatorsFixture::SetUp(); - } - - ~StatisticalProfilerTest() - { - } - - void TearDown() override - { - AllocatorsFixture::TearDown(); - } - - }; //class StatisticalProfilerTest - - TEST_F(StatisticalProfilerTest, StatisticalProfilerStringNoMutex_ProfileCode_ValidateStatistics) - { -//Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler<>::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler<> profiler; - - const AZStd::string statNamePerformance("PerformanceResult"); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 10; - { - CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(StatisticalProfilerTest, StatisticalProfilerCrc32NoMutex_ProfileCode_ValidateStatistics) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler profiler; - - const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); - const AZStd::string statNamePerformance("PerformanceResult"); - - const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 10; - { - CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(StatisticalProfilerTest, StatisticalProfilerStringWithSharedSpinMutex__ProfileCode_ValidateStatistics) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler profiler; - - const AZStd::string statNamePerformance("PerformanceResult"); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 10; - { - CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(StatisticalProfilerTest, StatisticalProfilerCrc32WithSharedSpinMutex__ProfileCode_ValidateStatistics) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler profiler; - - const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); - const AZStd::string statNamePerformance("PerformanceResult"); - - const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 10; - { - CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - static void simple_thread01(AZ::Statistics::StatisticalProfiler* profiler, int loop_cnt) - { - const AZStd::string simple_thread("simple_thread1"); - const AZStd::string simple_thread_loop("simple_thread1_loop"); - - CODE_PROFILER_PUSH_TIME(*profiler, simple_thread); - - static int counter = 0; - for (int i = 0; i < loop_cnt; i++) - { - CODE_PROFILER_PUSH_TIME(*profiler, simple_thread_loop); - counter++; - } - } - - static void simple_thread02(AZ::Statistics::StatisticalProfiler* profiler, int loop_cnt) - { - const AZStd::string simple_thread("simple_thread2"); - const AZStd::string simple_thread_loop("simple_thread2_loop"); - - CODE_PROFILER_PUSH_TIME(*profiler, simple_thread); - - static int counter = 0; - for (int i = 0; i < loop_cnt; i++) - { - CODE_PROFILER_PUSH_TIME(*profiler, simple_thread_loop); - counter++; - } - } - - static void simple_thread03(AZ::Statistics::StatisticalProfiler* profiler, int loop_cnt) - { - const AZStd::string simple_thread("simple_thread3"); - const AZStd::string simple_thread_loop("simple_thread3_loop"); - - CODE_PROFILER_PUSH_TIME(*profiler, simple_thread); - - static int counter = 0; - for (int i = 0; i < loop_cnt; i++) - { - CODE_PROFILER_PUSH_TIME(*profiler, simple_thread_loop); - counter++; - } - } - -#undef CODE_PROFILER_PUSH_TIME - - TEST_F(StatisticalProfilerTest, StatisticalProfilerStringWithSharedSpinMutex_RunProfiledThreads_ValidateStatistics) - { - AZ::Statistics::StatisticalProfiler profiler; - - const AZStd::string statIdThread1 = "simple_thread1"; - const AZStd::string statNameThread1("simple_thread1"); - const AZStd::string statIdThread1Loop = "simple_thread1_loop"; - const AZStd::string statNameThread1Loop("simple_thread1_loop"); - - const AZStd::string statIdThread2 = "simple_thread2"; - const AZStd::string statNameThread2("simple_thread2"); - const AZStd::string statIdThread2Loop = "simple_thread2_loop"; - const AZStd::string statNameThread2Loop("simple_thread2_loop"); - - const AZStd::string statIdThread3 = "simple_thread3"; - const AZStd::string statNameThread3("simple_thread3"); - const AZStd::string statIdThread3Loop = "simple_thread3_loop"; - const AZStd::string statNameThread3Loop("simple_thread3_loop"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); - - //Let's kickoff the threads to see how much contention affects the profiler's performance. - const int iter_count = 10; - AZStd::thread t1(AZStd::bind(&simple_thread01, &profiler, iter_count)); - AZStd::thread t2(AZStd::bind(&simple_thread02, &profiler, iter_count)); - AZStd::thread t3(AZStd::bind(&simple_thread03, &profiler, iter_count)); - t1.join(); - t2.join(); - t3.join(); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); - - } - - TEST_F(StatisticalProfilerTest, StatisticalProfilerProxy_ProfileCode_ValidateStatistics) - { -#define CODE_PROFILER_PROXY_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); - AZ::Statistics::StatisticalProfilerProxy profilerProxy; - AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdPerformance = "PerformanceResult"; - const AZStd::string statNamePerformance("PerformanceResult"); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdBlock = "Block"; - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - - proxy->ActivateProfiler(Terrain, true); - - const int iter_count = 10; - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdPerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); - - //Clean Up - proxy->ActivateProfiler(Terrain, false); - -#undef CODE_PROFILER_PROXY_PUSH_TIME - - } - -#define CODE_PROFILER_PROXY_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - static void simple_thread1(int loop_cnt) - { - const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread1("simple_thread1"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread1_loop("simple_thread1_loop"); - - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread1); - - static int counter = 0; - for (int i = 0; i < loop_cnt; i++) - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread1_loop); - counter++; - } - } - - static void simple_thread2(int loop_cnt) - { - const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread2("simple_thread2"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread2_loop("simple_thread2_loop"); - - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread2); - - static int counter = 0; - for (int i = 0; i < loop_cnt; i++) - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread2_loop); - counter++; - } - } - - static void simple_thread3(int loop_cnt) - { - const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread3("simple_thread3"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread3_loop("simple_thread3_loop"); - - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread3); - - static int counter = 0; - for (int i = 0; i < loop_cnt; i++) - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, simple_thread3_loop); - } - } - -#undef CODE_PROFILER_PROXY_PUSH_TIME - - TEST_F(StatisticalProfilerTest, StatisticalProfilerProxy3_RunProfiledThreads_ValidateStatistics) - { - AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); - AZ::Statistics::StatisticalProfilerProxy profilerProxy; - AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1 = "simple_thread1"; - const AZStd::string statNameThread1("simple_thread1"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1Loop = "simple_thread1_loop"; - const AZStd::string statNameThread1Loop("simple_thread1_loop"); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2 = "simple_thread2"; - const AZStd::string statNameThread2("simple_thread2"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2Loop = "simple_thread2_loop"; - const AZStd::string statNameThread2Loop("simple_thread2_loop"); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3 = "simple_thread3"; - const AZStd::string statNameThread3("simple_thread3"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3Loop = "simple_thread3_loop"; - const AZStd::string statNameThread3Loop("simple_thread3_loop"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); - - proxy->ActivateProfiler(Terrain, true); - - //Let's kickoff the threads to see how much contention affects the profiler's performance. - const int iter_count = 10; - AZStd::thread t1(AZStd::bind(&simple_thread1, iter_count)); - AZStd::thread t2(AZStd::bind(&simple_thread2, iter_count)); - AZStd::thread t3(AZStd::bind(&simple_thread3, iter_count)); - t1.join(); - t2.join(); - t3.join(); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); - - //Clean Up - proxy->ActivateProfiler(Terrain, false); - } - - /** Trace message handler to track messages during tests -*/ - struct MyTraceMessageSink final - : public AZ::Debug::TraceMessageDrillerBus::Handler - { - MyTraceMessageSink() - { - AZ::Debug::TraceMessageDrillerBus::Handler::BusConnect(); - } - - ~MyTraceMessageSink() - { - AZ::Debug::TraceMessageDrillerBus::Handler::BusDisconnect(); - } - - ////////////////////////////////////////////////////////////////////////// - // TraceMessageDrillerBus - void OnPrintf(const char* window, const char* message) override - { - OnOutput(window, message); - } - - void OnOutput(const char* window, const char* message) override - { - printf("%s: %s\n", window, message); - } - }; //struct MyTraceMessageSink - - class Suite_StatisticalProfilerPerformance - : public AllocatorsFixture - { - public: - MyTraceMessageSink* m_testSink; - - Suite_StatisticalProfilerPerformance() :m_testSink(nullptr) - { - } - - void SetUp() override - { - AllocatorsFixture::SetUp(); - m_testSink = new MyTraceMessageSink(); - } - - ~Suite_StatisticalProfilerPerformance() - { - } - - void TearDown() override - { - // clearing up memory - delete m_testSink; - AllocatorsFixture::TearDown(); - } - - }; //class Suite_StatisticalProfilerPerformance - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerStringNoMutex_1ThreadPerformance) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler<>::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler<> profiler; - - const AZStd::string statNamePerformance("PerformanceResult"); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 1000000; - { - CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("StatisticalProfilerStringNoMutex"); - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerCrc32NoMutex_1ThreadPerformance) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler profiler; - - const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); - const AZStd::string statNamePerformance("PerformanceResult"); - - const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 1000000; - { - CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("StatisticalProfilerCrc32NoMutex"); - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerStringWithSharedSpinMutex_1ThreadPerformance) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler profiler; - - const AZStd::string statNamePerformance("PerformanceResult"); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 1000000; - { - CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("StatisticalProfilerStringWithSharedSpinMutex"); - - ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerCrc32WithSharedSpinMutex_1ThreadPerformance) - { - //Helper macro. -#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - AZ::Statistics::StatisticalProfiler profiler; - - const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); - const AZStd::string statNamePerformance("PerformanceResult"); - - const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - - const int iter_count = 1000000; - { - CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("StatisticalProfilerCrc32WithSharedSpinMutex"); - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - -#undef CODE_PROFILER_PUSH_TIME - - } - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerStringWithSharedSpinMutex3Threads_3ThreadsPerformance) - { - AZ::Statistics::StatisticalProfiler profiler; - - const AZStd::string statIdThread1 = "simple_thread1"; - const AZStd::string statNameThread1("simple_thread1"); - const AZStd::string statIdThread1Loop = "simple_thread1_loop"; - const AZStd::string statNameThread1Loop("simple_thread1_loop"); - - const AZStd::string statIdThread2 = "simple_thread2"; - const AZStd::string statNameThread2("simple_thread2"); - const AZStd::string statIdThread2Loop = "simple_thread2_loop"; - const AZStd::string statNameThread2Loop("simple_thread2_loop"); - - const AZStd::string statIdThread3 = "simple_thread3"; - const AZStd::string statNameThread3("simple_thread3"); - const AZStd::string statIdThread3Loop = "simple_thread3_loop"; - const AZStd::string statNameThread3Loop("simple_thread3_loop"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); - - //Let's kickoff the threads to see how much contention affects the profiler's performance. - const int iter_count = 1000000; - AZStd::thread t1(AZStd::bind(&simple_thread01, &profiler, iter_count)); - AZStd::thread t2(AZStd::bind(&simple_thread02, &profiler, iter_count)); - AZStd::thread t3(AZStd::bind(&simple_thread03, &profiler, iter_count)); - t1.join(); - t2.join(); - t3.join(); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("3_Threads_StatisticalProfiler"); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); - - } - -#define CODE_PROFILER_PROXY_PUSH_TIME(profiler, scopeNameId) \ - AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerProxy_1ThreadPerformance) - { - AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); - AZ::Statistics::StatisticalProfilerProxy profilerProxy; - AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdPerformance = "PerformanceResult"; - const AZStd::string statNamePerformance("PerformanceResult"); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdBlock = "Block"; - const AZStd::string statNameBlock("Block"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); - - proxy->ActivateProfiler(Terrain, true); - - const int iter_count = 1000000; - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdPerformance) - int counter = 0; - for (int i = 0; i < iter_count; i++) - { - CODE_PROFILER_PROXY_PUSH_TIME(Terrain, statIdBlock) - counter++; - } - } - - ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); - - ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("StatisticalProfilerProxy"); - - //Clean Up - proxy->ActivateProfiler(Terrain, false); - } - -#undef CODE_PROFILER_PROXY_PUSH_TIME - - TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerProxy_3ThreadsPerformance) - { - AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); - AZ::Statistics::StatisticalProfilerProxy profilerProxy; - AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); - AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(Terrain); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1 = "simple_thread1"; - const AZStd::string statNameThread1("simple_thread1"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1Loop = "simple_thread1_loop"; - const AZStd::string statNameThread1Loop("simple_thread1_loop"); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2 = "simple_thread2"; - const AZStd::string statNameThread2("simple_thread2"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2Loop = "simple_thread2_loop"; - const AZStd::string statNameThread2Loop("simple_thread2_loop"); - - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3 = "simple_thread3"; - const AZStd::string statNameThread3("simple_thread3"); - const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3Loop = "simple_thread3_loop"; - const AZStd::string statNameThread3Loop("simple_thread3_loop"); - - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); - ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); - - proxy->ActivateProfiler(Terrain, true); - - //Let's kickoff the threads to see how much contention affects the profiler's performance. - const int iter_count = 1000000; - AZStd::thread t1(AZStd::bind(&simple_thread1, iter_count)); - AZStd::thread t2(AZStd::bind(&simple_thread2, iter_count)); - AZStd::thread t3(AZStd::bind(&simple_thread3, iter_count)); - t1.join(); - t2.join(); - t3.join(); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); - - ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); - ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); - EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); - - profiler.LogAndResetStats("3_Threads_StatisticalProfilerProxy"); - - //Clean Up - proxy->ActivateProfiler(Terrain, false); - } - -}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/Statistics.cpp b/Code/Framework/AzCore/Tests/Statistics.cpp deleted file mode 100644 index 941c2eff0b..0000000000 --- a/Code/Framework/AzCore/Tests/Statistics.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include -#include - -#include -#include - -#include - -using namespace AZ; -using namespace Debug; - -namespace UnitTest -{ - class StatisticsTest - : public AllocatorsFixture - { - public: - StatisticsTest() - { - } - - void SetUp() override - { - AllocatorsFixture::SetUp(); - - m_dataSamples = AZStd::make_unique>(); - const u32 numSamples = 100; - m_dataSamples->set_capacity(numSamples); - for (u32 i = 0; i < numSamples; ++i) - { - m_dataSamples->push_back(i); - } - } - - ~StatisticsTest() - { - } - - void TearDown() override - { - // clearing up memory - m_dataSamples = nullptr; - - AllocatorsFixture::TearDown(); - } - - protected: - AZStd::unique_ptr> m_dataSamples; - }; //class StatisticsTest - - TEST_F(StatisticsTest, RunningStatistic_ProcessAnArrayOfNumbers_GetExpectedStatisticalData) - { - Statistics::RunningStatistic runningStat; - - ASSERT_TRUE(m_dataSamples.get() != nullptr); - const AZStd::vector& dataSamples = *m_dataSamples; - for (u32 sample : dataSamples) - { - runningStat.PushSample(sample); - } - - EXPECT_EQ(runningStat.GetNumSamples(), dataSamples.size()); - EXPECT_EQ(runningStat.GetMostRecentSample(), dataSamples.back()); - EXPECT_EQ(runningStat.GetMinimum(), dataSamples[0]); - EXPECT_EQ(runningStat.GetMaximum(), dataSamples.back()); - EXPECT_NEAR(runningStat.GetAverage(), 49.5, 0.001); - EXPECT_NEAR(runningStat.GetVariance(), 841.666, 0.001); - EXPECT_NEAR(runningStat.GetStdev(), 29.011, 0.001); - EXPECT_NEAR(runningStat.GetVariance(Statistics::VarianceType::P), 833.25, 0.001); - EXPECT_NEAR(runningStat.GetStdev(Statistics::VarianceType::P), 28.866, 0.001); - - //Reset the stat object. - runningStat.Reset(); - EXPECT_EQ(runningStat.GetNumSamples(), 0); - EXPECT_EQ(runningStat.GetAverage(), 0.0); - EXPECT_EQ(runningStat.GetStdev(), 0.0); - } - - - TEST_F(StatisticsTest, StatisticsManager_AddAndRemoveStatisticistics_CollectionIntegrityIsCorrect) - { - Statistics::StatisticsManager<> statsManager; - AZStd::string statName0("stat0"); - AZStd::string statName1("stat1"); - AZStd::string statName2("stat2"); - AZStd::string statName3("stat3"); - EXPECT_TRUE(statsManager.AddStatistic(statName0, statName0, "")); - EXPECT_TRUE(statsManager.AddStatistic(statName1, statName1, "")); - EXPECT_TRUE(statsManager.AddStatistic(statName2, statName2, "")); - EXPECT_TRUE(statsManager.AddStatistic(statName3, statName3, "")); - - //Validate the number of running statistics object we have so far. - { - AZStd::vector allStats; - statsManager.GetAllStatistics(allStats); - EXPECT_TRUE(allStats.size() == 4); - } - - //Try to add an Stat that already exist. expect to fail. - EXPECT_EQ(statsManager.AddStatistic(statName1), nullptr); - - //Remove stat1. - statsManager.RemoveStatistic(statName1); - //Validate the number of running statistics object we have so far. - { - AZStd::vector allStats; - statsManager.GetAllStatistics(allStats); - EXPECT_TRUE(allStats.size() == 3); - } - - //Add stat1 again, expect to pass. - EXPECT_TRUE(statsManager.AddStatistic(statName1)); - - //Get a pointer to stat2. - Statistics::NamedRunningStatistic* stat2 = statsManager.GetStatistic(statName2); - ASSERT_TRUE(stat2 != nullptr); - EXPECT_EQ(stat2->GetName(), statName2); - } - - TEST_F(StatisticsTest, StatisticsManager_DistributeSamplesAcrossStatistics_StatisticsAreCorrect) - { - Statistics::StatisticsManager<> statsManager; - AZStd::string statName0("stat0"); - AZStd::string statName1("stat1"); - AZStd::string statName2("stat2"); - AZStd::string statName3("stat3"); - - EXPECT_TRUE(statsManager.AddStatistic(statName3)); - EXPECT_TRUE(statsManager.AddStatistic(statName0)); - EXPECT_TRUE(statsManager.AddStatistic(statName2)); - EXPECT_TRUE(statsManager.AddStatistic(statName1)); - - //Distribute the 100 samples of data evenly across the 4 running statistics. - ASSERT_TRUE(m_dataSamples.get() != nullptr); - const AZStd::vector& dataSamples = *m_dataSamples; - const size_t numSamples = dataSamples.size(); - const size_t numSamplesPerStat = numSamples / 4; - size_t sampleIndex = 0; - size_t nextStopIndex = numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName0, dataSamples[sampleIndex]); - sampleIndex++; - } - nextStopIndex += numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName1, dataSamples[sampleIndex]); - sampleIndex++; - } - nextStopIndex += numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName2, dataSamples[sampleIndex]); - sampleIndex++; - } - nextStopIndex += numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName3, dataSamples[sampleIndex]); - sampleIndex++; - } - - EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetAverage(), 12.0, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetAverage(), 37.0, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetAverage(), 62.0, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetAverage(), 87.0, 0.001); - - EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetStdev(), 7.359, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetStdev(), 7.359, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetStdev(), 7.359, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetStdev(), 7.359, 0.001); - - //Reset one of the stats. - statsManager.ResetStatistic(statName2); - EXPECT_EQ(statsManager.GetStatistic(statName2)->GetAverage(), 0.0); - //Reset all of the stats. - statsManager.ResetAllStatistics(); - EXPECT_EQ(statsManager.GetStatistic(statName0)->GetNumSamples(), 0); - EXPECT_EQ(statsManager.GetStatistic(statName1)->GetNumSamples(), 0); - EXPECT_EQ(statsManager.GetStatistic(statName2)->GetNumSamples(), 0); - EXPECT_EQ(statsManager.GetStatistic(statName3)->GetNumSamples(), 0); - } - - TEST_F(StatisticsTest, StatisticsManagerCrc32_DistributeSamplesAcrossStatistics_StatisticsAreCorrect) - { - Statistics::StatisticsManager statsManager; - AZ::Crc32 statName0 = AZ_CRC("stat0", 0xb8927780); - AZ::Crc32 statName1 = AZ_CRC("stat1", 0xcf954716); - AZ::Crc32 statName2 = AZ_CRC("stat2", 0x569c16ac); - AZ::Crc32 statName3 = AZ_CRC("stat3", 0x219b263a); - - EXPECT_TRUE(statsManager.AddStatistic(statName3) != nullptr); - EXPECT_TRUE(statsManager.AddStatistic(statName0) != nullptr); - EXPECT_TRUE(statsManager.AddStatistic(statName2) != nullptr); - EXPECT_TRUE(statsManager.AddStatistic(statName1) != nullptr); - - EXPECT_TRUE(statsManager.GetStatistic(statName3) != nullptr); - EXPECT_TRUE(statsManager.GetStatistic(statName0) != nullptr); - EXPECT_TRUE(statsManager.GetStatistic(statName1) != nullptr); - EXPECT_TRUE(statsManager.GetStatistic(statName2) != nullptr); - - //Distribute the 100 samples of data evenly across the 4 running statistics. - ASSERT_TRUE(m_dataSamples.get() != nullptr); - const AZStd::vector& dataSamples = *m_dataSamples; - const size_t numSamples = dataSamples.size(); - const size_t numSamplesPerStat = numSamples / 4; - size_t sampleIndex = 0; - size_t nextStopIndex = numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName0, dataSamples[sampleIndex]); - sampleIndex++; - } - nextStopIndex += numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName1, dataSamples[sampleIndex]); - sampleIndex++; - } - nextStopIndex += numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName2, dataSamples[sampleIndex]); - sampleIndex++; - } - nextStopIndex += numSamplesPerStat; - while (sampleIndex < nextStopIndex) - { - statsManager.PushSampleForStatistic(statName3, dataSamples[sampleIndex]); - sampleIndex++; - } - - EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetAverage(), 12.0, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetAverage(), 37.0, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetAverage(), 62.0, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetAverage(), 87.0, 0.001); - - EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetStdev(), 7.359, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetStdev(), 7.359, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetStdev(), 7.359, 0.001); - EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetStdev(), 7.359, 0.001); - - //Reset one of the stats. - statsManager.ResetStatistic(statName2); - EXPECT_EQ(statsManager.GetStatistic(statName2)->GetAverage(), 0.0); - //Reset all of the stats. - statsManager.ResetAllStatistics(); - EXPECT_EQ(statsManager.GetStatistic(statName0)->GetNumSamples(), 0); - EXPECT_EQ(statsManager.GetStatistic(statName1)->GetNumSamples(), 0); - EXPECT_EQ(statsManager.GetStatistic(statName2)->GetNumSamples(), 0); - EXPECT_EQ(statsManager.GetStatistic(statName3)->GetNumSamples(), 0); - } - -}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp deleted file mode 100644 index 192d9dc7f6..0000000000 --- a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -using namespace AZ; -using namespace Debug; - -namespace UnitTest -{ - /** - * Validate functionality of the convenience class TimeDataStatisticsManager. - * It is a specialized version of RunningStatisticsManager that works with Timer type - * of registers that can be captured with the FrameProfilerBus::OnFrameProfilerData() - */ - class TimeDataStatisticsManagerTest - : public AllocatorsFixture - , public FrameProfilerBus::Handler - { - static constexpr const char* PARENT_TIMER_STAT = "ParentStat"; - static constexpr const char* CHILD_TIMER_STAT0 = "ChildStat0"; - static constexpr const char* CHILD_TIMER_STAT1 = "ChildStat1"; - - public: - TimeDataStatisticsManagerTest() - : AllocatorsFixture() - { - } - - void SetUp() override - { - AllocatorsFixture::SetUp(); - m_statsManager = AZStd::make_unique(); - } - - void TearDown() override - { - m_statsManager = nullptr; - AllocatorsFixture::TearDown(); - } - - ////////////////////////////////////////////////////////////////////////// - // FrameProfilerBus - virtual void OnFrameProfilerData(const FrameProfiler::ThreadDataArray& data) - { - for (size_t iThread = 0; iThread < data.size(); ++iThread) - { - const FrameProfiler::ThreadData& td = data[iThread]; - FrameProfiler::ThreadData::RegistersMap::const_iterator regIt = td.m_registers.begin(); - for (; regIt != td.m_registers.end(); ++regIt) - { - const FrameProfiler::RegisterData& rd = regIt->second; - u32 unitTestCrc = AZ_CRC("UnitTest", 0x8089cea8); - if (unitTestCrc != rd.m_systemId) - { - continue; //Not for us. - } - ASSERT_EQ(ProfilerRegister::PRT_TIME, rd.m_type); - const FrameProfiler::FrameData& fd = rd.m_frames.back(); - m_statsManager->PushTimeDataSample(rd.m_name, fd.m_timeData); - } - } - } - ////////////////////////////////////////////////////////////////////////// - - int ChildFunction0(int numIterations, int sleepTimeMilliseconds) - { - AZ_PROFILE_SCOPE(AzCore, CHILD_TIMER_STAT0); - AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); - int result = 5; - for (int i = 0; i < numIterations; ++i) - { - result += i % 3; - } - return result; - } - - int ChildFunction1(int numIterations, int sleepTimeMilliseconds) - { - AZ_PROFILE_SCOPE(AzCore, CHILD_TIMER_STAT1); - AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); - int result = 5; - for (int i = 0; i < numIterations; ++i) - { - result += i % 3; - } - return result; - } - - int ParentFunction(int numIterations, int sleepTimeMilliseconds) - { - AZ_PROFILE_SCOPE(AzCore, PARENT_TIMER_STAT); - AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); - int result = 0; - result += ChildFunction0(numIterations, sleepTimeMilliseconds); - result += ChildFunction1(numIterations, sleepTimeMilliseconds); - return result; - } - - void run() - { - Debug::FrameProfilerBus::Handler::BusConnect(); - - ComponentApplication app; - ComponentApplication::Descriptor desc; - desc.m_useExistingAllocator = true; - desc.m_enableDrilling = false; // we already created a memory driller for the test (AllocatorsFixture) - ComponentApplication::StartupParameters startupParams; - startupParams.m_allocator = &AllocatorInstance::Get(); - Entity* systemEntity = app.Create(desc, startupParams); - systemEntity->CreateComponent(); - - systemEntity->Init(); - systemEntity->Activate(); // start frame component - - const int sleepTimeAllFuncsMillis = 1; - const int numIterations = 10; - for (int iterationCounter = 0; iterationCounter < numIterations; ++iterationCounter) - { - ParentFunction(numIterations, sleepTimeAllFuncsMillis); - //Collect all samples. - app.Tick(); - } - - //Verify we have three running stats. - { - AZStd::vector allStats; - m_statsManager->GetAllStatistics(allStats); - EXPECT_EQ(allStats.size(), 3); - } - - AZStd::string parentStatName(PARENT_TIMER_STAT); - AZStd::string child0StatName(CHILD_TIMER_STAT0); - AZStd::string child1StatName(CHILD_TIMER_STAT1); - ASSERT_TRUE(m_statsManager->GetStatistic(parentStatName) != nullptr); - ASSERT_TRUE(m_statsManager->GetStatistic(child0StatName) != nullptr); - ASSERT_TRUE(m_statsManager->GetStatistic(child1StatName) != nullptr); - - EXPECT_EQ(m_statsManager->GetStatistic(parentStatName)->GetNumSamples(), numIterations); - EXPECT_EQ(m_statsManager->GetStatistic(child0StatName)->GetNumSamples(), numIterations); - EXPECT_EQ(m_statsManager->GetStatistic(child1StatName)->GetNumSamples(), numIterations); - - const double minimumExpectDurationOfChildFunctionMicros = 1; - const double minimumExpectDurationOfParentFunctionMicros = 1; - - EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetMinimum(), minimumExpectDurationOfParentFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetAverage(), minimumExpectDurationOfParentFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetMaximum(), minimumExpectDurationOfParentFunctionMicros); - - EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetMinimum(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetAverage(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetMaximum(), minimumExpectDurationOfChildFunctionMicros); - - EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetMinimum(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetAverage(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetMaximum(), minimumExpectDurationOfChildFunctionMicros); - - //Let's validate TimeDataStatisticsManager::RemoveStatistics() - m_statsManager->RemoveStatistic(child1StatName); - ASSERT_TRUE(m_statsManager->GetStatistic(parentStatName) != nullptr); - ASSERT_TRUE(m_statsManager->GetStatistic(child0StatName) != nullptr); - EXPECT_EQ(m_statsManager->GetStatistic(child1StatName), nullptr); - - //Let's store the sample count for both parentStatName and child0StatName. - const AZ::u64 numSamplesParent = m_statsManager->GetStatistic(parentStatName)->GetNumSamples(); - const AZ::u64 numSamplesChild0 = m_statsManager->GetStatistic(child0StatName)->GetNumSamples(); - - //Let's call child1 function again and call app.Tick(). child1StatName should be readded to m_statsManager. - ChildFunction1(numIterations, sleepTimeAllFuncsMillis); - app.Tick(); - ASSERT_TRUE(m_statsManager->GetStatistic(child1StatName) != nullptr); - EXPECT_EQ(m_statsManager->GetStatistic(parentStatName)->GetNumSamples(), numSamplesParent); - EXPECT_EQ(m_statsManager->GetStatistic(child0StatName)->GetNumSamples(), numSamplesChild0); - EXPECT_EQ(m_statsManager->GetStatistic(child1StatName)->GetNumSamples(), 1); - - Debug::FrameProfilerBus::Handler::BusDisconnect(); - app.Destroy(); - } - - AZStd::unique_ptr m_statsManager; - };//class TimeDataStatisticsManagerTest - - TEST_F(TimeDataStatisticsManagerTest, Test) - { - run(); - } - //End of all Tests of TimeDataStatisticsManagerTest - -}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/azcoretests_files.cmake b/Code/Framework/AzCore/Tests/azcoretests_files.cmake index 911eaa7b10..7833cf97bb 100644 --- a/Code/Framework/AzCore/Tests/azcoretests_files.cmake +++ b/Code/Framework/AzCore/Tests/azcoretests_files.cmake @@ -60,13 +60,11 @@ set(FILES SerializeContextFixture.h Slice.cpp State.cpp - Statistics.cpp StreamerTests.cpp StringFunc.cpp SystemFile.cpp TaskTests.cpp TickBusTest.cpp - TimeDataStatistics.cpp UUIDTests.cpp XML.cpp Debug/AssetTracking.cpp diff --git a/Code/Framework/AzFramework/CMakeLists.txt b/Code/Framework/AzFramework/CMakeLists.txt index 8a68aac887..2748da20dc 100644 --- a/Code/Framework/AzFramework/CMakeLists.txt +++ b/Code/Framework/AzFramework/CMakeLists.txt @@ -10,7 +10,6 @@ ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) ly_get_list_relative_pal_filename(common_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/Common) -set(LY_STATISTICAL_PROFILING_ENABLED OFF CACHE BOOL "Enables statistical profiling when using AZ_PROFILE_SCOPE. If True, it takes effect only if RAD Telemetry is disabled.") set(LY_TOUCHBENDING_LAYER_BIT 63 CACHE STRING "Use TouchBending as the collision layer. The TouchBending layer can be a number from 1 to 63 (Default=63).") ly_add_target( @@ -38,14 +37,6 @@ ly_add_target( 3rdParty::lz4 ) -if(LY_STATISTICAL_PROFILING_ENABLED) - ly_add_source_properties( - SOURCES AzFramework/Debug/StatisticalProfilerProxy.h - PROPERTY COMPILE_DEFINITIONS - VALUES AZ_STATISTICAL_PROFILING_ENABLED - ) -endif() - ly_add_source_properties( SOURCES AzFramework/Physics/Collision/CollisionGroups.cpp diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp index f1b91fa1ad..2582710aa7 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp @@ -700,7 +700,7 @@ namespace GridMate { if (IsUsingFixedTimeStep()) { - return static_cast(m_fixedTimeStep.CurrentTime()); + return static_cast(m_fixedTimeStep.GetCurrentTime()); } else { diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h index bedff54939..bd9f1a1ee9 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.h @@ -302,7 +302,7 @@ namespace GridMate // this could allow for changing on the fly but it would need to ensure that if it were in the middle of a second, that the new rate would result in landing on the } - AZ::u64 CurrentTime() const + AZ::u64 GetCurrentTime() const { return m_currentTime; } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h index fc89abfc9a..cb6c742722 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h @@ -73,4 +73,3 @@ namespace ImageProcessingAtom using ImageBuilderRequestBus = AZ::EBus; } // namespace ImageProcessingAtom - diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp index 90fd926b99..10dab85dcb 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp @@ -295,7 +295,7 @@ namespace AZ void DecalTextureArrayFeatureProcessor::SetDecalMaterial(const DecalHandle handle, const AZ::Data::AssetId material) { - AZ_PROFILE_FUNCTION(Renderer); + AZ_PROFILE_FUNCTION(AzRender); if (handle.IsNull()) { AZ_Warning("DecalTextureArrayFeatureProcessor", false, "Invalid handle passed to DecalTextureArrayFeatureProcessor::SetDecalMaterial()."); @@ -365,7 +365,7 @@ namespace AZ void DecalTextureArrayFeatureProcessor::OnAssetReady(const Data::Asset asset) { - AZ_PROFILE_FUNCTION(Renderer); + AZ_PROFILE_FUNCTION(AzRender); const Data::AssetId& assetId = asset->GetId(); const RPI::MaterialAsset* materialAsset = asset.GetAs(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp index 4d3dcba36e..26fdae1c54 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -541,6 +542,7 @@ namespace AZ { view->FinalizeDrawLists(); } + AZ_PROFILE_END(); } else { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h index f41cf29c79..8ca1ab570f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h @@ -20,6 +20,9 @@ #include #include +#if defined GetCurrentTime +#undef GetCurrentTime +#endif namespace EMotionFX { diff --git a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp index 5a3304fecd..d9daced995 100644 --- a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp +++ b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include diff --git a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp index 02a57cea6f..77223ba566 100644 --- a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp +++ b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp @@ -116,7 +116,7 @@ namespace NvCloth } void zoneEnd([[maybe_unused]] void* profilerData, - const char* eventName, bool detached, + [[maybe_unused]] const char* eventName, bool detached, [[maybe_unused]] uint64_t contextId) override { if (detached) diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp index 65129e4054..b9e96938af 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp @@ -57,7 +57,7 @@ namespace ScriptCanvasEditor::Nodes // Handles the creation of a node through the node configurations for most nodes. AZ::EntityId DisplayGeneralScriptCanvasNode(AZ::EntityId, const ScriptCanvas::Node* node, const NodeConfiguration& nodeConfiguration) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); AZ::Entity* graphCanvasEntity = nullptr; @@ -445,7 +445,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplayEbusEventNode(AZ::EntityId, const AZStd::string& busName, const AZStd::string& eventName, const ScriptCanvas::EBusEventId& eventId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); AZ::EntityId graphCanvasNodeId; @@ -668,7 +668,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplayScriptEventNode(AZ::EntityId, const AZ::Data::AssetId assetId, const ScriptEvents::Method& methodDefinition) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); AZ::EntityId graphCanvasNodeId; @@ -1001,7 +1001,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplayGetVariableNode(AZ::EntityId graphCanvasGraphId, const ScriptCanvas::Nodes::Core::GetVariableNode* variableNode) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeConfiguration nodeConfiguration; nodeConfiguration.PopulateComponentDescriptors(); @@ -1033,7 +1033,7 @@ namespace ScriptCanvasEditor::Nodes AZ::EntityId DisplaySetVariableNode(AZ::EntityId graphCanvasGraphId, const ScriptCanvas::Nodes::Core::SetVariableNode* variableNode) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeConfiguration nodeConfiguration; nodeConfiguration.PopulateComponentDescriptors(); @@ -1069,7 +1069,7 @@ namespace ScriptCanvasEditor::Nodes /////////////////// AZ::EntityId DisplayScriptCanvasNode(AZ::EntityId graphCanvasGraphId, const ScriptCanvas::Node* node) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); AZ::EntityId graphCanvasNodeId; if (azrtti_istypeof(node)) @@ -1122,7 +1122,7 @@ namespace ScriptCanvasEditor::Nodes static void RegisterAndActivateGraphCanvasSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::SlotId& slotId, AZ::Entity* slotEntity) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); if (slotEntity) { slotEntity->Init(); @@ -1166,7 +1166,7 @@ namespace ScriptCanvasEditor::Nodes return AZ::EntityId(); } - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); AZ::Entity* slotEntity = nullptr; AZ::Uuid typeId = ScriptCanvas::Data::ToAZType(slot.GetDataType()); @@ -1258,7 +1258,7 @@ namespace ScriptCanvasEditor::Nodes::SlotDisplayHelper { AZ::EntityId DisplayPropertySlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::VisualExtensionSlotConfiguration& propertyConfiguration) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); GraphCanvas::SlotConfiguration graphCanvasConfiguration; @@ -1284,7 +1284,7 @@ namespace ScriptCanvasEditor::Nodes::SlotDisplayHelper AZ::EntityId DisplayExtendableSlot(AZ::EntityId graphCanvasNodeId, const ScriptCanvas::VisualExtensionSlotConfiguration& extenderConfiguration) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); GraphCanvas::ExtenderSlotConfiguration graphCanvasConfiguration; diff --git a/cmake/3rdParty/FindPIX.cmake b/cmake/3rdParty/FindPIX.cmake index 4bce14312d..e4652467ac 100644 --- a/cmake/3rdParty/FindPIX.cmake +++ b/cmake/3rdParty/FindPIX.cmake @@ -8,7 +8,7 @@ if(LY_PIX_ENABLED) file(TO_CMAKE_PATH "${LY_PIX_PATH}" PIX_PATH) - message(STATUS "PIX PATH ${PIX_PATH}") + message(STATUS "PIX found: ${PIX_PATH}") ly_add_external_target( NAME pix diff --git a/cmake/3rdParty/Platform/Windows/pix_windows.cmake b/cmake/3rdParty/Platform/Windows/pix_windows.cmake index aba65d9627..54d419d1c2 100644 --- a/cmake/3rdParty/Platform/Windows/pix_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/pix_windows.cmake @@ -11,4 +11,4 @@ if(LY_MONOLITHIC_GAME) else() set(PIX_LIBS ${BASE_PATH}/bin/x64/WinPixEventRuntime.lib) set(PIX_RUNTIME_DEPENDENCIES ${BASE_PATH}/bin/x64/WinPixEventRuntime.dll) -endif() \ No newline at end of file +endif() From 5f2fe83c5b99a058488fa3cb6c35b9d3ed728578 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 18 Aug 2021 09:16:44 -0600 Subject: [PATCH 091/100] Remove test associated with frame profiler going away Signed-off-by: Jeremy Ong --- Code/Framework/AzCore/Tests/Components.cpp | 147 --------------------- 1 file changed, 147 deletions(-) diff --git a/Code/Framework/AzCore/Tests/Components.cpp b/Code/Framework/AzCore/Tests/Components.cpp index 37bb783642..77524dabc9 100644 --- a/Code/Framework/AzCore/Tests/Components.cpp +++ b/Code/Framework/AzCore/Tests/Components.cpp @@ -1191,153 +1191,6 @@ namespace UnitTest ////////////////////////////////////////////////////////////////////////// } - class FrameProfilerComponentTest - : public AllocatorsFixture - , public FrameProfilerBus::Handler - { - public: - FrameProfilerComponentTest() - : AllocatorsFixture() - { - } - - ////////////////////////////////////////////////////////////////////////// - // FrameProfilerDrillerBus - void OnFrameProfilerData(const FrameProfiler::ThreadDataArray& data) override - { - for (size_t iThread = 0; iThread < data.size(); ++iThread) - { - const FrameProfiler::ThreadData& td = data[iThread]; - FrameProfiler::ThreadData::RegistersMap::const_iterator regIt = td.m_registers.begin(); - size_t numRegisters = m_numRegistersReceived; - for (; regIt != td.m_registers.end(); ++regIt) - { - const FrameProfiler::RegisterData& rd = regIt->second; - - AZ_TEST_ASSERT(rd.m_function != NULL); - if (strstr(rd.m_function, "ChildFunction") || strstr(rd.m_function, "Profile1")) // filter only the test registers - { - ++m_numRegistersReceived; - - EXPECT_GT(rd.m_line, 0); - EXPECT_TRUE(rd.m_name == nullptr || strstr(rd.m_name, "Child1") || strstr(rd.m_name, "Custom name")); - AZ::u32 unitTestCrc = AZ_CRC("UnitTest", 0x8089cea8); - EXPECT_EQ(unitTestCrc, rd.m_systemId); - EXPECT_EQ(ProfilerRegister::PRT_TIME, rd.m_type); - - EXPECT_FALSE(rd.m_frames.empty()); - const FrameProfiler::FrameData& fd = rd.m_frames.back(); - EXPECT_GT(fd.m_frameId, 0u); - EXPECT_GT(fd.m_timeData.m_time, 0); - EXPECT_GT(fd.m_timeData.m_calls, 0); - } - } - - if (numRegisters < m_numRegistersReceived) - { - // we have received valid test registers for this thread, add it to the list - ++m_numThreads; - } - } - } - ////////////////////////////////////////////////////////////////////////// - - int ChildFunction(int input) - { - AZ_PROFILE_FUNCTION(System); - int result = 5; - for (int i = 0; i < 10000; ++i) - { - result += i % (input + 3); - } - return result; - } - - int ChildFunction1(int input) - { - AZ_PROFILE_SCOPE(AzCore, "Child1"); - int result = 5; - for (int i = 0; i < 10000; ++i) - { - result += i % (input + 1); - } - return result; - } - - int Profile1(int numIterations) - { - AZ_PROFILE_SCOPE(AzCore, "Custom name"); - int result = 0; - for (int i = 0; i < numIterations; ++i) - { - result += ChildFunction(i); - } - - result += ChildFunction1(numIterations / 3); - return result; - } - - void run() - { - FrameProfilerBus::Handler::BusConnect(); - - ComponentApplication app; - ComponentApplication::Descriptor desc; - desc.m_useExistingAllocator = true; - desc.m_enableDrilling = false; // we already created a memory driller for the test (AllocatorsFixture) - ComponentApplication::StartupParameters startupParams; - startupParams.m_allocator = &AZ::AllocatorInstance::Get(); - Entity* systemEntity = app.Create(desc, startupParams); - systemEntity->CreateComponent(); - - systemEntity->Init(); - systemEntity->Activate(); // start frame component - - m_numThreads = 0; - m_numRegistersReceived = 0; - - // tick to frame 1 and collect all the samples - app.Tick(); - EXPECT_EQ(0, m_numThreads); - EXPECT_EQ(0, m_numRegistersReceived); - - int numIterations = 10000; - { - AZStd::thread t1(AZStd::bind(&FrameProfilerComponentTest::Profile1, this, numIterations)); - AZStd::thread t2(AZStd::bind(&FrameProfilerComponentTest::Profile1, this, numIterations)); - AZStd::thread t3(AZStd::bind(&FrameProfilerComponentTest::Profile1, this, numIterations)); - AZStd::thread t4(AZStd::bind(&FrameProfilerComponentTest::Profile1, this, numIterations)); - - t1.join(); - t2.join(); - t3.join(); - t4.join(); - } - - // tick to frame 2 and collect all the samples - app.Tick(); - - EXPECT_EQ(4, m_numThreads); - EXPECT_EQ(m_numThreads * 3, m_numRegistersReceived); - - FrameProfilerBus::Handler::BusDisconnect(); - - app.Destroy(); - } - - size_t m_numRegistersReceived; - size_t m_numThreads; - }; - -#if AZ_TRAIT_DISABLE_FAILED_FRAMEPROFILER_TEST - TEST_F(FrameProfilerComponentTest, DISABLED_Test) -#else - TEST_F(FrameProfilerComponentTest, Test) -#endif - { - run(); - } - class SimpleEntityRefTestComponent : public Component { From 11d4543442aa7de56049c064f0dabcb969b0ec13 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 18 Aug 2021 15:00:00 -0600 Subject: [PATCH 092/100] Reintroduce StatisticalProfiler and associated classes in deactivated state Signed-off-by: Jeremy Ong --- .../Statistics/RunningStatisticsManager.cpp | 106 +++ .../AzCore/Statistics/StatisticalProfiler.h | 255 ++++++ .../Statistics/StatisticalProfilerProxy.h | 164 ++++ ...tatisticalProfilerProxySystemComponent.cpp | 66 ++ .../StatisticalProfilerProxySystemComponent.h | 67 ++ .../AzCore/Statistics/StatisticsManager.h | 200 +++++ .../Statistics/TimeDataStatisticsManager.cpp | 49 + .../Statistics/TimeDataStatisticsManager.h | 51 ++ .../AzCore/AzCore/azcore_files.cmake | 7 + .../AzCore/Tests/StatisticalProfiler.cpp | 847 ++++++++++++++++++ Code/Framework/AzCore/Tests/Statistics.cpp | 263 ++++++ .../AzCore/Tests/TimeDataStatistics.cpp | 207 +++++ .../AzCore/Tests/azcoretests_files.cmake | 2 + .../Include/Atom/Utils/StableDynamicArray.h | 1 - 14 files changed, 2284 insertions(+), 1 deletion(-) create mode 100644 Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp create mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h create mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h create mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp create mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h create mode 100644 Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h create mode 100644 Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp create mode 100644 Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h create mode 100644 Code/Framework/AzCore/Tests/StatisticalProfiler.cpp create mode 100644 Code/Framework/AzCore/Tests/Statistics.cpp create mode 100644 Code/Framework/AzCore/Tests/TimeDataStatistics.cpp diff --git a/Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp b/Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp new file mode 100644 index 0000000000..52085d98e7 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/RunningStatisticsManager.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include "RunningStatisticsManager.h" + +namespace AzFramework +{ + namespace Statistics + { + bool RunningStatisticsManager::ContainsStatistic(const AZStd::string& name) + { + auto iterator = m_statisticsNamesToIndexMap.find(name); + return iterator != m_statisticsNamesToIndexMap.end(); + } + + bool RunningStatisticsManager::AddStatistic(const AZStd::string& name, const AZStd::string& units) + { + if (ContainsStatistic(name)) + { + return false; + } + AddStatisticValidated(name, units); + return true; + } + + void RunningStatisticsManager::RemoveStatistic(const AZStd::string& name) + { + auto iterator = m_statisticsNamesToIndexMap.find(name); + if (iterator == m_statisticsNamesToIndexMap.end()) + { + return; + } + AZ::u32 itemIndex = iterator->second; + m_statistics.erase(m_statistics.begin() + itemIndex); + m_statisticsNamesToIndexMap.erase(iterator); + //Update the indices in m_statisticsNamesToIndexMap. + while (itemIndex < m_statistics.size()) + { + const AZStd::string& statName = m_statistics[itemIndex].GetName(); + m_statisticsNamesToIndexMap[statName] = itemIndex; + ++itemIndex; + } + } + + void RunningStatisticsManager::ResetStatistic(const AZStd::string& name) + { + NamedRunningStatistic* stat = GetStatistic(name); + if (!stat) + { + return; + } + stat->Reset(); + } + + void RunningStatisticsManager::ResetAllStatistics() + { + for (NamedRunningStatistic& stat : m_statistics) + { + stat.Reset(); + } + } + + void RunningStatisticsManager::PushSampleForStatistic(const AZStd::string& name, double value) + { + NamedRunningStatistic* stat = GetStatistic(name); + if (!stat) + { + return; + } + stat->PushSample(value); + } + + NamedRunningStatistic* RunningStatisticsManager::GetStatistic(const AZStd::string& name, AZ::u32* indexOut) + { + auto iterator = m_statisticsNamesToIndexMap.find(name); + if (iterator == m_statisticsNamesToIndexMap.end()) + { + return nullptr; + } + const AZ::u32 index = iterator->second; + if (indexOut) + { + *indexOut = index; + } + return &m_statistics[index]; + } + + const AZStd::vector& RunningStatisticsManager::GetAllStatistics() const + { + return m_statistics; + } + + void RunningStatisticsManager::AddStatisticValidated(const AZStd::string& name, const AZStd::string& units) + { + m_statistics.emplace_back(NamedRunningStatistic(name, units)); + const AZ::u32 itemIndex = static_cast(m_statistics.size() - 1); + m_statisticsNamesToIndexMap[name] = itemIndex; + } + + }//namespace Statistics +}//namespace AzFramework diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h new file mode 100644 index 0000000000..2d8823c6e8 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfiler.h @@ -0,0 +1,255 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#include //Just to get AZ::NullMutex +#include +#include +#include + +namespace AZ +{ + namespace Statistics + { + //! A helper class that facilitates collecting time spent in blocks (scopes) of code + //! and aggregating the measured times as running statistics. + //! + //! See "StatisticalProfilerProxy.h" for more explanations on the meaning of Statistical Profiling. + //! + //! The StatisticalProfiler was made as a template to accommodate for several performance needs... + //! If all the code that is being profiled is single threaded and you want to identify + //! each statistic by its string name, then the default StatisticalProfiler<> works for you. + //! If using a map is too much of what you can afford, then index your + //! statistics with an integer or crc32 and your code profiler should be declared as + //! StatisticalProfiler. + //! For multi-threaded cases and indexing statistic with Crc32 you can have a profiler like this: + //! StatisticalProfiler. + //! The UnitTests mentioned in the first paragraph do benchmarks of different combinations + //! of indexing and synchronization primitives. + //! + //! Even though you can create, subclass and use your own StatisticalProfiler<*,*>, there + //! are some things to consider when working with the StatisticalProfilerProxy: + //! The StatisticalProfilerProxy OWNS an array of StatisticalProfiler. + //! You can "manage" one of those StatisticalProfiler by getting a reference to it and + //! add Running statistics etc. See The TerrainProfilers mentioned above to see concrete use + //! cases on how to work with the StatisticalProfilerProxy. + template + class StatisticalProfiler + { + public: + + //! A Convenience class used to measure time performance of scopes of code + //! with constructor/destructor. Suitable to be used as part of a macro + //! to facilitate its usage. + class TimedScope + { + public: + TimedScope() = delete; + + TimedScope(StatisticalProfiler& profiler, const StatIdType& statId) + : m_profiler(profiler), m_statId(statId) + { + m_startTime = AZStd::chrono::high_resolution_clock::now(); + } + + ~TimedScope() + { + AZStd::chrono::system_clock::time_point stopTime = AZStd::chrono::high_resolution_clock::now(); + AZStd::chrono::microseconds duration = stopTime - m_startTime; + m_profiler.PushSample(m_statId, static_cast(duration.count())); + } + + private: + StatisticalProfiler& m_profiler; + const StatIdType& m_statId; + AZStd::chrono::system_clock::time_point m_startTime; + }; //class TimedScope + + friend class TimedScope; + + StatisticalProfiler() + { + } + + StatisticalProfiler(const StatisticalProfiler& other) + { + m_statisticsManager = other.m_statisticsManager; + m_statsVector.clear(); + m_perFrameAggregates.clear(); + } + + StatisticalProfiler(StatisticalProfiler&& other) + { + m_statisticsManager = AZStd::move(other.m_statisticsManager); + m_perFrameAggregates = AZStd::move(other.m_perFrameAggregates); + } + + virtual ~StatisticalProfiler() + { + } + + AZ::Statistics::StatisticsManager& GetStatsManager() + { + return m_statisticsManager; + } + + //! Should be called once per frame, it runs over all existing timed stats in m_statsForPerFrameCalculation + //! and accumulates all the values as a single stat per frame. + double SummarizePerFrameStats() + { + AZStd::scoped_lock lock(m_mutex); + + if (m_perFrameAggregates.size() < 1) + { + return 0.0; + } + + double allStatsSumMicroSecs = 0.0; + + for (StatisticalAggregate& aggregate : m_perFrameAggregates) + { + double statsSumMicroSecs = 0.0; + for (const AZ::Statistics::NamedRunningStatistic* stat : aggregate.m_statsForPerFrameCalculation) + { + statsSumMicroSecs += stat->GetSum(); + } + + const double frameTime = statsSumMicroSecs - aggregate.m_prevAccumulatedSums; + if (frameTime > 0.0) + { + aggregate.m_statPerFrame->PushSample(frameTime); + aggregate.m_prevAccumulatedSums = statsSumMicroSecs; + } + allStatsSumMicroSecs += statsSumMicroSecs; + } + + return allStatsSumMicroSecs; + } + + void LogAndResetStats(const char* windowName) + { + AZStd::scoped_lock lock(m_mutex); + + if (m_statsVector.size() != m_statisticsManager.GetCount()) + { + m_statsVector.clear(); + m_statisticsManager.GetAllStatistics(m_statsVector); + } + + for (AZ::Statistics::NamedRunningStatistic* stat : m_statsVector) + { + if (stat->GetNumSamples() == 0) + { + continue; + } + const AZStd::string& statReport = stat->GetFormatted(); + AZ_Printf(windowName, "%s\n", statReport.c_str()); + stat->Reset(); + } + for (StatisticalAggregate& aggregate : m_perFrameAggregates) + { + aggregate.m_prevAccumulatedSums = 0.0; + } + } + + void PushSample(const StatIdType& statId, double value) + { + AZStd::scoped_lock lock(m_mutex); + AZ::Statistics::NamedRunningStatistic* stat = m_statisticsManager.GetStatistic(statId); + if (!stat) + { + return; + } + stat->PushSample(value); + } + + const AZ::Statistics::NamedRunningStatistic* GetStatistic(const StatIdType& statId) + { + return m_statisticsManager.GetStatistic(statId); + } + + int AddPerFrameStatisticalAggregate(const AZStd::vector& statIds, + const StatIdType& timePerFrameStatId, + const AZStd::string& timePerFrameStatName) + { + AZStd::scoped_lock lock(m_mutex); + + m_perFrameAggregates.push_back(StatisticalAggregate()); + StatisticalAggregate& aggregate = m_perFrameAggregates[m_perFrameAggregates.size() - 1]; + + int added_count = 0; + for (const StatIdType& statId : statIds) + { + AZ::Statistics::NamedRunningStatistic* stat = m_statisticsManager.GetStatistic(statId); + if (!stat) + { + continue; + } + auto const& itor = AZStd::find(aggregate.m_statsForPerFrameCalculation.begin(), aggregate.m_statsForPerFrameCalculation.end(), stat); + if (itor != aggregate.m_statsForPerFrameCalculation.end()) + { + continue; + } + aggregate.m_statsForPerFrameCalculation.push_back(stat); + added_count++; + } + + if (added_count < 1) + { + m_perFrameAggregates.pop_back(); + return 0; + } + + aggregate.m_statPerFrame = m_statisticsManager.AddStatistic(timePerFrameStatId, timePerFrameStatName, "us", true); + if (!aggregate.m_statPerFrame) + { + AZ_Warning("StatisticalProfiler", false, "Per frame stat with name %s already exists\n", timePerFrameStatName.c_str()); + m_perFrameAggregates.pop_back(); + return 0; + } + + return added_count; + } + + const AZ::Statistics::NamedRunningStatistic* GetFirstStatPerFrame() const + { + if (m_perFrameAggregates.size() < 1) + { + return nullptr; + } + return m_perFrameAggregates[0].m_statPerFrame; + } + + protected: + //! Lock this before reading/writing to m_timeStatisticsManager, or else... + MutexType m_mutex; + AZ::Statistics::StatisticsManager m_statisticsManager; + AZStd::vector m_statsVector; + + + struct StatisticalAggregate + { + StatisticalAggregate() : m_statPerFrame(nullptr), m_prevAccumulatedSums(0.0) + { + + } + AZ::Statistics::NamedRunningStatistic* m_statPerFrame; + AZStd::vector m_statsForPerFrameCalculation; + + //! This one is needed because running statistics are collected many times across + //! several frames. This value is used to calculate a per frame sample for @m_totalTimePerFrameStat, + //! by subtracting @m_prevAccumulatedSums from the accumulated sum in @m_statisticsManager. + double m_prevAccumulatedSums; + }; + + AZStd::vector m_perFrameAggregates; + + }; //class StatisticalProfiler + + }; //namespace Statistics +}; //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h new file mode 100644 index 0000000000..5ea69b205c --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + + +#if !defined(AZ_PROFILE_TELEMETRY) && defined(AZ_STATISTICAL_PROFILING_ENABLED) + +#if defined(AZ_PROFILE_SCOPE) +#undef AZ_PROFILE_SCOPE +#endif // #if defined(AZ_PROFILE_SCOPE) + +#define AZ_PROFILE_SCOPE(profiler, scopeNameId) \ + static const AZStd::string AZ_JOIN(blockName, __LINE__)(scopeNameId); \ + AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, AZ_JOIN(blockName, __LINE__)); + +#endif //#if !defined(AZ_PROFILE_TELEMETRY) + +namespace AZ::Statistics +{ + using StatisticalProfilerId = uint32_t; + + //! This AZ::Interface<> (Yes, it is an application wide singleton) owns an array of StatisticalProfilers. + //! When is this useful? + //! When you need to statistically profile code that runs across DLL boundaries. + //! + //! What is the meaning of "statistically profile" code? + //! In regular profiling with tools like RAD Telemetry, every execution of a profiled + //! scope of code will be captured when using AZ_PROFILE_SCOPE(). You can collect + //! very large amounts of data and do your own post processing and analysis in tools like Excel,etc. + //! In contrast, "statistical profiling" means that everytime AZ_PROFILE_SCOPE() is called, + //! the time spent in the given scope of code will be mathematically accumulated as part of a unique + //! Running statistic. Common statistical parameters like min, max, average, variance and standard deviation + //! are calculated on the fly. This approach reduces considerably the amount of data that is collected. + //! The data is recorded in the Game/Editor Log file. + //! + //! This StatisticalProfilerProxy should be used via the AZ_PROFILE_SCOPE() macro, and by using + //! this macro the developer gains the flexibility of switching at compile time between profiling + //! the code via RAD Telemetry or through statistical profiling. + //! + //! When creating a new statistical profiler add your category (aka profiler id) in Profiler.h (enum class ProfileCategory). + //! Get a reference of the statistical profiler with "GetProfiler(const StatisticalProfilerId& id)" using the profiler Id. + //! Once you get a reference to the profiler you can customize it, add Running statistics to it, etc. + //! Some class in your code will manage the reference to the statistical profiler and will determine + //! the policy on how often to log data to the game logs, etc. For example, by subclassing the TickBus Handler, etc. + //! + //! The StatisticalProfilerProxySystemComponent guarantees that the StatisticalProfilerProxy singleton exists + //! as soon as the AZ::Environment is fully initialized. + //! See StatisticalProfiler.h for more details and info. + class StatisticalProfilerProxy + { + public: + AZ_TYPE_INFO(StatisticalProfilerProxy, "{1103D0EB-1C32-4854-B9D9-40A2D65BDBD2}"); + + using StatIdType = AZStd::string; + using StatisticalProfilerType = StatisticalProfiler; + + //! A Convenience class used to measure time performance of scopes of code + //! with constructor/destructor. Suitable to be used as part of a macro + //! to facilitate its usage. + class TimedScope + { + public: + TimedScope() = delete; + + TimedScope(const StatisticalProfilerId profilerId, const StatIdType& statId) + : m_profilerId(profilerId) + , m_statId(statId) + { + if (!m_profilerProxy) + { + m_profilerProxy = AZ::Interface::Get(); + if (!m_profilerProxy) + { + return; + } + } + if (!m_profilerProxy->IsProfilerActive(profilerId)) + { + return; + } + m_startTime = AZStd::chrono::high_resolution_clock::now(); + } + ~TimedScope() + { + if (!m_profilerProxy) + { + return; + } + AZStd::chrono::system_clock::time_point stopTime = AZStd::chrono::high_resolution_clock::now(); + AZStd::chrono::microseconds duration = stopTime - m_startTime; + m_profilerProxy->PushSample(m_profilerId, m_statId, static_cast(duration.count())); + } + + //! Required only for UnitTests + static void ClearCachedProxy() + { + m_profilerProxy = nullptr; + } + + private: + static StatisticalProfilerProxy* m_profilerProxy; + const StatisticalProfilerId m_profilerId; + const StatIdType& m_statId; + AZStd::chrono::system_clock::time_point m_startTime; + }; // class TimedScope + + friend class TimedScope; + + StatisticalProfilerProxy() + { + // TODO:BUDGETS Query available budgets at registration time and create an associated profiler per type + AZ::Interface::Register(this); + } + + virtual ~StatisticalProfilerProxy() + { + AZ::Interface::Unregister(this); + } + + // Note that you have to delete these for safety reasons, you will trip a static_assert if you do not + StatisticalProfilerProxy(StatisticalProfilerProxy&&) = delete; + StatisticalProfilerProxy& operator=(StatisticalProfilerProxy&&) = delete; + + bool IsProfilerActive(StatisticalProfilerId id) const + { + return m_activeProfilersFlag[static_cast(id)]; + } + + StatisticalProfilerType& GetProfiler(StatisticalProfilerId id) + { + return m_profilers[static_cast(id)]; + } + + void ActivateProfiler(StatisticalProfilerId id, bool activate) + { + m_activeProfilersFlag[static_cast(id)] = activate; + } + + void PushSample(StatisticalProfilerId id, const StatIdType& statId, double value) + { + m_profilers[static_cast(id)].PushSample(statId, value); + } + + private: + // TODO:BUDGETS the number of bits allocated here must be based on the number of budgets available at profiler registration time + AZStd::bitset<128> m_activeProfilersFlag; + AZStd::vector m_profilers; + }; // class StatisticalProfilerProxy + +}; // namespace AZ::Statistics diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp new file mode 100644 index 0000000000..00bb97b745 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include +#include +#include +#include "StatisticalProfilerProxySystemComponent.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace AZ +{ + namespace Statistics + { + StatisticalProfilerProxy* StatisticalProfilerProxy::TimedScope::m_profilerProxy = nullptr; + + //////////////////////////////////////////////////////////////////////////////////////////////// + void StatisticalProfilerProxySystemComponent::Reflect(AZ::ReflectContext* context) + { + if (AZ::SerializeContext* serializeContext = azrtti_cast(context)) + { + serializeContext->Class() + ->Version(1); + } + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + void StatisticalProfilerProxySystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) + { + provided.push_back(AZ_CRC("StatisticalProfilerService", 0x20066f73)); + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + void StatisticalProfilerProxySystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) + { + incompatible.push_back(AZ_CRC("StatisticalProfilerService", 0x20066f73)); + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + StatisticalProfilerProxySystemComponent::StatisticalProfilerProxySystemComponent() + : m_StatisticalProfilerProxy(nullptr) + { + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + StatisticalProfilerProxySystemComponent::~StatisticalProfilerProxySystemComponent() + { + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + void StatisticalProfilerProxySystemComponent::Activate() + { + m_StatisticalProfilerProxy = new StatisticalProfilerProxy; + } + + //////////////////////////////////////////////////////////////////////////////////////////////// + void StatisticalProfilerProxySystemComponent::Deactivate() + { + delete m_StatisticalProfilerProxy; + } + } //namespace Statistics +} // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h new file mode 100644 index 0000000000..333e29e3b9 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxySystemComponent.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#include +#include "StatisticalProfilerProxy.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +namespace AZ +{ + namespace Statistics + { + //////////////////////////////////////////////////////////////////////////////////////////////// + //! This system component manages the globally unique StatisticalProfilerProxy instance. + //! And this is all this component does... it simply makes sure the StatisticalProfilerProxy exists. + class StatisticalProfilerProxySystemComponent : public AZ::Component + { + public: + //////////////////////////////////////////////////////////////////////////////////////////// + // AZ::Component Setup + AZ_COMPONENT(StatisticalProfilerProxySystemComponent, "{1E15565F-A5C1-4BF2-8AEE-D3880AC9E1EB}") + + //////////////////////////////////////////////////////////////////////////////////////////// + //! \ref AZ::ComponentDescriptor::Reflect + static void Reflect(AZ::ReflectContext* reflection); + + //////////////////////////////////////////////////////////////////////////////////////////// + //! \ref AZ::ComponentDescriptor::GetProvidedServices + static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); + + //////////////////////////////////////////////////////////////////////////////////////////// + //! \ref AZ::ComponentDescriptor::GetIncompatibleServices + static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); + + //////////////////////////////////////////////////////////////////////////////////////////// + //! Constructor + StatisticalProfilerProxySystemComponent(); + + //////////////////////////////////////////////////////////////////////////////////////////// + //! Destructor + ~StatisticalProfilerProxySystemComponent() override; + + protected: + //////////////////////////////////////////////////////////////////////////////////////////// + //! \ref AZ::Component::Activate + void Activate() override; + + //////////////////////////////////////////////////////////////////////////////////////////// + //! \ref AZ::Component::Deactivate + void Deactivate() override; + + private: + //////////////////////////////////////////////////////////////////////////////////////////// + // Disable copy constructor + StatisticalProfilerProxySystemComponent(const StatisticalProfilerProxySystemComponent&) = delete; + + //////////////////////////////////////////////////////////////////////////////////////////// + // The one and only StatisticalProfilerProxy (Which is itself an AZ::Interface<>) + StatisticalProfilerProxy* m_StatisticalProfilerProxy; + }; + } //namespace Statistics +} // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h new file mode 100644 index 0000000000..5984701f4e --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticsManager.h @@ -0,0 +1,200 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#include +#include + +#include "NamedRunningStatistic.h" + +namespace AZ +{ + namespace Statistics + { + /** + * @brief A Collection of Running Statistics, addressable by a hashable + * class/primitive. e.g. AZ::Crc32, int, AZStd::string, etc. + * + */ + template + class StatisticsManager + { + public: + StatisticsManager() = default; + + StatisticsManager(const StatisticsManager& other) + { + m_statistics.reserve(other.m_statistics.size()); + for (auto const& it : other.m_statistics) + { + const StatIdType& statId = it.first; + const NamedRunningStatistic* stat = it.second; + m_statistics[statId] = new NamedRunningStatistic(*stat); + } + } + + virtual ~StatisticsManager() + { + Clear(); + } + + bool ContainsStatistic(const StatIdType& statId) const + { + auto iterator = m_statistics.find(statId); + return iterator != m_statistics.end(); + } + + AZ::u32 GetCount() const + { + return static_cast(m_statistics.size()); + } + + void GetAllStatistics(AZStd::vector& vector) + { + for (auto const& it : m_statistics) + { + NamedRunningStatistic* stat = it.second; + vector.push_back(stat); + } + } + + //! Helper method to apply units to statistics with empty units string. + AZ::u32 ApplyUnits(const AZStd::string& units) + { + AZ::u32 updatedCount = 0; + for (auto& it : m_statistics) + { + NamedRunningStatistic* stat = it.second; + if (stat->GetUnits().empty()) + { + stat->UpdateUnits(units); + updatedCount++; + } + } + return updatedCount; + } + + void Clear() + { + for (auto& it : m_statistics) + { + NamedRunningStatistic* stat = it.second; + delete stat; + } + m_statistics.clear(); + } + + /** + * Returns nullptr if a statistic with such name doesn't exist, + * otherwise returns a pointer to the statistic. + */ + NamedRunningStatistic* GetStatistic(const StatIdType& statId) + { + auto iterator = m_statistics.find(statId); + if (iterator == m_statistics.end()) + { + return nullptr; + } + return iterator->second; + } + + //! Returns false if a NamedRunningStatistic with such id already exists. + NamedRunningStatistic* AddStatistic(const StatIdType& statId, const bool failIfExist = true) + { + if (failIfExist) + { + NamedRunningStatistic* prevStat = GetStatistic(statId); + if (prevStat) + { + return nullptr; + } + } + NamedRunningStatistic* stat = new NamedRunningStatistic(); + m_statistics[statId] = stat; + return stat; + } + + //! Returns false if a NamedRunningStatistic with such id already exists. + NamedRunningStatistic* AddStatistic(const StatIdType& statId, const AZStd::string& name, const AZStd::string& units, const bool failIfExist = true) + { + if (failIfExist) + { + NamedRunningStatistic* prevStat = GetStatistic(statId); + if (prevStat) + { + return nullptr; + } + } + NamedRunningStatistic* stat = new NamedRunningStatistic(name, units); + m_statistics[statId] = stat; + return stat; + } + + virtual void RemoveStatistic(const StatIdType& statId) + { + auto iterator = m_statistics.find(statId); + if (iterator == m_statistics.end()) + { + return; + } + NamedRunningStatistic* prevStat = iterator->second; + delete prevStat; + m_statistics.erase(iterator); + } + + void ResetStatistic(const StatIdType& statId) + { + NamedRunningStatistic* stat = GetStatistic(statId); + if (!stat) + { + return; + } + stat->Reset(); + } + + void ResetAllStatistics() + { + for (auto& it : m_statistics) + { + NamedRunningStatistic* stat = it.second; + stat->Reset(); + } + } + + void PushSampleForStatistic(const StatIdType& statId, double value) + { + NamedRunningStatistic* stat = GetStatistic(statId); + if (!stat) + { + return; + } + stat->PushSample(value); + } + + //! Expensive function because it does a reverse lookup + bool GetStatId(NamedRunningStatistic* searchStat, StatIdType& statIdOut) const + { + for (auto& it : m_statistics) + { + NamedRunningStatistic* stat = it.second; + if (stat == searchStat) + { + statIdOut = it.first; + return true; + } + } + return false; + } + + + private: + ///Key: StatIdType, Value: NamedRunningStatistic* + AZStd::unordered_map m_statistics; + };//class StatisticsManager + }//namespace Statistics +}//namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp new file mode 100644 index 0000000000..0e9b36a8b6 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include "TimeDataStatisticsManager.h" + +namespace AZ +{ + namespace Statistics + { + void TimeDataStatisticsManager::PushTimeDataSample(const char * registerName, const AZ::Debug::ProfilerRegister::TimeData& timeData) + { + const AZStd::string statName(registerName); + NamedRunningStatistic* statistic = GetStatistic(statName); + if (!statistic) + { + const AZStd::string units("us"); + AddStatistic(statName, statName, units, false); + AZ::Debug::ProfilerRegister::TimeData zeroTimeData; + memset(&zeroTimeData, 0, sizeof(AZ::Debug::ProfilerRegister::TimeData)); + m_previousTimeData[statName] = zeroTimeData; + statistic = GetStatistic(statName); + AZ_Assert(statistic != nullptr, "Fatal error adding a new statistic object"); + } + + const AZ::u64 accumulatedTime = timeData.m_time; + const AZ::s64 totalNumCalls = timeData.m_calls; + const AZ::u64 previousAccumulatedTime = m_previousTimeData[statName].m_time; + const AZ::s64 previousTotalNumCalls = m_previousTimeData[statName].m_calls; + const AZ::u64 deltaTime = accumulatedTime - previousAccumulatedTime; + const AZ::s64 deltaCalls = totalNumCalls - previousTotalNumCalls; + + if (deltaCalls == 0) + { + //This is the same old data. Let's skip it + return; + } + + double newSample = static_cast(deltaTime) / deltaCalls; + + statistic->PushSample(newSample); + m_previousTimeData[statName] = timeData; + } + } //namespace Statistics +} //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h new file mode 100644 index 0000000000..c9adc4de2f --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Statistics/TimeDataStatisticsManager.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#include +#include + +namespace AZ +{ + namespace Statistics + { + /** + * @brief Specialization useful for data generated with AZ::Debug::FrameProfileComponent + * + * Timer based data collection using AZ_PROFILE_TIMER(...), available in + * AzCore/Debug/Profiler.h can be collected when using AZ::Debug::FrameProfilerComponent + * and AZ::Debug::FrameProfilerBus. The method PushTimeDataSample(...) is a convenience + * to convert those Timer registers into a RunningStatistic. + * + * + */ + class TimeDataStatisticsManager : public StatisticsManager<> + { + public: + TimeDataStatisticsManager() = default; + virtual ~TimeDataStatisticsManager() = default; + + /** + * @brief Adds one sample data to a specific running stat by name. + * + * This method is specialized to work with ProfilerRegister::TimeData that can be intercepted + * during AZ::Debug::FrameProfilerBus::OnFrameProfilerData(). + * For each @param registerName a new RunningStat object is created if it doesn't exist. + * + * Adds the TimeData as one sample for its RunningStatistic. + */ + void PushTimeDataSample(const char * registerName, const AZ::Debug::ProfilerRegister::TimeData& timeData); + + protected: + ///We store here the previous value from the previous timer frame data. + ///This is necessary because AZ_PROFILER_TIMER is cumulative + ///and we need the time spent for each call. + AZStd::unordered_map m_previousTimeData; + }; + } //namespace Statistics +} //namespace AZ diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index c49c93f220..59db0d94fc 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -566,6 +566,13 @@ set(FILES Statistics/NamedRunningStatistic.h Statistics/RunningStatistic.cpp Statistics/RunningStatistic.h + Statistics/StatisticalProfiler.h + Statistics/StatisticalProfilerProxy.h + Statistics/StatisticalProfilerProxySystemComponent.cpp + Statistics/StatisticalProfilerProxySystemComponent.h + Statistics/StatisticsManager.h + Statistics/TimeDataStatisticsManager.cpp + Statistics/TimeDataStatisticsManager.h StringFunc/StringFunc.cpp StringFunc/StringFunc.h UserSettings/UserSettings.cpp diff --git a/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp b/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp new file mode 100644 index 0000000000..04e70d92a5 --- /dev/null +++ b/Code/Framework/AzCore/Tests/StatisticalProfiler.cpp @@ -0,0 +1,847 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +//REMARK: The macros CODE_PROFILER_PROXY_PUSH_TIME and CODE_PROFILER_PUSH_TIME will be redefined +//several times in this file to accommodate for the different specializations of the StatisticalProfiler<> +//template. +#ifdef CODE_PROFILER_PROXY_PUSH_TIME +#undef CODE_PROFILER_PROXY_PUSH_TIME +#endif + +#ifdef CODE_PROFILER_PUSH_TIME +#undef CODE_PROFILER_PUSH_TIME +#endif + +namespace UnitTest +{ + class StatisticalProfilerTest + : public AllocatorsFixture + { + public: + + StatisticalProfilerTest() + { + } + + void SetUp() override + { + AllocatorsFixture::SetUp(); + } + + ~StatisticalProfilerTest() + { + } + + void TearDown() override + { + AllocatorsFixture::TearDown(); + } + + }; //class StatisticalProfilerTest + + TEST_F(StatisticalProfilerTest, StatisticalProfilerStringNoMutex_ProfileCode_ValidateStatistics) + { +//Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler<>::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler<> profiler; + + const AZStd::string statNamePerformance("PerformanceResult"); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 10; + { + CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(StatisticalProfilerTest, StatisticalProfilerCrc32NoMutex_ProfileCode_ValidateStatistics) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler profiler; + + const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); + const AZStd::string statNamePerformance("PerformanceResult"); + + const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 10; + { + CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(StatisticalProfilerTest, StatisticalProfilerStringWithSharedSpinMutex__ProfileCode_ValidateStatistics) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler profiler; + + const AZStd::string statNamePerformance("PerformanceResult"); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 10; + { + CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(StatisticalProfilerTest, StatisticalProfilerCrc32WithSharedSpinMutex__ProfileCode_ValidateStatistics) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler profiler; + + const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); + const AZStd::string statNamePerformance("PerformanceResult"); + + const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 10; + { + CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + static void simple_thread01(AZ::Statistics::StatisticalProfiler* profiler, int loop_cnt) + { + const AZStd::string simple_thread("simple_thread1"); + const AZStd::string simple_thread_loop("simple_thread1_loop"); + + CODE_PROFILER_PUSH_TIME(*profiler, simple_thread); + + static int counter = 0; + for (int i = 0; i < loop_cnt; i++) + { + CODE_PROFILER_PUSH_TIME(*profiler, simple_thread_loop); + counter++; + } + } + + static void simple_thread02(AZ::Statistics::StatisticalProfiler* profiler, int loop_cnt) + { + const AZStd::string simple_thread("simple_thread2"); + const AZStd::string simple_thread_loop("simple_thread2_loop"); + + CODE_PROFILER_PUSH_TIME(*profiler, simple_thread); + + static int counter = 0; + for (int i = 0; i < loop_cnt; i++) + { + CODE_PROFILER_PUSH_TIME(*profiler, simple_thread_loop); + counter++; + } + } + + static void simple_thread03(AZ::Statistics::StatisticalProfiler* profiler, int loop_cnt) + { + const AZStd::string simple_thread("simple_thread3"); + const AZStd::string simple_thread_loop("simple_thread3_loop"); + + CODE_PROFILER_PUSH_TIME(*profiler, simple_thread); + + static int counter = 0; + for (int i = 0; i < loop_cnt; i++) + { + CODE_PROFILER_PUSH_TIME(*profiler, simple_thread_loop); + counter++; + } + } + +#undef CODE_PROFILER_PUSH_TIME + + TEST_F(StatisticalProfilerTest, StatisticalProfilerStringWithSharedSpinMutex_RunProfiledThreads_ValidateStatistics) + { + AZ::Statistics::StatisticalProfiler profiler; + + const AZStd::string statIdThread1 = "simple_thread1"; + const AZStd::string statNameThread1("simple_thread1"); + const AZStd::string statIdThread1Loop = "simple_thread1_loop"; + const AZStd::string statNameThread1Loop("simple_thread1_loop"); + + const AZStd::string statIdThread2 = "simple_thread2"; + const AZStd::string statNameThread2("simple_thread2"); + const AZStd::string statIdThread2Loop = "simple_thread2_loop"; + const AZStd::string statNameThread2Loop("simple_thread2_loop"); + + const AZStd::string statIdThread3 = "simple_thread3"; + const AZStd::string statNameThread3("simple_thread3"); + const AZStd::string statIdThread3Loop = "simple_thread3_loop"; + const AZStd::string statNameThread3Loop("simple_thread3_loop"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); + + //Let's kickoff the threads to see how much contention affects the profiler's performance. + const int iter_count = 10; + AZStd::thread t1(AZStd::bind(&simple_thread01, &profiler, iter_count)); + AZStd::thread t2(AZStd::bind(&simple_thread02, &profiler, iter_count)); + AZStd::thread t3(AZStd::bind(&simple_thread03, &profiler, iter_count)); + t1.join(); + t2.join(); + t3.join(); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); + + } + + TEST_F(StatisticalProfilerTest, StatisticalProfilerProxy_ProfileCode_ValidateStatistics) + { +#define CODE_PROFILER_PROXY_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); + AZ::Statistics::StatisticalProfilerProxy profilerProxy; + AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdPerformance = "PerformanceResult"; + const AZStd::string statNamePerformance("PerformanceResult"); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdBlock = "Block"; + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); + + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + + const int iter_count = 10; + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdPerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); + + //Clean Up + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + +#undef CODE_PROFILER_PROXY_PUSH_TIME + + } + +#define CODE_PROFILER_PROXY_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + static void simple_thread1(int loop_cnt) + { + const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread1("simple_thread1"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread1_loop("simple_thread1_loop"); + + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread1); + + static int counter = 0; + for (int i = 0; i < loop_cnt; i++) + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread1_loop); + counter++; + } + } + + static void simple_thread2(int loop_cnt) + { + const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread2("simple_thread2"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread2_loop("simple_thread2_loop"); + + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread2); + + static int counter = 0; + for (int i = 0; i < loop_cnt; i++) + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread2_loop); + counter++; + } + } + + static void simple_thread3(int loop_cnt) + { + const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread3("simple_thread3"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType simple_thread3_loop("simple_thread3_loop"); + + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread3); + + static int counter = 0; + for (int i = 0; i < loop_cnt; i++) + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, simple_thread3_loop); + } + } + +#undef CODE_PROFILER_PROXY_PUSH_TIME + + TEST_F(StatisticalProfilerTest, StatisticalProfilerProxy3_RunProfiledThreads_ValidateStatistics) + { + AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); + AZ::Statistics::StatisticalProfilerProxy profilerProxy; + AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1 = "simple_thread1"; + const AZStd::string statNameThread1("simple_thread1"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1Loop = "simple_thread1_loop"; + const AZStd::string statNameThread1Loop("simple_thread1_loop"); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2 = "simple_thread2"; + const AZStd::string statNameThread2("simple_thread2"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2Loop = "simple_thread2_loop"; + const AZStd::string statNameThread2Loop("simple_thread2_loop"); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3 = "simple_thread3"; + const AZStd::string statNameThread3("simple_thread3"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3Loop = "simple_thread3_loop"; + const AZStd::string statNameThread3Loop("simple_thread3_loop"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); + + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + + //Let's kickoff the threads to see how much contention affects the profiler's performance. + const int iter_count = 10; + AZStd::thread t1(AZStd::bind(&simple_thread1, iter_count)); + AZStd::thread t2(AZStd::bind(&simple_thread2, iter_count)); + AZStd::thread t3(AZStd::bind(&simple_thread3, iter_count)); + t1.join(); + t2.join(); + t3.join(); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); + + //Clean Up + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + } + + /** Trace message handler to track messages during tests +*/ + struct MyTraceMessageSink final + : public AZ::Debug::TraceMessageDrillerBus::Handler + { + MyTraceMessageSink() + { + AZ::Debug::TraceMessageDrillerBus::Handler::BusConnect(); + } + + ~MyTraceMessageSink() + { + AZ::Debug::TraceMessageDrillerBus::Handler::BusDisconnect(); + } + + ////////////////////////////////////////////////////////////////////////// + // TraceMessageDrillerBus + void OnPrintf(const char* window, const char* message) override + { + OnOutput(window, message); + } + + void OnOutput(const char* window, const char* message) override + { + printf("%s: %s\n", window, message); + } + }; //struct MyTraceMessageSink + + class Suite_StatisticalProfilerPerformance + : public AllocatorsFixture + { + public: + MyTraceMessageSink* m_testSink; + + Suite_StatisticalProfilerPerformance() :m_testSink(nullptr) + { + } + + void SetUp() override + { + AllocatorsFixture::SetUp(); + m_testSink = new MyTraceMessageSink(); + } + + ~Suite_StatisticalProfilerPerformance() + { + } + + void TearDown() override + { + // clearing up memory + delete m_testSink; + AllocatorsFixture::TearDown(); + } + + }; //class Suite_StatisticalProfilerPerformance + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerStringNoMutex_1ThreadPerformance) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler<>::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler<> profiler; + + const AZStd::string statNamePerformance("PerformanceResult"); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 1000000; + { + CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("StatisticalProfilerStringNoMutex"); + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerCrc32NoMutex_1ThreadPerformance) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler profiler; + + const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); + const AZStd::string statNamePerformance("PerformanceResult"); + + const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 1000000; + { + CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("StatisticalProfilerCrc32NoMutex"); + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerStringWithSharedSpinMutex_1ThreadPerformance) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler profiler; + + const AZStd::string statNamePerformance("PerformanceResult"); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNamePerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statNameBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 1000000; + { + CODE_PROFILER_PUSH_TIME(profiler, statNamePerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statNameBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNamePerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statNameBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statNameBlock)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("StatisticalProfilerStringWithSharedSpinMutex"); + + ASSERT_TRUE(profiler.GetStatistic(statNamePerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerCrc32WithSharedSpinMutex_1ThreadPerformance) + { + //Helper macro. +#define CODE_PROFILER_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfiler::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + AZ::Statistics::StatisticalProfiler profiler; + + const AZ::Crc32 statIdPerformance = AZ_CRC("PerformanceResult", 0xc1f29a10); + const AZStd::string statNamePerformance("PerformanceResult"); + + const AZ::Crc32 statIdBlock = AZ_CRC("Block", 0x831b9722); + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); + + const int iter_count = 1000000; + { + CODE_PROFILER_PUSH_TIME(profiler, statIdPerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PUSH_TIME(profiler, statIdBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("StatisticalProfilerCrc32WithSharedSpinMutex"); + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + +#undef CODE_PROFILER_PUSH_TIME + + } + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerStringWithSharedSpinMutex3Threads_3ThreadsPerformance) + { + AZ::Statistics::StatisticalProfiler profiler; + + const AZStd::string statIdThread1 = "simple_thread1"; + const AZStd::string statNameThread1("simple_thread1"); + const AZStd::string statIdThread1Loop = "simple_thread1_loop"; + const AZStd::string statNameThread1Loop("simple_thread1_loop"); + + const AZStd::string statIdThread2 = "simple_thread2"; + const AZStd::string statNameThread2("simple_thread2"); + const AZStd::string statIdThread2Loop = "simple_thread2_loop"; + const AZStd::string statNameThread2Loop("simple_thread2_loop"); + + const AZStd::string statIdThread3 = "simple_thread3"; + const AZStd::string statNameThread3("simple_thread3"); + const AZStd::string statIdThread3Loop = "simple_thread3_loop"; + const AZStd::string statNameThread3Loop("simple_thread3_loop"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); + + //Let's kickoff the threads to see how much contention affects the profiler's performance. + const int iter_count = 1000000; + AZStd::thread t1(AZStd::bind(&simple_thread01, &profiler, iter_count)); + AZStd::thread t2(AZStd::bind(&simple_thread02, &profiler, iter_count)); + AZStd::thread t3(AZStd::bind(&simple_thread03, &profiler, iter_count)); + t1.join(); + t2.join(); + t3.join(); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("3_Threads_StatisticalProfiler"); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); + + } + +#define CODE_PROFILER_PROXY_PUSH_TIME(profiler, scopeNameId) \ + AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, scopeNameId); + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerProxy_1ThreadPerformance) + { + AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); + AZ::Statistics::StatisticalProfilerProxy profilerProxy; + AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdPerformance = "PerformanceResult"; + const AZStd::string statNamePerformance("PerformanceResult"); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdBlock = "Block"; + const AZStd::string statNameBlock("Block"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdPerformance, statNamePerformance, "us") != nullptr); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdBlock, statNameBlock, "us") != nullptr); + + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + + const int iter_count = 1000000; + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdPerformance) + int counter = 0; + for (int i = 0; i < iter_count; i++) + { + CODE_PROFILER_PROXY_PUSH_TIME(AZ::Debug::ProfileCategory::Terrain, statIdBlock) + counter++; + } + } + + ASSERT_TRUE(profiler.GetStatistic(statIdPerformance) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdPerformance)->GetNumSamples(), 1); + + ASSERT_TRUE(profiler.GetStatistic(statIdBlock) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdBlock)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("StatisticalProfilerProxy"); + + //Clean Up + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + } + +#undef CODE_PROFILER_PROXY_PUSH_TIME + + TEST_F(Suite_StatisticalProfilerPerformance, StatisticalProfilerProxy_3ThreadsPerformance) + { + AZ::Statistics::StatisticalProfilerProxy::TimedScope::ClearCachedProxy(); + AZ::Statistics::StatisticalProfilerProxy profilerProxy; + AZ::Statistics::StatisticalProfilerProxy* proxy = AZ::Interface::Get(); + AZ::Statistics::StatisticalProfilerProxy::StatisticalProfilerType& profiler = proxy->GetProfiler(AZ::Debug::ProfileCategory::Terrain); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1 = "simple_thread1"; + const AZStd::string statNameThread1("simple_thread1"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread1Loop = "simple_thread1_loop"; + const AZStd::string statNameThread1Loop("simple_thread1_loop"); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2 = "simple_thread2"; + const AZStd::string statNameThread2("simple_thread2"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread2Loop = "simple_thread2_loop"; + const AZStd::string statNameThread2Loop("simple_thread2_loop"); + + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3 = "simple_thread3"; + const AZStd::string statNameThread3("simple_thread3"); + const AZ::Statistics::StatisticalProfilerProxy::StatIdType statIdThread3Loop = "simple_thread3_loop"; + const AZStd::string statNameThread3Loop("simple_thread3_loop"); + + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1, statNameThread1, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread1Loop, statNameThread1Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2, statNameThread2, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread2Loop, statNameThread2Loop, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3, statNameThread3, "us")); + ASSERT_TRUE(profiler.GetStatsManager().AddStatistic(statIdThread3Loop, statNameThread3Loop, "us")); + + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, true); + + //Let's kickoff the threads to see how much contention affects the profiler's performance. + const int iter_count = 1000000; + AZStd::thread t1(AZStd::bind(&simple_thread1, iter_count)); + AZStd::thread t2(AZStd::bind(&simple_thread2, iter_count)); + AZStd::thread t3(AZStd::bind(&simple_thread3, iter_count)); + t1.join(); + t2.join(); + t3.join(); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread1) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread1Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread1Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread2) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread2Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread2Loop)->GetNumSamples(), iter_count); + + ASSERT_TRUE(profiler.GetStatistic(statIdThread3) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3)->GetNumSamples(), 1); + ASSERT_TRUE(profiler.GetStatistic(statIdThread3Loop) != nullptr); + EXPECT_EQ(profiler.GetStatistic(statIdThread3Loop)->GetNumSamples(), iter_count); + + profiler.LogAndResetStats("3_Threads_StatisticalProfilerProxy"); + + //Clean Up + proxy->ActivateProfiler(AZ::Debug::ProfileCategory::Terrain, false); + } + +}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/Statistics.cpp b/Code/Framework/AzCore/Tests/Statistics.cpp new file mode 100644 index 0000000000..941c2eff0b --- /dev/null +++ b/Code/Framework/AzCore/Tests/Statistics.cpp @@ -0,0 +1,263 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#include +#include +#include + +#include +#include + +#include + +using namespace AZ; +using namespace Debug; + +namespace UnitTest +{ + class StatisticsTest + : public AllocatorsFixture + { + public: + StatisticsTest() + { + } + + void SetUp() override + { + AllocatorsFixture::SetUp(); + + m_dataSamples = AZStd::make_unique>(); + const u32 numSamples = 100; + m_dataSamples->set_capacity(numSamples); + for (u32 i = 0; i < numSamples; ++i) + { + m_dataSamples->push_back(i); + } + } + + ~StatisticsTest() + { + } + + void TearDown() override + { + // clearing up memory + m_dataSamples = nullptr; + + AllocatorsFixture::TearDown(); + } + + protected: + AZStd::unique_ptr> m_dataSamples; + }; //class StatisticsTest + + TEST_F(StatisticsTest, RunningStatistic_ProcessAnArrayOfNumbers_GetExpectedStatisticalData) + { + Statistics::RunningStatistic runningStat; + + ASSERT_TRUE(m_dataSamples.get() != nullptr); + const AZStd::vector& dataSamples = *m_dataSamples; + for (u32 sample : dataSamples) + { + runningStat.PushSample(sample); + } + + EXPECT_EQ(runningStat.GetNumSamples(), dataSamples.size()); + EXPECT_EQ(runningStat.GetMostRecentSample(), dataSamples.back()); + EXPECT_EQ(runningStat.GetMinimum(), dataSamples[0]); + EXPECT_EQ(runningStat.GetMaximum(), dataSamples.back()); + EXPECT_NEAR(runningStat.GetAverage(), 49.5, 0.001); + EXPECT_NEAR(runningStat.GetVariance(), 841.666, 0.001); + EXPECT_NEAR(runningStat.GetStdev(), 29.011, 0.001); + EXPECT_NEAR(runningStat.GetVariance(Statistics::VarianceType::P), 833.25, 0.001); + EXPECT_NEAR(runningStat.GetStdev(Statistics::VarianceType::P), 28.866, 0.001); + + //Reset the stat object. + runningStat.Reset(); + EXPECT_EQ(runningStat.GetNumSamples(), 0); + EXPECT_EQ(runningStat.GetAverage(), 0.0); + EXPECT_EQ(runningStat.GetStdev(), 0.0); + } + + + TEST_F(StatisticsTest, StatisticsManager_AddAndRemoveStatisticistics_CollectionIntegrityIsCorrect) + { + Statistics::StatisticsManager<> statsManager; + AZStd::string statName0("stat0"); + AZStd::string statName1("stat1"); + AZStd::string statName2("stat2"); + AZStd::string statName3("stat3"); + EXPECT_TRUE(statsManager.AddStatistic(statName0, statName0, "")); + EXPECT_TRUE(statsManager.AddStatistic(statName1, statName1, "")); + EXPECT_TRUE(statsManager.AddStatistic(statName2, statName2, "")); + EXPECT_TRUE(statsManager.AddStatistic(statName3, statName3, "")); + + //Validate the number of running statistics object we have so far. + { + AZStd::vector allStats; + statsManager.GetAllStatistics(allStats); + EXPECT_TRUE(allStats.size() == 4); + } + + //Try to add an Stat that already exist. expect to fail. + EXPECT_EQ(statsManager.AddStatistic(statName1), nullptr); + + //Remove stat1. + statsManager.RemoveStatistic(statName1); + //Validate the number of running statistics object we have so far. + { + AZStd::vector allStats; + statsManager.GetAllStatistics(allStats); + EXPECT_TRUE(allStats.size() == 3); + } + + //Add stat1 again, expect to pass. + EXPECT_TRUE(statsManager.AddStatistic(statName1)); + + //Get a pointer to stat2. + Statistics::NamedRunningStatistic* stat2 = statsManager.GetStatistic(statName2); + ASSERT_TRUE(stat2 != nullptr); + EXPECT_EQ(stat2->GetName(), statName2); + } + + TEST_F(StatisticsTest, StatisticsManager_DistributeSamplesAcrossStatistics_StatisticsAreCorrect) + { + Statistics::StatisticsManager<> statsManager; + AZStd::string statName0("stat0"); + AZStd::string statName1("stat1"); + AZStd::string statName2("stat2"); + AZStd::string statName3("stat3"); + + EXPECT_TRUE(statsManager.AddStatistic(statName3)); + EXPECT_TRUE(statsManager.AddStatistic(statName0)); + EXPECT_TRUE(statsManager.AddStatistic(statName2)); + EXPECT_TRUE(statsManager.AddStatistic(statName1)); + + //Distribute the 100 samples of data evenly across the 4 running statistics. + ASSERT_TRUE(m_dataSamples.get() != nullptr); + const AZStd::vector& dataSamples = *m_dataSamples; + const size_t numSamples = dataSamples.size(); + const size_t numSamplesPerStat = numSamples / 4; + size_t sampleIndex = 0; + size_t nextStopIndex = numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName0, dataSamples[sampleIndex]); + sampleIndex++; + } + nextStopIndex += numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName1, dataSamples[sampleIndex]); + sampleIndex++; + } + nextStopIndex += numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName2, dataSamples[sampleIndex]); + sampleIndex++; + } + nextStopIndex += numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName3, dataSamples[sampleIndex]); + sampleIndex++; + } + + EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetAverage(), 12.0, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetAverage(), 37.0, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetAverage(), 62.0, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetAverage(), 87.0, 0.001); + + EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetStdev(), 7.359, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetStdev(), 7.359, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetStdev(), 7.359, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetStdev(), 7.359, 0.001); + + //Reset one of the stats. + statsManager.ResetStatistic(statName2); + EXPECT_EQ(statsManager.GetStatistic(statName2)->GetAverage(), 0.0); + //Reset all of the stats. + statsManager.ResetAllStatistics(); + EXPECT_EQ(statsManager.GetStatistic(statName0)->GetNumSamples(), 0); + EXPECT_EQ(statsManager.GetStatistic(statName1)->GetNumSamples(), 0); + EXPECT_EQ(statsManager.GetStatistic(statName2)->GetNumSamples(), 0); + EXPECT_EQ(statsManager.GetStatistic(statName3)->GetNumSamples(), 0); + } + + TEST_F(StatisticsTest, StatisticsManagerCrc32_DistributeSamplesAcrossStatistics_StatisticsAreCorrect) + { + Statistics::StatisticsManager statsManager; + AZ::Crc32 statName0 = AZ_CRC("stat0", 0xb8927780); + AZ::Crc32 statName1 = AZ_CRC("stat1", 0xcf954716); + AZ::Crc32 statName2 = AZ_CRC("stat2", 0x569c16ac); + AZ::Crc32 statName3 = AZ_CRC("stat3", 0x219b263a); + + EXPECT_TRUE(statsManager.AddStatistic(statName3) != nullptr); + EXPECT_TRUE(statsManager.AddStatistic(statName0) != nullptr); + EXPECT_TRUE(statsManager.AddStatistic(statName2) != nullptr); + EXPECT_TRUE(statsManager.AddStatistic(statName1) != nullptr); + + EXPECT_TRUE(statsManager.GetStatistic(statName3) != nullptr); + EXPECT_TRUE(statsManager.GetStatistic(statName0) != nullptr); + EXPECT_TRUE(statsManager.GetStatistic(statName1) != nullptr); + EXPECT_TRUE(statsManager.GetStatistic(statName2) != nullptr); + + //Distribute the 100 samples of data evenly across the 4 running statistics. + ASSERT_TRUE(m_dataSamples.get() != nullptr); + const AZStd::vector& dataSamples = *m_dataSamples; + const size_t numSamples = dataSamples.size(); + const size_t numSamplesPerStat = numSamples / 4; + size_t sampleIndex = 0; + size_t nextStopIndex = numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName0, dataSamples[sampleIndex]); + sampleIndex++; + } + nextStopIndex += numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName1, dataSamples[sampleIndex]); + sampleIndex++; + } + nextStopIndex += numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName2, dataSamples[sampleIndex]); + sampleIndex++; + } + nextStopIndex += numSamplesPerStat; + while (sampleIndex < nextStopIndex) + { + statsManager.PushSampleForStatistic(statName3, dataSamples[sampleIndex]); + sampleIndex++; + } + + EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetAverage(), 12.0, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetAverage(), 37.0, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetAverage(), 62.0, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetAverage(), 87.0, 0.001); + + EXPECT_NEAR(statsManager.GetStatistic(statName0)->GetStdev(), 7.359, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName1)->GetStdev(), 7.359, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName2)->GetStdev(), 7.359, 0.001); + EXPECT_NEAR(statsManager.GetStatistic(statName3)->GetStdev(), 7.359, 0.001); + + //Reset one of the stats. + statsManager.ResetStatistic(statName2); + EXPECT_EQ(statsManager.GetStatistic(statName2)->GetAverage(), 0.0); + //Reset all of the stats. + statsManager.ResetAllStatistics(); + EXPECT_EQ(statsManager.GetStatistic(statName0)->GetNumSamples(), 0); + EXPECT_EQ(statsManager.GetStatistic(statName1)->GetNumSamples(), 0); + EXPECT_EQ(statsManager.GetStatistic(statName2)->GetNumSamples(), 0); + EXPECT_EQ(statsManager.GetStatistic(statName3)->GetNumSamples(), 0); + } + +}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp new file mode 100644 index 0000000000..50856b1df8 --- /dev/null +++ b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp @@ -0,0 +1,207 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +using namespace AZ; +using namespace Debug; + +namespace UnitTest +{ + /** + * Validate functionality of the convenience class TimeDataStatisticsManager. + * It is a specialized version of RunningStatisticsManager that works with Timer type + * of registers that can be captured with the FrameProfilerBus::OnFrameProfilerData() + */ + class TimeDataStatisticsManagerTest + : public AllocatorsFixture + , public FrameProfilerBus::Handler + { + static constexpr const char* PARENT_TIMER_STAT = "ParentStat"; + static constexpr const char* CHILD_TIMER_STAT0 = "ChildStat0"; + static constexpr const char* CHILD_TIMER_STAT1 = "ChildStat1"; + + public: + TimeDataStatisticsManagerTest() + : AllocatorsFixture() + { + } + + void SetUp() override + { + AllocatorsFixture::SetUp(); + m_statsManager = AZStd::make_unique(); + } + + void TearDown() override + { + m_statsManager = nullptr; + AllocatorsFixture::TearDown(); + } + + ////////////////////////////////////////////////////////////////////////// + // FrameProfilerBus + virtual void OnFrameProfilerData(const FrameProfiler::ThreadDataArray& data) + { + for (size_t iThread = 0; iThread < data.size(); ++iThread) + { + const FrameProfiler::ThreadData& td = data[iThread]; + FrameProfiler::ThreadData::RegistersMap::const_iterator regIt = td.m_registers.begin(); + for (; regIt != td.m_registers.end(); ++regIt) + { + const FrameProfiler::RegisterData& rd = regIt->second; + u32 unitTestCrc = AZ_CRC("UnitTest", 0x8089cea8); + if (unitTestCrc != rd.m_systemId) + { + continue; //Not for us. + } + ASSERT_EQ(ProfilerRegister::PRT_TIME, rd.m_type); + const FrameProfiler::FrameData& fd = rd.m_frames.back(); + m_statsManager->PushTimeDataSample(rd.m_name, fd.m_timeData); + } + } + } + ////////////////////////////////////////////////////////////////////////// + + int ChildFunction0(int numIterations, int sleepTimeMilliseconds) + { + AZ_PROFILE_TIMER("UnitTest", CHILD_TIMER_STAT0); + AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); + int result = 5; + for (int i = 0; i < numIterations; ++i) + { + result += i % 3; + } + return result; + } + + int ChildFunction1(int numIterations, int sleepTimeMilliseconds) + { + AZ_PROFILE_TIMER("UnitTest", CHILD_TIMER_STAT1); + AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); + int result = 5; + for (int i = 0; i < numIterations; ++i) + { + result += i % 3; + } + return result; + } + + int ParentFunction(int numIterations, int sleepTimeMilliseconds) + { + AZ_PROFILE_TIMER("UnitTest", PARENT_TIMER_STAT); + AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); + int result = 0; + result += ChildFunction0(numIterations, sleepTimeMilliseconds); + result += ChildFunction1(numIterations, sleepTimeMilliseconds); + return result; + } + + void run() + { + Debug::FrameProfilerBus::Handler::BusConnect(); + + ComponentApplication app; + ComponentApplication::Descriptor desc; + desc.m_useExistingAllocator = true; + desc.m_enableDrilling = false; // we already created a memory driller for the test (AllocatorsFixture) + ComponentApplication::StartupParameters startupParams; + startupParams.m_allocator = &AllocatorInstance::Get(); + Entity* systemEntity = app.Create(desc, startupParams); + systemEntity->CreateComponent(); + + systemEntity->Init(); + systemEntity->Activate(); // start frame component + + const int sleepTimeAllFuncsMillis = 1; + const int numIterations = 10; + for (int iterationCounter = 0; iterationCounter < numIterations; ++iterationCounter) + { + ParentFunction(numIterations, sleepTimeAllFuncsMillis); + //Collect all samples. + app.Tick(); + } + + //Verify we have three running stats. + { + AZStd::vector allStats; + m_statsManager->GetAllStatistics(allStats); + EXPECT_EQ(allStats.size(), 3); + } + + AZStd::string parentStatName(PARENT_TIMER_STAT); + AZStd::string child0StatName(CHILD_TIMER_STAT0); + AZStd::string child1StatName(CHILD_TIMER_STAT1); + ASSERT_TRUE(m_statsManager->GetStatistic(parentStatName) != nullptr); + ASSERT_TRUE(m_statsManager->GetStatistic(child0StatName) != nullptr); + ASSERT_TRUE(m_statsManager->GetStatistic(child1StatName) != nullptr); + + EXPECT_EQ(m_statsManager->GetStatistic(parentStatName)->GetNumSamples(), numIterations); + EXPECT_EQ(m_statsManager->GetStatistic(child0StatName)->GetNumSamples(), numIterations); + EXPECT_EQ(m_statsManager->GetStatistic(child1StatName)->GetNumSamples(), numIterations); + + const double minimumExpectDurationOfChildFunctionMicros = 1; + const double minimumExpectDurationOfParentFunctionMicros = 1; + + EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetMinimum(), minimumExpectDurationOfParentFunctionMicros); + EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetAverage(), minimumExpectDurationOfParentFunctionMicros); + EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetMaximum(), minimumExpectDurationOfParentFunctionMicros); + + EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetMinimum(), minimumExpectDurationOfChildFunctionMicros); + EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetAverage(), minimumExpectDurationOfChildFunctionMicros); + EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetMaximum(), minimumExpectDurationOfChildFunctionMicros); + + EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetMinimum(), minimumExpectDurationOfChildFunctionMicros); + EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetAverage(), minimumExpectDurationOfChildFunctionMicros); + EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetMaximum(), minimumExpectDurationOfChildFunctionMicros); + + //Let's validate TimeDataStatisticsManager::RemoveStatistics() + m_statsManager->RemoveStatistic(child1StatName); + ASSERT_TRUE(m_statsManager->GetStatistic(parentStatName) != nullptr); + ASSERT_TRUE(m_statsManager->GetStatistic(child0StatName) != nullptr); + EXPECT_EQ(m_statsManager->GetStatistic(child1StatName), nullptr); + + //Let's store the sample count for both parentStatName and child0StatName. + const AZ::u64 numSamplesParent = m_statsManager->GetStatistic(parentStatName)->GetNumSamples(); + const AZ::u64 numSamplesChild0 = m_statsManager->GetStatistic(child0StatName)->GetNumSamples(); + + //Let's call child1 function again and call app.Tick(). child1StatName should be readded to m_statsManager. + ChildFunction1(numIterations, sleepTimeAllFuncsMillis); + app.Tick(); + ASSERT_TRUE(m_statsManager->GetStatistic(child1StatName) != nullptr); + EXPECT_EQ(m_statsManager->GetStatistic(parentStatName)->GetNumSamples(), numSamplesParent); + EXPECT_EQ(m_statsManager->GetStatistic(child0StatName)->GetNumSamples(), numSamplesChild0); + EXPECT_EQ(m_statsManager->GetStatistic(child1StatName)->GetNumSamples(), 1); + + Debug::FrameProfilerBus::Handler::BusDisconnect(); + app.Destroy(); + } + + AZStd::unique_ptr m_statsManager; + };//class TimeDataStatisticsManagerTest + + TEST_F(TimeDataStatisticsManagerTest, Test) + { + run(); + } + //End of all Tests of TimeDataStatisticsManagerTest + +}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/azcoretests_files.cmake b/Code/Framework/AzCore/Tests/azcoretests_files.cmake index 7833cf97bb..911eaa7b10 100644 --- a/Code/Framework/AzCore/Tests/azcoretests_files.cmake +++ b/Code/Framework/AzCore/Tests/azcoretests_files.cmake @@ -60,11 +60,13 @@ set(FILES SerializeContextFixture.h Slice.cpp State.cpp + Statistics.cpp StreamerTests.cpp StringFunc.cpp SystemFile.cpp TaskTests.cpp TickBusTest.cpp + TimeDataStatistics.cpp UUIDTests.cpp XML.cpp Debug/AssetTracking.cpp diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h index e73f641b96..454a6d4086 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.h @@ -130,7 +130,6 @@ namespace AZ template struct StableDynamicArray::Page { - static constexpr size_t PageSize = ElementsPerPage * sizeof(T); static constexpr size_t InvalidPage = -1; static constexpr uint64_t FullBits = 0xFFFFFFFFFFFFFFFFull; static constexpr size_t NumUint64_t = ElementsPerPage / 64; From ec6e9407f6cd1a1c8f535785def37b33e2dd80a3 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 18 Aug 2021 17:20:27 -0600 Subject: [PATCH 093/100] Remove RAD (pending future interface for external profiler registration) Signed-off-by: Jeremy Ong --- .../AzCore/Component/ComponentApplication.h | 1 - .../AzCore/AzCore/Debug/EventTrace.h | 17 +- .../AzCore/AzCore/Debug/ProfileModuleInit.cpp | 53 --- .../AzCore/AzCore/Debug/ProfileModuleInit.h | 36 -- Code/Framework/AzCore/AzCore/Debug/Profiler.h | 6 - Code/Framework/AzCore/AzCore/Module/Module.h | 4 - .../AzCore/Script/ScriptSystemComponent.cpp | 8 - .../Statistics/StatisticalProfilerProxy.h | 4 +- .../AzCore/AzCore/azcore_files.cmake | 2 - Code/Framework/AzCore/CMakeLists.txt | 11 - .../profile_telemetry_platform_android.cmake | 4 - .../Common/RadTelemetry/ProfileTelemetry.h | 143 -------- .../Common/RadTelemetry/ProfileTelemetryBus.h | 49 --- .../Mac/profile_telemetry_platform_mac.cmake | 4 - .../profile_telemetry_platform_windows.cmake | 4 - .../iOS/profile_telemetry_platform_ios.cmake | 4 - .../AzCore/Tests/TimeDataStatistics.cpp | 11 +- Code/Legacy/CryCommon/ISystem.h | 11 - Code/Legacy/CryCommon/ProjectDefines.h | 2 +- Code/Legacy/CryCommon/platform_impl.cpp | 2 - Gems/RADTelemetry/CMakeLists.txt | 9 - Gems/RADTelemetry/Code/CMakeLists.txt | 47 --- .../Android/RADTelemetry_Traits_Platform.h | 10 - .../Android/platform_android_files.cmake | 11 - .../Linux/RADTelemetry_Traits_Platform.h | 10 - .../Platform/Linux/platform_linux_files.cmake | 11 - .../Mac/RADTelemetry_Traits_Platform.h | 10 - .../Platform/Mac/platform_mac_files.cmake | 11 - .../Windows/RADTelemetry_Traits_Platform.h | 10 - .../Windows/platform_windows_files.cmake | 11 - .../iOS/RADTelemetry_Traits_Platform.h | 10 - .../Platform/iOS/platform_ios_files.cmake | 11 - .../Code/Source/ProfileTelemetryComponent.cpp | 344 ------------------ .../Code/Source/ProfileTelemetryComponent.h | 103 ------ .../Code/Source/RADTelemetryModule.cpp | 132 ------- .../Code/radtelemetry_files.cmake | 12 - .../Code/radtelemetry_shared_files.cmake | 11 - Gems/RADTelemetry/gem.json | 13 - Gems/RADTelemetry/preview.png | 3 - .../Android/RadTelemetry_android.cmake | 9 - .../Platform/Mac/RadTelemetry_mac.cmake | 11 - .../Windows/RadTelemetry_windows.cmake | 11 - .../Platform/iOS/RadTelemetry_ios.cmake | 9 - engine.json | 1 - 44 files changed, 12 insertions(+), 1184 deletions(-) delete mode 100644 Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.h delete mode 100644 Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h delete mode 100644 Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetryBus.h delete mode 100644 Gems/RADTelemetry/CMakeLists.txt delete mode 100644 Gems/RADTelemetry/Code/CMakeLists.txt delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Android/RADTelemetry_Traits_Platform.h delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Android/platform_android_files.cmake delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Linux/RADTelemetry_Traits_Platform.h delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Linux/platform_linux_files.cmake delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Mac/RADTelemetry_Traits_Platform.h delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Mac/platform_mac_files.cmake delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Windows/RADTelemetry_Traits_Platform.h delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/Windows/platform_windows_files.cmake delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/iOS/RADTelemetry_Traits_Platform.h delete mode 100644 Gems/RADTelemetry/Code/Source/Platform/iOS/platform_ios_files.cmake delete mode 100644 Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp delete mode 100644 Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.h delete mode 100644 Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp delete mode 100644 Gems/RADTelemetry/Code/radtelemetry_files.cmake delete mode 100644 Gems/RADTelemetry/Code/radtelemetry_shared_files.cmake delete mode 100644 Gems/RADTelemetry/gem.json delete mode 100644 Gems/RADTelemetry/preview.png delete mode 100644 cmake/3rdParty/Platform/Android/RadTelemetry_android.cmake delete mode 100644 cmake/3rdParty/Platform/Mac/RadTelemetry_mac.cmake delete mode 100644 cmake/3rdParty/Platform/Windows/RadTelemetry_windows.cmake delete mode 100644 cmake/3rdParty/Platform/iOS/RadTelemetry_ios.cmake diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h index 278e911455..d2da86c368 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/Code/Framework/AzCore/AzCore/Debug/EventTrace.h b/Code/Framework/AzCore/AzCore/Debug/EventTrace.h index 8d096707ba..1bc7ee20a6 100644 --- a/Code/Framework/AzCore/AzCore/Debug/EventTrace.h +++ b/Code/Framework/AzCore/AzCore/Debug/EventTrace.h @@ -38,17 +38,6 @@ namespace AZ } } -#ifdef AZ_PROFILE_TELEMETRY -# define AZ_TRACE_METHOD_NAME_CATEGORY(name, category) AZ::Debug::EventTrace::ScopedSlice AZ_JOIN(ScopedSlice__, __LINE__)(name, category); -# define AZ_TRACE_METHOD_NAME(name) \ - AZ_TRACE_METHOD_NAME_CATEGORY(name, "") \ - AZ_PROFILE_SCOPE(AzTrace, name) - -# define AZ_TRACE_METHOD() \ - AZ_TRACE_METHOD_NAME_CATEGORY(AZ_FUNCTION_SIGNATURE, "") \ - AZ_PROFILE_FUNCTION(AzTrace) -#else -# define AZ_TRACE_METHOD_NAME_CATEGORY(name, category) -# define AZ_TRACE_METHOD_NAME(name) AZ_TRACE_METHOD_NAME_CATEGORY(name, "") -# define AZ_TRACE_METHOD() AZ_TRACE_METHOD_NAME(AZ_FUNCTION_SIGNATURE) -#endif +#define AZ_TRACE_METHOD_NAME_CATEGORY(name, category) +#define AZ_TRACE_METHOD_NAME(name) AZ_TRACE_METHOD_NAME_CATEGORY(name, "") +#define AZ_TRACE_METHOD() AZ_TRACE_METHOD_NAME(AZ_FUNCTION_SIGNATURE) diff --git a/Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.cpp b/Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.cpp deleted file mode 100644 index 9dda1f7656..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#ifdef AZ_PROFILE_TELEMETRY -# include - // Define the per-module RAD Telemetry instance pointer - struct tm_api; - tm_api* g_radTmApi; -#endif - - -namespace AZ -{ - namespace Debug - { - void ProfileModuleInit() - { -#if defined(AZ_PROFILE_TELEMETRY) - { - if (!g_radTmApi) - { - using namespace RADTelemetry; - ProfileTelemetryRequestBus::BroadcastResult(g_radTmApi, &ProfileTelemetryRequests::GetApiInstance); - } - } -#endif - // Add additional per-DLL required profiler initialization here - } - - - ProfileModuleInitializer::ProfileModuleInitializer() - { - ProfilerNotificationBus::Handler::BusConnect(); - } - - ProfileModuleInitializer::~ProfileModuleInitializer() - { - ProfilerNotificationBus::Handler::BusDisconnect(); - } - - void ProfileModuleInitializer::OnProfileSystemInitialized() - { - ProfileModuleInit(); - } - } -} diff --git a/Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.h b/Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.h deleted file mode 100644 index e6666c9747..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/ProfileModuleInit.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace AZ -{ - namespace Debug - { - //! Perform any required per-module initialization of the current profiler - void ProfileModuleInit(); - - - /*! - * ProfileModuleInitializer - * Helper class that calls ProfileModuleInit when OnProfileSystemInitialized is fired. - */ - class ProfileModuleInitializer - : private AZ::Debug::ProfilerNotificationBus::Handler - { - public: - ProfileModuleInitializer(); - ~ProfileModuleInitializer() override; - - private: - void OnProfileSystemInitialized() override; - }; - } -} diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index 5cb6142ebf..1d932031ef 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -15,10 +15,6 @@ #include #endif -#ifdef AZ_PROFILE_TELEMETRY -# include -#endif - #if defined(AZ_PROFILER_MACRO_DISABLE) // by default we never disable the profiler registers as their overhead should be minimal, you can still do that for your code though. # define AZ_PROFILE_SCOPE(...) # define AZ_PROFILE_FUNCTION(...) @@ -38,7 +34,6 @@ #endif // AZ_PROFILER_MACRO_DISABLE #ifndef AZ_PROFILE_INTERVAL_START -// No other profiler has defined the performance markers AZ_PROFILE_INTERVAL_START/END, fallback to a Driller implementation (currently empty) # define AZ_PROFILE_INTERVAL_START(...) # define AZ_PROFILE_INTERVAL_START_COLORED(...) # define AZ_PROFILE_INTERVAL_END(...) @@ -46,7 +41,6 @@ #endif #ifndef AZ_PROFILE_DATAPOINT -// No other profiler has defined the performance markers AZ_PROFILE_DATAPOINT, fallback to a Driller implementation (currently empty) # define AZ_PROFILE_DATAPOINT(...) # define AZ_PROFILE_DATAPOINT_PERCENT(...) #endif diff --git a/Code/Framework/AzCore/AzCore/Module/Module.h b/Code/Framework/AzCore/AzCore/Module/Module.h index 2c87b4f0fb..9606342cf7 100644 --- a/Code/Framework/AzCore/AzCore/Module/Module.h +++ b/Code/Framework/AzCore/AzCore/Module/Module.h @@ -9,7 +9,6 @@ #define AZCORE_MODULE_INCLUDE_H 1 #include -#include #include #include #include @@ -78,9 +77,6 @@ namespace AZ protected: AZStd::list m_descriptors; - - private: - AZ::Debug::ProfileModuleInitializer m_moduleProfilerInit; }; } // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp index 018f9ed15a..a83232c8cb 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp @@ -287,14 +287,6 @@ void ScriptSystemComponent::OnSystemTick() contextContainer.m_context->GetDebugContext()->ProcessDebugCommands(); } -#ifdef AZ_PROFILE_TELEMETRY - if (contextContainer.m_context->GetId() == ScriptContextIds::DefaultScriptContextId) - { - size_t memoryUsageBytes = contextContainer.m_context->GetMemoryUsage(); - AZ_PROFILE_DATAPOINT(Script, memoryUsageBytes / 1024.0, "Script Memory (KB)"); - } -#endif // AZ_PROFILE_TELEMETRY - contextContainer.m_context->GarbageCollectStep(contextContainer.m_garbageCollectorSteps); } } diff --git a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h index 5ea69b205c..33d835076f 100644 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h @@ -17,7 +17,7 @@ #include -#if !defined(AZ_PROFILE_TELEMETRY) && defined(AZ_STATISTICAL_PROFILING_ENABLED) +#if defined(AZ_STATISTICAL_PROFILING_ENABLED) #if defined(AZ_PROFILE_SCOPE) #undef AZ_PROFILE_SCOPE @@ -27,7 +27,7 @@ static const AZStd::string AZ_JOIN(blockName, __LINE__)(scopeNameId); \ AZ::Statistics::StatisticalProfilerProxy::TimedScope AZ_JOIN(scope, __LINE__)(profiler, AZ_JOIN(blockName, __LINE__)); -#endif //#if !defined(AZ_PROFILE_TELEMETRY) +#endif //#if defined(AZ_STATISTICAL_PROFILING_ENABLED) namespace AZ::Statistics { diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 59db0d94fc..d106b5b12f 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -100,8 +100,6 @@ set(FILES Debug/FrameProfilerComponent.h Debug/IEventLogger.h Debug/MemoryProfiler.h - Debug/ProfileModuleInit.cpp - Debug/ProfileModuleInit.h Debug/Profiler.cpp Debug/Profiler.h Debug/ProfilerBus.h diff --git a/Code/Framework/AzCore/CMakeLists.txt b/Code/Framework/AzCore/CMakeLists.txt index ab9596e2b2..f764242843 100644 --- a/Code/Framework/AzCore/CMakeLists.txt +++ b/Code/Framework/AzCore/CMakeLists.txt @@ -12,13 +12,6 @@ ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) ly_get_list_relative_pal_filename(common_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/Common) -if(LY_RAD_TELEMETRY_ENABLED) - set(AZ_CORE_RADTELEMETRY_FILES ${common_dir}/azcore_profile_telemetry_files.cmake) - set(AZ_CORE_RADTELEMETRY_PLATFORM_INCLUDES ${pal_dir}/profile_telemetry_platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) - set(AZ_CORE_RADTELEMETRY_INCLUDE_DIRECTORIES ${common_dir}) - set(AZ_CORE_RADTELEMETRY_BUILD_DEPENDENCIES 3rdParty::RadTelemetry) -endif() - if(PAL_TRAIT_PROF_PIX_SUPPORTED AND LY_PIX_ENABLED) set(LY_PIX_PATH "${LY_3RDPARTY_PATH}/winpixeventruntime" CACHE PATH "Path to the Windows Pix Event Runtime.") set(AZ_CORE_PIX_BUILD_DEPENDENCIES 3rdParty::pix) @@ -32,16 +25,13 @@ ly_add_target( AzCore/azcore_files.cmake AzCore/std/azstd_files.cmake ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - ${AZ_CORE_RADTELEMETRY_FILES} PLATFORM_INCLUDE_FILES ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake - ${AZ_CORE_RADTELEMETRY_PLATFORM_INCLUDES} INCLUDE_DIRECTORIES PUBLIC . ${pal_dir} ${common_dir} - ${AZ_CORE_RADTELEMETRY_INCLUDE_DIRECTORIES} BUILD_DEPENDENCIES PUBLIC 3rdParty::Lua @@ -50,7 +40,6 @@ ly_add_target( 3rdParty::zlib 3rdParty::zstd 3rdParty::cityhash - ${AZ_CORE_RADTELEMETRY_BUILD_DEPENDENCIES} ${AZ_CORE_PIX_BUILD_DEPENDENCIES} COMPILE_DEFINITIONS PUBLIC diff --git a/Code/Framework/AzCore/Platform/Android/profile_telemetry_platform_android.cmake b/Code/Framework/AzCore/Platform/Android/profile_telemetry_platform_android.cmake index df12777586..9ecf9fd999 100644 --- a/Code/Framework/AzCore/Platform/Android/profile_telemetry_platform_android.cmake +++ b/Code/Framework/AzCore/Platform/Android/profile_telemetry_platform_android.cmake @@ -11,7 +11,3 @@ # NOTE: functions in cmake are global, therefore adding functions to this file # is being avoided to prevent overriding functions declared in other targets platfrom # specific cmake files - -if(LY_RAD_TELEMETRY_ENABLED) - set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY) -endif() diff --git a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h b/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h deleted file mode 100644 index 7677c985c6..0000000000 --- a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#ifdef AZ_PROFILE_TELEMETRY - -/*! -* ProfileTelemetry.h provides a RAD Telemetry specific implementation of the AZ_PROFILE_FUNCTION, AZ_PROFILE_SCOPE, and AZ_PROFILE_SCOPE_DYNAMIC performance instrumentation markers -*/ - -#define TM_API_PTR g_radTmApi -#include -#include - -namespace ProfileTelemetryInternal -{ - inline constexpr tm_uint32 ConvertColor(uint32_t rgba) - { - return - ((rgba >> 24) & 0x000000ff) | // move byte 3 to byte 0 - ((rgba << 8) & 0x00ff0000) | // move byte 1 to byte 2 - ((rgba >> 8) & 0x0000ff00) | // move byte 2 to byte 1 - ((rgba << 24) & 0xff000000); // byte 0 to byte 3 - } - - inline constexpr tm_uint32 ConvertColor(const AZ::Color& color) - { - return ConvertColor(color.ToU32()); - } -} - -#define AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category) (static_cast(1) << static_cast(category)) -// Helpers -#define AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category) (AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category) | \ - AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(AZ::Debug::ProfileCategory::MemoryReserved)) - -#define AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id) static_assert(sizeof(id) <= sizeof(tm_uint64), "Interval id must be a unique value no larger than 64-bits") - -#define AZ_INTERNAL_PROF_TM_FUNC_VERIFY_CAT(category, flags) \ - tmFunction(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), flags) - -#define AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, flags, ...) \ - tmZone(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), flags, __VA_ARGS__) - -// AZ_PROFILE_FUNCTION -#define AZ_PROFILE_FUNCTION(category) \ - AZ_INTERNAL_PROF_TM_FUNC_VERIFY_CAT(category, TMZF_NONE) - -#define AZ_PROFILE_FUNCTION_STALL(category) \ - AZ_INTERNAL_PROF_TM_FUNC_VERIFY_CAT(category, TMZF_STALL) - -#define AZ_PROFILE_FUNCTION_IDLE(category) \ - AZ_INTERNAL_PROF_TM_FUNC_VERIFY_CAT(category, TMZF_IDLE) - - -// AZ_PROFILE_SCOPE -#define AZ_PROFILE_SCOPE(category, name) \ - AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, TMZF_NONE, name) - -#define AZ_PROFILE_SCOPE_STALL(category, name) \ - AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, TMZF_STALL, name) - -#define AZ_PROFILE_SCOPE_IDLE(category, name) \ - AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, TMZF_IDLE, name) - -// AZ_PROFILE_SCOPE_DYNAMIC -// For profiling events with dynamic scope names -// Note: the first variable argument must be a const format string -// Usage: AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory, , format args...) -#define AZ_PROFILE_SCOPE_DYNAMIC(category, ...) \ - AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, TMZF_NONE, __VA_ARGS__) - -#define AZ_PROFILE_SCOPE_STALL_DYNAMIC(category, ...) \ - AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, TMZF_STALL, __VA_ARGS__) - -#define AZ_PROFILE_SCOPE_IDLE_DYNAMIC(category, ...) \ - AZ_INTERNAL_PROF_TM_ZONE_VERIFY_CAT(category, TMZF_IDLE, __VA_ARGS__) - - -// AZ_PROFILE_EVENT_BEGIN/END -// For profiling events that do not start and stop in the same scope (they MUST start/stop on the same thread) -// ALWAYS favor using scoped events (AZ_PROFILE_FUNCTION, AZ_PROFILE_SCOPE) as debugging an unmatched begin/end can be challenging -#define AZ_PROFILE_EVENT_BEGIN(category, name) \ - tmEnter(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), TMZF_NONE, name) - -#define AZ_PROFILE_EVENT_END(category) \ - tmLeave(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category)) - - -// AZ_PROFILE_INTERVAL (mapped to Telemetry Timespan APIs) -// Note: using C-style casting as we allow either pointers or integral types as IDs -#define AZ_PROFILE_INTERVAL_START(category, id, ...) \ - AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ - tmBeginTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id), TMZF_NONE, __VA_ARGS__) - -#define AZ_PROFILE_INTERVAL_START_COLORED(category, id, color, ...) \ - AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ - tmBeginColoredTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id), 0, ProfileTelemetryInternal::ConvertColor(color), TMZF_NONE, __VA_ARGS__) - -#define AZ_PROFILE_INTERVAL_END(category, id) \ - AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ - tmEndTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id)) - -// AZ_PROFILE_INTERVAL_SCOPED -// Scoped interval event that implicitly starts and ends in the same scope -// Note: using C-style casting as we allow either pointers or integral types as IDs -// Note: the first variable argument must be a const format string -// Usage: AZ_PROFILE_INTERVAL_SCOPED(AZ::Debug::ProfileCategory, , , format args...) -#define AZ_PROFILE_INTERVAL_SCOPED(category, id, ...) \ - AZ_INTERNAL_PROF_VERIFY_INTERVAL_ID(id); \ - tmTimeSpan(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), (tm_uint64)(id), TM_MIN_TIME_SPAN_TRACK_ID + static_cast(category), 0, TMZF_NONE, __VA_ARGS__) - - -// AZ_PROFILE_DATAPOINT (mapped to tmPlot APIs) -// Note: data points can have static or dynamic names, if using a dynamic name the first variable argument must be a const format string -// Usage: AZ_PROFILE_DATAPOINT(AZ::Debug::ProfileCategory, , format args...) -#define AZ_PROFILE_DATAPOINT(category, value, ...) \ - tmPlot(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), TM_PLOT_UNITS_REAL, TM_PLOT_DRAW_LINE, static_cast(value), __VA_ARGS__) - -#define AZ_PROFILE_DATAPOINT_PERCENT(category, value, ...) \ - tmPlot(AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(category), TM_PLOT_UNITS_PERCENTAGE_DIRECT, TM_PLOT_DRAW_LINE, static_cast(value), __VA_ARGS__) - - -// AZ_PROFILE_MEMORY_ALLOC -#define AZ_PROFILE_MEMORY_ALLOC(category, address, size, context) \ - tmAlloc(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), address, size, context) - -#define AZ_PROFILE_MEMORY_ALLOC_EX(category, filename, lineNumber, address, size, context) \ - tmAllocEx(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), filename, lineNumber, address, size, context) - -#define AZ_PROFILE_MEMORY_FREE(category, address) \ - tmFree(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), address) - -#define AZ_PROFILE_MEMORY_FREE_EX(category, filename, lineNumber, address) \ - tmFreeEx(AZ_INTERNAL_PROF_MEMORY_CAT_TO_FLAGS(category), filename, lineNumber, address) - -#endif diff --git a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetryBus.h b/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetryBus.h deleted file mode 100644 index e572314723..0000000000 --- a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetryBus.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#ifdef AZ_PROFILE_TELEMETRY - -#include -#include -#include -#include - -struct tm_api; - -namespace RADTelemetry -{ - class ProfileTelemetryRequests - : public AZ::EBusTraits - { - public: - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single; - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; - - virtual ~ProfileTelemetryRequests() = default; - - virtual void ToggleEnabled() = 0; - - virtual void SetAddress(const char* address, AZ::u16 port) = 0; - - virtual void SetCaptureMask(AZ::Debug::ProfileCategoryPrimitiveType mask) = 0; - - virtual void SetFrameAdvanceType(AZ::Debug::ProfileFrameAdvanceType type) = 0; - - virtual AZ::Debug::ProfileCategoryPrimitiveType GetCaptureMask() = 0; - - virtual AZ::Debug::ProfileCategoryPrimitiveType GetDefaultCaptureMask() = 0; - - virtual tm_api* GetApiInstance() = 0; - }; - - using ProfileTelemetryRequestBus = AZ::EBus; -} - -#endif diff --git a/Code/Framework/AzCore/Platform/Mac/profile_telemetry_platform_mac.cmake b/Code/Framework/AzCore/Platform/Mac/profile_telemetry_platform_mac.cmake index df12777586..9ecf9fd999 100644 --- a/Code/Framework/AzCore/Platform/Mac/profile_telemetry_platform_mac.cmake +++ b/Code/Framework/AzCore/Platform/Mac/profile_telemetry_platform_mac.cmake @@ -11,7 +11,3 @@ # NOTE: functions in cmake are global, therefore adding functions to this file # is being avoided to prevent overriding functions declared in other targets platfrom # specific cmake files - -if(LY_RAD_TELEMETRY_ENABLED) - set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY) -endif() diff --git a/Code/Framework/AzCore/Platform/Windows/profile_telemetry_platform_windows.cmake b/Code/Framework/AzCore/Platform/Windows/profile_telemetry_platform_windows.cmake index df12777586..9ecf9fd999 100644 --- a/Code/Framework/AzCore/Platform/Windows/profile_telemetry_platform_windows.cmake +++ b/Code/Framework/AzCore/Platform/Windows/profile_telemetry_platform_windows.cmake @@ -11,7 +11,3 @@ # NOTE: functions in cmake are global, therefore adding functions to this file # is being avoided to prevent overriding functions declared in other targets platfrom # specific cmake files - -if(LY_RAD_TELEMETRY_ENABLED) - set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY) -endif() diff --git a/Code/Framework/AzCore/Platform/iOS/profile_telemetry_platform_ios.cmake b/Code/Framework/AzCore/Platform/iOS/profile_telemetry_platform_ios.cmake index aeb91ebce6..7a325ca97e 100644 --- a/Code/Framework/AzCore/Platform/iOS/profile_telemetry_platform_ios.cmake +++ b/Code/Framework/AzCore/Platform/iOS/profile_telemetry_platform_ios.cmake @@ -5,7 +5,3 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT # # - -if(LY_RAD_TELEMETRY_ENABLED) - set(LY_COMPILE_DEFINITIONS PUBLIC AZ_PROFILE_TELEMETRY) -endif() diff --git a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp index 50856b1df8..f75d401c1f 100644 --- a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp +++ b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp @@ -83,7 +83,7 @@ namespace UnitTest int ChildFunction0(int numIterations, int sleepTimeMilliseconds) { - AZ_PROFILE_TIMER("UnitTest", CHILD_TIMER_STAT0); + AZ_PROFILE_SCOPE(UnitTest, CHILD_TIMER_STAT0); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); int result = 5; for (int i = 0; i < numIterations; ++i) @@ -95,7 +95,7 @@ namespace UnitTest int ChildFunction1(int numIterations, int sleepTimeMilliseconds) { - AZ_PROFILE_TIMER("UnitTest", CHILD_TIMER_STAT1); + AZ_PROFILE_SCOPE(UnitTest, CHILD_TIMER_STAT1); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); int result = 5; for (int i = 0; i < numIterations; ++i) @@ -107,7 +107,7 @@ namespace UnitTest int ParentFunction(int numIterations, int sleepTimeMilliseconds) { - AZ_PROFILE_TIMER("UnitTest", PARENT_TIMER_STAT); + AZ_PROFILE_SCOPE(UnitTest, PARENT_TIMER_STAT); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); int result = 0; result += ChildFunction0(numIterations, sleepTimeMilliseconds); @@ -198,9 +198,10 @@ namespace UnitTest AZStd::unique_ptr m_statsManager; };//class TimeDataStatisticsManagerTest - TEST_F(TimeDataStatisticsManagerTest, Test) + // TODO:BUDGETS disabled until profiler budgets system comes online + // TEST_F(TimeDataStatisticsManagerTest, Test) { - run(); + // run(); } //End of all Tests of TimeDataStatisticsManagerTest diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h index d8aba337d5..74153eb39b 100644 --- a/Code/Legacy/CryCommon/ISystem.h +++ b/Code/Legacy/CryCommon/ISystem.h @@ -1149,22 +1149,11 @@ struct DiskOperationInfo #endif -#if defined(ENABLE_LOADING_PROFILER) && AZ_PROFILE_TELEMETRY - -#define LOADING_TIME_PROFILE_SECTION AZ_PROFILE_FUNCTION(AzCore) -#define LOADING_TIME_PROFILE_SECTION_ARGS(...) AZ_PROFILE_SCOPE(AzCore, __VA_ARGS__) -#define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName) AZ_PROFILE_SCOPE(AzCore, sectionName) -#define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...) AZ_PROFILE_SCOPE(AzCore, sectionName, __VA_ARGS__) - -#else - #define LOADING_TIME_PROFILE_SECTION #define LOADING_TIME_PROFILE_SECTION_ARGS(...) #define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName) #define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...) -#endif - ////////////////////////////////////////////////////////////////////////// // CrySystem DLL Exports. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CryCommon/ProjectDefines.h b/Code/Legacy/CryCommon/ProjectDefines.h index 18b4665fab..c7740db95c 100644 --- a/Code/Legacy/CryCommon/ProjectDefines.h +++ b/Code/Legacy/CryCommon/ProjectDefines.h @@ -173,7 +173,7 @@ #if defined(ENABLE_PROFILING_CODE) #define USE_DISK_PROFILER - #define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined + #define ENABLE_LOADING_PROFILER #endif // The maximum number of joints in an animation diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index dc8a555286..ecc196a49f 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -94,7 +93,6 @@ extern "C" AZ_DLL_EXPORT void ModuleInitISystem(ISystem* pSystem, [[maybe_unused AZ::Environment::Attach(gEnv->pSharedEnvironment); AZ::AllocatorManager::Instance(); // Force the AllocatorManager to instantiate and register any allocators defined in data sections } - AZ::Debug::ProfileModuleInit(); } // if pSystem } diff --git a/Gems/RADTelemetry/CMakeLists.txt b/Gems/RADTelemetry/CMakeLists.txt deleted file mode 100644 index 2bb380fae3..0000000000 --- a/Gems/RADTelemetry/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -add_subdirectory(Code) diff --git a/Gems/RADTelemetry/Code/CMakeLists.txt b/Gems/RADTelemetry/Code/CMakeLists.txt deleted file mode 100644 index 544540f273..0000000000 --- a/Gems/RADTelemetry/Code/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(LY_RAD_TELEMETRY_ENABLED OFF CACHE BOOL "Enables RAD Telemetry in Debug/Profile mode.") -set(LY_RAD_TELEMETRY_INSTALL_ROOT "@LY_3RDPARTY_PATH@/RadTelemetry" CACHE PATH "Install path to RAD Telemetry.") -string(CONFIGURE ${LY_RAD_TELEMETRY_INSTALL_ROOT} LY_RAD_TELEMETRY_INSTALL_ROOT @ONLY) - -ly_get_list_relative_pal_filename(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME}) - -ly_add_target( - NAME RADTelemetry.Static STATIC - NAMESPACE Gem - FILES_CMAKE - radtelemetry_files.cmake - ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - INCLUDE_DIRECTORIES - PRIVATE - Source - ${pal_source_dir} - BUILD_DEPENDENCIES - PUBLIC - AZ::AzCore - Legacy::CryCommon -) - -ly_add_target( - NAME RADTelemetry ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} - NAMESPACE Gem - FILES_CMAKE - radtelemetry_shared_files.cmake - INCLUDE_DIRECTORIES - PRIVATE - Source - BUILD_DEPENDENCIES - PRIVATE - Gem::RADTelemetry.Static -) - -# the RADTelemetry module above can be used in all kinds of applications, but we don't enable it in asset builders -ly_create_alias(NAME RADTelemetry.Clients NAMESPACE Gem TARGETS Gem::RADTelemetry) -ly_create_alias(NAME RADTelemetry.Tools NAMESPACE Gem TARGETS Gem::RADTelemetry) -ly_create_alias(NAME RADTelemetry.Servers NAMESPACE Gem TARGETS Gem::RADTelemetry) diff --git a/Gems/RADTelemetry/Code/Source/Platform/Android/RADTelemetry_Traits_Platform.h b/Gems/RADTelemetry/Code/Source/Platform/Android/RADTelemetry_Traits_Platform.h deleted file mode 100644 index 8b524df127..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Android/RADTelemetry_Traits_Platform.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#define AZ_TRAIT_RAD_TELEMETRY_OPEN_FLAGS TMOF_INIT_NETWORKING diff --git a/Gems/RADTelemetry/Code/Source/Platform/Android/platform_android_files.cmake b/Gems/RADTelemetry/Code/Source/Platform/Android/platform_android_files.cmake deleted file mode 100644 index 6e7a9dd5eb..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Android/platform_android_files.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - RADTelemetry_Traits_Platform.h -) diff --git a/Gems/RADTelemetry/Code/Source/Platform/Linux/RADTelemetry_Traits_Platform.h b/Gems/RADTelemetry/Code/Source/Platform/Linux/RADTelemetry_Traits_Platform.h deleted file mode 100644 index 8b524df127..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Linux/RADTelemetry_Traits_Platform.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#define AZ_TRAIT_RAD_TELEMETRY_OPEN_FLAGS TMOF_INIT_NETWORKING diff --git a/Gems/RADTelemetry/Code/Source/Platform/Linux/platform_linux_files.cmake b/Gems/RADTelemetry/Code/Source/Platform/Linux/platform_linux_files.cmake deleted file mode 100644 index 6e7a9dd5eb..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Linux/platform_linux_files.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - RADTelemetry_Traits_Platform.h -) diff --git a/Gems/RADTelemetry/Code/Source/Platform/Mac/RADTelemetry_Traits_Platform.h b/Gems/RADTelemetry/Code/Source/Platform/Mac/RADTelemetry_Traits_Platform.h deleted file mode 100644 index 8b524df127..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Mac/RADTelemetry_Traits_Platform.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#define AZ_TRAIT_RAD_TELEMETRY_OPEN_FLAGS TMOF_INIT_NETWORKING diff --git a/Gems/RADTelemetry/Code/Source/Platform/Mac/platform_mac_files.cmake b/Gems/RADTelemetry/Code/Source/Platform/Mac/platform_mac_files.cmake deleted file mode 100644 index 6e7a9dd5eb..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Mac/platform_mac_files.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - RADTelemetry_Traits_Platform.h -) diff --git a/Gems/RADTelemetry/Code/Source/Platform/Windows/RADTelemetry_Traits_Platform.h b/Gems/RADTelemetry/Code/Source/Platform/Windows/RADTelemetry_Traits_Platform.h deleted file mode 100644 index 8b524df127..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Windows/RADTelemetry_Traits_Platform.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#define AZ_TRAIT_RAD_TELEMETRY_OPEN_FLAGS TMOF_INIT_NETWORKING diff --git a/Gems/RADTelemetry/Code/Source/Platform/Windows/platform_windows_files.cmake b/Gems/RADTelemetry/Code/Source/Platform/Windows/platform_windows_files.cmake deleted file mode 100644 index 6e7a9dd5eb..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/Windows/platform_windows_files.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - RADTelemetry_Traits_Platform.h -) diff --git a/Gems/RADTelemetry/Code/Source/Platform/iOS/RADTelemetry_Traits_Platform.h b/Gems/RADTelemetry/Code/Source/Platform/iOS/RADTelemetry_Traits_Platform.h deleted file mode 100644 index 8b524df127..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/iOS/RADTelemetry_Traits_Platform.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#define AZ_TRAIT_RAD_TELEMETRY_OPEN_FLAGS TMOF_INIT_NETWORKING diff --git a/Gems/RADTelemetry/Code/Source/Platform/iOS/platform_ios_files.cmake b/Gems/RADTelemetry/Code/Source/Platform/iOS/platform_ios_files.cmake deleted file mode 100644 index 6e7a9dd5eb..0000000000 --- a/Gems/RADTelemetry/Code/Source/Platform/iOS/platform_ios_files.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - RADTelemetry_Traits_Platform.h -) diff --git a/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp b/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp deleted file mode 100644 index 7e38f76592..0000000000 --- a/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifdef AZ_PROFILE_TELEMETRY - -#include -#include -#include - -#include -#include - -#include "ProfileTelemetryComponent.h" - -namespace RADTelemetry -{ - static const char * ProfileChannel = "RADTelemetry"; - static const AZ::u32 MaxProfileThreadCount = 128; - - static void MessageFrameTickType(AZ::Debug::ProfileFrameAdvanceType type) - { - const char * frameAdvanceTypeMessage = "Profile tick set to %s"; - const char* frameAdvanceTypeString = (type == AZ::Debug::ProfileFrameAdvanceType::Game) ? "Game Thread" : "Render Frame"; - AZ_Printf(ProfileChannel, frameAdvanceTypeMessage, frameAdvanceTypeString); - tmMessage(0, TMMF_SEVERITY_LOG, frameAdvanceTypeMessage, frameAdvanceTypeString); - } - - ProfileTelemetryComponent::ProfileTelemetryComponent() - { - // Connecting in the constructor because we need to catch ALL created threads - AZStd::ThreadEventBus::Handler::BusConnect(); - } - - ProfileTelemetryComponent::~ProfileTelemetryComponent() - { - AZ_Assert(!m_running, "A telemetry session should not be open."); - - AZStd::ThreadEventBus::Handler::BusDisconnect(); - - if (IsInitialized()) - { - tmShutdown(); - AZ_OS_FREE(m_buffer); - m_buffer = nullptr; - } - } - - void ProfileTelemetryComponent::Activate() - { - AZ::Debug::ProfilerRequestBus::Handler::BusConnect(); - ProfileTelemetryRequestBus::Handler::BusConnect(); - AZ::SystemTickBus::Handler::BusConnect(); - } - - void ProfileTelemetryComponent::Deactivate() - { - AZ::SystemTickBus::Handler::BusDisconnect(); - ProfileTelemetryRequestBus::Handler::BusDisconnect(); - AZ::Debug::ProfilerRequestBus::Handler::BusDisconnect(); - - Disable(); - } - - void ProfileTelemetryComponent::OnThreadEnter(const AZStd::thread_id& id, const AZStd::thread_desc* desc) - { - (void)id; - (void)desc; -#if AZ_TRAIT_OS_USE_WINDOWS_THREADS - if (!desc) - { - // Skip unnamed threads - return; - } - - if (IsInitialized()) - { - // We can send the thread name to Telemetry now - const AZ::u32 newProfiledThreadCount = ++m_profiledThreadCount; - AZ_Assert(newProfiledThreadCount <= MaxProfileThreadCount, "RAD Telemetry profiled threadcount exceeded MaxProfileThreadCount!"); - tmThreadName(0, id.m_id, desc->m_name); - return; - } - - // Save off to send on the next connection - ScopedLock lock(m_threadNameLock); - - auto end = m_threadNames.end(); - auto itr = AZStd::find_if(m_threadNames.begin(), end, [id](const ThreadNameEntry& entry) - { - return entry.id == id; - }); - - if (itr != end) - { - itr->name = desc->m_name; - } - else - { - m_threadNames.push_back({ id, desc->m_name }); - } -#else - const AZ::u32 newProfiledThreadCount = ++m_profiledThreadCount; - AZ_Assert(newProfiledThreadCount <= MaxProfileThreadCount, "RAD Telemetry profiled threadcount exceeded MaxProfileThreadCount!"); -#endif - } - - void ProfileTelemetryComponent::OnThreadExit(const AZStd::thread_id& id) - { - (void)id; -#if AZ_TRAIT_OS_USE_WINDOWS_THREADS - { - ScopedLock lock(m_threadNameLock); - - auto end = m_threadNames.end(); - auto itr = AZStd::find_if(m_threadNames.begin(), end, [id](const ThreadNameEntry& entry) - { - return entry.id == id; - }); - if (itr != end) - { - m_threadNames.erase(itr); - } - else - { - // assume it was already sent on to RAD Telemetry - tmEndThread(0, id.m_id); - --m_profiledThreadCount; - } - } -#else - --m_profiledThreadCount; -#endif - } - - void ProfileTelemetryComponent::OnSystemTick() - { - FrameAdvance(AZ::Debug::ProfileFrameAdvanceType::Game); - } - - void ProfileTelemetryComponent::FrameAdvance(AZ::Debug::ProfileFrameAdvanceType type) - { - if (type == m_frameAdvanceType) - { - tmTick(0); - } - } - - bool ProfileTelemetryComponent::IsActive() - { - return m_running; - } - - void ProfileTelemetryComponent::ToggleEnabled() - { - Initialize(); - - if (!m_running) - { - Enable(); - } - else - { - Disable(); - } - } - - tm_api* ProfileTelemetryComponent::GetApiInstance() - { - Initialize(); - - return TM_API_PTR; - } - - void ProfileTelemetryComponent::Enable() - { - AZ_Printf(ProfileChannel, "Attempting to connect to the Telemetry server at %s:%d", m_address, m_port); - - tmSetCaptureMask(m_captureMask); - tm_error result = tmOpen( - 0, // unused - "ly", // program name, don't use slashes or weird character that will screw up a filename - __DATE__ " " __TIME__, // identifier, could be date time, or a build number ... whatever you want - m_address, // telemetry server address - TMCT_TCP, // network capture - m_port, // telemetry server port - AZ_TRAIT_RAD_TELEMETRY_OPEN_FLAGS,// flags - 3000 // timeout in milliseconds ... pass -1 for infinite - ); - - switch (result) - { - case TM_OK: - { - m_running = true; - AZ_Printf(ProfileChannel, "Connected to the Telemetry server at %s:%d", m_address, m_port); - MessageFrameTickType(m_frameAdvanceType); - -#if AZ_TRAIT_OS_USE_WINDOWS_THREADS - ScopedLock lock(m_threadNameLock); - for (const auto& threadNameEntry : m_threadNames) - { - const AZ::u32 newProfiledThreadCount = ++m_profiledThreadCount; - AZ_Assert(newProfiledThreadCount <= MaxProfileThreadCount, "RAD Telemetry profiled thread count exceeded MaxProfileThreadCount!"); - tmThreadName(0, threadNameEntry.id.m_id, threadNameEntry.name.c_str()); - } - m_threadNames.clear(); // Telemetry caches names so we can clear what we have sent on -#endif - break; - } - - case TMERR_DISABLED: - AZ_Printf(ProfileChannel, "Telemetry is disabled via #define NTELEMETRY"); - break; - - case TMERR_UNINITIALIZED: - AZ_Printf(ProfileChannel, "tmInitialize failed or was not called"); - break; - - case TMERR_NETWORK_NOT_INITIALIZED: - AZ_Printf(ProfileChannel, "WSAStartup was not called before tmOpen! Call WSAStartup or pass TMOF_INIT_NETWORKING."); - break; - - case TMERR_NULL_API: - AZ_Printf(ProfileChannel, "There is no Telemetry API (the DLL isn't in the EXE's path)!"); - break; - - case TMERR_COULD_NOT_CONNECT: - AZ_Printf(ProfileChannel, "Unable to connect to the Telemetry server at %s:%d (1. is it running? 2. check firewall settings)", m_address, m_port); - break; - - case TMERR_UNKNOWN: - AZ_Printf(ProfileChannel, "Unknown error occurred"); - break; - - default: - AZ_Assert(false, "Unhandled tmOpen error case %d", result); - break; - } - } - - void ProfileTelemetryComponent::Disable() - { - if (m_running) - { - m_running = false; - tmClose(0); - AZ_Printf(ProfileChannel, "Disconnected from the Telemetry server."); - } - } - - TM_EXPORT_API tm_api* g_tm_api; // Required for the RAD Telemetry as static lib case - void ProfileTelemetryComponent::Initialize() - { - if (IsInitialized()) - { - return; - } - - tmLoadLibrary(TM_RELEASE); - if (!TM_API_PTR) - { - // Work around for UnixLike platforms that do not load RAD Telemetry static lib (they are incorrectly compiled with the dynamic library version of tmLoadLibrary. RAD is aware of the issue.) - TM_API_PTR = g_tm_api; - } - AZ_Assert(TM_API_PTR, "Invalid RAD Telemetry API pointer state"); - - tmSetMaxThreadCount(MaxProfileThreadCount); - - const tm_int32 telemetryBufferSize = 16 * 1024 * 1024; - m_buffer = static_cast(AZ_OS_MALLOC(telemetryBufferSize, sizeof(void*))); - tmInitialize(telemetryBufferSize, m_buffer); - - // Notify so individual modules can update their Telemetry pointer - AZ::Debug::ProfilerNotificationBus::Broadcast(&AZ::Debug::ProfilerNotifications::OnProfileSystemInitialized); - } - - bool ProfileTelemetryComponent::IsInitialized() const { - return m_buffer != nullptr; - } - - void ProfileTelemetryComponent::SetAddress(const char *address, AZ::u16 port) - { - m_address = address; - m_port = port; - } - - void ProfileTelemetryComponent::SetCaptureMask(AZ::Debug::ProfileCategoryPrimitiveType mask) - { - m_captureMask = mask; - if (IsInitialized()) - { - tmSetCaptureMask(m_captureMask); - } - } - - void ProfileTelemetryComponent::SetFrameAdvanceType(AZ::Debug::ProfileFrameAdvanceType type) - { - if (type != m_frameAdvanceType) - { - MessageFrameTickType(type); - m_frameAdvanceType = type; - } - } - - AZ::Debug::ProfileCategoryPrimitiveType ProfileTelemetryComponent::GetDefaultCaptureMaskInternal() - { - using MaskType = AZ::Debug::ProfileCategoryPrimitiveType; - - // Set all the category bits "below" FirstDetailedCategory and do not enable memory capture by default - return (static_cast(1) << static_cast(FirstDetailedCategory)) - 1; - } - - AZ::Debug::ProfileCategoryPrimitiveType ProfileTelemetryComponent::GetDefaultCaptureMask() - { - return GetDefaultCaptureMaskInternal(); - } - - AZ::Debug::ProfileCategoryPrimitiveType ProfileTelemetryComponent::GetCaptureMask() - { - return m_captureMask; - } - - void ProfileTelemetryComponent::Reflect(AZ::ReflectContext* context) - { - if (AZ::SerializeContext* serializeContext = azrtti_cast(context)) - { - serializeContext->Class() - ->Version(1) - ; - } - } - - void ProfileTelemetryComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) - { - provided.push_back(AZ_CRC("ProfilerService")); - } -} - -#endif diff --git a/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.h b/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.h deleted file mode 100644 index 44fb1e5b4a..0000000000 --- a/Gems/RADTelemetry/Code/Source/ProfileTelemetryComponent.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#ifdef AZ_PROFILE_TELEMETRY - -#include -#include -#include -#include - -#include - -namespace RADTelemetry -{ - class ProfileTelemetryComponent - : public AZ::Component - , private AZStd::ThreadEventBus::Handler - , private AZ::SystemTickBus::Handler - , private AZ::Debug::ProfilerRequestBus::Handler - , private ProfileTelemetryRequestBus::Handler - { - public: - AZ_COMPONENT(ProfileTelemetryComponent, "{51118122-7214-4918-BFF3-237E25FF4918}"); - - ProfileTelemetryComponent(); - ~ProfileTelemetryComponent() override; - - ////////////////////////////////////////////////////////////////////////// - // AZ::Component - void Activate() override; - void Deactivate() override; - - private: - ProfileTelemetryComponent(const ProfileTelemetryComponent&) = delete; - ////////////////////////////////////////////////////////////////////////// - // Thread event bus - void OnThreadEnter(const AZStd::thread_id& id, const AZStd::thread_desc* desc) override; - void OnThreadExit(const AZStd::thread_id& id) override; - - ////////////////////////////////////////////////////////////////////////// - // SystemTickBus - void OnSystemTick() override; - - ////////////////////////////////////////////////////////////////////////// - // ProfilerRequstBus - bool IsActive() override; - void FrameAdvance(AZ::Debug::ProfileFrameAdvanceType type) override; - - ////////////////////////////////////////////////////////////////////////// - // ProfileTelemetryRequestBus - void ToggleEnabled() override; - void SetAddress(const char *address, AZ::u16 port) override; - void SetCaptureMask(AZ::Debug::ProfileCategoryPrimitiveType mask) override; - void SetFrameAdvanceType(AZ::Debug::ProfileFrameAdvanceType type) override; - - AZ::Debug::ProfileCategoryPrimitiveType GetCaptureMask() override; - AZ::Debug::ProfileCategoryPrimitiveType GetDefaultCaptureMask() override; - tm_api* GetApiInstance() override; - - ////////////////////////////////////////////////////////////////////////// - // Component descriptor - static void Reflect(AZ::ReflectContext* context); - static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); - - ////////////////////////////////////////////////////////////////////////// - // Private helpers - void Enable(); - void Disable(); - void Initialize(); - bool IsInitialized() const; - static AZ::Debug::ProfileCategoryPrimitiveType GetDefaultCaptureMaskInternal(); - - ////////////////////////////////////////////////////////////////////////// - // Data members - struct ThreadNameEntry - { - AZStd::thread_id id; - AZStd::string name; - }; - AZStd::vector m_threadNames; - using LockType = AZStd::mutex; - using ScopedLock = AZStd::lock_guard; - LockType m_threadNameLock; - AZStd::atomic_uint m_profiledThreadCount = { 0 }; - - const char* m_address = "127.0.0.1"; - char* m_buffer = nullptr; - AZ::Debug::ProfileCategoryPrimitiveType m_captureMask = GetDefaultCaptureMaskInternal(); - AZ::Debug::ProfileFrameAdvanceType m_frameAdvanceType = AZ::Debug::ProfileFrameAdvanceType::Game; - AZ::u16 m_port = 4719; - bool m_running = false; - bool m_initialized = false; - }; -} - -#endif diff --git a/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp b/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp deleted file mode 100644 index dc23505833..0000000000 --- a/Gems/RADTelemetry/Code/Source/RADTelemetryModule.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include // snprintf -#include - -#include "ProfileTelemetryComponent.h" - -namespace RADTelemetry -{ -#ifdef AZ_PROFILE_TELEMETRY - using TelemetryRequestBus = RADTelemetry::ProfileTelemetryRequestBus; - using TelemetryRequests = RADTelemetry::ProfileTelemetryRequests; - using MaskType = AZ::Debug::ProfileCategoryPrimitiveType; - - static const char* s_telemetryAddress; - static int s_telemetryPort; - static const char* s_telemetryCaptureMask; - static int s_memCaptureEnabled; - static int s_frameAdvanceType; - - using FrameAdvanceType = AZ::Debug::ProfileFrameAdvanceType; - - static void MaskCvarChangedCallback(ICVar*) - { - if (!s_telemetryCaptureMask || !s_telemetryCaptureMask[0]) - { - return; - } - - // Parse as a 64-bit hex string - MaskType maskCvarValue = strtoull(s_telemetryCaptureMask, nullptr, 16); - if (maskCvarValue == std::numeric_limits::max()) - { - MaskType defaultMask = 0; - TelemetryRequestBus::BroadcastResult(defaultMask, &TelemetryRequests::GetDefaultCaptureMask); - - AZ_Error("RADTelemetryGem", false, "Invalid RAD Telemetry capture mask cvar value: %s, using default capture mask 0x%" PRIx64, s_telemetryCaptureMask, defaultMask); - maskCvarValue = defaultMask; - } - - // Mask off the memory capture flag and add it back if memory capture is enabled - const MaskType fullCaptureMask = (maskCvarValue & ~AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(MemoryReserved)) | (s_memCaptureEnabled ? AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(MemoryReserved) : 0); - TelemetryRequestBus::Broadcast(&TelemetryRequests::SetCaptureMask, fullCaptureMask); - } - - static void FrameAdvancedTypeCvarChangedCallback(ICVar*) - { - TelemetryRequestBus::Broadcast(&TelemetryRequests::SetFrameAdvanceType, (s_frameAdvanceType == 0) ? FrameAdvanceType::Game : FrameAdvanceType::Render); - } - - static void CmdTelemetryToggleEnabled([[maybe_unused]] IConsoleCmdArgs* args) - { - TelemetryRequestBus::Broadcast(&TelemetryRequests::SetAddress, s_telemetryAddress, s_telemetryPort); - - FrameAdvancedTypeCvarChangedCallback(nullptr); // Set frame advance type - MaskCvarChangedCallback(nullptr); // Set the capture mask - - TelemetryRequestBus::Broadcast(&TelemetryRequests::ToggleEnabled); - } -#endif - - class RADTelemetryModule - : public CryHooksModule - { - public: - AZ_RTTI(RADTelemetryModule, "{50BB63A6-4669-41F2-B93D-6EB8529413CD}", CryHooksModule); - - RADTelemetryModule() - : CryHooksModule() - { -#ifdef AZ_PROFILE_TELEMETRY - m_descriptors.insert(m_descriptors.end(), { - ProfileTelemetryComponent::CreateDescriptor(), - }); -#endif - } - - /** - * Add required SystemComponents to the SystemEntity. - */ - AZ::ComponentTypeList GetRequiredSystemComponents() const override - { - AZ::ComponentTypeList components; - -#ifdef AZ_PROFILE_TELEMETRY - components.insert(components.end(), - azrtti_typeid() - ); -#endif - - return components; - } - - void OnCrySystemInitialized(ISystem& system, const SSystemInitParams& initParams) override - { - CryHooksModule::OnCrySystemInitialized(system, initParams); - -#ifdef AZ_PROFILE_TELEMETRY - REGISTER_COMMAND("radtm_ToggleEnabled", &CmdTelemetryToggleEnabled, 0, "Enabled or Disable RAD Telemetry"); - - REGISTER_CVAR2("radtm_Address", &s_telemetryAddress, "127.0.0.1", VF_NULL, "The IP address for the telemetry server"); - REGISTER_CVAR2("radtm_Port", &s_telemetryPort, 4719, VF_NULL, "The port for the RAD telemetry server"); - REGISTER_CVAR2("radtm_MemoryCaptureEnabled", &s_memCaptureEnabled, 0, VF_NULL, "Toggle for telemetry memory capture"); - - const int defaultFrameAdvanceTypeCvarValue = (FrameAdvanceType::Default == FrameAdvanceType::Game) ? 0 : 1; - REGISTER_CVAR2_CB("radtm_FrameAdvanceType", &s_frameAdvanceType, defaultFrameAdvanceTypeCvarValue, VF_NULL, "Advance profile frames from either: =0 the main thread, or =1 render frame advance", FrameAdvancedTypeCvarChangedCallback); - - // Get the default value from ProfileTelemetryComponent - MaskType defaultCaptureMaskValue = 0; - TelemetryRequestBus::BroadcastResult(defaultCaptureMaskValue, &TelemetryRequests::GetCaptureMask); - - char defaultCaptureMaskStr[19]; - azsnprintf(defaultCaptureMaskStr, AZ_ARRAY_SIZE(defaultCaptureMaskStr), "0x%" PRIx64, defaultCaptureMaskValue); - REGISTER_CVAR2_CB("radtm_CaptureMask", &s_telemetryCaptureMask, defaultCaptureMaskStr, VF_NULL, "A hex bitmask for the categories to be captured, 0x0 for all", MaskCvarChangedCallback); -#endif - } - }; -} - -// DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM -// The first parameter should be GemName_GemIdLower -// The second should be the fully qualified name of the class above -AZ_DECLARE_MODULE_CLASS(Gem_RADTelemetry, RADTelemetry::RADTelemetryModule) diff --git a/Gems/RADTelemetry/Code/radtelemetry_files.cmake b/Gems/RADTelemetry/Code/radtelemetry_files.cmake deleted file mode 100644 index 2efee83797..0000000000 --- a/Gems/RADTelemetry/Code/radtelemetry_files.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - Source/ProfileTelemetryComponent.cpp - Source/ProfileTelemetryComponent.h -) diff --git a/Gems/RADTelemetry/Code/radtelemetry_shared_files.cmake b/Gems/RADTelemetry/Code/radtelemetry_shared_files.cmake deleted file mode 100644 index 9b07af44d4..0000000000 --- a/Gems/RADTelemetry/Code/radtelemetry_shared_files.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - Source/RADTelemetryModule.cpp -) diff --git a/Gems/RADTelemetry/gem.json b/Gems/RADTelemetry/gem.json deleted file mode 100644 index 932093b4a9..0000000000 --- a/Gems/RADTelemetry/gem.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "gem_name": "RADTelemetry", - "display_name": "RAD Telemetry", - "license": "Apache-2.0 Or MIT", - "origin": "Open 3D Engine - o3de.org", - "type": "Tool", - "summary": "The RAD Telemetry Gem provides support for RAD Telemetry, a performance profiling and visualization middleware, in Open 3D Engine.", - "canonical_tags": ["Gem"], - "user_tags": ["Debug", "SDK"], - "icon_path": "preview.png", - "requirements": "", - "documentation_url": "https://o3de.org/docs/user-guide/gems/reference/debug/rad/rad-telemetry/" -} diff --git a/Gems/RADTelemetry/preview.png b/Gems/RADTelemetry/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/RADTelemetry/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/cmake/3rdParty/Platform/Android/RadTelemetry_android.cmake b/cmake/3rdParty/Platform/Android/RadTelemetry_android.cmake deleted file mode 100644 index 658c9440b2..0000000000 --- a/cmake/3rdParty/Platform/Android/RadTelemetry_android.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(RADTELEMETRY_LIBS ${BASE_PATH}/Lib/librad_tm_android_arm64.a) diff --git a/cmake/3rdParty/Platform/Mac/RadTelemetry_mac.cmake b/cmake/3rdParty/Platform/Mac/RadTelemetry_mac.cmake deleted file mode 100644 index 572d798868..0000000000 --- a/cmake/3rdParty/Platform/Mac/RadTelemetry_mac.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(RADTELEMETRY_LIBS ${BASE_PATH}/Lib/librad_tm_mac_x64_link.a) - -set(RADTELEMETRY_RUNTIME_DEPENDENCIES ${BASE_PATH}/Lib/librad_tm_mac_x64.dylib) diff --git a/cmake/3rdParty/Platform/Windows/RadTelemetry_windows.cmake b/cmake/3rdParty/Platform/Windows/RadTelemetry_windows.cmake deleted file mode 100644 index 1caa62e5c5..0000000000 --- a/cmake/3rdParty/Platform/Windows/RadTelemetry_windows.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(RADTELEMETRY_LIBS ${BASE_PATH}/Lib/rad_tm_win64.lib) - -set(RADTELEMETRY_RUNTIME_DEPENDENCIES ${BASE_PATH}/Dll/rad_tm_win64.dll) diff --git a/cmake/3rdParty/Platform/iOS/RadTelemetry_ios.cmake b/cmake/3rdParty/Platform/iOS/RadTelemetry_ios.cmake deleted file mode 100644 index 0da6750cbe..0000000000 --- a/cmake/3rdParty/Platform/iOS/RadTelemetry_ios.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(RADTELEMETRY_LIBS ${BASE_PATH}/Lib/librad_tm_ios.a) diff --git a/engine.json b/engine.json index 5d862779c0..29532347db 100644 --- a/engine.json +++ b/engine.json @@ -62,7 +62,6 @@ "Gems/PrimitiveAssets", "Gems/PythonAssetBuilder", "Gems/QtForPython", - "Gems/RADTelemetry", "Gems/SaveData", "Gems/SceneLoggingExample", "Gems/SceneProcessing", From f1349a3f60d8ce23802a14d8d028a9764972dcf9 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 18 Aug 2021 17:31:28 -0600 Subject: [PATCH 094/100] Clean up vestigial PIX references in Atom Signed-off-by: Jeremy Ong --- Code/Framework/AzCore/Tests/TimeDataStatistics.cpp | 4 ++-- Gems/Atom/RHI/DX12/Code/CMakeLists.txt | 10 ---------- .../Code/Source/Platform/Windows/PAL_windows.cmake | 1 - Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h | 2 ++ 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp index f75d401c1f..21b42fc451 100644 --- a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp +++ b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp @@ -200,9 +200,9 @@ namespace UnitTest // TODO:BUDGETS disabled until profiler budgets system comes online // TEST_F(TimeDataStatisticsManagerTest, Test) - { + // { // run(); - } + // } //End of all Tests of TimeDataStatisticsManagerTest }//namespace UnitTest diff --git a/Gems/Atom/RHI/DX12/Code/CMakeLists.txt b/Gems/Atom/RHI/DX12/Code/CMakeLists.txt index 8670efa7e6..b913ad58bf 100644 --- a/Gems/Atom/RHI/DX12/Code/CMakeLists.txt +++ b/Gems/Atom/RHI/DX12/Code/CMakeLists.txt @@ -11,13 +11,6 @@ ly_get_list_relative_pal_filename(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Sourc include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) # PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED -if(PAL_TRAIT_PIX_AVAILABLE) - set(PIX_BUILD_DEPENDENCY "3rdParty::pix") -else() - set(PIX_BUILD_DEPENDENCY "") -endif() - - if(PAL_TRAIT_AFTERMATH_AVAILABLE) set(USE_NSIGHT_AFTERMATH_DEFINE $,"","USE_NSIGHT_AFTERMATH">) set(AFTERMATH_BUILD_DEPENDENCY "3rdParty::Aftermath") @@ -90,7 +83,6 @@ ly_add_target( BUILD_DEPENDENCIES PRIVATE AZ::AzCore - ${PIX_BUILD_DEPENDENCY} Gem::Atom_RHI.Reflect ) @@ -116,7 +108,6 @@ ly_add_target( Gem::Atom_RHI_DX12.Reflect 3rdParty::d3dx12 ${AFTERMATH_BUILD_DEPENDENCY} - ${PIX_BUILD_DEPENDENCY} COMPILE_DEFINITIONS PRIVATE ${USE_NSIGHT_AFTERMATH_DEFINE} @@ -142,7 +133,6 @@ ly_add_target( Gem::Atom_RHI.Public Gem::Atom_RHI_DX12.Reflect Gem::Atom_RHI_DX12.Private.Static - ${PIX_BUILD_DEPENDENCY} ) if(PAL_TRAIT_BUILD_HOST_TOOLS) diff --git a/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake b/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake index b885e53ec0..eb733a4d5a 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake +++ b/Gems/Atom/RHI/DX12/Code/Source/Platform/Windows/PAL_windows.cmake @@ -18,7 +18,6 @@ if(d3d12_dll) set(PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED TRUE) endif() -set(PAL_TRAIT_PIX_AVAILABLE FALSE) unset(pix3_header CACHE) set(PAL_TRAIT_AFTERMATH_AVAILABLE FALSE) diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h index 133b8aa664..ab1a719ae6 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h @@ -7,6 +7,8 @@ */ #pragma once +// NOTE: We are careful to include platform headers *before* we include AzCore/Debug/Profiler.h to ensure that d3d12 symbols +// are defined prior to the inclusion of the pix3 runtime. #include #include From cf44a4ad678b8ae7e2bf793d9c1d345db857feee Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 18 Aug 2021 19:16:05 -0600 Subject: [PATCH 095/100] Address additional PR feedback Signed-off-by: Jeremy Ong --- .gitignore | 1 - Code/Framework/AzCore/AzCore/Debug/Profiler.h | 4 +++- Code/Legacy/CryCommon/ProjectDefines.h | 1 - .../ExpressionEvaluationSystemComponent.cpp | 2 +- .../Code/Editor/Nodes/NodeCreateUtils.cpp | 22 +++++++++---------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index e41b92498f..b73c89b1d9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .vscode/ __pycache__ AssetProcessorTemp/** -CMakeUserPresets.json [Bb]uild/** [Oo]ut/** [Cc]ache/ diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index 1d932031ef..f173bb8e17 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -58,13 +58,15 @@ namespace AZ static uint32_t GetSystemID(const char* system); template - static void BeginRegion([[maybe_unused]] const char* system, [[maybe_unused]] char const* eventName, [[maybe_unused]] T const&... args) + static void BeginRegion([[maybe_unused]] const char* system, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) { // TODO: Verification that the supplied system name corresponds to a known budget #if defined(USE_PIX) PIXBeginEvent(PIX_COLOR_INDEX(GetSystemID(system) & 0xff), eventName, args...); #endif // TODO: injecting instrumentation for other profilers + // NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism + // will be introduced in a future PR } static void EndRegion() diff --git a/Code/Legacy/CryCommon/ProjectDefines.h b/Code/Legacy/CryCommon/ProjectDefines.h index c7740db95c..f7f73f111b 100644 --- a/Code/Legacy/CryCommon/ProjectDefines.h +++ b/Code/Legacy/CryCommon/ProjectDefines.h @@ -173,7 +173,6 @@ #if defined(ENABLE_PROFILING_CODE) #define USE_DISK_PROFILER - #define ENABLE_LOADING_PROFILER #endif // The maximum number of joints in an animation diff --git a/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp b/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp index 09b7bf878b..295d42228d 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp +++ b/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp @@ -514,7 +514,7 @@ namespace ExpressionEvaluation ExpressionResult ExpressionEvaluationSystemComponent::Evaluate(const ExpressionTree& expressionTree) const { - AZ_PROFILE_SCOPE("ExpressionEvaluation", __FUNCTION__); + AZ_PROFILE_FUNCTION(ExpressionEvaluation); ExpressionResultStack resultStack; diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp index bb3a28099e..3bcd940a01 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeCreateUtils.cpp @@ -99,7 +99,7 @@ namespace ScriptCanvasEditor::Nodes AZStd::pair CreateAndGetNode(const AZ::Uuid& classId, const ScriptCanvas::ScriptCanvasId& scriptCanvasId, const StyleConfiguration& styleConfiguration, AZStd::function onCreateCallback) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIdPair; ScriptCanvas::Node* node{}; @@ -134,7 +134,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateObjectMethodNode(AZStd::string_view className, AZStd::string_view methodName, const ScriptCanvas::ScriptCanvasId& scriptCanvasId, ScriptCanvas::PropertyStatus propertyStatus) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIds; ScriptCanvas::Node* node = nullptr; @@ -161,7 +161,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateObjectMethodOverloadNode(AZStd::string_view className, AZStd::string_view methodName, const ScriptCanvas::ScriptCanvasId& scriptCanvasGraphId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIds; ScriptCanvas::Node* node = nullptr; @@ -188,7 +188,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateGlobalMethodNode(AZStd::string_view methodName, const ScriptCanvas::ScriptCanvasId& scriptCanvasId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIds; ScriptCanvas::Node* node = nullptr; @@ -215,7 +215,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateEbusWrapperNode(AZStd::string_view busName, const ScriptCanvas::ScriptCanvasId& scriptCanvasId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIdPair; ScriptCanvas::Node* node = nullptr; @@ -241,7 +241,7 @@ namespace ScriptCanvasEditor::Nodes { AZ_Assert(assetId.IsValid(), "CreateScriptEventReceiverNode asset Id must be valid"); - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIdPair; AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::Data::AssetLoadBehavior::Default); @@ -276,7 +276,7 @@ namespace ScriptCanvasEditor::Nodes { AZ_Assert(assetId.IsValid(), "CreateScriptEventSenderNode asset Id must be valid"); - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIdPair; AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::Data::AssetLoadBehavior::Default); @@ -302,7 +302,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateGetVariableNode(const ScriptCanvas::VariableId& variableId, ScriptCanvas::ScriptCanvasId scriptCanvasId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); const AZ::Uuid k_VariableNodeTypeId = azrtti_typeid(); NodeIdPair nodeIds; @@ -333,7 +333,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateSetVariableNode(const ScriptCanvas::VariableId& variableId, ScriptCanvas::ScriptCanvasId scriptCanvasId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); const AZ::Uuid k_VariableNodeTypeId = azrtti_typeid(); NodeIdPair nodeIds; @@ -366,7 +366,7 @@ namespace ScriptCanvasEditor::Nodes { AZ_Assert(assetId.IsValid(), "CreateFunctionNode source asset Id must be valid"); - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIdPair; AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::Data::AssetLoadBehavior::PreLoad); @@ -394,7 +394,7 @@ namespace ScriptCanvasEditor::Nodes NodeIdPair CreateAzEventHandlerNode(const AZ::BehaviorMethod& methodWithAzEventReturn, ScriptCanvas::ScriptCanvasId scriptCanvasId, AZ::EntityId connectingMethodNodeId) { - AZ_PROFILE_SCOPE("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); NodeIdPair nodeIdPair; // Make sure the method returns an AZ::Event by reference or pointer From 80e08dd9475aa9b4b29db60e2c9d10a4d14d4e71 Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Thu, 19 Aug 2021 09:06:24 +0100 Subject: [PATCH 096/100] Fix issue with mouse input for viewport camera (#3210) * fix for drift accumulating in the viewport camera Signed-off-by: hultonha * fix typo and update how events are stored Signed-off-by: hultonha * respond to PR feedback and fix linux and windows build issues Signed-off-by: hultonha * fix failing unit tests in camera input Signed-off-by: hultonha --- Code/Editor/CMakeLists.txt | 1 + Code/Editor/EditorViewportSettings.cpp | 22 +++ Code/Editor/EditorViewportSettings.h | 6 + Code/Editor/EditorViewportWidget.cpp | 37 ++-- Code/Editor/EditorViewportWidget.h | 7 +- .../test_ModularViewportCameraController.cpp | 170 ++++++++++++++++++ Code/Editor/editor_lib_test_files.cmake | 1 + .../AzFramework/Viewport/CameraInput.cpp | 72 ++++++-- .../AzFramework/Viewport/CameraInput.h | 34 +++- Code/Framework/AzFramework/CMakeLists.txt | 3 + .../AzFramework/Tests/CameraInputTests.cpp | 5 + .../Tests/Mocks/MockWindowRequests.h | 41 +++++ .../Tests/framework_shared_tests_files.cmake | 1 + .../Input/QtEventToAzInputManager.cpp | 38 ++-- .../Input/QtEventToAzInputManager.h | 9 +- .../EditorDefaultSelection.cpp | 23 +-- .../ModularViewportCameraController.h | 38 ++++ .../ModularViewportCameraController.cpp | 164 ++++++++++------- 18 files changed, 538 insertions(+), 134 deletions(-) create mode 100644 Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp create mode 100644 Code/Framework/AzFramework/Tests/Mocks/MockWindowRequests.h diff --git a/Code/Editor/CMakeLists.txt b/Code/Editor/CMakeLists.txt index 9baa83179b..9256fd041f 100644 --- a/Code/Editor/CMakeLists.txt +++ b/Code/Editor/CMakeLists.txt @@ -242,6 +242,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) Legacy::CryCommon AZ::AzToolsFramework AZ::AzToolsFramework.Tests + AZ::AzFrameworkTestShared AZ::AzToolsFrameworkTestCommon Legacy::EditorLib Gem::AtomToolsFramework.Static diff --git a/Code/Editor/EditorViewportSettings.cpp b/Code/Editor/EditorViewportSettings.cpp index 680592a597..6e0ed86d2a 100644 --- a/Code/Editor/EditorViewportSettings.cpp +++ b/Code/Editor/EditorViewportSettings.cpp @@ -31,6 +31,8 @@ namespace SandboxEditor constexpr AZStd::string_view CameraPanSpeedSetting = "/Amazon/Preferences/Editor/Camera/PanSpeed"; constexpr AZStd::string_view CameraRotateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothness"; constexpr AZStd::string_view CameraTranslateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothness"; + constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing"; + constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing"; constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId"; constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId"; constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId"; @@ -259,6 +261,26 @@ namespace SandboxEditor SetRegistry(CameraTranslateSmoothnessSetting, smoothness); } + bool CameraRotateSmoothingEnabled() + { + return GetRegistry(CameraRotateSmoothingSetting, true); + } + + void SetCameraRotateSmoothingEnabled(const bool enabled) + { + SetRegistry(CameraRotateSmoothingSetting, enabled); + } + + bool CameraTranslateSmoothingEnabled() + { + return GetRegistry(CameraTranslateSmoothingSetting, true); + } + + void SetCameraTranslateSmoothingEnabled(const bool enabled) + { + SetRegistry(CameraTranslateSmoothingSetting, enabled); + } + AzFramework::InputChannelId CameraTranslateForwardChannelId() { return AzFramework::InputChannelId( diff --git a/Code/Editor/EditorViewportSettings.h b/Code/Editor/EditorViewportSettings.h index b1488c5528..1aca51395f 100644 --- a/Code/Editor/EditorViewportSettings.h +++ b/Code/Editor/EditorViewportSettings.h @@ -80,6 +80,12 @@ namespace SandboxEditor SANDBOX_API float CameraTranslateSmoothness(); SANDBOX_API void SetCameraTranslateSmoothness(float smoothness); + SANDBOX_API bool CameraRotateSmoothingEnabled(); + SANDBOX_API void SetCameraRotateSmoothingEnabled(bool enabled); + + SANDBOX_API bool CameraTranslateSmoothingEnabled(); + SANDBOX_API void SetCameraTranslateSmoothingEnabled(bool enabled); + SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId(); SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId); diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index 28e8cce33e..4d40c44402 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -132,12 +132,11 @@ namespace AZ::ViewportHelpers { static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no level is loaded."; - class EditorEntityNotifications - : public AzToolsFramework::EditorEntityContextNotificationBus::Handler + class EditorEntityNotifications : public AzToolsFramework::EditorEntityContextNotificationBus::Handler { public: - EditorEntityNotifications(EditorViewportWidget& renderViewport) - : m_renderViewport(renderViewport) + EditorEntityNotifications(EditorViewportWidget& editorViewportWidget) + : m_editorViewportWidget(editorViewportWidget) { AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect(); } @@ -147,22 +146,24 @@ namespace AZ::ViewportHelpers AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect(); } - // AzToolsFramework::EditorEntityContextNotificationBus + // AzToolsFramework::EditorEntityContextNotificationBus overrides ... void OnStartPlayInEditor() override { - m_renderViewport.OnStartPlayInEditor(); + m_editorViewportWidget.OnStartPlayInEditor(); } + void OnStopPlayInEditor() override { - m_renderViewport.OnStopPlayInEditor(); + m_editorViewportWidget.OnStopPlayInEditor(); } + void OnStartPlayInEditorBegin() override { - m_renderViewport.OnStartPlayInEditorBegin(); + m_editorViewportWidget.OnStartPlayInEditorBegin(); } private: - EditorViewportWidget& m_renderViewport; + EditorViewportWidget& m_editorViewportWidget; }; } // namespace AZ::ViewportHelpers @@ -1027,10 +1028,16 @@ bool EditorViewportWidget::ShowingWorldSpace() } AZStd::shared_ptr CreateModularViewportCameraController( - AzFramework::ViewportId viewportId) + const AzFramework::ViewportId viewportId) { auto controller = AZStd::make_shared(); + controller->SetCameraViewportContextBuilderCallback( + [viewportId](AZStd::unique_ptr& cameraViewportContext) + { + cameraViewportContext = AZStd::make_unique(viewportId); + }); + controller->SetCameraPriorityBuilderCallback( [](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn) { @@ -1049,6 +1056,16 @@ AZStd::shared_ptr CreateMod { return SandboxEditor::CameraTranslateSmoothness(); }; + + cameraProps.m_rotateSmoothingEnabledFn = [] + { + return SandboxEditor::CameraRotateSmoothingEnabled(); + }; + + cameraProps.m_translateSmoothingEnabledFn = [] + { + return SandboxEditor::CameraTranslateSmoothingEnabled(); + }; }); controller->SetCameraListBuilderCallback( diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h index 33ed001735..a75928b353 100644 --- a/Code/Editor/EditorViewportWidget.h +++ b/Code/Editor/EditorViewportWidget.h @@ -54,7 +54,8 @@ namespace AZ::ViewportHelpers namespace AtomToolsFramework { class RenderViewportWidget; -} + class ModularViewportCameraController; +} // namespace AtomToolsFramework namespace AzToolsFramework { @@ -389,3 +390,7 @@ private: AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING }; + +//! Creates a modular camera controller in the configuration used by the editor viewport. +SANDBOX_API AZStd::shared_ptr CreateModularViewportCameraController( + const AzFramework::ViewportId viewportId); diff --git a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp new file mode 100644 index 0000000000..c994458baa --- /dev/null +++ b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp @@ -0,0 +1,170 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include +#include +#include +#include +#include +#include + +namespace UnitTest +{ + const QSize WidgetSize = QSize(1920, 1080); + + using AzToolsFramework::ViewportInteraction::MouseInteractionEvent; + + class ModularViewportCameraControllerFixture : public AllocatorsTestFixture + { + public: + static const AzFramework::ViewportId TestViewportId; + + void SetUp() override + { + AllocatorsTestFixture::SetUp(); + + m_rootWidget = AZStd::make_unique(); + m_rootWidget->setFixedSize(WidgetSize); + + m_controllerList = AZStd::make_shared(); + m_controllerList->RegisterViewportContext(TestViewportId); + + m_inputChannelMapper = AZStd::make_unique(m_rootWidget.get(), TestViewportId); + } + + void TearDown() + { + m_inputChannelMapper.reset(); + + m_controllerList->UnregisterViewportContext(TestViewportId); + m_controllerList.reset(); + m_rootWidget.reset(); + + AllocatorsTestFixture::TearDown(); + } + + AZStd::unique_ptr m_rootWidget; + AzFramework::ViewportControllerListPtr m_controllerList; + AZStd::unique_ptr m_inputChannelMapper; + }; + + const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0); + + class TestModularCameraViewportContextImpl : public AtomToolsFramework::ModularCameraViewportContext + { + public: + AZ::Transform GetCameraTransform() const override + { + return m_cameraTransform; + } + + void SetCameraTransform(const AZ::Transform& transform) override + { + m_cameraTransform = transform; + } + + void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler&) override + { + // noop + } + + private: + AZ::Transform m_cameraTransform = AZ::Transform::CreateIdentity(); + }; + + TEST_F(ModularViewportCameraControllerFixture, Mouse_movement_does_not_accumulate_excessive_drift_in_modular_viewport_camera) + { + AzFramework::NativeWindowHandle nativeWindowHandle = nullptr; + + const float deltaTime = 1.0f / 60.0f; // mimic 60fps + + // Given + // listen for events signaled from QtEventToAzInputMapper and forward to the controller list + QObject::connect( + m_inputChannelMapper.get(), &AzToolsFramework::QtEventToAzInputMapper::InputChannelUpdated, m_rootWidget.get(), + [this, nativeWindowHandle](const AzFramework::InputChannel* inputChannel, [[maybe_unused]] QEvent* event) + { + m_controllerList->HandleInputChannelEvent( + AzFramework::ViewportControllerInputEvent{ TestViewportId, nativeWindowHandle, *inputChannel }); + }); + + using ::testing::NiceMock; + using ::testing::Return; + + NiceMock mockWindowRequests; + mockWindowRequests.Connect(nativeWindowHandle); + + // note: WindowRequests is used internally by ModularViewportCameraController, this ensures it returns the viewport size we want + ON_CALL(mockWindowRequests, GetClientAreaSize()) + .WillByDefault(Return(AzFramework::WindowSize(WidgetSize.width(), WidgetSize.height()))); + + // create editor modular camera + auto controller = CreateModularViewportCameraController(TestViewportId); + + // set some overrides for the test + AtomToolsFramework::ModularCameraViewportContext* cameraViewportContextView = nullptr; + controller->SetCameraViewportContextBuilderCallback( + [&cameraViewportContextView](AZStd::unique_ptr& cameraViewportContext) + { + cameraViewportContext = AZStd::make_unique(); + cameraViewportContextView = cameraViewportContext.get(); + }); + + controller->SetCameraPropsBuilderCallback( + [](AzFramework::CameraProps& cameraProps) + { + cameraProps.m_rotateSmoothingEnabledFn = [] + { + return false; + }; + + cameraProps.m_translateSmoothingEnabledFn = [] + { + return false; + }; + }); + + m_controllerList->Add(controller); + + // move to the center of the screen + auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2); + MouseMove(m_rootWidget.get(), start, QPoint(0, 0)); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + + // When + // move mouse diagonally to top right, then to bottom left and back repeatedly + auto current = start; + auto halfDelta = QPoint(200, -200); + const int iterationsPerDiagonal = 50; + for (int diagonals = 0; diagonals < 80; ++diagonals) + { + for (int i = 0; i < iterationsPerDiagonal; ++i) + { + MousePressAndMove(m_rootWidget.get(), current, halfDelta / iterationsPerDiagonal, Qt::MouseButton::RightButton); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + current += halfDelta / iterationsPerDiagonal; + } + + if (diagonals % 2 == 0) + { + halfDelta.setX(halfDelta.x() * -1); + halfDelta.setY(halfDelta.y() * -1); + } + } + + QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, current); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + + // Then + // ensure the camera rotation is the identity (no significant drift has occurred as we moved the mouse) + const AZ::Transform cameraRotation = cameraViewportContextView->GetCameraTransform(); + EXPECT_THAT(cameraRotation.GetRotation(), IsClose(AZ::Quaternion::CreateIdentity())); + + mockWindowRequests.Disconnect(); + } +} // namespace UnitTest diff --git a/Code/Editor/editor_lib_test_files.cmake b/Code/Editor/editor_lib_test_files.cmake index 49f707b1f6..2ae3d22c19 100644 --- a/Code/Editor/editor_lib_test_files.cmake +++ b/Code/Editor/editor_lib_test_files.cmake @@ -21,6 +21,7 @@ set(FILES Lib/Tests/test_ViewportTitleDlgPythonBindings.cpp Lib/Tests/test_DisplaySettingsPythonBindings.cpp Lib/Tests/test_ViewportManipulatorController.cpp + Lib/Tests/test_ModularViewportCameraController.cpp DisplaySettingsPythonFuncs.cpp DisplaySettingsPythonFuncs.h ) diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp index c5b6a2ff96..f40c92997a 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp @@ -8,12 +8,12 @@ #include "CameraInput.h" -#include #include #include #include #include #include +#include namespace AzFramework { @@ -26,6 +26,13 @@ namespace AzFramework "The default height of the ground plane to do intersection tests against when orbiting"); AZ_CVAR(float, ed_cameraSystemMinOrbitDistance, 10.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); AZ_CVAR(float, ed_cameraSystemMaxOrbitDistance, 50.0f, nullptr, AZ::ConsoleFunctorFlags::Null, ""); + AZ_CVAR( + bool, + ed_cameraSystemUseCursor, + true, + nullptr, + AZ::ConsoleFunctorFlags::Null, + "Should the camera use cursor absolute positions or motion deltas"); //! return -1.0f if inverted, 1.0f otherwise constexpr static float Invert(const bool invert) @@ -134,9 +141,13 @@ namespace AzFramework bool CameraSystem::HandleEvents(const InputEvent& event) { - if (const auto& horizonalMotion = AZStd::get_if(&event)) + if (const auto& cursor = AZStd::get_if(&event)) { - m_motionDelta.m_x = horizonalMotion->m_delta; + m_cursorState.SetCurrentPosition(cursor->m_position); + } + else if (const auto& horizontalMotion = AZStd::get_if(&event)) + { + m_motionDelta.m_x = horizontalMotion->m_delta; } else if (const auto& verticalMotion = AZStd::get_if(&event)) { @@ -147,15 +158,18 @@ namespace AzFramework m_scrollDelta = scroll->m_delta; } - m_handlingEvents = m_cameras.HandleEvents(event, m_motionDelta, m_scrollDelta); + m_handlingEvents = + m_cameras.HandleEvents(event, ed_cameraSystemUseCursor ? m_cursorState.CursorDelta() : m_motionDelta, m_scrollDelta); return m_handlingEvents; } Camera CameraSystem::StepCamera(const Camera& targetCamera, const float deltaTime) { - const auto nextCamera = m_cameras.StepCamera(targetCamera, m_motionDelta, m_scrollDelta, deltaTime); + const auto nextCamera = m_cameras.StepCamera( + targetCamera, ed_cameraSystemUseCursor ? m_cursorState.CursorDelta() : m_motionDelta, m_scrollDelta, deltaTime); + m_cursorState.Update(); m_motionDelta = ScreenVector{ 0, 0 }; m_scrollDelta = 0.0f; @@ -727,18 +741,36 @@ namespace AzFramework Camera camera; // note: the math for the lerp smoothing implementation for camera rotation and translation was inspired by this excellent // article by Scott Lembcke: https://www.gamasutra.com/blogs/ScottLembcke/20180404/316046/Improved_Lerp_Smoothing.php - const float lookRate = AZStd::exp2(cameraProps.m_rotateSmoothnessFn()); - const float lookT = AZStd::exp2(-lookRate * deltaTime); - camera.m_pitch = AZ::Lerp(targetCamera.m_pitch, currentCamera.m_pitch, lookT); - camera.m_yaw = AZ::Lerp(targetYaw, currentYaw, lookT); - const float moveRate = AZStd::exp2(cameraProps.m_translateSmoothnessFn()); - const float moveT = AZStd::exp2(-moveRate * deltaTime); - camera.m_lookDist = AZ::Lerp(targetCamera.m_lookDist, currentCamera.m_lookDist, moveT); - camera.m_lookAt = targetCamera.m_lookAt.Lerp(currentCamera.m_lookAt, moveT); + if (cameraProps.m_rotateSmoothingEnabledFn()) + { + const float lookRate = AZStd::exp2(cameraProps.m_rotateSmoothnessFn()); + const float lookTime = AZStd::exp2(-lookRate * deltaTime); + camera.m_pitch = AZ::Lerp(targetCamera.m_pitch, currentCamera.m_pitch, lookTime); + camera.m_yaw = AZ::Lerp(targetYaw, currentYaw, lookTime); + } + else + { + camera.m_pitch = targetCamera.m_pitch; + camera.m_yaw = targetYaw; + } + + if (cameraProps.m_translateSmoothingEnabledFn()) + { + const float moveRate = AZStd::exp2(cameraProps.m_translateSmoothnessFn()); + const float moveTime = AZStd::exp2(-moveRate * deltaTime); + camera.m_lookDist = AZ::Lerp(targetCamera.m_lookDist, currentCamera.m_lookDist, moveTime); + camera.m_lookAt = targetCamera.m_lookAt.Lerp(currentCamera.m_lookAt, moveTime); + } + else + { + camera.m_lookDist = targetCamera.m_lookDist; + camera.m_lookAt = targetCamera.m_lookAt; + } + return camera; } - InputEvent BuildInputEvent(const InputChannel& inputChannel) + InputEvent BuildInputEvent(const InputChannel& inputChannel, const WindowSize& windowSize) { const auto& inputChannelId = inputChannel.GetInputChannelId(); const auto& inputDeviceId = inputChannel.GetInputDevice().GetInputDeviceId(); @@ -753,7 +785,16 @@ namespace AzFramework // accept active mouse channel updates, inactive movement channels will just have a 0 delta if (inputChannel.IsActive()) { - if (inputChannelId == InputDeviceMouse::Movement::X) + if (inputChannelId == InputDeviceMouse::SystemCursorPosition) + { + const auto* position = inputChannel.GetCustomData(); + AZ_Assert(position, "Expected PositionData2D but found nullptr"); + + return CursorEvent{ ScreenPoint( + position->m_normalizedPosition.GetX() * windowSize.m_width, + position->m_normalizedPosition.GetY() * windowSize.m_height) }; + } + else if (inputChannelId == InputDeviceMouse::Movement::X) { return HorizontalMotionEvent{ aznumeric_cast(inputChannel.GetValue()) }; } @@ -761,6 +802,7 @@ namespace AzFramework { return VerticalMotionEvent{ aznumeric_cast(inputChannel.GetValue()) }; } + else if (inputChannelId == InputDeviceMouse::Movement::Z) { return ScrollEvent{ inputChannel.GetValue() }; diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h index bb0df4853a..0b7bbbc30d 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h @@ -8,17 +8,23 @@ #pragma once +#include #include #include #include #include #include #include +#include #include #include namespace AzFramework { + AZ_CVAR_EXTERNED(bool, ed_cameraSystemUseCursor); + + struct WindowSize; + //! Returns Euler angles (pitch, roll, yaw) for the incoming orientation. //! @note Order of rotation is Z, Y, X. AZ::Vector3 EulerAngles(const AZ::Matrix3x3& orientation); @@ -79,6 +85,11 @@ namespace AzFramework using HorizontalMotionEvent = MotionEvent; using VerticalMotionEvent = MotionEvent; + struct CursorEvent + { + ScreenPoint m_position; + }; + struct ScrollEvent { float m_delta; @@ -93,7 +104,8 @@ namespace AzFramework }; //! Represents a type-safe union of input events that are handled by the camera system. - using InputEvent = AZStd::variant; + using InputEvent = + AZStd::variant; //! Base class for all camera behaviors. //! The core interface consists of: @@ -219,10 +231,14 @@ namespace AzFramework //! Properties to use to configure behavior across all types of camera. struct CameraProps { - AZStd::function - m_rotateSmoothnessFn; //!< Rotate smoothing value (useful approx range 3-6, higher values give sharper feel). - AZStd::function - m_translateSmoothnessFn; //!< Translate smoothing value (useful approx range 3-6, higher values give sharper feel). + //! Rotate smoothing value (useful approx range 3-6, higher values give sharper feel). + AZStd::function m_rotateSmoothnessFn; + //! Translate smoothing value (useful approx range 3-6, higher values give sharper feel). + AZStd::function m_translateSmoothnessFn; + //! Enable/disable rotation smoothing. + AZStd::function m_rotateSmoothingEnabledFn; + //! Enable/disable translation smoothing. + AZStd::function m_translateSmoothingEnabledFn; }; //! An interpolation function to smoothly interpolate all camera properties from currentCamera to targetCamera. @@ -262,12 +278,16 @@ namespace AzFramework public: bool HandleEvents(const InputEvent& event); Camera StepCamera(const Camera& targetCamera, float deltaTime); - bool HandlingEvents() const { return m_handlingEvents; } + bool HandlingEvents() const + { + return m_handlingEvents; + } Cameras m_cameras; //!< Represents a collection of camera inputs that together provide a camera controller. private: ScreenVector m_motionDelta; //!< The delta used for look/orbit/pan (rotation + translation) - two dimensional. + CursorState m_cursorState; //!< The current and previous position of the cursor (used to calculate movement delta). float m_scrollDelta = 0.0f; //!< The delta used for dolly/movement (translation) - one dimensional. bool m_handlingEvents = false; //!< Is the camera system currently handling events (events are consumed and not propagated). }; @@ -548,5 +568,5 @@ namespace AzFramework } //! Map from a generic InputChannel event to a camera specific InputEvent. - InputEvent BuildInputEvent(const InputChannel& inputChannel); + InputEvent BuildInputEvent(const InputChannel& inputChannel, const WindowSize& windowSize); } // namespace AzFramework diff --git a/Code/Framework/AzFramework/CMakeLists.txt b/Code/Framework/AzFramework/CMakeLists.txt index 8a68aac887..4359ae1f02 100644 --- a/Code/Framework/AzFramework/CMakeLists.txt +++ b/Code/Framework/AzFramework/CMakeLists.txt @@ -70,6 +70,9 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) PRIVATE AZ::AzCore AZ::AzFramework + PUBLIC + AZ::AzTest + AZ::AzTestShared ) if(PAL_TRAIT_BUILD_HOST_TOOLS) diff --git a/Code/Framework/AzFramework/Tests/CameraInputTests.cpp b/Code/Framework/AzFramework/Tests/CameraInputTests.cpp index 590d46850e..ef340a41a5 100644 --- a/Code/Framework/AzFramework/Tests/CameraInputTests.cpp +++ b/Code/Framework/AzFramework/Tests/CameraInputTests.cpp @@ -59,10 +59,15 @@ namespace UnitTest m_cameraSystem->m_cameras.AddCamera(m_firstPersonRotateCamera); m_cameraSystem->m_cameras.AddCamera(m_firstPersonTranslateCamera); m_cameraSystem->m_cameras.AddCamera(orbitCamera); + + // these tests rely on using motion delta, not cursor positions (default is true) + AzFramework::ed_cameraSystemUseCursor = false; } void TearDown() override { + AzFramework::ed_cameraSystemUseCursor = true; + m_firstPersonRotateCamera.reset(); m_firstPersonTranslateCamera.reset(); diff --git a/Code/Framework/AzFramework/Tests/Mocks/MockWindowRequests.h b/Code/Framework/AzFramework/Tests/Mocks/MockWindowRequests.h new file mode 100644 index 0000000000..63f73d0b28 --- /dev/null +++ b/Code/Framework/AzFramework/Tests/Mocks/MockWindowRequests.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#pragma once + +#include + +#include + +namespace UnitTest +{ + class MockWindowRequests : public AzFramework::WindowRequestBus::Handler + { + public: + void Connect(AzFramework::NativeWindowHandle handle) + { + AzFramework::WindowRequestBus::Handler::BusConnect(handle); + } + void Disconnect() + { + AzFramework::WindowRequestBus::Handler::BusDisconnect(); + } + + // AzFramework::WindowRequestBus overrides ... + MOCK_METHOD1(SetWindowTitle, void(const AZStd::string&)); + MOCK_CONST_METHOD0(GetClientAreaSize, AzFramework::WindowSize()); + MOCK_METHOD1(ResizeClientArea, void(AzFramework::WindowSize clientAreaSize)); + MOCK_CONST_METHOD0(GetFullScreenState, bool()); + MOCK_METHOD1(SetFullScreenState, void(bool)); + MOCK_CONST_METHOD0(CanToggleFullScreenState, bool()); + MOCK_METHOD0(ToggleFullScreenState, void()); + MOCK_CONST_METHOD0(GetDpiScaleFactor, float()); + MOCK_CONST_METHOD0(GetSyncInterval, uint32_t()); + MOCK_CONST_METHOD0(GetDisplayRefreshRate, uint32_t()); + }; +} // namespace UnitTest diff --git a/Code/Framework/AzFramework/Tests/framework_shared_tests_files.cmake b/Code/Framework/AzFramework/Tests/framework_shared_tests_files.cmake index 3d2c2a51be..85c00a2e8a 100644 --- a/Code/Framework/AzFramework/Tests/framework_shared_tests_files.cmake +++ b/Code/Framework/AzFramework/Tests/framework_shared_tests_files.cmake @@ -8,6 +8,7 @@ set(FILES Mocks/MockSpawnableEntitiesInterface.h + Mocks/MockWindowRequests.h Utils/Utils.h Utils/Utils.cpp FrameworkApplicationFixture.h diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index b7776238ba..260270e85e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -285,7 +285,7 @@ namespace AzToolsFramework } } - void QtEventToAzInputMapper::ProcessPendingMouseEvents() + void QtEventToAzInputMapper::ProcessPendingMouseEvents(const QPoint& cursorDelta) { auto systemCursorChannel = GetInputChannel(AzFramework::InputDeviceMouse::SystemCursorPosition); @@ -297,14 +297,8 @@ namespace AzToolsFramework GetInputChannel(AzFramework::InputDeviceMouse::Movement::Z); systemCursorChannel->ProcessRawInputEvent(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetLength()); - // Generate movement events based on the pixel delta divided by the DPI scaling factor, to calculate a rough approximation - // of cursor movement velocity. - movementXChannel->ProcessRawInputEvent( - m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / - m_sourceWidget->devicePixelRatioF()); - movementYChannel->ProcessRawInputEvent( - m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetY() * aznumeric_cast(m_sourceWidget->height()) / - m_sourceWidget->devicePixelRatioF()); + movementXChannel->ProcessRawInputEvent(cursorDelta.x()); + movementYChannel->ProcessRawInputEvent(cursorDelta.y()); mouseWheelChannel->ProcessRawInputEvent(0.0f); NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr); @@ -337,41 +331,43 @@ namespace AzToolsFramework } } - AZ::Vector2 QtEventToAzInputMapper::WidgetPositionToNormalizedPosition(QPoint position) + AZ::Vector2 QtEventToAzInputMapper::WidgetPositionToNormalizedPosition(const QPoint& position) { const float normalizedX = aznumeric_cast(position.x()) / aznumeric_cast(m_sourceWidget->width()); const float normalizedY = aznumeric_cast(position.y()) / aznumeric_cast(m_sourceWidget->height()); - return AZ::Vector2{normalizedX, normalizedY}; + return AZ::Vector2{ normalizedX, normalizedY }; } - QPoint QtEventToAzInputMapper::NormalizedPositionToWidgetPosition(AZ::Vector2 normalizedPosition) + QPoint QtEventToAzInputMapper::NormalizedPositionToWidgetPosition(const AZ::Vector2& normalizedPosition) { const int denormalizedX = aznumeric_cast(normalizedPosition.GetX() * m_sourceWidget->width()); const int denormalizedY = aznumeric_cast(normalizedPosition.GetY() * m_sourceWidget->height()); - return QPoint{denormalizedX, denormalizedY}; + return QPoint{ denormalizedX, denormalizedY }; } void QtEventToAzInputMapper::HandleMouseMoveEvent(QMouseEvent* mouseEvent) { - AZ::Vector2 lastCursorPosition = m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition; + const QPoint cursorPosition = mouseEvent->pos(); + const QPoint cursorDelta = cursorPosition - m_previousCursorPosition; - const QPoint mousePos = mouseEvent->pos(); - const AZ::Vector2 normalizedPosition = WidgetPositionToNormalizedPosition(mousePos); - m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta = normalizedPosition - m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition; - m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = normalizedPosition; - ProcessPendingMouseEvents(); + m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(cursorPosition); + m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta = WidgetPositionToNormalizedPosition(cursorDelta); + + ProcessPendingMouseEvents(cursorDelta); if (m_capturingCursor) { // Reset our cursor position to the previous point. - QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(NormalizedPositionToWidgetPosition(lastCursorPosition)); + const QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition); AzQtComponents::SetCursorPos(targetScreenPosition); // Even though we just set the cursor position, there are edge cases such as remote desktop that will leave // the cursor position unchanged. For safety, we re-cache our last cursor position for delta generation. - QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos()); + const QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos()); m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(actualWidgetPosition); } + + m_previousCursorPosition = cursorPosition; } void QtEventToAzInputMapper::HandleKeyEvent(QKeyEvent* keyEvent) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h index 0187cb2e5b..6e73bf4f9c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h @@ -21,6 +21,7 @@ #include #include +#include #endif //! defined(Q_MOC_RUN) class QWidget; @@ -111,12 +112,12 @@ namespace AzToolsFramework void NotifyUpdateChannelIfNotIdle(const AzFramework::InputChannel* channel, QEvent* event); // Processes any pending mouse movement events, this allows mouse movement channels to close themselves. - void ProcessPendingMouseEvents(); + void ProcessPendingMouseEvents(const QPoint& cursorDelta); // Converts a point in logical source widget space [0..m_sourceWidget->size()] to normalized [0..1] space. - AZ::Vector2 WidgetPositionToNormalizedPosition(QPoint position); + AZ::Vector2 WidgetPositionToNormalizedPosition(const QPoint& position); // Converts a point in normalized [0..1] space to logical source widget space [0..m_sourceWidget->size()]. - QPoint NormalizedPositionToWidgetPosition(AZ::Vector2 normalizedPosition); + QPoint NormalizedPositionToWidgetPosition(const AZ::Vector2& normalizedPosition); // Handle mouse click events. void HandleMouseButtonEvent(QMouseEvent* mouseEvent); @@ -148,6 +149,8 @@ namespace AzToolsFramework AZStd::unordered_set m_highPriorityKeys; // A lookup table for AZ input channel ID -> physical input channel on our mouse or keyboard device. AZStd::unordered_map m_channels; + // Where the position of the mouse cursor was at the last cursor event. + QPoint m_previousCursorPosition; // The source widget to map events from, used to calculate the relative mouse position within the widget bounds. QWidget* m_sourceWidget; // Flags whether or not Qt events should currently be processed. diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.cpp index 0eae7707bc..d7dd008c9e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorDefaultSelection.cpp @@ -188,7 +188,7 @@ namespace AzToolsFramework return false; } - using namespace AzToolsFramework::ViewportInteraction; + using AzToolsFramework::ViewportInteraction::MouseEvent; const auto& mouseInteraction = mouseInteractionEvent.m_mouseInteraction; // store the current interaction for use in DrawManipulators m_currentInteraction = mouseInteraction; @@ -196,28 +196,19 @@ namespace AzToolsFramework switch (mouseInteractionEvent.m_mouseEvent) { case MouseEvent::Down: - { - return m_manipulatorManager->ConsumeViewportMousePress(mouseInteraction); - } + return m_manipulatorManager->ConsumeViewportMousePress(mouseInteraction); case MouseEvent::DoubleClick: - { - return false; - } + return false; case MouseEvent::Move: { - AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult mouseMoveResult = - AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult::None; - mouseMoveResult = m_manipulatorManager->ConsumeViewportMouseMove(mouseInteraction); + const AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult mouseMoveResult = + m_manipulatorManager->ConsumeViewportMouseMove(mouseInteraction); return mouseMoveResult == AzToolsFramework::ManipulatorManager::ConsumeMouseMoveResult::Interacting; } case MouseEvent::Up: - { - return m_manipulatorManager->ConsumeViewportMouseRelease(mouseInteraction); - } + return m_manipulatorManager->ConsumeViewportMouseRelease(mouseInteraction); case MouseEvent::Wheel: - { - return m_manipulatorManager->ConsumeViewportMouseWheel(mouseInteraction); - } + return m_manipulatorManager->ConsumeViewportMouseWheel(mouseInteraction); default: return false; } diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h index e6a666c640..42fe9a01c9 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/ModularViewportCameraController.h @@ -18,9 +18,22 @@ namespace AtomToolsFramework { class ModularViewportCameraControllerInstance; + //! A reduced ViewportContext interface for use by the ModularViewportCameraController. + //! @note This extra indirection is used to facilitate testing the ModularViewportCameraController. + class ModularCameraViewportContext + { + public: + virtual ~ModularCameraViewportContext() = default; + + virtual AZ::Transform GetCameraTransform() const = 0; + virtual void SetCameraTransform(const AZ::Transform& transform) = 0; + virtual void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler& handler) = 0; + }; + //! A function object to represent returning a camera controller priority. using CameraControllerPriorityFn = AZStd::function; + using CameraViewportContextFn = AZStd::function(AzFramework::ViewportId)>; //! The default behavior for what priority the camera controller should respond to events at. //! @note This can change based on the state of the camera controller/system. @@ -38,6 +51,7 @@ namespace AtomToolsFramework using CameraListBuilder = AZStd::function; using CameraPropsBuilder = AZStd::function; using CameraPriorityBuilder = AZStd::function; + using CameraViewportContextBuilder = AZStd::function&)>; //! Sets the camera list builder callback used to populate new ModularViewportCameraControllerInstances. void SetCameraListBuilderCallback(const CameraListBuilder& builder); @@ -45,6 +59,8 @@ namespace AtomToolsFramework void SetCameraPropsBuilderCallback(const CameraPropsBuilder& builder); //! Sets the camera controller priority builder callback used to populate new ModularViewportCameraControllerInstances. void SetCameraPriorityBuilderCallback(const CameraPriorityBuilder& builder); + //! Sets the camera controller viewport context builder callback to populate new ModularViewportCameraControllerInstances. + void SetCameraViewportContextBuilderCallback(const CameraViewportContextBuilder& builder); private: //! Sets up a camera list based on this controller's CameraListBuilderCallback. @@ -53,6 +69,8 @@ namespace AtomToolsFramework void SetupCameraProperties(AzFramework::CameraProps& cameraProps); //! Sets up how the camera controller should decide at what priority level to respond to. void SetupCameraControllerPriority(CameraControllerPriorityFn& cameraPriorityFn); + //! Sets up what viewport context should be used by the camera controller. + void SetupCameraControllerViewportContext(AZStd::unique_ptr& cameraViewportContext); //! Builder to generate a list of CameraInputs to run in the ModularViewportCameraControllerInstance. CameraListBuilder m_cameraListBuilder; @@ -60,6 +78,24 @@ namespace AtomToolsFramework CameraPropsBuilder m_cameraPropsBuilder; //! Builder to define what priority level the camera controller should respond to events at. CameraPriorityBuilder m_cameraControllerPriorityBuilder; + //! Builder to define what viewport context interface the camera controller should use. + CameraViewportContextBuilder m_cameraViewportContextBuilder; + }; + + //! The production modular camera viewport context backed by an AZ::RPI::ViewportContextPtr. + //! @note This is instantiated during normal runtime use. + class ModularCameraViewportContextImpl : public ModularCameraViewportContext + { + public: + explicit ModularCameraViewportContextImpl(AzFramework::ViewportId viewportId); + + // ModularCameraViewportContext overrides ... + AZ::Transform GetCameraTransform() const override; + void SetCameraTransform(const AZ::Transform& transform) override; + void ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler& handler) override; + + private: + AzFramework::ViewportId m_viewportId; }; //! A customizable camera controller that can be configured to run a varying set of CameraInput instances. @@ -115,5 +151,7 @@ namespace AtomToolsFramework bool m_updatingTransformInternally = false; //! Listen for camera view changes outside of the camera controller. AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler; + //! The current instance of the modular camera viewport context. + AZStd::unique_ptr m_modularCameraViewportContext; }; } // namespace AtomToolsFramework diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp index e98df83930..0fc55e2363 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/ModularViewportCameraController.cpp @@ -41,6 +41,7 @@ namespace AtomToolsFramework display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisZ().GetNormalizedSafe() * axisLength); } + // convenience function to access the ViewportContext for the given ViewportId. static AZ::RPI::ViewportContextPtr RetrieveViewportContext(const AzFramework::ViewportId viewportId) { auto viewportContextManager = AZ::Interface::Get(); @@ -58,6 +59,35 @@ namespace AtomToolsFramework return viewportContext; } + ModularCameraViewportContextImpl::ModularCameraViewportContextImpl(const AzFramework::ViewportId viewportId) + : m_viewportId(viewportId) + { + } + + AZ::Transform ModularCameraViewportContextImpl::GetCameraTransform() const + { + if (auto viewportContext = RetrieveViewportContext(m_viewportId)) + { + return viewportContext->GetCameraTransform(); + } + + return AZ::Transform::CreateIdentity(); + } + void ModularCameraViewportContextImpl::SetCameraTransform(const AZ::Transform& transform) + { + if (auto viewportContext = RetrieveViewportContext(m_viewportId)) + { + viewportContext->SetCameraTransform(transform); + } + } + void ModularCameraViewportContextImpl::ConnectViewMatrixChangedHandler(AZ::RPI::ViewportContext::MatrixChangedEvent::Handler& handler) + { + if (auto viewportContext = RetrieveViewportContext(m_viewportId)) + { + viewportContext->ConnectViewMatrixChangedHandler(handler); + } + } + void ModularViewportCameraController::SetCameraListBuilderCallback(const CameraListBuilder& builder) { m_cameraListBuilder = builder; @@ -73,6 +103,11 @@ namespace AtomToolsFramework m_cameraControllerPriorityBuilder = builder; } + void ModularViewportCameraController::SetCameraViewportContextBuilderCallback(const CameraViewportContextBuilder& builder) + { + m_cameraViewportContextBuilder = builder; + } + void ModularViewportCameraController::SetupCameras(AzFramework::Cameras& cameras) { if (m_cameraListBuilder) @@ -97,6 +132,15 @@ namespace AtomToolsFramework } } + void ModularViewportCameraController::SetupCameraControllerViewportContext( + AZStd::unique_ptr& cameraViewportContext) + { + if (m_cameraViewportContextBuilder) + { + m_cameraViewportContextBuilder(cameraViewportContext); + } + } + // what priority should the camera system respond to AzFramework::ViewportControllerPriority DefaultCameraControllerPriority(const AzFramework::CameraSystem& cameraSystem) { @@ -119,23 +163,20 @@ namespace AtomToolsFramework controller->SetupCameras(m_cameraSystem.m_cameras); controller->SetupCameraProperties(m_cameraProps); controller->SetupCameraControllerPriority(m_priorityFn); + controller->SetupCameraControllerViewportContext(m_modularCameraViewportContext); - if (auto viewportContext = RetrieveViewportContext(GetViewportId())) + auto handleCameraChange = [this](const AZ::Matrix4x4&) { - auto handleCameraChange = [this, viewportContext](const AZ::Matrix4x4&) + // ignore these updates if the camera is being updated internally + if (!m_updatingTransformInternally) { - // ignore these updates if the camera is being updated internally - if (!m_updatingTransformInternally) - { - UpdateCameraFromTransform(m_targetCamera, viewportContext->GetCameraTransform()); - m_camera = m_targetCamera; - } - }; + UpdateCameraFromTransform(m_targetCamera, m_modularCameraViewportContext->GetCameraTransform()); + m_camera = m_targetCamera; + } + }; - m_cameraViewMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange); - - viewportContext->ConnectViewMatrixChangedHandler(m_cameraViewMatrixChangeHandler); - } + m_cameraViewMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange); + m_modularCameraViewportContext->ConnectViewMatrixChangedHandler(m_cameraViewMatrixChangeHandler); AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId()); ModularViewportCameraControllerRequestBus::Handler::BusConnect(viewportId); @@ -151,7 +192,11 @@ namespace AtomToolsFramework { if (event.m_priority == m_priorityFn(m_cameraSystem)) { - return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel)); + AzFramework::WindowSize windowSize; + AzFramework::WindowRequestBus::EventResult( + windowSize, event.m_windowHandle, &AzFramework::WindowRequestBus::Events::GetClientAreaSize); + + return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel, windowSize)); } return false; @@ -165,61 +210,58 @@ namespace AtomToolsFramework return; } - if (auto viewportContext = RetrieveViewportContext(GetViewportId())) + m_updatingTransformInternally = true; + + if (m_cameraMode == CameraMode::Control) { - m_updatingTransformInternally = true; + m_targetCamera = m_cameraSystem.StepCamera(m_targetCamera, event.m_deltaTime.count()); + m_camera = AzFramework::SmoothCamera(m_camera, m_targetCamera, m_cameraProps, event.m_deltaTime.count()); - if (m_cameraMode == CameraMode::Control) + // if there has been an interpolation, only clear the look at point if it is no longer + // centered in the view (the camera has looked away from it) + if (m_lookAtAfterInterpolation.has_value()) { - m_targetCamera = m_cameraSystem.StepCamera(m_targetCamera, event.m_deltaTime.count()); - m_camera = AzFramework::SmoothCamera(m_camera, m_targetCamera, m_cameraProps, event.m_deltaTime.count()); - - // if there has been an interpolation, only clear the look at point if it is no longer - // centered in the view (the camera has looked away from it) - if (m_lookAtAfterInterpolation.has_value()) + if (const float lookDirection = + (*m_lookAtAfterInterpolation - m_camera.Translation()).GetNormalized().Dot(m_camera.Transform().GetBasisY()); + !AZ::IsCloseMag(lookDirection, 1.0f, 0.001f)) { - if (const float lookDirection = - (*m_lookAtAfterInterpolation - m_camera.Translation()).GetNormalized().Dot(m_camera.Transform().GetBasisY()); - !AZ::IsCloseMag(lookDirection, 1.0f, 0.001f)) - { - m_lookAtAfterInterpolation = {}; - } + m_lookAtAfterInterpolation = {}; } - - viewportContext->SetCameraTransform(m_camera.Transform()); - } - else if (m_cameraMode == CameraMode::Animation) - { - const auto smootherStepFn = [](const float t) - { - return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); - }; - - const auto& [transformStart, transformEnd, animationTime] = m_cameraAnimation; - - const float transitionTime = smootherStepFn(animationTime); - const AZ::Transform current = AZ::Transform::CreateFromQuaternionAndTranslation( - transformStart.GetRotation().Slerp(transformEnd.GetRotation(), transitionTime), - transformStart.GetTranslation().Lerp(transformEnd.GetTranslation(), transitionTime)); - - const AZ::Vector3 eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromTransform(current)); - m_camera.m_pitch = eulerAngles.GetX(); - m_camera.m_yaw = eulerAngles.GetZ(); - m_camera.m_lookAt = current.GetTranslation(); - m_targetCamera = m_camera; - - if (animationTime >= 1.0f) - { - m_cameraMode = CameraMode::Control; - } - - m_cameraAnimation.m_time = AZ::GetClamp(animationTime + event.m_deltaTime.count(), 0.0f, 1.0f); - - viewportContext->SetCameraTransform(current); } - m_updatingTransformInternally = false; + m_modularCameraViewportContext->SetCameraTransform(m_camera.Transform()); } + else if (m_cameraMode == CameraMode::Animation) + { + const auto smootherStepFn = [](const float t) + { + return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); + }; + + const auto& [transformStart, transformEnd, animationTime] = m_cameraAnimation; + + const float transitionTime = smootherStepFn(animationTime); + const AZ::Transform current = AZ::Transform::CreateFromQuaternionAndTranslation( + transformStart.GetRotation().Slerp(transformEnd.GetRotation(), transitionTime), + transformStart.GetTranslation().Lerp(transformEnd.GetTranslation(), transitionTime)); + + const AZ::Vector3 eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromTransform(current)); + m_camera.m_pitch = eulerAngles.GetX(); + m_camera.m_yaw = eulerAngles.GetZ(); + m_camera.m_lookAt = current.GetTranslation(); + m_targetCamera = m_camera; + + if (animationTime >= 1.0f) + { + m_cameraMode = CameraMode::Control; + } + + m_cameraAnimation.m_time = AZ::GetClamp(animationTime + event.m_deltaTime.count(), 0.0f, 1.0f); + + m_modularCameraViewportContext->SetCameraTransform(current); + } + + m_updatingTransformInternally = false; } void ModularViewportCameraControllerInstance::DisplayViewport( From e0b2027b42703cb540f263c89923880cba7c1b5a Mon Sep 17 00:00:00 2001 From: John Date: Thu, 19 Aug 2021 11:16:14 +0100 Subject: [PATCH 097/100] Erase existing artifacts before generation. Signed-off-by: John --- cmake/TestImpactFramework/LYTestImpactFramework.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/TestImpactFramework/LYTestImpactFramework.cmake b/cmake/TestImpactFramework/LYTestImpactFramework.cmake index 7dd2617582..4b8ea226a1 100644 --- a/cmake/TestImpactFramework/LYTestImpactFramework.cmake +++ b/cmake/TestImpactFramework/LYTestImpactFramework.cmake @@ -448,8 +448,9 @@ function(ly_test_impact_post_step) # Directory for binaries built for this profile set(bin_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$") - # Erase any existing non-persistent data to avoid getting test impact framework out of sync with current repo state + # Erase any existing artifact and non-persistent data to avoid getting test impact framework out of sync with current repo state file(REMOVE_RECURSE "${LY_TEST_IMPACT_TEMP_DIR}") + file(REMOVE_RECURSE "${LY_TEST_IMPACT_ARTIFACT_DIR}") # Export the soruce to target mapping files ly_test_impact_export_source_target_mappings( From d0238a5977764e960cbea575d1eace6916410992 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 19 Aug 2021 09:37:45 -0700 Subject: [PATCH 098/100] More fixes after merge Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzFramework/AzFramework/Viewport/CameraInput.cpp | 4 ++-- .../AzToolsFramework/Input/QtEventToAzInputManager.cpp | 4 ++-- .../Source/PostProcessing/BlendColorGradingLutsPass.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp index f40c92997a..74adcd9543 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp @@ -791,8 +791,8 @@ namespace AzFramework AZ_Assert(position, "Expected PositionData2D but found nullptr"); return CursorEvent{ ScreenPoint( - position->m_normalizedPosition.GetX() * windowSize.m_width, - position->m_normalizedPosition.GetY() * windowSize.m_height) }; + static_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), + static_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)) }; } else if (inputChannelId == InputDeviceMouse::Movement::X) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index 260270e85e..d39ade5527 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -297,8 +297,8 @@ namespace AzToolsFramework GetInputChannel(AzFramework::InputDeviceMouse::Movement::Z); systemCursorChannel->ProcessRawInputEvent(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetLength()); - movementXChannel->ProcessRawInputEvent(cursorDelta.x()); - movementYChannel->ProcessRawInputEvent(cursorDelta.y()); + movementXChannel->ProcessRawInputEvent(static_cast(cursorDelta.x())); + movementYChannel->ProcessRawInputEvent(static_cast(cursorDelta.y())); mouseWheelChannel->ProcessRawInputEvent(0.0f); NotifyUpdateChannelIfNotIdle(systemCursorChannel, nullptr); diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp index 8631ae2eb3..f74837bd9a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp @@ -326,7 +326,7 @@ namespace AZ one_over[curLutIndex] = 1.f; } - int current = 0; + uint32_t current = 0; for (size_t lutIndex = 0; lutIndex < numLuts; lutIndex++) { LutBlendItem& lutBlendItem = settings->GetLutBlendItem(lutIndex); @@ -378,7 +378,7 @@ namespace AZ { // Compute all the weights // First compute the weight of the ungraded color value - for (int lutIndex = 0; lutIndex < current; lutIndex++) + for (uint32_t lutIndex = 0; lutIndex < current; lutIndex++) { float weight = one_intensity[lutIndex] * over[lutIndex]; for (int overrideLutIndex = lutIndex + 1; overrideLutIndex < LookModificationSettings::MaxBlendLuts; overrideLutIndex++) @@ -388,7 +388,7 @@ namespace AZ m_weights[0] += weight; } // Then compute the weights for the LUTs - for (int weightIndex = 0; weightIndex < current; weightIndex++) + for (uint32_t weightIndex = 0; weightIndex < current; weightIndex++) { m_weights[weightIndex + 1] = intensity[weightIndex] * over[weightIndex]; for (int lutIndex = weightIndex + 1; lutIndex < LookModificationSettings::MaxBlendLuts; lutIndex++) From 6766d10d1be624e65f6e60a5ca8771c1b34da478 Mon Sep 17 00:00:00 2001 From: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com> Date: Thu, 19 Aug 2021 10:08:10 -0700 Subject: [PATCH 099/100] ATOM-13883 [RHI][Core] - Moving RHI init settings to the new settings registry system (#3086) * Moved PlatformLimits to setreg. Removed Device PostInit. Some clean up. Signed-off-by: jiaweig * Move setreg loading the PlatformLimitsDescriptor super class. Signed-off-by: jiaweig * Apply same implementation for fake device used in unit tests Signed-off-by: jiaweig * Add implementation for Null renderer. Swap order for register RHI interface in initialization. Signed-off-by: jiaweig * Move back setreg from PlatfromLimitsDescriptor to Device, due to Linux dependency issue. Signed-off-by: jiaweig * Changed the function to take in RHI backend name Signed-off-by: jiaweig --- .../Android/Vulkan/PlatformLimits.azasset | 11 ---- .../Linux/Vulkan/PlatformLimits.azasset | 11 ---- .../Platform/Mac/Metal/PlatformLimits.azasset | 12 ----- .../Windows/DX12/PlatformLimits.azasset | 18 ------- .../Windows/Vulkan/PlatformLimits.azasset | 11 ---- .../Platform/iOS/Metal/PlatformLimits.azasset | 12 ----- .../Atom/RHI.Reflect/DeviceDescriptor.h | 4 +- .../RHI.Reflect/PlatformLimitsDescriptor.h | 12 +++-- .../Atom/RHI.Reflect/RHISystemDescriptor.h | 2 - Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h | 17 +++--- .../RHI/Code/Include/Atom/RHI/RHISystem.h | 1 - .../Source/RHI.Reflect/DeviceDescriptor.cpp | 6 +++ .../RHI.Reflect/PlatformLimitsDescriptor.cpp | 52 ++++++++++++------- Gems/Atom/RHI/Code/Source/RHI/Device.cpp | 28 ++-------- Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp | 52 +++++++------------ Gems/Atom/RHI/Code/Tests/Device.cpp | 6 ++- Gems/Atom/RHI/Code/Tests/Device.h | 7 ++- .../DX12/PlatformLimitsDescriptor.h | 10 ++-- .../RHI.Reflect/PlatformLimitsDescriptor.cpp | 14 ++--- Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp | 36 +++++++------ Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h | 4 +- .../Metal/PlatformLimitsDescriptor.h | 6 +-- .../RHI.Reflect/PlatformLimitsDescriptor.cpp | 16 +++--- .../Atom/RHI/Metal/Code/Source/RHI/Device.cpp | 18 +++++-- Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h | 4 +- Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp | 5 ++ Gems/Atom/RHI/Null/Code/Source/RHI/Device.h | 6 +-- .../Platform/Android/PlatformLimits.setreg | 27 ++++++++++ .../Platform/Linux/PlatformLimits.setreg | 27 ++++++++++ .../Platform/Mac/PlatformLimits.setreg | 27 ++++++++++ .../Platform/Windows/PlatformLimits.setreg | 38 ++++++++++++++ .../Platform/iOS/PlatformLimits.setreg | 27 ++++++++++ .../Vulkan/PlatformLimitsDescriptor.h | 6 +-- .../RHI.Reflect/PlatformLimitsDescriptor.cpp | 14 ++--- .../RHI/Vulkan/Code/Source/RHI/BufferPool.cpp | 2 +- .../RHI/Vulkan/Code/Source/RHI/Device.cpp | 15 ++++-- Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h | 4 +- .../RPI/Code/Source/RPI.Public/RPISystem.cpp | 13 ----- .../RPI/Code/Tests/Common/RHI/Factory.cpp | 1 - Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.cpp | 5 ++ Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h | 3 +- 41 files changed, 333 insertions(+), 257 deletions(-) delete mode 100644 Gems/Atom/Feature/Common/Assets/Config/Platform/Android/Vulkan/PlatformLimits.azasset delete mode 100644 Gems/Atom/Feature/Common/Assets/Config/Platform/Linux/Vulkan/PlatformLimits.azasset delete mode 100644 Gems/Atom/Feature/Common/Assets/Config/Platform/Mac/Metal/PlatformLimits.azasset delete mode 100644 Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/DX12/PlatformLimits.azasset delete mode 100644 Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/Vulkan/PlatformLimits.azasset delete mode 100644 Gems/Atom/Feature/Common/Assets/Config/Platform/iOS/Metal/PlatformLimits.azasset create mode 100644 Gems/Atom/RHI/Registry/Platform/Android/PlatformLimits.setreg create mode 100644 Gems/Atom/RHI/Registry/Platform/Linux/PlatformLimits.setreg create mode 100644 Gems/Atom/RHI/Registry/Platform/Mac/PlatformLimits.setreg create mode 100644 Gems/Atom/RHI/Registry/Platform/Windows/PlatformLimits.setreg create mode 100644 Gems/Atom/RHI/Registry/Platform/iOS/PlatformLimits.setreg diff --git a/Gems/Atom/Feature/Common/Assets/Config/Platform/Android/Vulkan/PlatformLimits.azasset b/Gems/Atom/Feature/Common/Assets/Config/Platform/Android/Vulkan/PlatformLimits.azasset deleted file mode 100644 index 37becd9eef..0000000000 --- a/Gems/Atom/Feature/Common/Assets/Config/Platform/Android/Vulkan/PlatformLimits.azasset +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Type": "JsonSerialization", - "Version": 0, - "ClassName": "PlatformLimits", - "ClassData": { - "m_platformLimitsDescriptor": - { - "$type": "Vulkan::PlatformLimitsDescriptor" - } - } -} diff --git a/Gems/Atom/Feature/Common/Assets/Config/Platform/Linux/Vulkan/PlatformLimits.azasset b/Gems/Atom/Feature/Common/Assets/Config/Platform/Linux/Vulkan/PlatformLimits.azasset deleted file mode 100644 index 37becd9eef..0000000000 --- a/Gems/Atom/Feature/Common/Assets/Config/Platform/Linux/Vulkan/PlatformLimits.azasset +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Type": "JsonSerialization", - "Version": 0, - "ClassName": "PlatformLimits", - "ClassData": { - "m_platformLimitsDescriptor": - { - "$type": "Vulkan::PlatformLimitsDescriptor" - } - } -} diff --git a/Gems/Atom/Feature/Common/Assets/Config/Platform/Mac/Metal/PlatformLimits.azasset b/Gems/Atom/Feature/Common/Assets/Config/Platform/Mac/Metal/PlatformLimits.azasset deleted file mode 100644 index 573862cc40..0000000000 --- a/Gems/Atom/Feature/Common/Assets/Config/Platform/Mac/Metal/PlatformLimits.azasset +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Type": "JsonSerialization", - "Version": 0, - "ClassName": "PlatformLimits", - "ClassData": { - "m_platformLimitsDescriptor": - { - "$type": "Metal::PlatformLimitsDescriptor" - } - } -} - diff --git a/Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/DX12/PlatformLimits.azasset b/Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/DX12/PlatformLimits.azasset deleted file mode 100644 index 3c88544e62..0000000000 --- a/Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/DX12/PlatformLimits.azasset +++ /dev/null @@ -1,18 +0,0 @@ -{ - "Type": "JsonSerialization", - "Version": 0, - "ClassName": "PlatformLimits", - "ClassData": { - "m_platformLimitsDescriptor": - { - "$type": "DX12::PlatformLimitsDescriptor", - - "m_descriptorHeapLimits": { - "DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV": [1000000, 1000000], - "DESCRIPTOR_HEAP_TYPE_SAMPLER": [2048, 2048], - "DESCRIPTOR_HEAP_TYPE_RTV": [2048, 0], - "DESCRIPTOR_HEAP_TYPE_DSV": [2048, 0] - } - } - } -} diff --git a/Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/Vulkan/PlatformLimits.azasset b/Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/Vulkan/PlatformLimits.azasset deleted file mode 100644 index 37becd9eef..0000000000 --- a/Gems/Atom/Feature/Common/Assets/Config/Platform/Windows/Vulkan/PlatformLimits.azasset +++ /dev/null @@ -1,11 +0,0 @@ -{ - "Type": "JsonSerialization", - "Version": 0, - "ClassName": "PlatformLimits", - "ClassData": { - "m_platformLimitsDescriptor": - { - "$type": "Vulkan::PlatformLimitsDescriptor" - } - } -} diff --git a/Gems/Atom/Feature/Common/Assets/Config/Platform/iOS/Metal/PlatformLimits.azasset b/Gems/Atom/Feature/Common/Assets/Config/Platform/iOS/Metal/PlatformLimits.azasset deleted file mode 100644 index 4556073118..0000000000 --- a/Gems/Atom/Feature/Common/Assets/Config/Platform/iOS/Metal/PlatformLimits.azasset +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Type": "JsonSerialization", - "Version": 0, - "ClassName": "PlatformLimits", - "ClassData": { - "m_platformLimitsDescriptor": - { - "$type": "Metal::PlatformLimitsDescriptor" - } - } -} - diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/DeviceDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/DeviceDescriptor.h index 87e2b03181..b7f7a6754f 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/DeviceDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/DeviceDescriptor.h @@ -22,14 +22,14 @@ namespace AZ class DeviceDescriptor { public: - virtual ~DeviceDescriptor() = default; AZ_RTTI(DeviceDescriptor, "{8446A34C-A079-44B8-A20F-45D9CAB1FAFD}"); static void Reflect(AZ::ReflectContext* context); DeviceDescriptor() = default; + virtual ~DeviceDescriptor(); uint32_t m_frameCountMax = RHI::Limits::Device::FrameCountMax; - ConstPtr m_platformLimitsDescriptor = nullptr; + Ptr m_platformLimitsDescriptor = nullptr; }; } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PlatformLimitsDescriptor.h index 4cec15651c..2d85420694 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PlatformLimitsDescriptor.h @@ -20,7 +20,7 @@ namespace AZ { struct TransientAttachmentPoolBudgets { - AZ_TYPE_INFO(TransientAttachmentPoolBudgets, "{CE39BBEF-C9CD-4B9A-BA41-C886D9F063BC}"); + AZ_TYPE_INFO(AZ::RHI::TransientAttachmentPoolBudgets, "{CE39BBEF-C9CD-4B9A-BA41-C886D9F063BC}"); static void Reflect(AZ::ReflectContext* context); //! Defines the maximum amount of memory the pool is allowed to consume for transient buffers. @@ -53,8 +53,8 @@ namespace AZ : public AZStd::intrusive_base { public: - AZ_RTTI(PlatformLimitsDescriptor, "{3A7B2BE4-0337-4F59-B4FC-B7E529EBE6C5}"); - AZ_CLASS_ALLOCATOR(PlatformLimitsDescriptor, AZ::SystemAllocator, 0); + AZ_RTTI(AZ::RHI::PlatformLimitsDescriptor, "{3A7B2BE4-0337-4F59-B4FC-B7E529EBE6C5}"); + AZ_CLASS_ALLOCATOR(AZ::RHI::PlatformLimitsDescriptor, AZ::SystemAllocator, 0); static void Reflect(AZ::ReflectContext* context); static RHI::Ptr Create(); @@ -67,13 +67,15 @@ namespace AZ HeapPagingParameters m_pagingParameters; HeapMemoryHintParameters m_usageHintParameters; HeapAllocationStrategy m_heapAllocationStrategy = HeapAllocationStrategy::MemoryHint; + + void LoadPlatformLimitsDescriptor(const char* rhiName); }; class PlatformLimits final { public: - AZ_RTTI(PlatformLimits, "{48158F25-5044-441C-A2B2-2D3E9255B0C3}"); - AZ_CLASS_ALLOCATOR(PlatformLimits, AZ::SystemAllocator, 0); + AZ_RTTI(AZ::RHI::PlatformLimits, "{48158F25-5044-441C-A2B2-2D3E9255B0C3}"); + AZ_CLASS_ALLOCATOR(AZ::RHI::PlatformLimits, AZ::SystemAllocator, 0); static void Reflect(AZ::ReflectContext* context); Ptr m_platformLimitsDescriptor = nullptr; diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h index b9fae5593f..8c512662e7 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h @@ -26,8 +26,6 @@ namespace AZ //! The set of globally declared draw list tags, which will be registered with the registry at startup. AZStd::vector m_drawListTags; - - const RHI::PlatformLimits* m_platformLimits = nullptr; }; } // namespace RHI } // namespace AZ diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h index e7ad98c074..f9df29cf74 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/Device.h @@ -60,10 +60,6 @@ namespace AZ //! been called), and an error code is returned. ResultCode Init(PhysicalDevice& physicalDevice); - //! Called to initialize anything that wasn't done as part of Init. DeviceDescriptor is passed down - //! as part of this API. This is called after AssetCatalog is loaded and hence any file can be loaded at this point - ResultCode PostInit(const DeviceDescriptor& descriptor); - //! Begins execution of a frame. The device internally manages a set of command queues. This //! method will synchronize the CPU with the GPU according to the number of in-light frames //! configured on the device. This means you should make sure any manipulation of N-buffered @@ -147,7 +143,9 @@ namespace AZ DeviceFeatures m_features; DeviceLimits m_limits; ResourcePoolDatabase m_resourcePoolDatabase; - + + DeviceDescriptor m_descriptor; + using FormatCapabilitiesList = AZStd::array(Format::Count)>; private: @@ -165,10 +163,6 @@ namespace AZ //! Called when just the device is being initialized. virtual ResultCode InitInternal(PhysicalDevice& physicalDevice) = 0; - - //! Called to initialize anything that wasnt done as part of InitInternal. - //! This is called after AssetCatalog is loaded and hence any file can be loaded at this point - virtual ResultCode PostInitInternal(const DeviceDescriptor& descriptor) = 0; //! Called when the device is being shutdown. virtual void ShutdownInternal() = 0; @@ -190,6 +184,9 @@ namespace AZ //! Fills the capabilities for each format. virtual void FillFormatsCapabilitiesInternal(FormatCapabilitiesList& formatsCapabilities) = 0; + + //! Initialize limits and resources associated with them. + virtual ResultCode InitializeLimits() = 0; /////////////////////////////////////////////////////////////////// void CalculateDepthStencilNearestSupportedFormats(); @@ -198,8 +195,6 @@ namespace AZ //! All platform specific format mappings should be executed before this function is called void FillRemainingSupportedFormats(); - DeviceDescriptor m_descriptor; - // The physical device backing this logical device instance. Ptr m_physicalDevice; diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h index e37fd75148..25026b5b87 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h @@ -68,7 +68,6 @@ namespace AZ RHI::FrameScheduler m_frameScheduler; RHI::FrameSchedulerCompileRequest m_compileRequest; - ConstPtr m_platformLimitsDescriptor = nullptr; RHI::CpuProfilerImpl m_cpuProfiler; }; } // namespace RPI diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/DeviceDescriptor.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/DeviceDescriptor.cpp index 709a870c81..8f36d38934 100644 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/DeviceDescriptor.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI.Reflect/DeviceDescriptor.cpp @@ -24,5 +24,11 @@ namespace AZ ; } } + + DeviceDescriptor::~DeviceDescriptor() + { + m_platformLimitsDescriptor = nullptr; + } + } } diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp index 02bcb3432f..250f03716d 100644 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp @@ -7,6 +7,7 @@ */ #include #include +#include namespace AZ { @@ -17,8 +18,8 @@ namespace AZ if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(0) - ->Field("m_platformLimitsDescriptor", &PlatformLimits::m_platformLimitsDescriptor) + ->Version(1) + ->Field("PlatformLimitsDescriptor", &PlatformLimits::m_platformLimitsDescriptor) ; } } @@ -28,10 +29,10 @@ namespace AZ if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(0) - ->Field("m_bufferBudgetInBytes", &TransientAttachmentPoolBudgets::m_bufferBudgetInBytes) - ->Field("m_imageBudgetInBytes", &TransientAttachmentPoolBudgets::m_imageBudgetInBytes) - ->Field("m_renderTargetBudgetInBytes", &TransientAttachmentPoolBudgets::m_renderTargetBudgetInBytes) + ->Version(1) + ->Field("BufferBudgetInBytes", &TransientAttachmentPoolBudgets::m_bufferBudgetInBytes) + ->Field("ImageBudgetInBytes", &TransientAttachmentPoolBudgets::m_imageBudgetInBytes) + ->Field("RenderTargetBudgetInBytes", &TransientAttachmentPoolBudgets::m_renderTargetBudgetInBytes) ; } } @@ -41,13 +42,13 @@ namespace AZ if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(0) - ->Field("m_stagingBufferBudgetInBytes", &PlatformDefaultValues::m_stagingBufferBudgetInBytes) - ->Field("m_asyncQueueStagingBufferSizeInBytes", &PlatformDefaultValues::m_asyncQueueStagingBufferSizeInBytes) - ->Field("m_mediumStagingBufferPageSizeInBytes", &PlatformDefaultValues::m_mediumStagingBufferPageSizeInBytes) - ->Field("m_largestStagingBufferPageSizeInBytes", &PlatformDefaultValues::m_largestStagingBufferPageSizeInBytes) - ->Field("m_imagePoolPageSizeInBytes", &PlatformDefaultValues::m_imagePoolPageSizeInBytes) - ->Field("m_bufferPoolPageSizeInBytes", &PlatformDefaultValues::m_bufferPoolPageSizeInBytes) + ->Version(1) + ->Field("StagingBufferBudgetInBytes", &PlatformDefaultValues::m_stagingBufferBudgetInBytes) + ->Field("AsyncQueueStagingBufferSizeInBytes", &PlatformDefaultValues::m_asyncQueueStagingBufferSizeInBytes) + ->Field("MediumStagingBufferPageSizeInBytes", &PlatformDefaultValues::m_mediumStagingBufferPageSizeInBytes) + ->Field("LargestStagingBufferPageSizeInBytes", &PlatformDefaultValues::m_largestStagingBufferPageSizeInBytes) + ->Field("ImagePoolPageSizeInBytes", &PlatformDefaultValues::m_imagePoolPageSizeInBytes) + ->Field("BufferPoolPageSizeInBytes", &PlatformDefaultValues::m_bufferPoolPageSizeInBytes) ; } } @@ -58,12 +59,12 @@ namespace AZ if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(1) - ->Field("m_transientAttachmentPoolBudgets", &PlatformLimitsDescriptor::m_transientAttachmentPoolBudgets) - ->Field("m_platformDefaultValues", &PlatformLimitsDescriptor::m_platformDefaultValues) - ->Field("m_pagingParameters", &PlatformLimitsDescriptor::m_pagingParameters) - ->Field("m_usageHintParameters", &PlatformLimitsDescriptor::m_usageHintParameters) - ->Field("m_heapAllocationStrategy", &PlatformLimitsDescriptor::m_heapAllocationStrategy) + ->Version(2) + ->Field("TransientAttachmentPoolBudgets", &PlatformLimitsDescriptor::m_transientAttachmentPoolBudgets) + ->Field("PlatformDefaultValues", &PlatformLimitsDescriptor::m_platformDefaultValues) + ->Field("PagingParameters", &PlatformLimitsDescriptor::m_pagingParameters) + ->Field("UsageHintParameters", &PlatformLimitsDescriptor::m_usageHintParameters) + ->Field("HeapAllocationStrategy", &PlatformLimitsDescriptor::m_heapAllocationStrategy) ; } } @@ -72,5 +73,18 @@ namespace AZ { return aznew PlatformLimitsDescriptor; } + + void PlatformLimitsDescriptor::LoadPlatformLimitsDescriptor(const char* rhiName) + { + auto settingsRegistry = AZ::SettingsRegistry::Get(); + AZStd::string platformLimitsRegPath = AZStd::string::format("/Amazon/Atom/RHI/PlatformLimits/%s", rhiName); + if (!(settingsRegistry && + settingsRegistry->GetObject(this, azrtti_typeid(this), platformLimitsRegPath.c_str()))) + { + AZ_Warning( + "Device", false, "Platform limits for %s %s is not loaded correctly. Will use default values.", + AZ_TRAIT_OS_PLATFORM_NAME, rhiName); + } + } } } diff --git a/Gems/Atom/RHI/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Code/Source/RHI/Device.cpp index b7a1e2315c..3af09717df 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/Device.cpp @@ -77,7 +77,7 @@ namespace AZ m_physicalDevice = &physicalDevice; - const ResultCode resultCode = InitInternal(physicalDevice); + RHI::ResultCode resultCode = InitInternal(physicalDevice); if (resultCode == ResultCode::Success) { @@ -90,6 +90,9 @@ namespace AZ // Assume all formats that haven't been mapped yet are supported and map to themselves FillRemainingSupportedFormats(); + + // Initialize limits and resources that are associated with them + resultCode = InitializeLimits(); } else { @@ -98,29 +101,6 @@ namespace AZ return resultCode; } - - ResultCode Device::PostInit(const DeviceDescriptor& descriptor) - { - if (Validation::IsEnabled()) - { - if (!IsInitialized()) - { - AZ_Error("Device", false, "Device is not initialized."); - return ResultCode::InvalidOperation; - } - } - - m_descriptor = descriptor; - const ResultCode resultCode = PostInitInternal(descriptor); - - if (resultCode != ResultCode::Success) - { - AZ_Error("Device", false, "Device is not initialized."); - return ResultCode::InvalidOperation; - } - - return resultCode; - } void Device::Shutdown() { diff --git a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp index 5e08696ec2..8f8b7677fd 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp @@ -30,42 +30,26 @@ namespace AZ void RHISystem::InitDevice() { - m_device = InitInternalDevice(); Interface::Register(this); + m_device = InitInternalDevice(); } void RHISystem::Init(const RHISystemDescriptor& descriptor) { m_cpuProfiler.Init(); + Ptr platformLimitsDescriptor = m_device->GetDescriptor().m_platformLimitsDescriptor; + RHI::FrameSchedulerDescriptor frameSchedulerDescriptor; - if (descriptor.m_platformLimits) - { - m_platformLimitsDescriptor = descriptor.m_platformLimits->m_platformLimitsDescriptor; - } - - //If platformlimits.azasset file is not provided create an object with default config values. - if (!m_platformLimitsDescriptor) - { - m_platformLimitsDescriptor = PlatformLimitsDescriptor::Create(); - } - - RHI::DeviceDescriptor deviceDesc; - deviceDesc.m_platformLimitsDescriptor = m_platformLimitsDescriptor; - if (m_device->PostInit(deviceDesc) != RHI::ResultCode::Success) - { - AZ_Assert(false, "RHISystem", "Unable to initialize RHI! \n"); - return; - } m_drawListTagRegistry = RHI::DrawListTagRegistry::Create(); m_pipelineStateCache = RHI::PipelineStateCache::Create(*m_device); - frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_renderTargetBudgetInBytes = m_platformLimitsDescriptor->m_transientAttachmentPoolBudgets.m_renderTargetBudgetInBytes; - frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_imageBudgetInBytes = m_platformLimitsDescriptor->m_transientAttachmentPoolBudgets.m_imageBudgetInBytes; - frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_bufferBudgetInBytes = m_platformLimitsDescriptor->m_transientAttachmentPoolBudgets.m_bufferBudgetInBytes; + frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_renderTargetBudgetInBytes = platformLimitsDescriptor->m_transientAttachmentPoolBudgets.m_renderTargetBudgetInBytes; + frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_imageBudgetInBytes = platformLimitsDescriptor->m_transientAttachmentPoolBudgets.m_imageBudgetInBytes; + frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_bufferBudgetInBytes = platformLimitsDescriptor->m_transientAttachmentPoolBudgets.m_bufferBudgetInBytes; - switch (m_platformLimitsDescriptor->m_heapAllocationStrategy) + switch (platformLimitsDescriptor->m_heapAllocationStrategy) { case HeapAllocationStrategy::Fixed: { @@ -75,19 +59,19 @@ namespace AZ case HeapAllocationStrategy::Paging: { RHI::HeapPagingParameters heapAllocationParameters; - heapAllocationParameters.m_collectLatency = m_platformLimitsDescriptor->m_pagingParameters.m_collectLatency; - heapAllocationParameters.m_initialAllocationPercentage = m_platformLimitsDescriptor->m_pagingParameters.m_initialAllocationPercentage; - heapAllocationParameters.m_pageSizeInBytes = m_platformLimitsDescriptor->m_pagingParameters.m_pageSizeInBytes; + heapAllocationParameters.m_collectLatency = platformLimitsDescriptor->m_pagingParameters.m_collectLatency; + heapAllocationParameters.m_initialAllocationPercentage = platformLimitsDescriptor->m_pagingParameters.m_initialAllocationPercentage; + heapAllocationParameters.m_pageSizeInBytes = platformLimitsDescriptor->m_pagingParameters.m_pageSizeInBytes; frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_heapParameters = RHI::HeapAllocationParameters(heapAllocationParameters); break; } case HeapAllocationStrategy::MemoryHint: { RHI::HeapMemoryHintParameters heapAllocationParameters; - heapAllocationParameters.m_heapSizeScaleFactor = m_platformLimitsDescriptor->m_usageHintParameters.m_heapSizeScaleFactor; - heapAllocationParameters.m_collectLatency = m_platformLimitsDescriptor->m_usageHintParameters.m_collectLatency; - heapAllocationParameters.m_maxHeapWastedPercentage = m_platformLimitsDescriptor->m_usageHintParameters.m_maxHeapWastedPercentage; - heapAllocationParameters.m_minHeapSizeInBytes = m_platformLimitsDescriptor->m_usageHintParameters.m_minHeapSizeInBytes; + heapAllocationParameters.m_heapSizeScaleFactor = platformLimitsDescriptor->m_usageHintParameters.m_heapSizeScaleFactor; + heapAllocationParameters.m_collectLatency = platformLimitsDescriptor->m_usageHintParameters.m_collectLatency; + heapAllocationParameters.m_maxHeapWastedPercentage = platformLimitsDescriptor->m_usageHintParameters.m_maxHeapWastedPercentage; + heapAllocationParameters.m_minHeapSizeInBytes = platformLimitsDescriptor->m_usageHintParameters.m_minHeapSizeInBytes; frameSchedulerDescriptor.m_transientAttachmentPoolDescriptor.m_heapParameters = RHI::HeapAllocationParameters(heapAllocationParameters); break; } @@ -98,7 +82,7 @@ namespace AZ } } - frameSchedulerDescriptor.m_platformLimitsDescriptor = m_platformLimitsDescriptor; + frameSchedulerDescriptor.m_platformLimitsDescriptor = platformLimitsDescriptor; m_frameScheduler.Init(*m_device, frameSchedulerDescriptor); // Register draw list tags declared from content. @@ -183,6 +167,7 @@ namespace AZ RHI::Ptr device = RHI::Factory::Get().CreateDevice(); if (device->Init(*physicalDeviceFound) == RHI::ResultCode::Success) { + PlatformLimitsDescriptor::Create(); return device; } @@ -195,10 +180,9 @@ namespace AZ Interface::Unregister(this); m_frameScheduler.Shutdown(); - m_platformLimitsDescriptor = nullptr; m_pipelineStateCache = nullptr; if (m_device) - { + { m_device->PreShutdown(); AZ_Assert(m_device->use_count()==1, "The ref count for Device is %i but it should be 1 here to ensure all the resources are released", m_device->use_count()); m_device = nullptr; @@ -293,7 +277,7 @@ namespace AZ ConstPtr RHISystem::GetPlatformLimitsDescriptor() const { - return m_platformLimitsDescriptor; + return m_device->GetDescriptor().m_platformLimitsDescriptor; } void RHISystem::QueueRayTracingShaderTableForBuild(RayTracingShaderTable* rayTracingShaderTable) diff --git a/Gems/Atom/RHI/Code/Tests/Device.cpp b/Gems/Atom/RHI/Code/Tests/Device.cpp index 654653ceb9..0f424a5405 100644 --- a/Gems/Atom/RHI/Code/Tests/Device.cpp +++ b/Gems/Atom/RHI/Code/Tests/Device.cpp @@ -17,6 +17,11 @@ namespace UnitTest m_descriptor.m_description = "UnitTest Fake Device"; } + Device::Device() + { + m_descriptor.m_platformLimitsDescriptor = aznew RHI::PlatformLimitsDescriptor; + } + RHI::PhysicalDeviceList PhysicalDevice::Enumerate() { return RHI::PhysicalDeviceList{aznew PhysicalDevice}; @@ -29,7 +34,6 @@ namespace UnitTest RHI::Ptr device = RHI::Factory::Get().CreateDevice(); device->Init(*physicalDevices[0]); - device->PostInit(RHI::DeviceDescriptor{}); return device; } diff --git a/Gems/Atom/RHI/Code/Tests/Device.h b/Gems/Atom/RHI/Code/Tests/Device.h index e11bd75983..d3177fc823 100644 --- a/Gems/Atom/RHI/Code/Tests/Device.h +++ b/Gems/Atom/RHI/Code/Tests/Device.h @@ -31,10 +31,11 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(Device, AZ::SystemAllocator, 0); + Device(); + private: AZ::RHI::ResultCode InitInternal(AZ::RHI::PhysicalDevice&) override { return AZ::RHI::ResultCode::Success; } - AZ::RHI::ResultCode PostInitInternal(const AZ::RHI::DeviceDescriptor&) override { return AZ::RHI::ResultCode::Success; } void ShutdownInternal() override {} @@ -54,7 +55,9 @@ namespace UnitTest } void FillFormatsCapabilitiesInternal([[maybe_unused]] FormatCapabilitiesList& formatsCapabilities) override {} - + + AZ::RHI::ResultCode InitializeLimits() override { return AZ::RHI::ResultCode::Success; } + void PreShutdown() override {} AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::ImageDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; }; diff --git a/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h index 06e15d0ca6..cbf1fd11f6 100644 --- a/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h @@ -23,11 +23,11 @@ namespace AZ DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, DESCRIPTOR_HEAP_TYPE_SAMPLER, DESCRIPTOR_HEAP_TYPE_RTV, - DESCRIPTOR_HEAP_TYPE_DSV); + DESCRIPTOR_HEAP_TYPE_DSV); struct FrameGraphExecuterData { - AZ_TYPE_INFO(FrameGraphExecuterData, "{C21547F6-DE48-4F82-B812-1A187101AB4E}"); + AZ_TYPE_INFO(AZ::DX12::FrameGraphExecuterData, "{C21547F6-DE48-4F82-B812-1A187101AB4E}"); static void Reflect(AZ::ReflectContext* context); //Cost per draw/dispatch item @@ -52,15 +52,15 @@ namespace AZ { using Base = RHI::PlatformLimitsDescriptor; public: - AZ_RTTI(DX12::PlatformLimitsDescriptor, "{ADCC8071-FCE4-4FA1-A048-DF8982951A0D}", Base); - AZ_CLASS_ALLOCATOR(PlatformLimitsDescriptor, AZ::SystemAllocator, 0); + AZ_RTTI(AZ::DX12::PlatformLimitsDescriptor, "{ADCC8071-FCE4-4FA1-A048-DF8982951A0D}", Base); + AZ_CLASS_ALLOCATOR(AZ::DX12::PlatformLimitsDescriptor, AZ::SystemAllocator, 0); static void Reflect(AZ::ReflectContext* context); PlatformLimitsDescriptor() = default; static const uint32_t NumHeapFlags = 2;// D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE + 1; - //! string key: stringifed version of DESCRIPTOR_HEAP_TYPE. + //! string key: string version of DESCRIPTOR_HEAP_TYPE. //! int array: Max count for descriptors AZStd::unordered_map> m_descriptorHeapLimits; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp index 3c685051ea..980264aa9b 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp @@ -19,8 +19,8 @@ namespace AZ { serializeContext->Class() ->Version(0) - ->Field("m_descriptorHeapLimits", &PlatformLimitsDescriptor::m_descriptorHeapLimits) - ->Field("m_frameGraphExecuterData", &PlatformLimitsDescriptor::m_frameGraphExecuterData) + ->Field("DescriptorHeapLimits", &PlatformLimitsDescriptor::m_descriptorHeapLimits) + ->Field("FrameGraphExecuterData", &PlatformLimitsDescriptor::m_frameGraphExecuterData) ; } } @@ -31,11 +31,11 @@ namespace AZ { serializeContext->Class() ->Version(0) - ->Field("m_itemCost", &FrameGraphExecuterData::m_itemCost) - ->Field("m_attachmentCost", &FrameGraphExecuterData::m_attachmentCost) - ->Field("m_swapChainsPerCommandList", &FrameGraphExecuterData::m_swapChainsPerCommandList) - ->Field("m_commandListCostThresholdMin", &FrameGraphExecuterData::m_commandListCostThresholdMin) - ->Field("m_commandListsPerScopeMax", &FrameGraphExecuterData::m_commandListsPerScopeMax) + ->Field("ItemCost", &FrameGraphExecuterData::m_itemCost) + ->Field("AttachmentCost", &FrameGraphExecuterData::m_attachmentCost) + ->Field("SwapChainsPerCommandList", &FrameGraphExecuterData::m_swapChainsPerCommandList) + ->Field("CommandListCostThresholdMin", &FrameGraphExecuterData::m_commandListCostThresholdMin) + ->Field("CommandListsPerScopeMax", &FrameGraphExecuterData::m_commandListsPerScopeMax) ; } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp index 9d23dfa43d..30ed07bd22 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp @@ -5,6 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ +#include #include #include #include @@ -29,6 +30,13 @@ namespace AZ void DeviceCompileMemoryStatisticsInternal(RHI::MemoryStatisticsBuilder& builder, IDXGIAdapterX* dxgiAdapter); } + Device::Device() + { + RHI::Ptr platformLimitsDescriptor = aznew PlatformLimitsDescriptor(); + platformLimitsDescriptor->LoadPlatformLimitsDescriptor(RHI::Factory::Get().GetName().GetCStr()); + m_descriptor.m_platformLimitsDescriptor = RHI::Ptr(platformLimitsDescriptor); + } + RHI::Ptr Device::Create() { return aznew Device(); @@ -43,35 +51,31 @@ namespace AZ } InitFeatures(); + return RHI::ResultCode::Success; } - RHI::ResultCode Device::PostInitInternal(const RHI::DeviceDescriptor& descriptor) + RHI::ResultCode Device::InitializeLimits() { m_allocationInfoCache.SetInitFunction([](auto& cache) { cache.set_capacity(64); }); { ReleaseQueue::Descriptor releaseQueueDescriptor; - releaseQueueDescriptor.m_collectLatency = descriptor.m_frameCountMax - 1; + releaseQueueDescriptor.m_collectLatency = m_descriptor.m_frameCountMax - 1; m_releaseQueue.Init(releaseQueueDescriptor); } m_descriptorContext = AZStd::make_shared(); - RHI::ConstPtr rhiDescriptor = descriptor.m_platformLimitsDescriptor; - if (RHI::ConstPtr platLimitsDesc = azrtti_cast(rhiDescriptor)) - { - m_descriptorContext->Init(m_dx12Device.get(), platLimitsDesc); - } - else - { - AZ_Assert(false, "Missing PlatformLimits config file for DX12 backend"); - } + RHI::ConstPtr rhiDescriptor = m_descriptor.m_platformLimitsDescriptor; + RHI::ConstPtr platLimitsDesc = azrtti_cast(rhiDescriptor); + AZ_Assert(platLimitsDesc != nullptr, "Missing PlatformLimits config file for DX12 backend"); + m_descriptorContext->Init(m_dx12Device.get(), platLimitsDesc); { CommandListAllocator::Descriptor commandListAllocatorDescriptor; commandListAllocatorDescriptor.m_device = this; - commandListAllocatorDescriptor.m_frameCountMax = descriptor.m_frameCountMax; + commandListAllocatorDescriptor.m_frameCountMax = m_descriptor.m_frameCountMax; commandListAllocatorDescriptor.m_descriptorContext = m_descriptorContext; m_commandListAllocator.Init(commandListAllocatorDescriptor); } @@ -80,9 +84,9 @@ namespace AZ StagingMemoryAllocator::Descriptor allocatorDesc; allocatorDesc.m_device = this; - allocatorDesc.m_mediumPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes; - allocatorDesc.m_largePageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes; - allocatorDesc.m_collectLatency = descriptor.m_frameCountMax; + allocatorDesc.m_mediumPageSizeInBytes = platLimitsDesc->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes; + allocatorDesc.m_largePageSizeInBytes = platLimitsDesc->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes; + allocatorDesc.m_collectLatency = m_descriptor.m_frameCountMax; m_stagingMemoryAllocator.Init(allocatorDesc); } @@ -90,7 +94,7 @@ namespace AZ m_commandQueueContext.Init(*this); - m_asyncUploadQueue.Init(*this, AsyncUploadQueue::Descriptor(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_asyncQueueStagingBufferSizeInBytes)); + m_asyncUploadQueue.Init(*this, AsyncUploadQueue::Descriptor(platLimitsDesc->m_platformDefaultValues.m_asyncQueueStagingBufferSizeInBytes)); m_samplerCache.SetCapacity(SamplerCacheCapacity); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h index 9119545342..4d1f2c4ac9 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.h @@ -143,12 +143,11 @@ namespace AZ bool IsAftermathInitialized() const; private: - Device() = default; + Device(); ////////////////////////////////////////////////////////////////////////// // RHI::Device RHI::ResultCode InitInternal(RHI::PhysicalDevice& physicalDevice) override; - RHI::ResultCode PostInitInternal(const RHI::DeviceDescriptor & params) override; void ShutdownInternal() override; void CompileMemoryStatisticsInternal(RHI::MemoryStatisticsBuilder& builder) override; @@ -158,6 +157,7 @@ namespace AZ void WaitForIdleInternal() override; AZStd::chrono::microseconds GpuTimestampToMicroseconds(uint64_t gpuTimestamp, RHI::HardwareQueueClass queueClass) const override; void FillFormatsCapabilitiesInternal(FormatCapabilitiesList& formatsCapabilities) override; + RHI::ResultCode InitializeLimits() override; AZStd::vector GetValidSwapChainImageFormats(const RHI::WindowHandle& windowHandle) const override; void PreShutdown() override; RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::ImageDescriptor & descriptor) override; diff --git a/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h index ace3e08142..375b532d39 100644 --- a/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h @@ -18,7 +18,7 @@ namespace AZ { struct FrameGraphExecuterData { - AZ_TYPE_INFO(FrameGraphExecuterData, "{BD831EFB-CC74-46F8-BE48-118B2E8F07D0}"); + AZ_TYPE_INFO(AZ::Metal::FrameGraphExecuterData, "{BD831EFB-CC74-46F8-BE48-118B2E8F07D0}"); static void Reflect(AZ::ReflectContext* context); //Cost per draw/dispatch item @@ -43,8 +43,8 @@ namespace AZ { using Base = RHI::PlatformLimitsDescriptor; public: - AZ_RTTI(Metal::PlatformLimitsDescriptor, "{B89F116F-9FEF-4BCA-9EC7-9FF8F772B7FD}", Base); - AZ_CLASS_ALLOCATOR(PlatformLimitsDescriptor, AZ::SystemAllocator, 0); + AZ_RTTI(AZ::Metal::PlatformLimitsDescriptor, "{B89F116F-9FEF-4BCA-9EC7-9FF8F772B7FD}", Base); + AZ_CLASS_ALLOCATOR(AZ::Metal::PlatformLimitsDescriptor, AZ::SystemAllocator, 0); static void Reflect(AZ::ReflectContext* context); FrameGraphExecuterData m_frameGraphExecuterData; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp index bdf405d157..4788244775 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp @@ -18,8 +18,8 @@ namespace AZ if (SerializeContext* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(0) - ->Field("m_frameGraphExecuterData", &PlatformLimitsDescriptor::m_frameGraphExecuterData) + ->Version(1) + ->Field("FrameGraphExecuterData", &PlatformLimitsDescriptor::m_frameGraphExecuterData) ; } } @@ -29,12 +29,12 @@ namespace AZ if (auto* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(0) - ->Field("m_itemCost", &FrameGraphExecuterData::m_itemCost) - ->Field("m_attachmentCost", &FrameGraphExecuterData::m_attachmentCost) - ->Field("m_swapChainsPerCommandList", &FrameGraphExecuterData::m_swapChainsPerCommandList) - ->Field("m_commandListCostThresholdMin", &FrameGraphExecuterData::m_commandListCostThresholdMin) - ->Field("m_commandListsPerScopeMax", &FrameGraphExecuterData::m_commandListsPerScopeMax) + ->Version(1) + ->Field("ItemCost", &FrameGraphExecuterData::m_itemCost) + ->Field("AttachmentCost", &FrameGraphExecuterData::m_attachmentCost) + ->Field("SwapChainsPerCommandList", &FrameGraphExecuterData::m_swapChainsPerCommandList) + ->Field("CommandListCostThresholdMin", &FrameGraphExecuterData::m_commandListCostThresholdMin) + ->Field("CommandListsPerScopeMax", &FrameGraphExecuterData::m_commandListsPerScopeMax) ; } } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp index 5591bcc843..782ea7174b 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.cpp @@ -5,7 +5,9 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ +#include #include +#include #include #include #include @@ -27,6 +29,13 @@ namespace AZ { namespace Metal { + Device::Device() + { + RHI::Ptr platformLimitsDescriptor = aznew PlatformLimitsDescriptor(); + platformLimitsDescriptor->LoadPlatformLimitsDescriptor(RHI::Factory::Get().GetName().GetCStr()); + m_descriptor.m_platformLimitsDescriptor = RHI::Ptr(platformLimitsDescriptor); + } + RHI::Ptr Device::Create() { return aznew Device(); @@ -42,24 +51,24 @@ namespace AZ return RHI::ResultCode::Success; } - RHI::ResultCode Device::PostInitInternal(const RHI::DeviceDescriptor& descriptor) + RHI::ResultCode Device::InitializeLimits() { { ReleaseQueue::Descriptor releaseQueueDescriptor; - releaseQueueDescriptor.m_collectLatency = descriptor.m_frameCountMax; + releaseQueueDescriptor.m_collectLatency = m_descriptor.m_frameCountMax; m_releaseQueue.Init(releaseQueueDescriptor); } { CommandListAllocator::Descriptor commandListAllocatorDescriptor; - commandListAllocatorDescriptor.m_frameCountMax = descriptor.m_frameCountMax; + commandListAllocatorDescriptor.m_frameCountMax = m_descriptor.m_frameCountMax; m_commandListAllocator.Init(commandListAllocatorDescriptor, this); } m_pipelineLayoutCache.Init(*this); m_commandQueueContext.Init(*this); - m_asyncUploadQueue.Init(*this, AsyncUploadQueue::Descriptor(RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_asyncQueueStagingBufferSizeInBytes)); + m_asyncUploadQueue.Init(*this, AsyncUploadQueue::Descriptor(m_descriptor.m_platformLimitsDescriptor->m_platformDefaultValues.m_asyncQueueStagingBufferSizeInBytes)); BufferMemoryAllocator::Descriptor allocatorDescriptor; allocatorDescriptor.m_device = this; @@ -77,6 +86,7 @@ namespace AZ m_samplerCache = [[NSCache alloc]init]; [m_samplerCache setName:@"SamplerCache"]; + return RHI::ResultCode::Success; } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h index 9cdeee7eae..90dd4ff4a0 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Device.h @@ -154,12 +154,11 @@ namespace AZ void ObjectCollectionNotify(RHI::ObjectCollectorNotifyFunction notifyFunction) override; private: - Device() = default; + Device(); ////////////////////////////////////////////////////////////////////////// // RHI::Device RHI::ResultCode InitInternal(RHI::PhysicalDevice& physicalDevice) override; - RHI::ResultCode PostInitInternal(const RHI::DeviceDescriptor& params) override; void ShutdownInternal() override; void CompileMemoryStatisticsInternal(RHI::MemoryStatisticsBuilder& builder) override; void UpdateCpuTimingStatisticsInternal(RHI::CpuTimingStatistics& cpuTimingStatistics) const override; @@ -168,6 +167,7 @@ namespace AZ void WaitForIdleInternal() override; AZStd::chrono::microseconds GpuTimestampToMicroseconds(uint64_t gpuTimestamp, RHI::HardwareQueueClass queueClass) const override; void FillFormatsCapabilitiesInternal(FormatCapabilitiesList& formatsCapabilities) override; + RHI::ResultCode InitializeLimits() override; void PreShutdown() override; AZStd::vector GetValidSwapChainImageFormats(const RHI::WindowHandle& windowHandle) const override; ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp index 08a2c4f411..b056071327 100644 --- a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.cpp @@ -16,6 +16,11 @@ namespace AZ return aznew Device(); } + Device::Device() + { + m_descriptor.m_platformLimitsDescriptor = aznew RHI::PlatformLimitsDescriptor; + } + void Device::FillFormatsCapabilitiesInternal(FormatCapabilitiesList& formatsCapabilities) { formatsCapabilities.fill(static_cast(~0)); diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h index cd44135e62..27873887d4 100644 --- a/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h +++ b/Gems/Atom/RHI/Null/Code/Source/RHI/Device.h @@ -25,12 +25,11 @@ namespace AZ static RHI::Ptr Create(); private: - Device() = default; + Device(); ////////////////////////////////////////////////////////////////////////// // RHI::Device - RHI::ResultCode InitInternal([[maybe_unused]] RHI::PhysicalDevice& physicalDevice) override { return RHI::ResultCode::Success;} - RHI::ResultCode PostInitInternal([[maybe_unused]] const RHI::DeviceDescriptor& params) override { return RHI::ResultCode::Success;} + RHI::ResultCode InitInternal([[maybe_unused]] RHI::PhysicalDevice& physicalDevice) override { return RHI::ResultCode::Success; } void ShutdownInternal() override {} void CompileMemoryStatisticsInternal([[maybe_unused]] RHI::MemoryStatisticsBuilder& builder) override {} void UpdateCpuTimingStatisticsInternal([[maybe_unused]] RHI::CpuTimingStatistics& cpuTimingStatistics) const override {} @@ -39,6 +38,7 @@ namespace AZ void WaitForIdleInternal() override {} AZStd::chrono::microseconds GpuTimestampToMicroseconds([[maybe_unused]] uint64_t gpuTimestamp, [[maybe_unused]] RHI::HardwareQueueClass queueClass) const override { return AZStd::chrono::microseconds();} void FillFormatsCapabilitiesInternal([[maybe_unused]] FormatCapabilitiesList& formatsCapabilities) override; + RHI::ResultCode InitializeLimits() override { return RHI::ResultCode::Success; } void PreShutdown() override {} RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const RHI::ImageDescriptor& descriptor) override { return RHI::ResourceMemoryRequirements();} RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const RHI::BufferDescriptor& descriptor) override { return RHI::ResourceMemoryRequirements();} diff --git a/Gems/Atom/RHI/Registry/Platform/Android/PlatformLimits.setreg b/Gems/Atom/RHI/Registry/Platform/Android/PlatformLimits.setreg new file mode 100644 index 0000000000..6ce3c88bbb --- /dev/null +++ b/Gems/Atom/RHI/Registry/Platform/Android/PlatformLimits.setreg @@ -0,0 +1,27 @@ +// +// Copyright (c) Contributors to the Open 3D Engine Project. +// For complete copyright and license terms please see the LICENSE at the root of this distribution. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// +// + +{ + "Amazon": + { + "Atom": + { + "RHI": + { + "PlatformLimits": + { + "metal": + { + "$type": "AZ::Vulkan::PlatformLimitsDescriptor" + } + } + } + } + } +} diff --git a/Gems/Atom/RHI/Registry/Platform/Linux/PlatformLimits.setreg b/Gems/Atom/RHI/Registry/Platform/Linux/PlatformLimits.setreg new file mode 100644 index 0000000000..7c60aeb098 --- /dev/null +++ b/Gems/Atom/RHI/Registry/Platform/Linux/PlatformLimits.setreg @@ -0,0 +1,27 @@ +// +// Copyright (c) Contributors to the Open 3D Engine Project. +// For complete copyright and license terms please see the LICENSE at the root of this distribution. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// +// + +{ + "Amazon": + { + "Atom": + { + "RHI": + { + "PlatformLimits": + { + "vulkan": + { + "$type": "AZ::Vulkan::PlatformLimitsDescriptor" + } + } + } + } + } +} diff --git a/Gems/Atom/RHI/Registry/Platform/Mac/PlatformLimits.setreg b/Gems/Atom/RHI/Registry/Platform/Mac/PlatformLimits.setreg new file mode 100644 index 0000000000..508287b762 --- /dev/null +++ b/Gems/Atom/RHI/Registry/Platform/Mac/PlatformLimits.setreg @@ -0,0 +1,27 @@ +// +// Copyright (c) Contributors to the Open 3D Engine Project. +// For complete copyright and license terms please see the LICENSE at the root of this distribution. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// +// + +{ + "Amazon": + { + "Atom": + { + "RHI": + { + "PlatformLimits": + { + "metal": + { + "$type": "AZ::Metal::PlatformLimitsDescriptor" + } + } + } + } + } +} diff --git a/Gems/Atom/RHI/Registry/Platform/Windows/PlatformLimits.setreg b/Gems/Atom/RHI/Registry/Platform/Windows/PlatformLimits.setreg new file mode 100644 index 0000000000..dd1273953b --- /dev/null +++ b/Gems/Atom/RHI/Registry/Platform/Windows/PlatformLimits.setreg @@ -0,0 +1,38 @@ +// +// Copyright (c) Contributors to the Open 3D Engine Project. +// For complete copyright and license terms please see the LICENSE at the root of this distribution. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// +// + +{ + "Amazon": + { + "Atom": + { + "RHI": + { + "PlatformLimits": + { + "dx12": + { + "$type": "AZ::DX12::PlatformLimitsDescriptor", + "DescriptorHeapLimits": + { + "DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV": [1000000, 1000000], + "DESCRIPTOR_HEAP_TYPE_SAMPLER": [2048, 2048], + "DESCRIPTOR_HEAP_TYPE_RTV": [2048, 0], + "DESCRIPTOR_HEAP_TYPE_DSV": [2048, 0] + } + }, + "vulkan": + { + "$type": "AZ::Vulkan::PlatformLimitsDescriptor" + } + } + } + } + } +} diff --git a/Gems/Atom/RHI/Registry/Platform/iOS/PlatformLimits.setreg b/Gems/Atom/RHI/Registry/Platform/iOS/PlatformLimits.setreg new file mode 100644 index 0000000000..508287b762 --- /dev/null +++ b/Gems/Atom/RHI/Registry/Platform/iOS/PlatformLimits.setreg @@ -0,0 +1,27 @@ +// +// Copyright (c) Contributors to the Open 3D Engine Project. +// For complete copyright and license terms please see the LICENSE at the root of this distribution. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT +// +// +// + +{ + "Amazon": + { + "Atom": + { + "RHI": + { + "PlatformLimits": + { + "metal": + { + "$type": "AZ::Metal::PlatformLimitsDescriptor" + } + } + } + } + } +} diff --git a/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h index d23a51f781..5e41da9627 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h @@ -20,7 +20,7 @@ namespace AZ { struct FrameGraphExecuterData { - AZ_TYPE_INFO(FrameGraphExecuterData, "{648B4414-7208-4BFD-8E8F-CF2CA923ABCF}"); + AZ_TYPE_INFO(AZ::Vulkan::FrameGraphExecuterData, "{648B4414-7208-4BFD-8E8F-CF2CA923ABCF}"); static void Reflect(AZ::ReflectContext* context); //Cost per draw/dispatch item @@ -45,8 +45,8 @@ namespace AZ { using Base = RHI::PlatformLimitsDescriptor; public: - AZ_RTTI(Vulkan::PlatformLimitsDescriptor, "{23673F3F-1562-4D1B-B130-553B35B48C64}", Base); - AZ_CLASS_ALLOCATOR(PlatformLimitsDescriptor, AZ::SystemAllocator, 0); + AZ_RTTI(AZ::Vulkan::PlatformLimitsDescriptor, "{23673F3F-1562-4D1B-B130-553B35B48C64}", Base); + AZ_CLASS_ALLOCATOR(AZ::Vulkan::PlatformLimitsDescriptor, AZ::SystemAllocator, 0); static void Reflect(AZ::ReflectContext* context); FrameGraphExecuterData m_frameGraphExecuterData; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp index d5692cb4d4..8af53c431b 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI.Reflect/PlatformLimitsDescriptor.cpp @@ -18,8 +18,8 @@ namespace AZ if (SerializeContext* serializeContext = azrtti_cast(context)) { serializeContext->Class() - ->Version(0) - ->Field("m_frameGraphExecuterData", &PlatformLimitsDescriptor::m_frameGraphExecuterData) + ->Version(1) + ->Field("FrameGraphExecuterData", &PlatformLimitsDescriptor::m_frameGraphExecuterData) ; } } @@ -30,11 +30,11 @@ namespace AZ { serializeContext->Class() ->Version(0) - ->Field("m_itemCost", &FrameGraphExecuterData::m_itemCost) - ->Field("m_attachmentCost", &FrameGraphExecuterData::m_attachmentCost) - ->Field("m_swapChainsPerCommandList", &FrameGraphExecuterData::m_swapChainsPerCommandList) - ->Field("m_commandListCostThresholdMin", &FrameGraphExecuterData::m_commandListCostThresholdMin) - ->Field("m_commandListsPerScopeMax", &FrameGraphExecuterData::m_commandListsPerScopeMax) + ->Field("ItemCost", &FrameGraphExecuterData::m_itemCost) + ->Field("AttachmentCost", &FrameGraphExecuterData::m_attachmentCost) + ->Field("SwapChainsPerCommandList", &FrameGraphExecuterData::m_swapChainsPerCommandList) + ->Field("CommandListCostThresholdMin", &FrameGraphExecuterData::m_commandListCostThresholdMin) + ->Field("CommandListsPerScopeMax", &FrameGraphExecuterData::m_commandListsPerScopeMax) ; } } diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp index 6371b12526..12d5f9bf79 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPool.cpp @@ -49,7 +49,7 @@ namespace AZ { auto& device = static_cast(deviceBase); - VkDeviceSize bufferPageSizeInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; + VkDeviceSize bufferPageSizeInBytes = device.GetDescriptor().m_platformLimitsDescriptor->m_platformDefaultValues.m_bufferPoolPageSizeInBytes; VkMemoryPropertyFlags additionalMemoryPropertyFlags = 0; if (const auto* descriptor = azrtti_cast(&descriptorBase)) { diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp index 05ff8bb2a6..d6cf28e78f 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp @@ -7,6 +7,8 @@ */ #include +#include +#include #include #include #include @@ -31,6 +33,13 @@ namespace AZ { namespace Vulkan { + Device::Device() + { + RHI::Ptr platformLimitsDescriptor = aznew PlatformLimitsDescriptor(); + platformLimitsDescriptor->LoadPlatformLimitsDescriptor(RHI::Factory::Get().GetName().GetCStr()); + m_descriptor.m_platformLimitsDescriptor = RHI::Ptr(platformLimitsDescriptor); + } + RHI::Ptr Device::Create() { return aznew Device(); @@ -232,7 +241,7 @@ namespace AZ return RHI::ResultCode::Success; } - RHI::ResultCode Device::PostInitInternal( const RHI::DeviceDescriptor& descriptor) + RHI::ResultCode Device::InitializeLimits() { CommandQueueContext::Descriptor commandQueueContextDescriptor; commandQueueContextDescriptor.m_frameCountMax = RHI::Limits::Device::FrameCountMax; @@ -241,7 +250,7 @@ namespace AZ // Initialize member variables. ReleaseQueue::Descriptor releaseQueueDescriptor; - releaseQueueDescriptor.m_collectLatency = descriptor.m_frameCountMax - 1; + releaseQueueDescriptor.m_collectLatency = m_descriptor.m_frameCountMax - 1; m_releaseQueue.Init(releaseQueueDescriptor); @@ -272,7 +281,7 @@ namespace AZ poolDesc.m_heapMemoryLevel = RHI::HeapMemoryLevel::Host; poolDesc.m_hostMemoryAccess = RHI::HostMemoryAccess::Write; poolDesc.m_bindFlags = RHI::BufferBindFlags::CopyRead; - poolDesc.m_budgetInBytes = RHI::RHISystemInterface::Get()->GetPlatformLimitsDescriptor()->m_platformDefaultValues.m_stagingBufferBudgetInBytes; + poolDesc.m_budgetInBytes = m_descriptor.m_platformLimitsDescriptor->m_platformDefaultValues.m_stagingBufferBudgetInBytes; result = m_stagingBufferPool->Init(*this, poolDesc); RETURN_RESULT_IF_UNSUCCESSFUL(result); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h index 28e56d1fa9..5a8ed04c11 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.h @@ -110,7 +110,7 @@ namespace AZ void DestroyBufferResource(VkBuffer vkBuffer) const; private: - Device() = default; + Device(); ////////////////////////////////////////////////////////////////////////// // RHI::Object @@ -120,7 +120,6 @@ namespace AZ ////////////////////////////////////////////////////////////////////////// // RHI::Device RHI::ResultCode InitInternal(RHI::PhysicalDevice& physicalDevice) override; - RHI::ResultCode PostInitInternal(const RHI::DeviceDescriptor& params) override; void ShutdownInternal() override; void BeginFrameInternal() override; @@ -131,6 +130,7 @@ namespace AZ AZStd::vector GetValidSwapChainImageFormats(const RHI::WindowHandle& windowHandle) const override; AZStd::chrono::microseconds GpuTimestampToMicroseconds(uint64_t gpuTimestamp, RHI::HardwareQueueClass queueClass) const override; void FillFormatsCapabilitiesInternal(FormatCapabilitiesList& formatsCapabilities) override; + RHI::ResultCode InitializeLimits() override; void PreShutdown() override; RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::ImageDescriptor& descriptor) override; RHI::ResourceMemoryRequirements GetResourceMemoryRequirements(const RHI::BufferDescriptor& descriptor) override; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp index efc050eb68..5eb9bd2d46 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp @@ -349,19 +349,6 @@ namespace AZ return; } - //[GFX TODO][ATOM-5867] - Move file loading code within RHI to reduce coupling with RPI - AZStd::string platformLimitsFilePath = AZStd::string::format("config/platform/%s/%s/platformlimits.azasset", AZ_TRAIT_OS_PLATFORM_NAME, GetRenderApiName().GetCStr()); - AZStd::to_lower(platformLimitsFilePath.begin(), platformLimitsFilePath.end()); - - Data::Asset platformLimitsAsset; - platformLimitsAsset = RPI::AssetUtils::LoadCriticalAsset(platformLimitsFilePath.c_str(), RPI::AssetUtils::TraceLevel::None); - // Only read the m_platformLimits if the platformLimitsAsset is ready. - // The platformLimitsAsset may not exist for null renderer which is allowed - if (platformLimitsAsset.IsReady()) - { - m_descriptor.m_rhiSystemDescriptor.m_platformLimits = RPI::GetDataFromAnyAsset(platformLimitsAsset); - } - m_commonShaderAssetForSrgs = AssetUtils::LoadCriticalAsset( m_descriptor.m_commonSrgsShaderAssetPath.c_str()); if (!m_commonShaderAssetForSrgs.IsReady()) { diff --git a/Gems/Atom/RPI/Code/Tests/Common/RHI/Factory.cpp b/Gems/Atom/RPI/Code/Tests/Common/RHI/Factory.cpp index 115ccb3819..62af2852e6 100644 --- a/Gems/Atom/RPI/Code/Tests/Common/RHI/Factory.cpp +++ b/Gems/Atom/RPI/Code/Tests/Common/RHI/Factory.cpp @@ -47,7 +47,6 @@ namespace UnitTest RHI::Ptr device = Get().CreateDevice(); device->Init(*physicalDevices[0]); - device->PostInit(RHI::DeviceDescriptor{}); return device; } diff --git a/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.cpp b/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.cpp index 3d40aa27cf..a8d2ac2b0b 100644 --- a/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.cpp +++ b/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.cpp @@ -20,6 +20,11 @@ namespace UnitTest m_descriptor.m_description = "UnitTest Fake Device"; } + Device::Device() + { + m_descriptor.m_platformLimitsDescriptor = aznew RHI::PlatformLimitsDescriptor; + } + RHI::PhysicalDeviceList PhysicalDevice::Enumerate() { return RHI::PhysicalDeviceList{ aznew PhysicalDevice }; diff --git a/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h b/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h index be362c60d6..c3768c1ce6 100644 --- a/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h +++ b/Gems/Atom/RPI/Code/Tests/Common/RHI/Stubs.h @@ -52,10 +52,10 @@ namespace UnitTest { public: AZ_CLASS_ALLOCATOR(Device, AZ::SystemAllocator, 0); + Device(); private: AZ::RHI::ResultCode InitInternal(AZ::RHI::PhysicalDevice&) override { return AZ::RHI::ResultCode::Success; } - AZ::RHI::ResultCode PostInitInternal(const AZ::RHI::DeviceDescriptor&) override { return AZ::RHI::ResultCode::Success; } void ShutdownInternal() override {} void BeginFrameInternal() override {} void EndFrameInternal() override {} @@ -67,6 +67,7 @@ namespace UnitTest return AZStd::chrono::microseconds(); } void FillFormatsCapabilitiesInternal([[maybe_unused]] FormatCapabilitiesList& formatsCapabilities) override {} + AZ::RHI::ResultCode InitializeLimits() override { return AZ::RHI::ResultCode::Success; } void PreShutdown() override {} AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::ImageDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; }; AZ::RHI::ResourceMemoryRequirements GetResourceMemoryRequirements([[maybe_unused]] const AZ::RHI::BufferDescriptor& descriptor) { return AZ::RHI::ResourceMemoryRequirements{}; }; From 13770b4c42cf7d8400bfc76bb913a40fb05abfb4 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 19 Aug 2021 10:20:39 -0700 Subject: [PATCH 100/100] fix after merge Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp index 30ed07bd22..371aa20a84 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Device.cpp @@ -84,8 +84,8 @@ namespace AZ StagingMemoryAllocator::Descriptor allocatorDesc; allocatorDesc.m_device = this; - allocatorDesc.m_mediumPageSizeInBytes = platLimitsDesc->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes; - allocatorDesc.m_largePageSizeInBytes = platLimitsDesc->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes; + allocatorDesc.m_mediumPageSizeInBytes = static_cast(platLimitsDesc->m_platformDefaultValues.m_mediumStagingBufferPageSizeInBytes); + allocatorDesc.m_largePageSizeInBytes = static_cast(platLimitsDesc->m_platformDefaultValues.m_largestStagingBufferPageSizeInBytes); allocatorDesc.m_collectLatency = m_descriptor.m_frameCountMax; m_stagingMemoryAllocator.Init(allocatorDesc); }