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/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index 2739e2d698..e5988918f5 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(), static_cast(entitySaveBuffer.size())); // Save XML archive to pak file. 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 75b62f3781..c305b1be6c 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 @@ -1033,10 +1034,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) { @@ -1055,6 +1062,16 @@ AZStd::shared_ptr CreateMod { return SandboxEditor::CameraTranslateSmoothness(); }; + + cameraProps.m_rotateSmoothingEnabledFn = [] + { + return SandboxEditor::CameraRotateSmoothingEnabled(); + }; + + cameraProps.m_translateSmoothingEnabledFn = [] + { + return SandboxEditor::CameraTranslateSmoothingEnabled(); + }; }); controller->SetCameraListBuilderCallback( @@ -1956,7 +1973,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) @@ -1991,7 +2008,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/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/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 7126e22a4e..8eb3bb83c1 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 afbf370ca8..d2a2ae7d18 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 3e2a1c0d2c..940ef5b551 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 74187fc9c5..c91bf58074 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 276e6e4c83..429fbd923c 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()) { @@ -646,16 +646,27 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con QAction* action = nullptr; - action = menu->addAction(QObject::tr("Create entity")); - QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_NewEntity(); }); - - if (selected.size() == 1) + // when nothing is selected, entity is created at root level + if (selected.size() == 0) { - action = menu->addAction(QObject::tr("Create child entity")); - QObject::connect(action, &QAction::triggered, action, [selected] - { - EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, CreateNewEntityAsChild, selected.front()); - }); + action = menu->addAction(QObject::tr("Create entity")); + QObject::connect( + action, &QAction::triggered, action, + [this] + { + ContextMenu_NewEntity(); + }); + } + // when a single entity is selected, entity is created as its child + else if (selected.size() == 1) + { + action = menu->addAction(QObject::tr("Create entity")); + QObject::connect( + action, &QAction::triggered, action, + [selected] + { + EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, CreateNewEntityAsChild, selected.front()); + }); } bool prefabSystemEnabled = false; @@ -847,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); @@ -949,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 @@ -1072,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()) @@ -1084,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; @@ -1206,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( @@ -1839,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 95fe28f406..9ec81cdb3b 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 2646f1cd50..3c34f464b8 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/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/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/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/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/Console/Console.cpp b/Code/Framework/AzCore/AzCore/Console/Console.cpp index 0166e964b8..a1b8a1759d 100644 --- a/Code/Framework/AzCore/AzCore/Console/Console.cpp +++ b/Code/Framework/AzCore/AzCore/Console/Console.cpp @@ -174,12 +174,28 @@ namespace AZ } } - bool Console::HasCommand(const char* command) + bool Console::ExecuteDeferredConsoleCommands() + { + auto DeferredCommandCallable = [this](const DeferredCommand& deferredCommand) + { + return this->DispatchCommand(deferredCommand.m_command, deferredCommand.m_arguments, deferredCommand.m_silentMode, + deferredCommand.m_invokedFrom, deferredCommand.m_requiredSet, deferredCommand.m_requiredClear); + }; + // Attempt to invoke the deferred command and remove it from the queue if successful + return AZStd::erase_if(m_deferredCommands, DeferredCommandCallable) != 0; + } + + void Console::ClearDeferredConsoleCommands() + { + m_deferredCommands = {}; + } + + bool Console::HasCommand(AZStd::string_view command) { return FindCommand(command) != nullptr; } - ConsoleFunctorBase* Console::FindCommand(const char* command) + ConsoleFunctorBase* Console::FindCommand(AZStd::string_view command) { CVarFixedString lowerName(command); AZStd::to_lower(lowerName.begin(), lowerName.end()); @@ -200,11 +216,9 @@ namespace AZ return nullptr; } - AZStd::string Console::AutoCompleteCommand(const char* command, AZStd::vector* matches) + AZStd::string Console::AutoCompleteCommand(AZStd::string_view command, AZStd::vector* matches) { - const size_t commandLength = strlen(command); - - if (commandLength <= 0) + if (command.empty()) { return command; } @@ -219,7 +233,7 @@ namespace AZ continue; } - if (StringFunc::Equal(curr->m_name, command, false, commandLength)) + if (StringFunc::StartsWith(curr->m_name, command, false)) { AZLOG_INFO("- %s : %s\n", curr->m_name, curr->m_desc); commandSubset.push_back(curr->m_name); @@ -498,7 +512,8 @@ namespace AZ AZ::IO::PathView consoleRootCommandKey{ IConsole::ConsoleRootCommandKey, AZ::IO::PosixPathSeparator }; AZ::IO::PathView inputKey{ path, AZ::IO::PosixPathSeparator }; - if (inputKey.IsRelativeTo(consoleRootCommandKey)) + // The ConsoleRootComamndKey is not a command itself so strictly children keys are being examined + if (inputKey.IsRelativeTo(consoleRootCommandKey) && inputKey != consoleRootCommandKey) { FixedValueString command = inputKey.LexicallyRelative(consoleRootCommandKey).Native(); ConsoleCommandContainer commandArgs; @@ -560,7 +575,24 @@ namespace AZ commandTrace += commandArg; } - m_console.PerformCommand(command, commandArgs, ConsoleSilentMode::NotSilent, ConsoleInvokedFrom::AzConsole, ConsoleFunctorFlags::Null, ConsoleFunctorFlags::Null); + if (!m_console.PerformCommand(command, commandArgs, ConsoleSilentMode::NotSilent, + ConsoleInvokedFrom::AzConsole, ConsoleFunctorFlags::Null, ConsoleFunctorFlags::Null)) + { + // If the command could not be dispatched at this time add it to the + // deferred commands queue + using DeferredCommand = Console::DeferredCommand; + DeferredCommand deferredCommand + { + AZStd::string_view{command}, + DeferredCommand::DeferredArguments{commandArgs.begin(), commandArgs.end()}, + ConsoleSilentMode::NotSilent, + ConsoleInvokedFrom::AzConsole, + ConsoleFunctorFlags::Null, + ConsoleFunctorFlags::Null + }; + + m_console.m_deferredCommands.emplace_back(AZStd::move(deferredCommand)); + } } } diff --git a/Code/Framework/AzCore/AzCore/Console/Console.h b/Code/Framework/AzCore/AzCore/Console/Console.h index dbcf2b116f..0edda9f531 100644 --- a/Code/Framework/AzCore/AzCore/Console/Console.h +++ b/Code/Framework/AzCore/AzCore/Console/Console.h @@ -60,9 +60,13 @@ namespace AZ ) override; void ExecuteConfigFile(AZStd::string_view configFileName) override; void ExecuteCommandLine(const AZ::CommandLine& commandLine) override; - bool HasCommand(const char* command) override; - ConsoleFunctorBase* FindCommand(const char* command) override; - AZStd::string AutoCompleteCommand(const char* command, AZStd::vector* matches = nullptr) override; + bool ExecuteDeferredConsoleCommands() override; + + void ClearDeferredConsoleCommands() override; + + bool HasCommand(AZStd::string_view command) override; + ConsoleFunctorBase* FindCommand(AZStd::string_view command) override; + AZStd::string AutoCompleteCommand(AZStd::string_view command, AZStd::vector* matches = nullptr) override; void VisitRegisteredFunctors(const FunctorVisitor& visitor) override; void RegisterFunctor(ConsoleFunctorBase* functor) override; void UnregisterFunctor(ConsoleFunctorBase* functor) override; @@ -98,7 +102,20 @@ namespace AZ using CommandMap = AZStd::unordered_map>; CommandMap m_commands; AZ::SettingsRegistryInterface::NotifyEventHandler m_consoleCommandKeyHandler; + struct DeferredCommand + { + using DeferredArguments = AZStd::vector; + AZStd::string m_command; + DeferredArguments m_arguments; + ConsoleSilentMode m_silentMode; + ConsoleInvokedFrom m_invokedFrom; + ConsoleFunctorFlags m_requiredSet; + ConsoleFunctorFlags m_requiredClear; + }; + using DeferredCommandQueue = AZStd::deque; + DeferredCommandQueue m_deferredCommands; + friend struct ConsoleCommandKeyNotificationHandler; friend class ConsoleFunctorBase; }; } diff --git a/Code/Framework/AzCore/AzCore/Console/IConsole.h b/Code/Framework/AzCore/AzCore/Console/IConsole.h index ee2b2bd0fb..dafc284ce3 100644 --- a/Code/Framework/AzCore/AzCore/Console/IConsole.h +++ b/Code/Framework/AzCore/AzCore/Console/IConsole.h @@ -94,22 +94,30 @@ namespace AZ //! @param commandLine the concatenated command-line string to execute virtual void ExecuteCommandLine(const AZ::CommandLine& commandLine) = 0; + //! Attempts to invoke a "deferred console command", which is a console command + //! that has failed to execute previously due to the command not being registered yet. + //! @return boolean true if any deferred console commands have executed, false otherwise + virtual bool ExecuteDeferredConsoleCommands() = 0; + + //! Clear out any deferred console commands queue + virtual void ClearDeferredConsoleCommands() = 0; + //! HasCommand is used to determine if the console knows about a command. //! @param command the command we are checking for //! @return boolean true on if the command is registered, false otherwise - virtual bool HasCommand(const char* command) = 0; + virtual bool HasCommand(AZStd::string_view command) = 0; //! FindCommand finds the console command with the specified console string. //! @param command the command that is being searched for //! @return non-null pointer to the console command if found - virtual ConsoleFunctorBase* FindCommand(const char* command) = 0; + virtual ConsoleFunctorBase* FindCommand(AZStd::string_view command) = 0; //! Finds all commands where the input command is a prefix and returns //! the longest matching substring prefix the results have in common. //! @param command The prefix string to find all matching commands for. //! @param matches The list of all commands that match the input prefix. //! @return The longest matching substring prefix the results have in common. - virtual AZStd::string AutoCompleteCommand(const char* command, + virtual AZStd::string AutoCompleteCommand(AZStd::string_view command, AZStd::vector* matches = nullptr) = 0; //! Retrieves the value of the requested cvar. @@ -117,7 +125,7 @@ namespace AZ //! @param outValue reference to the instance to write the current cvar value to //! @return GetValueResult::Success if the operation succeeded, or an error result if the operation failed template - GetValueResult GetCvarValue(const char* command, RETURN_TYPE& outValue); + GetValueResult GetCvarValue(AZStd::string_view command, RETURN_TYPE& outValue); //! Visits all registered console functors. //! @param visitor the instance to visit all functors with @@ -176,7 +184,7 @@ namespace AZ } template - inline GetValueResult IConsole::GetCvarValue(const char* command, RETURN_TYPE& outValue) + inline GetValueResult IConsole::GetCvarValue(AZStd::string_view command, RETURN_TYPE& outValue) { ConsoleFunctorBase* cvarFunctor = FindCommand(command); if (cvarFunctor == nullptr) diff --git a/Code/Framework/AzCore/AzCore/Debug/EventTrace.h b/Code/Framework/AzCore/AzCore/Debug/EventTrace.h index 5faf08f46e..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(AZ::Debug::ProfileCategory::AzTrace, name) - -# define AZ_TRACE_METHOD() \ - AZ_TRACE_METHOD_NAME_CATEGORY(AZ_FUNCTION_SIGNATURE, "") \ - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::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/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/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.cpp b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp index e6b7a80707..649bb0b8d7 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp @@ -20,6 +20,12 @@ namespace AZ { + uint32_t ProfileScope::GetSystemID(const char* system) + { + // TODO: stable ids for registered budgets + return AZ::Crc32(system); + } + namespace Debug { ////////////////////////////////////////////////////////////////////////// @@ -537,6 +543,7 @@ namespace AZ void ProfilerRegister::TimerStart(ProfilerSection* section) { ProfilerRegister* reg = this; + if (reg->m_isActive) { section->m_register = reg; diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index 243a8da0b0..f173bb8e17 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -5,310 +5,44 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ -#ifndef AZCORE_PROFILER_H -#define AZCORE_PROFILER_H 1 +#pragma once #include #include -namespace AZ -{ - namespace Debug - { - using ProfileCategoryPrimitiveType = AZ::u64; - - /** - * 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 +#ifdef USE_PIX +#include +#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, ...) ::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, ...) ::AZ::ProfileScope::BeginRegion(#category, __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 @@ -318,6 +52,42 @@ namespace AZStd namespace AZ { + class ProfileScope + { + public: + static uint32_t GetSystemID(const char* system); + + template + 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() + { +#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; @@ -615,5 +385,9 @@ namespace AZ } } // namespace AZ -#endif // AZCORE_PROFILER_H -#pragma once +#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/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 bbb54abb48..e838324408 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/Module/Module.h b/Code/Framework/AzCore/AzCore/Module/Module.h index 2c87b4f0fb..a4843f002c 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 @@ -98,19 +94,26 @@ namespace AZ /// /// \param MODULE_NAME Name of module. /// \param MODULE_CLASSNAME Name of AZ::Module class (include namespace). +/// +/// Execute any deferred console commands after linking any new deferred functors +/// This allows deferred console commands defined within the module to now execute +/// at this point now that the module has been loaded #if defined(AZ_MONOLITHIC_BUILD) # define AZ_DECLARE_MODULE_CLASS(MODULE_NAME, MODULE_CLASSNAME) \ extern "C" AZ::Module * CreateModuleClass_##MODULE_NAME() { return aznew MODULE_CLASSNAME; } #else # define AZ_DECLARE_MODULE_CLASS(MODULE_NAME, MODULE_CLASSNAME) \ AZ_DECLARE_MODULE_INITIALIZATION \ - extern "C" AZ_DLL_EXPORT AZ::Module * CreateModuleClass() \ + extern "C" AZ_DLL_EXPORT AZ::Module* CreateModuleClass() \ { \ - AZ::ConsoleFunctorBase*& deferredHead = AZ::ConsoleFunctorBase::GetDeferredHead(); \ - AZ::Interface::Get()->LinkDeferredFunctors(deferredHead); \ + if (auto console = AZ::Interface::Get(); console != nullptr) \ + { \ + console->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead()); \ + console->ExecuteDeferredConsoleCommands(); \ + } \ return aznew MODULE_CLASSNAME; \ } \ - extern "C" AZ_DLL_EXPORT void DestroyModuleClass(AZ::Module * module) { delete module; } + extern "C" AZ_DLL_EXPORT void DestroyModuleClass(AZ::Module* module) { delete module; } #endif #endif // AZCORE_MODULE_INCLUDE_H diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptSystemComponent.cpp index fa61a225c8..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(AZ::Debug::ProfileCategory::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/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..33d835076f 100644 --- a/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h +++ b/Code/Framework/AzCore/AzCore/Statistics/StatisticalProfilerProxy.h @@ -17,154 +17,148 @@ #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 #endif // #if defined(AZ_PROFILE_SCOPE) #define AZ_PROFILE_SCOPE(profiler, scopeNameId) \ - static_assert(profiler < AZ::Debug::ProfileCategory::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) +#endif //#if defined(AZ_STATISTICAL_PROFILING_ENABLED) -namespace AZ +namespace AZ::Statistics { - namespace Statistics - { - using StatisticalProfilerId = AZ::Debug::ProfileCategory; + 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 + //! 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: - AZ_TYPE_INFO(StatisticalProfilerProxy, "{1103D0EB-1C32-4854-B9D9-40A2D65BDBD2}"); + TimedScope() = delete; - 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 + TimedScope(const StatisticalProfilerId profilerId, const StatIdType& statId) + : m_profilerId(profilerId) + , m_statId(statId) { - 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) { + m_profilerProxy = AZ::Interface::Get(); 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() + if (!m_profilerProxy->IsProfilerActive(profilerId)) { - m_profilerProxy = nullptr; + return; } - - 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_startTime = AZStd::chrono::high_resolution_clock::now(); + } + ~TimedScope() { - m_profilers.reserve(static_cast(AZ::Debug::ProfileCategory::Count)); - for (AZStd::size_t i = 0; i < static_cast(AZ::Debug::ProfileCategory::Count); i++) + if (!m_profilerProxy) { - m_profilers.emplace_back(StatisticalProfilerType()); + return; } - AZ::Interface::Register(this); + 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())); } - virtual ~StatisticalProfilerProxy() + //! Required only for UnitTests + static void ClearCachedProxy() { - 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); + m_profilerProxy = nullptr; } private: - AZStd::bitset(AZ::Debug::ProfileCategory::Count)> m_activeProfilersFlag; - AZStd::vector m_profilers; - }; //class StatisticalProfilerProxy + static StatisticalProfilerProxy* m_profilerProxy; + const StatisticalProfilerId m_profilerId; + const StatIdType& m_statId; + AZStd::chrono::system_clock::time_point m_startTime; + }; // class TimedScope - }; //namespace Statistics -}; //namespace AZ + 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/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 0c95b9d592..d106b5b12f 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -99,8 +99,7 @@ set(FILES Debug/FrameProfilerComponent.cpp Debug/FrameProfilerComponent.h Debug/IEventLogger.h - Debug/ProfileModuleInit.cpp - Debug/ProfileModuleInit.h + Debug/MemoryProfiler.h Debug/Profiler.cpp Debug/Profiler.h Debug/ProfilerBus.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/CMakeLists.txt b/Code/Framework/AzCore/CMakeLists.txt index ea7cc27af5..f764242843 100644 --- a/Code/Framework/AzCore/CMakeLists.txt +++ b/Code/Framework/AzCore/CMakeLists.txt @@ -12,11 +12,10 @@ 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) +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( @@ -26,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 @@ -44,7 +40,10 @@ ly_add_target( 3rdParty::zlib 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/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 3337df9ede..0000000000 --- a/Code/Framework/AzCore/Platform/Common/RadTelemetry/ProfileTelemetry.h +++ /dev/null @@ -1,159 +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_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 -#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) \ - 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)) - -// 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_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__) - - -// 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, ...) \ - 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/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/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/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/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/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/Components.cpp b/Code/Framework/AzCore/Tests/Components.cpp index b14dcbbe53..77524dabc9 100644 --- a/Code/Framework/AzCore/Tests/Components.cpp +++ b/Code/Framework/AzCore/Tests/Components.cpp @@ -1191,154 +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_TIMER("UnitTest", nullptr, NamedRegister); - 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"); - int result = 5; - for (int i = 0; i < 10000; ++i) - { - result += i % (input + 1); - } - 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 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 { diff --git a/Code/Framework/AzCore/Tests/Console/ConsoleTests.cpp b/Code/Framework/AzCore/Tests/Console/ConsoleTests.cpp index 3a56772b3c..d91ec5ba58 100644 --- a/Code/Framework/AzCore/Tests/Console/ConsoleTests.cpp +++ b/Code/Framework/AzCore/Tests/Console/ConsoleTests.cpp @@ -507,6 +507,70 @@ namespace ConsoleSettingsRegistryTests AZ::Interface::Unregister(&testConsole); } + template + using ConsoleDataWrapper = AZ::ConsoleDataWrapper>; + TEST_P(ConsoleSettingsRegistryFixture, Console_RecordsUnregisteredCommands_And_IsAbleToDeferDispatchCommand_Successfully) + { + AZ::Console testConsole(*m_registry); + AZ::Interface::Register(&testConsole); + // GetDeferredHead is invoked for the side effect of to set the s_deferredHeadInvoked value to true + // This allows scoped console variables to be attached immediately + [[maybe_unused]] auto deferredHead = AZ::ConsoleFunctorBase::GetDeferredHead(); + + + ConsoleDataWrapper localTestInit{ {}, nullptr, "testInit", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestChar{ {}, nullptr, "testChar", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestBool{ {}, nullptr, "testBool", "", AZ::ConsoleFunctorFlags::Null }; + + s_consoleFreeFunctionInvoked = false; + + // Invoke the Commands for Scoped CVar variables above + auto configFileParams = GetParam(); + auto testFilePath = m_testFolder / configFileParams.m_testConfigFileName; + EXPECT_TRUE(AZ::IO::SystemFile::Exists(testFilePath.c_str())); + testConsole.ExecuteConfigFile(testFilePath.Native()); + + EXPECT_EQ(3, localTestInit); + EXPECT_TRUE(static_cast(localTestBool)); + EXPECT_EQ('Q', localTestChar); + + // The following commands from the config files should have been deferred + ConsoleDataWrapper localTestInt8{ {}, nullptr, "testInt8", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestInt16{ {}, nullptr, "testInt16", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestInt32{ {}, nullptr, "testInt32", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestInt64{ {}, nullptr, "testInt64", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestUInt8{ {}, nullptr, "testUInt8", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestUInt16{ {}, nullptr, "testUInt16", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestUInt32{ {}, nullptr, "testUInt32", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestUInt64{ {}, nullptr, "testUInt64", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestFloat{ {}, nullptr, "testFloat", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestDouble{ {}, nullptr, "testDouble", "", AZ::ConsoleFunctorFlags::Null }; + ConsoleDataWrapper localTestString{ {}, nullptr, "testString", "", AZ::ConsoleFunctorFlags::Null }; + + + // The scoped cvars just above should have all been deferred for execution + // Each of them should have executed resulting in the expected return value + EXPECT_TRUE(testConsole.ExecuteDeferredConsoleCommands()); + + EXPECT_EQ(24, localTestInt8); + EXPECT_EQ(-32, localTestInt16); + EXPECT_EQ(41, localTestInt32); + EXPECT_EQ(-51, localTestInt64); + EXPECT_EQ(3, localTestUInt8); + EXPECT_EQ(5, localTestUInt16); + EXPECT_EQ(6, localTestUInt32); + EXPECT_EQ(0xFFFF'FFFF'FFFF'FFFF, localTestUInt64); + EXPECT_FLOAT_EQ(1.0f, localTestFloat); + EXPECT_DOUBLE_EQ(2, localTestDouble); + EXPECT_STREQ("Stable", static_cast(localTestString).c_str()); + + // All of the deferred console commands should have executed at this point + // Therefore this invocation should return false + EXPECT_FALSE(testConsole.ExecuteDeferredConsoleCommands()); + + AZ::Interface::Unregister(&testConsole); + } + static constexpr AZStd::string_view UserINIStyleContent = R"( 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/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/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp index 50856b1df8..21b42fc451 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,10 +198,11 @@ namespace UnitTest AZStd::unique_ptr m_statsManager; };//class TimeDataStatisticsManagerTest - TEST_F(TimeDataStatisticsManagerTest, Test) - { - run(); - } + // 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/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 962c82614f..5bcdc3d719 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()) { @@ -680,7 +681,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) @@ -688,7 +689,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); @@ -711,7 +712,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. @@ -1089,8 +1090,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); @@ -1107,7 +1108,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); @@ -1125,7 +1126,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 6db205795e..292cce29ec 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -616,7 +616,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 @@ -631,7 +631,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(); } @@ -819,7 +819,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 } @@ -853,7 +853,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/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/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/AzFramework/CMakeLists.txt b/Code/Framework/AzFramework/CMakeLists.txt index 8a68aac887..1ac60e299e 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 @@ -70,6 +61,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/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/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index 3e6639c29b..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( - static_cast(m_mouseDevice->m_cursorPositionData2D->m_normalizedPositionDelta.GetX() * aznumeric_cast(m_sourceWidget->width()) / - m_sourceWidget->devicePixelRatioF())); - movementYChannel->ProcessRawInputEvent( - static_cast(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/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 44dbbee025..380d6876da 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 eb9cf2b65f..c17b96411e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -363,12 +364,25 @@ namespace AzToolsFramework if (hasUserSelectedValidSourceFile) { - // Get position (center of viewport). If no viewport is available, (0,0,0) will be used. - AZ::Vector3 viewportCenterPosition = AZ::Vector3::CreateZero(); - EditorRequestBus::BroadcastResult(viewportCenterPosition, &EditorRequestBus::Events::GetWorldPositionAtViewportCenter); + AZ::EntityId parentId; + AZ::Vector3 position = AZ::Vector3::CreateZero(); + + EntityIdList selectedEntities; + ToolsApplicationRequestBus::BroadcastResult(selectedEntities, &ToolsApplicationRequests::GetSelectedEntities); + // if one entity is selected, instantiate prefab as its child and place it at same position as parent + if (selectedEntities.size() == 1) + { + parentId = selectedEntities.front(); + AZ::TransformBus::EventResult(position, parentId, &AZ::TransformInterface::GetWorldTranslation); + } + // otherwise instantiate it at root level and center of viewport + else + { + EditorRequestBus::BroadcastResult(position, &EditorRequestBus::Events::GetWorldPositionAtViewportCenter); + } // Instantiating from context menu always puts the instance at the root level - auto createPrefabOutcome = s_prefabPublicInterface->InstantiatePrefab(prefabFilePath, AZ::EntityId(), viewportCenterPosition); + auto createPrefabOutcome = s_prefabPublicInterface->InstantiatePrefab(prefabFilePath, parentId, position); if (!createPrefabOutcome.IsSuccess()) { @@ -420,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; @@ -501,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)")); } @@ -837,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()); @@ -929,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; @@ -964,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 41cbde191a..223a573c55 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 c298d0d97e..9ba998b99a 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/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/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..2582710aa7 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp @@ -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/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..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(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__) - -#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/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/ProjectDefines.h b/Code/Legacy/CryCommon/ProjectDefines.h index 18b4665fab..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 // requires AZ_PROFILE_TELEMETRY to also be defined #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 4263d813b7..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 } @@ -203,7 +201,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/ProjectManager/Source/FormBrowseEditWidget.cpp b/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.cpp index 9cfc6461c2..8cd28fcbb4 100644 --- a/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.cpp +++ b/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.cpp @@ -10,6 +10,7 @@ #include #include +#include namespace O3DE::ProjectManager { @@ -27,4 +28,14 @@ namespace O3DE::ProjectManager : FormBrowseEditWidget(labelText, "", parent) { } + + void FormBrowseEditWidget::keyPressEvent(QKeyEvent* event) + { + int key = event->key(); + if (key == Qt::Key_Return || key == Qt::Key_Enter) + { + HandleBrowseButton(); + } + } + } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.h b/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.h index 7ec2865240..a1f6948ce9 100644 --- a/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.h +++ b/Code/Tools/ProjectManager/Source/FormBrowseEditWidget.h @@ -24,6 +24,9 @@ namespace O3DE::ProjectManager explicit FormBrowseEditWidget(const QString& labelText = "", QWidget* parent = nullptr); ~FormBrowseEditWidget() = default; + protected: + void keyPressEvent(QKeyEvent* event) override; + protected slots: virtual void HandleBrowseButton() = 0; }; diff --git a/Code/Tools/ProjectManager/Source/FormFolderBrowseEditWidget.cpp b/Code/Tools/ProjectManager/Source/FormFolderBrowseEditWidget.cpp index 86f46400b3..4101f02c9b 100644 --- a/Code/Tools/ProjectManager/Source/FormFolderBrowseEditWidget.cpp +++ b/Code/Tools/ProjectManager/Source/FormFolderBrowseEditWidget.cpp @@ -34,7 +34,6 @@ namespace O3DE::ProjectManager { setText(directory); } - } void FormFolderBrowseEditWidget::setText(const QString& text) @@ -42,4 +41,5 @@ namespace O3DE::ProjectManager QString path = QDir::toNativeSeparators(text); FormBrowseEditWidget::setText(path); } + } // namespace O3DE::ProjectManager 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/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/Assets/ShaderLib/Atom/Features/PostProcessing/Aces.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PostProcessing/Aces.azsli index f81a8cdf37..b7a6c63dc2 100644 --- a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PostProcessing/Aces.azsli +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PostProcessing/Aces.azsli @@ -75,6 +75,8 @@ UNDISCLOSED. //////////////////////////////////////////////////////////////////////////////// // Constants +#pragma once + #include static const float HALF_MAX = 65504.0f; @@ -90,7 +92,8 @@ static const float DIM_SURROUND_GAMMA = 0.9811; enum class ShaperType { ShaperLinear, - ShaperLog2 + ShaperLog2, + PqSmpteSt2084, }; //////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PostProcessing/Shapers.azsli b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PostProcessing/Shapers.azsli new file mode 100644 index 0000000000..a101867736 --- /dev/null +++ b/Gems/Atom/Feature/Common/Assets/ShaderLib/Atom/Features/PostProcessing/Shapers.azsli @@ -0,0 +1,52 @@ +/* + * 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 + +// Perceptual quantizer coefficients +static const float PqM1 = 1305.0 / 8192.0; +static const float PqM2 = 2533.0 / 32.0; +static const float PqC1 = 102.0 / 128.0; +static const float PqC2 = 2413.0 / 128.0; +static const float PqC3 = 2392.0 / 128.0; +static const float PqMaxNits = 10000.0; + +float3 ShaperToLinear(float3 shaperColor, ShaperType shaperType, float shaperBias, float shaperScale) +{ + // Apply the inverse of the shaper function to give the color in the working color space + switch (shaperType) + { + case ShaperType::ShaperLinear: + return (shaperColor - shaperBias) / shaperScale; + case ShaperType::ShaperLog2: + return pow(2.0, (shaperColor - shaperBias) / shaperScale); + case ShaperType::PqSmpteSt2084: + shaperColor = min(shaperColor, 1.0); + return PqMaxNits * pow(max(pow(shaperColor, 1.0 / PqM2) - PqC1, 0.0) / (PqC2 - PqC3 * pow(shaperColor, 1.0 / PqM2)), 1.0 / PqM1); + } + return shaperColor; +} + +float3 LinearToShaper(float3 linearColor, ShaperType shaperType, float shaperBias, float shaperScale) +{ + // Convert from working color space to lut coordinates by applying the shaper function + switch (shaperType) + { + case ShaperType::ShaperLinear: + return linearColor * shaperScale + shaperBias; + case ShaperType::ShaperLog2: + return log2(linearColor) * shaperScale + shaperBias; + case ShaperType::PqSmpteSt2084: + linearColor = min(linearColor, PqMaxNits); + linearColor = linearColor / PqMaxNits; + return pow((PqC1 + PqC2 * pow(linearColor, PqM1)) / (1.0 + PqC3 * pow(linearColor, PqM1)), PqM2); + } + return linearColor; +} diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/ApplyShaperLookupTable.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/ApplyShaperLookupTable.azsl index a180b09630..10d2eb1179 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/ApplyShaperLookupTable.azsl +++ b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/ApplyShaperLookupTable.azsl @@ -11,9 +11,7 @@ #include #include #include - -static const int SHAPER_LINEAR = 0; -static const int SHAPER_LOG2 = 1; +#include ShaderResourceGroup PassSrg : SRG_PerPass { @@ -41,36 +39,22 @@ PSOutput MainPS(VSOutput IN) float2 uvCoord = float2(IN.m_texCoord.x, IN.m_texCoord.y); float3 color = PassSrg::m_colorTexture.Sample(PassSrg::LinearSampler, uvCoord).rgb; + ShaperType shaperType = (ShaperType)PassSrg::m_shaperType; + // Convert from working color space to lut coordinates by applying the shaper function - float3 lutCoordinate = color; - if (PassSrg::m_shaperType == SHAPER_LINEAR) - { - lutCoordinate = color * PassSrg::m_shaperScale + PassSrg::m_shaperBias; - } - else if (PassSrg::m_shaperType == SHAPER_LOG2) - { - lutCoordinate = log2(color) * PassSrg::m_shaperScale + PassSrg::m_shaperBias; - } + float3 lutCoordinate = LinearToShaper(color, shaperType, PassSrg::m_shaperBias, PassSrg::m_shaperScale); // Adjust coordinate to the domain excluding the outer half texel in all directions uint3 outputDimensions; PassSrg::m_lut.GetDimensions(outputDimensions.x, outputDimensions.y, outputDimensions.z); - float3 coordBias = 1.0/(2.0 * outputDimensions); - float3 coordScale = (outputDimensions-1.0)/outputDimensions; + float3 coordBias = 1.0 / (2.0 * outputDimensions); + float3 coordScale = (outputDimensions - 1.0) / outputDimensions; lutCoordinate = (lutCoordinate * coordScale) + coordBias; float3 lutColor = PassSrg::m_lut.Sample(PassSrg::LinearSampler, lutCoordinate).rgb; // Apply the inverse of the shaper function to give the color in the working color space - float3 finalColor = lutColor; - if (PassSrg::m_shaperType == SHAPER_LINEAR) - { - finalColor = (lutColor - PassSrg::m_shaperBias)/PassSrg::m_shaperScale; - } - else if (PassSrg::m_shaperType == SHAPER_LOG2) - { - finalColor = pow(2.0, (lutColor - PassSrg::m_shaperBias)/PassSrg::m_shaperScale); - } + float3 finalColor = ShaperToLinear(lutColor, shaperType, PassSrg::m_shaperBias, PassSrg::m_shaperScale); OUT.m_color.rgb = finalColor; OUT.m_color.a = 1.0; diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/BlendColorGradingLuts.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/BlendColorGradingLuts.azsl index 6f97996c29..746e18cfc2 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/BlendColorGradingLuts.azsl +++ b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/BlendColorGradingLuts.azsl @@ -8,6 +8,7 @@ #include #include +#include ShaderResourceGroup PassSrg : SRG_PerPass_WithFallback { @@ -62,40 +63,18 @@ ShaderResourceGroup PassSrg : SRG_PerPass_WithFallback [[range(0, 4)]] option uint o_numSourceLuts = 0; -float3 ShaperToLinear(float3 shaperColor, ShaperType shaperType, float shaperBias, float shaperScale) -{ - // Apply the inverse of the shaper function to give the color in the working color space - float3 linearColor = shaperColor; - if (shaperType == ShaperType::ShaperLinear) - { - linearColor = (shaperColor - shaperBias)/shaperScale; - } - else if (shaperType == ShaperType::ShaperLog2) - { - linearColor = pow(2.0, (shaperColor - shaperBias)/shaperScale); - } - return linearColor; -} - -float3 LinearToShaper(float3 linearColor, ShaperType shaperType, float shaperBias, float shaperScale) -{ - // Convert from working color space to lut coordinates by applying the shaper function - float3 shaperColor = linearColor; - if (shaperType == ShaperType::ShaperLinear) - { - shaperColor = linearColor * shaperScale + shaperBias; - } - else if (shaperType == ShaperType::ShaperLog2) - { - shaperColor = log2(linearColor) * shaperScale + shaperBias; - } - return shaperColor; -} - float3 GetSourceLutLinearColor(float3 baseColor, Texture3D sourceLut, ShaperType shaperType, float shaperBias, float shaperScale) { // Convert from reference linearColor to the lutCoordinate for this Lut float3 lutCoord = LinearToShaper(baseColor, shaperType, shaperBias, shaperScale); + + // Adjust coordinate to the domain excluding the outer half texel in all directions + uint3 outputDimensions; + sourceLut.GetDimensions(outputDimensions.x, outputDimensions.y, outputDimensions.z); + float3 coordBias = 1.0 / (2.0 * outputDimensions); + float3 coordScale = (outputDimensions - 1.0) / outputDimensions; + lutCoord = (lutCoord * coordScale) + coordBias; + float3 lutColor = sourceLut.SampleLevel(PassSrg::LinearSampler, lutCoord, 0).rgb; // Convert to linear float3 linearColor = ShaperToLinear(lutColor, shaperType, shaperBias, shaperScale); @@ -115,11 +94,7 @@ void MainCS(uint3 dispatch_id: SV_DispatchThreadID) } // Get coordinates within the blended LUT 3D texture - float3 baseCoord = float3 ( - (float)(dispatch_id.x)/(float)PassSrg::m_blendedLutDimensions.x, - (float)(dispatch_id.y)/(float)PassSrg::m_blendedLutDimensions.y, - (float)(dispatch_id.z)/(float)PassSrg::m_blendedLutDimensions.z - ); + float3 baseCoord = float3(outPixel) / float3(PassSrg::m_blendedLutDimensions - 1.0); // Convert to the base linear color (this is the color of the identity LUT) float3 baseColor = ShaperToLinear(baseCoord, (ShaperType)PassSrg::m_blendedLutShaperType, PassSrg::m_blendedLutShaperBias, PassSrg::m_blendedLutShaperScale); diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.azsl index 8b1841c5e1..4741b01617 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.azsl +++ b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.azsl @@ -12,6 +12,7 @@ #include #include #include +#include #include "EyeAdaptationUtil.azsli" ShaderResourceGroup PassSrg : SRG_PerPass_WithFallback @@ -42,12 +43,111 @@ option bool o_enableExposureControlFeature = false; // Option shader variable to enable color grading LUT. option bool o_enableColorGradingLut = false; +// Controls the sampling quality of the blended LUT. Setting this higher can improve the quality of particularly tricky luts. +// 0 - linear +// 1 - 7 tap b-spline +// 2 - 19 tap b-spline +[[range(0, 2)]] +option uint o_lutSampleQuality = 0; + +// Sample a 3dtexture with a 7 or 19 tap B-Spline. Consider ripping this out and putting in a more general location. +// This function samples a 4x4x4 neighborhood around the uv. Normally this would take 64 samples, but by taking +// advantage of bilinear filtering this can be done with 27 taps on the edges between pixels. The cost is further +// reduced by dropping either the 8 corners (19 total taps) or also dropping the 12 edges (7 total taps). +float4 SampleBSpline3D(Texture3D texture, SamplerState linearSampler, float3 uv, float3 textureSize, float3 rcpTextureSize) +{ + // Think of sample locations in the 4x4 neighborhood as having a top left coordinate of 0,0 and + // a bottom right coordinate of 3,3. + + // Find the position in texture space then round it to get the center of the 1,1 pixel (tc1) + float3 texelPos = uv * textureSize; + float3 tc1= floor(texelPos - 0.5) + 0.5; + + // Offset from center position to texel + float3 f = texelPos - tc1; + + // Compute B-Spline weights based on the offset + float3 OneMinusF = (1.0 - f); + float3 OneMinusF2 = OneMinusF * OneMinusF; + float3 OneMinusF3 = OneMinusF2 * OneMinusF; + float3 w0 = OneMinusF3; + float3 w1 = 4.0 + 3.0 * f * f * f - 6.0 * f * f; + float3 w2 = 4.0 + 3.0 * OneMinusF3 - 6.0 * OneMinusF2; + float3 w3 = f * f * f; + + float3 w12 = w1 + w2; + + // Compute uv coordinates for sampling the texture + float3 tc0 = (tc1 - 1.0f) * rcpTextureSize; + float3 tc3 = (tc1 + 2.0f) * rcpTextureSize; + float3 tc12 = (tc1 + w2 / w12) * rcpTextureSize; + + // Compute sample weights + float sw0 = w12.x * w0.y * w12.z; + float sw1 = w0.x * w12.y * w12.z; + float sw2 = w12.x * w12.y * w12.z; + float sw3 = w3.x * w12.y * w12.z; + float sw4 = w12.x * w3.y * w12.z; + float sw5 = w12.x * w12.y * w0.z; + float sw6 = w12.x * w12.y * w3.z; + + // total weight of samples to normalize result. + float totalWeight = sw0 + sw1 + sw2 + sw3 + sw4 + sw5 + sw6; + + float4 result = 0.0f; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc0.y, tc12.z), 0.0) * sw0; + result += texture.SampleLevel(linearSampler, float3( tc0.x, tc12.y, tc12.z), 0.0) * sw1; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc12.y, tc12.z), 0.0) * sw2; + result += texture.SampleLevel(linearSampler, float3( tc3.x, tc12.y, tc12.z), 0.0) * sw3; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc3.y, tc12.z), 0.0) * sw4; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc12.y, tc0.z), 0.0) * sw5; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc12.y, tc3.z), 0.0) * sw6; + + if (o_lutSampleQuality == 2) + { + // Extra 12 taps for Diagonals to increase the quality further. + + float sw7 = w0.x * w0.y * w12.z; + float sw8 = w0.x * w3.y * w12.z; + float sw9 = w3.x * w0.y * w12.z; + float sw10 = w3.x * w3.y * w12.z; + + float sw11 = w12.x * w0.y * w0.z; + float sw12 = w12.x * w0.y * w3.z; + float sw13 = w12.x * w3.y * w0.z; + float sw14 = w12.x * w3.y * w3.z; + + float sw15 = w0.x * w12.y * w0.z; + float sw16 = w0.x * w12.y * w3.z; + float sw17 = w3.x * w12.y * w0.z; + float sw18 = w3.x * w12.y * w3.z; + + totalWeight += sw7 + sw8 + sw9 + sw10 + sw11 + sw12 + sw13 + sw14 + sw15 + sw16 + sw17 + sw18; + + result += texture.SampleLevel(linearSampler, float3(tc0.x, tc0.y, tc12.z), 0.0) * sw7; + result += texture.SampleLevel(linearSampler, float3(tc0.x, tc3.y, tc12.z), 0.0) * sw8; + result += texture.SampleLevel(linearSampler, float3(tc3.x, tc0.y, tc12.z), 0.0) * sw9; + result += texture.SampleLevel(linearSampler, float3(tc3.x, tc3.y, tc12.z), 0.0) * sw10; + + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc0.y, tc0.z), 0.0) * sw11; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc0.y, tc3.z), 0.0) * sw12; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc3.y, tc0.z), 0.0) * sw13; + result += texture.SampleLevel(linearSampler, float3(tc12.x, tc3.y, tc3.z), 0.0) * sw14; + + result += texture.SampleLevel(linearSampler, float3(tc0.x, tc12.y, tc0.z), 0.0) * sw15; + result += texture.SampleLevel(linearSampler, float3(tc0.x, tc12.y, tc3.z), 0.0) * sw16; + result += texture.SampleLevel(linearSampler, float3(tc3.x, tc12.y, tc0.z), 0.0) * sw17; + result += texture.SampleLevel(linearSampler, float3(tc3.x, tc12.y, tc3.z), 0.0) * sw18; + } + return result / totalWeight; +} + PSOutput MainPS(VSOutput IN) { PSOutput OUT; // Fetch the pixel color from the input texture - float3 color = PassSrg::m_framebuffer.Sample(PassSrg::LinearSampler, IN.m_texCoord).rgb; + float3 color = PassSrg::m_framebuffer.SampleLevel(PassSrg::LinearSampler, IN.m_texCoord, 0.0).rgb; if (o_enableExposureControlFeature) { @@ -63,36 +163,28 @@ PSOutput MainPS(VSOutput IN) if (o_enableColorGradingLut) { // Convert from working color space to lut coordinates by applying the shaper function - float3 lutCoordinate = color; - if (shaperType == ShaperType::ShaperLinear) - { - lutCoordinate = color * PassSrg::m_shaperScale + PassSrg::m_shaperBias; - } - else if (shaperType == ShaperType::ShaperLog2) - { - lutCoordinate = log2(color) * PassSrg::m_shaperScale + PassSrg::m_shaperBias; - } + float3 lutCoordinate = LinearToShaper(color, shaperType, PassSrg::m_shaperBias, PassSrg::m_shaperScale); // Adjust coordinate to the domain excluding the outer half texel in all directions uint3 outputDimensions; PassSrg::m_gradingLut.GetDimensions(outputDimensions.x, outputDimensions.y, outputDimensions.z); float3 coordBias = 0.5f / outputDimensions; - float3 coordScale = (outputDimensions-1.0)/outputDimensions; + float3 sizeMinusOne = outputDimensions - 1.0; + float3 coordScale = sizeMinusOne / outputDimensions; lutCoordinate = (lutCoordinate * coordScale) + coordBias; - float3 lutColor = PassSrg::m_gradingLut.Sample(PassSrg::LinearSampler, lutCoordinate).rgb; + float3 lutColor = float3(0.0, 0.0, 0.0); + if (o_lutSampleQuality == 0) + { + lutColor = PassSrg::m_gradingLut.SampleLevel(PassSrg::LinearSampler, lutCoordinate, 0.0).rgb; + } + else + { + lutColor = SampleBSpline3D(PassSrg::m_gradingLut, PassSrg::LinearSampler, lutCoordinate, float3(outputDimensions), 1.0 / float3(outputDimensions)).rgb; + } // Apply the inverse of the shaper function to give the color in the working color space - float3 finalColor = lutColor; - if (shaperType == ShaperType::ShaperLinear) - { - finalColor = (lutColor - PassSrg::m_shaperBias)/PassSrg::m_shaperScale; - } - else if (shaperType == ShaperType::ShaperLog2) - { - finalColor = pow(2.0, (lutColor - PassSrg::m_shaperBias)/PassSrg::m_shaperScale); - } - color = finalColor; + color = ShaperToLinear(lutColor, shaperType, PassSrg::m_shaperBias, PassSrg::m_shaperScale); } OUT.m_color.rgb = color; diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.shadervariantlist b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.shadervariantlist index 0de004bde6..88d6bf9b4e 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.shadervariantlist +++ b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/LookModificationTransform.shadervariantlist @@ -1,9 +1,13 @@ { "Shader" : "LookModificationTransform.shader", "Variants" : [ - { "StableId": 1, "Options" : { "o_enableExposureControlFeature": "true", "o_enableColorGradingLut": "true" } }, - { "StableId": 2, "Options" : { "o_enableExposureControlFeature": "true", "o_enableColorGradingLut": "false" } }, - { "StableId": 3, "Options" : { "o_enableExposureControlFeature": "false", "o_enableColorGradingLut": "true" } }, - { "StableId": 4, "Options" : { "o_enableExposureControlFeature": "false", "o_enableColorGradingLut": "false" } } + { "StableId": 1, "Options" : { "o_enableExposureControlFeature": "true", "o_enableColorGradingLut": "false" } }, + { "StableId": 2, "Options" : { "o_enableExposureControlFeature": "false", "o_enableColorGradingLut": "false" } }, + { "StableId": 3, "Options" : { "o_enableExposureControlFeature": "true", "o_enableColorGradingLut": "true", "o_lutSampleQuality": 0 } }, + { "StableId": 4, "Options" : { "o_enableExposureControlFeature": "false", "o_enableColorGradingLut": "true", "o_lutSampleQuality": 0 } }, + { "StableId": 5, "Options" : { "o_enableExposureControlFeature": "true", "o_enableColorGradingLut": "true", "o_lutSampleQuality": 1 } }, + { "StableId": 6, "Options" : { "o_enableExposureControlFeature": "false", "o_enableColorGradingLut": "true", "o_lutSampleQuality": 1 } }, + { "StableId": 7, "Options" : { "o_enableExposureControlFeature": "true", "o_enableColorGradingLut": "true", "o_lutSampleQuality": 2 } }, + { "StableId": 8, "Options" : { "o_enableExposureControlFeature": "false", "o_enableColorGradingLut": "true", "o_lutSampleQuality": 2 } } ] } diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/SMAA.azsli b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/SMAA.azsli index 58c2bc1ce9..8c03816b26 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/SMAA.azsli +++ b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/SMAA.azsli @@ -1135,13 +1135,13 @@ float4 SMAABlendingWeightCalculationPS(float2 texcoord, if (!o_enableDiagonalDetectionFeature || weights.r == -weights.g) // weights.r + weights.g == 0.0 { - float2 d; + // NOTE: using separate floats for (dx, dy) and (sqrt_d_x, sqrt_d_y) instead of float2 due to android Mali driver problem crashing the device // Find the distance to the left: float3 coords; coords.x = SMAASearchXLeft(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[0].xy, offset[2].x); coords.y = offset[1].y; // offset[1].y = texcoord.y - 0.25 * SMAA_RT_METRICS.y (@CROSSING_OFFSET) - d.x = coords.x; + float dx = coords.x; // Now fetch the left crossing edges, two at a time using bilinear // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to @@ -1150,26 +1150,29 @@ float4 SMAABlendingWeightCalculationPS(float2 texcoord, // Find the distance to the right: coords.z = SMAASearchXRight(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[0].zw, offset[2].y); - d.y = coords.z; + float dy = coords.z; // We want the distances to be in pixel units (doing this here allow to // better interleave arithmetic and memory accesses): - d = abs(round(mad(SMAA_RT_METRICS.zz, d, -pixcoord.xx))); + dx = abs(round(mad(SMAA_RT_METRICS.z, dx, -pixcoord.x))); + dy = abs(round(mad(SMAA_RT_METRICS.z, dy, -pixcoord.x))); // SMAAArea below needs a sqrt, as the areas texture is compressed // quadratically: - float2 sqrt_d = sqrt(d); + float sqrt_d_x = sqrt(dx); + float sqrt_d_y = sqrt(dy); + // Fetch the right crossing edges: float e2 = SMAASampleLevelZeroOffset(edgesTex, coords.zy, int2(1, 0)).r; // Ok, we know how this pattern looks like, now it is time for getting // the actual area: - weights.rg = SMAAArea(SMAATexturePass2D(areaTex), sqrt_d, e1, e2, subsampleIndices.y); + weights.rg = SMAAArea(SMAATexturePass2D(areaTex), float2(sqrt_d_x, sqrt_d_y), e1, e2, subsampleIndices.y); // Fix corners: coords.y = texcoord.y; - SMAADetectHorizontalCornerPattern(SMAATexturePass2D(edgesTex), weights.rg, coords.xyzy, d); + SMAADetectHorizontalCornerPattern(SMAATexturePass2D(edgesTex), weights.rg, coords.xyzy, float2(dx, dy)); } else { @@ -1180,37 +1183,37 @@ float4 SMAABlendingWeightCalculationPS(float2 texcoord, SMAA_BRANCH if (e.r > 0.0) // Edge at west { - float2 d; - // Find the distance to the top: float3 coords; coords.y = SMAASearchYUp(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[1].xy, offset[2].z); coords.x = offset[0].x; // offset[1].x = texcoord.x - 0.25 * SMAA_RT_METRICS.x; - d.x = coords.y; + float dx = coords.y; // Fetch the top crossing edges: float e1 = SMAASampleLevelZero(edgesTex, coords.xy).g; // Find the distance to the bottom: coords.z = SMAASearchYDown(SMAATexturePass2D(edgesTex), SMAATexturePass2D(searchTex), offset[1].zw, offset[2].w); - d.y = coords.z; + float dy = coords.z; // We want the distances to be in pixel units: - d = abs(round(mad(SMAA_RT_METRICS.ww, d, -pixcoord.yy))); + dx = abs(round(mad(SMAA_RT_METRICS.w, dx, -pixcoord.y))); + dy = abs(round(mad(SMAA_RT_METRICS.w, dy, -pixcoord.y))); // SMAAArea below needs a sqrt, as the areas texture is compressed // quadratically: - float2 sqrt_d = sqrt(d); + float sqrt_d_x = sqrt(dx); + float sqrt_d_y = sqrt(dy); // Fetch the bottom crossing edges: float e2 = SMAASampleLevelZeroOffset(edgesTex, coords.xz, int2(0, 1)).g; // Get the area for this direction: - weights.ba = SMAAArea(SMAATexturePass2D(areaTex), sqrt_d, e1, e2, subsampleIndices.x); + weights.ba = SMAAArea(SMAATexturePass2D(areaTex), float2(sqrt_d_x, sqrt_d_y), e1, e2, subsampleIndices.x); // Fix corners: coords.x = texcoord.x; - SMAADetectVerticalCornerPattern(SMAATexturePass2D(edgesTex), weights.ba, coords.xyxz, d); + SMAADetectVerticalCornerPattern(SMAATexturePass2D(edgesTex), weights.ba, coords.xyxz, float2(dx, dy)); } return weights; diff --git a/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.cpp b/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.cpp index 125614235f..79f16ee628 100644 --- a/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.cpp +++ b/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.cpp @@ -203,47 +203,37 @@ namespace AZ return ODT_48nits; } + ShaperParams GetLog2ShaperParameters(float minStops, float maxStops) + { + ShaperParams shaperParams; + + constexpr float Log2MediumGray = -2.47393118833f; // log2f(0.18f); + shaperParams.m_type = ShaperType::Log2; + shaperParams.m_scale = 1.0f / (maxStops - minStops); + shaperParams.m_bias = -((minStops + Log2MediumGray) * shaperParams.m_scale); + + return shaperParams; + } + ShaperParams GetAcesShaperParameters(OutputDeviceTransformType odtType) { AZ_Assert(static_cast(odtType) < static_cast(NumOutputDeviceTransformTypes), "Invalid ODT type specified."); - ShaperParams shaperParams; - - // These values represent and low and high end of the dynamic range in terms of stops from middle grey (0.18) - float lowerDynamicRangeInStops; - float higherDynamicRangeInStops; - const float MIDDLE_GREY = 0.18f; - switch (odtType) { case OutputDeviceTransformType_48Nits: - lowerDynamicRangeInStops = -6.5f; - higherDynamicRangeInStops = 6.5f; - break; + return GetLog2ShaperParameters(-6.5f, 6.5f); case OutputDeviceTransformType_1000Nits: - lowerDynamicRangeInStops = -12.f; - higherDynamicRangeInStops = 10.f; - break; + return GetLog2ShaperParameters(-12.0f, 10.0f); case OutputDeviceTransformType_2000Nits: - lowerDynamicRangeInStops = -12.f; - higherDynamicRangeInStops = 11.f; - break; + return GetLog2ShaperParameters(-12.0f, 11.0f); case OutputDeviceTransformType_4000Nits: - lowerDynamicRangeInStops = -12.f; - higherDynamicRangeInStops = 12.f; - break; + return GetLog2ShaperParameters(-12.0f, 12.0f); default: AZ_Assert(false, "Invalid output device transform type."); - return shaperParams; break; } - - float logMin = log2(MIDDLE_GREY * exp2(lowerDynamicRangeInStops)); - float logMax = log2(MIDDLE_GREY * exp2(higherDynamicRangeInStops)); - shaperParams.scale = 1.0f / (logMax - logMin); - shaperParams.bias = -shaperParams.scale * logMin; - shaperParams.type = ShaperType::Log2; - return shaperParams; + return ShaperParams(); } Matrix3x3 GetColorConvertionMatrix(ColorConvertionMatrixType type) diff --git a/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.h b/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.h index 94d6434b93..3ec2885a99 100644 --- a/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.h +++ b/Gems/Atom/Feature/Common/Code/3rdParty/ACES/ACES/Aces.h @@ -124,18 +124,19 @@ namespace AZ NumColorConvertionMatrixTypes }; - enum ShaperType + enum class ShaperType : uint32_t { Linear = 0, Log2 = 1, + PqSmpteSt2084 = 2, NumShaperTypes }; struct ShaperParams { - ShaperType type = ShaperType::Linear; - float bias = 0.f; - float scale = 1.f; + ShaperType m_type = ShaperType::Linear; + float m_bias = 0.0f; + float m_scale = 1.0f; }; enum class DisplayMapperOperationType : uint32_t @@ -151,10 +152,14 @@ namespace AZ enum class ShaperPresetType { None = 0, - Log2_48_nits, - Log2_1000_nits, - Log2_2000_nits, - Log2_4000_nits + LinearCustomRange, + Log2_48Nits, + Log2_1000Nits, + Log2_2000Nits, + Log2_4000Nits, + Log2CustomRange, + PqSmpteSt2084, + NumShaperTypes }; enum class ToneMapperType @@ -171,6 +176,7 @@ namespace AZ }; SegmentedSplineParamsC9 GetAcesODTParameters(OutputDeviceTransformType odtType); + ShaperParams GetLog2ShaperParameters(float minStops, float maxStops); ShaperParams GetAcesShaperParameters(OutputDeviceTransformType odtType); Matrix3x3 GetColorConvertionMatrix(ColorConvertionMatrixType type); diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h index 7d2aa18f29..6be81c8cae 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/ACES/AcesDisplayMapperFeatureProcessor.h @@ -78,7 +78,7 @@ namespace AZ static OutputDeviceTransformType GetOutputDeviceTransformType(RHI::Format bufferFormat); static void GetAcesDisplayMapperParameters(DisplayMapperParameters* displayMapperParameters, OutputDeviceTransformType odtType); - static ShaperParams GetShaperParameters(ShaperPresetType shaperPreset); + static ShaperParams GetShaperParameters(ShaperPresetType shaperPreset, float customMinEv = 0.0f, float customMaxEv = 0.0f); static void GetDefaultDisplayMapperConfiguration(DisplayMapperConfigurationDescriptor& config); // DisplayMapperFeatureProcessorInteface overrides... @@ -102,8 +102,6 @@ namespace AZ static constexpr const char* FeatureProcessorName = "AcesDisplayMapperFeatureProcessor"; - static const int LutSize = 32; - static const RHI::Format LutFormat = RHI::Format::R16G16B16A16_FLOAT; static const int ImagePoolBudget = 1 << 20; // 1 Megabyte // LUTs that are baked through shaders diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/PostProcess/LookModification/LookModificationParams.inl b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/PostProcess/LookModification/LookModificationParams.inl index 38a1987caa..4c3cf8ac92 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/PostProcess/LookModification/LookModificationParams.inl +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/PostProcess/LookModification/LookModificationParams.inl @@ -10,11 +10,9 @@ // PARAM(NAME, MEMBER_NAME, DEFAULT_VALUE, ...) AZ_GFX_BOOL_PARAM(Enabled, m_enabled, false) - AZ_GFX_COMMON_PARAM(Data::Asset, ColorGradingLut, m_colorGradingLut, {}) - -AZ_GFX_COMMON_PARAM(AZ::Render::ShaperPresetType, ShaperPresetType, m_shaperPresetType, AZ::Render::ShaperPresetType::Log2_48_nits) - +AZ_GFX_COMMON_PARAM(AZ::Render::ShaperPresetType, ShaperPresetType, m_shaperPresetType, AZ::Render::ShaperPresetType::Log2_48Nits) +AZ_GFX_COMMON_PARAM(float, CustomMinExposure, m_customMinExposure, -6.5) +AZ_GFX_COMMON_PARAM(float, CustomMaxExposure, m_customMaxExposure, 6.5) AZ_GFX_FLOAT_PARAM(ColorGradingLutIntensity, m_colorGradingLutIntensity, 1.0) - AZ_GFX_FLOAT_PARAM(ColorGradingLutOverride, m_colorGradingLutOverride, 1.0) diff --git a/Gems/Atom/Feature/Common/Code/Source/ACES/AcesDisplayMapperFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/ACES/AcesDisplayMapperFeatureProcessor.cpp index 4c057aab2a..c6c41edb31 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ACES/AcesDisplayMapperFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ACES/AcesDisplayMapperFeatureProcessor.cpp @@ -21,6 +21,7 @@ namespace { + static const AZ::RHI::Format LutFormat = AZ::RHI::Format::R16G16B16A16_FLOAT; uint16_t ConvertFloatToHalf(const float Value) { @@ -56,395 +57,409 @@ namespace } } -namespace AZ +namespace AZ::Render { - namespace Render + void AcesDisplayMapperFeatureProcessor::Reflect(ReflectContext* context) { - void AcesDisplayMapperFeatureProcessor::Reflect(ReflectContext* context) + if (auto* serializeContext = azrtti_cast(context)) { - if (auto* serializeContext = azrtti_cast(context)) - { - serializeContext - ->Class() - ->Version(0); - } + serializeContext + ->Class() + ->Version(0); + } + } + + void AcesDisplayMapperFeatureProcessor::Activate() + { + GetDefaultDisplayMapperConfiguration(m_displayMapperConfiguration); + } + + void AcesDisplayMapperFeatureProcessor::Deactivate() + { + m_ownedLuts.clear(); + } + + void AcesDisplayMapperFeatureProcessor::Simulate(const FeatureProcessor::SimulatePacket& packet) + { + AZ_TRACE_METHOD(); + AZ_UNUSED(packet); + } + + void AcesDisplayMapperFeatureProcessor::Render([[maybe_unused]] const FeatureProcessor::RenderPacket& packet) + { + } + + void AcesDisplayMapperFeatureProcessor::ApplyLdrOdtParameters(DisplayMapperParameters* displayMapperParameters) + { + AZ_Assert(displayMapperParameters != nullptr, "The pOutParameters must not to be null pointer."); + if (displayMapperParameters == nullptr) + { + return; } - void AcesDisplayMapperFeatureProcessor::Activate() + // These values in the ODT parameter are taken from the reference ACES transform. + // + // The original ACES references. + // Common: + // https://github.com/ampas/aces-dev/blob/master/transforms/ctl/lib/ACESlib.ODT_Common.ctl + // For sRGB: + // https://github.com/ampas/aces-dev/tree/master/transforms/ctl/odt/sRGB + displayMapperParameters->m_cinemaLimits[0] = 0.02f; + displayMapperParameters->m_cinemaLimits[1] = 48.0f; + displayMapperParameters->m_acesSplineParams = GetAcesODTParameters(OutputDeviceTransformType_48Nits); + displayMapperParameters->m_OutputDisplayTransformFlags = AlterSurround | ApplyDesaturation | ApplyCATD60toD65; + displayMapperParameters->m_OutputDisplayTransformMode = Srgb; + ColorConvertionMatrixType colorMatrixType = XYZ_To_Rec709; + switch (displayMapperParameters->m_OutputDisplayTransformMode) { - GetDefaultDisplayMapperConfiguration(m_displayMapperConfiguration); + case Srgb: + colorMatrixType = XYZ_To_Rec709; + break; + case PerceptualQuantizer: + case Ldr: + colorMatrixType = XYZ_To_Bt2020; + break; + default: + break; + } + displayMapperParameters->m_XYZtoDisplayPrimaries = GetColorConvertionMatrix(colorMatrixType); + + displayMapperParameters->m_surroundGamma = 0.9811f; + displayMapperParameters->m_gamma = 2.2f; + } + + void AcesDisplayMapperFeatureProcessor::ApplyHdrOdtParameters(DisplayMapperParameters* displayMapperParameters, const OutputDeviceTransformType& odtType) + { + AZ_Assert(displayMapperParameters != nullptr, "The pOutParameters must not to be null pointer."); + if (displayMapperParameters == nullptr) + { + return; } - void AcesDisplayMapperFeatureProcessor::Deactivate() + // Dynamic range limit values taken from NVIDIA HDR sample. + // These values represent and low and high end of the dynamic range in terms of stops from middle grey (0.18) + float lowerDynamicRangeInStops = -12.f; + float higherDynamicRangeInStops = 10.f; + const float MIDDLE_GREY = 0.18f; + + switch (odtType) { - m_ownedLuts.clear(); + case OutputDeviceTransformType_1000Nits: + higherDynamicRangeInStops = 10.f; + break; + case OutputDeviceTransformType_2000Nits: + higherDynamicRangeInStops = 11.f; + break; + case OutputDeviceTransformType_4000Nits: + higherDynamicRangeInStops = 12.f; + break; + default: + AZ_Assert(false, "Invalid output device transform type."); + break; } - void AcesDisplayMapperFeatureProcessor::Simulate(const FeatureProcessor::SimulatePacket& packet) + displayMapperParameters->m_cinemaLimits[0] = MIDDLE_GREY * exp2(lowerDynamicRangeInStops); + displayMapperParameters->m_cinemaLimits[1] = MIDDLE_GREY * exp2(higherDynamicRangeInStops); + displayMapperParameters->m_acesSplineParams = GetAcesODTParameters(odtType); + displayMapperParameters->m_OutputDisplayTransformFlags = AlterSurround | ApplyDesaturation | ApplyCATD60toD65; + displayMapperParameters->m_OutputDisplayTransformMode = PerceptualQuantizer; + ColorConvertionMatrixType colorMatrixType = XYZ_To_Bt2020; + displayMapperParameters->m_XYZtoDisplayPrimaries = GetColorConvertionMatrix(colorMatrixType); + + // Surround gamma value is from the dim surround gamma from the ACES reference transforms. + // https://github.com/ampas/aces-dev/blob/master/transforms/ctl/lib/ACESlib.ODT_Common.ctl + displayMapperParameters->m_surroundGamma = 0.9811f; + displayMapperParameters->m_gamma = 1.0f; // gamma not used with perceptual quantizer, but just set to 1.0 anyways + } + + OutputDeviceTransformType AcesDisplayMapperFeatureProcessor::GetOutputDeviceTransformType(RHI::Format bufferFormat) + { + OutputDeviceTransformType outputDeviceTransformType = OutputDeviceTransformType_48Nits; + if (bufferFormat == RHI::Format::R8G8B8A8_UNORM || + bufferFormat == RHI::Format::B8G8R8A8_UNORM) { - AZ_TRACE_METHOD(); - AZ_UNUSED(packet); + outputDeviceTransformType = OutputDeviceTransformType_48Nits; + } + else if (bufferFormat == RHI::Format::R10G10B10A2_UNORM) + { + outputDeviceTransformType = OutputDeviceTransformType_1000Nits; + } + else + { + AZ_Assert(false, "Not yet supported."); + // To work normally on unsupported environment, initialize the display parameters by OutputDeviceTransformType_48Nits. + outputDeviceTransformType = OutputDeviceTransformType_48Nits; + } + return outputDeviceTransformType; + } + + void AcesDisplayMapperFeatureProcessor::GetAcesDisplayMapperParameters(DisplayMapperParameters* displayMapperParameters, OutputDeviceTransformType odtType) + { + switch (odtType) + { + case OutputDeviceTransformType_48Nits: + ApplyLdrOdtParameters(displayMapperParameters); + break; + case OutputDeviceTransformType_1000Nits: + case OutputDeviceTransformType_2000Nits: + case OutputDeviceTransformType_4000Nits: + ApplyHdrOdtParameters(displayMapperParameters, odtType); + break; + default: + AZ_Assert(false, "This ODT type[%d] is not supported.", odtType); + break; + } + } + + void AcesDisplayMapperFeatureProcessor::GetOwnedLut(DisplayMapperLut& displayMapperLut, const AZ::Name& lutName) + { + auto it = m_ownedLuts.find(lutName); + if (it == m_ownedLuts.end()) + { + InitializeLutImage(lutName); + it = m_ownedLuts.find(lutName); + AZ_Assert(it != m_ownedLuts.end(), "AcesDisplayMapperFeatureProcessor unable to create LUT %s", lutName.GetCStr()); + } + displayMapperLut = it->second; + } + + void AcesDisplayMapperFeatureProcessor::GetDisplayMapperLut(DisplayMapperLut& displayMapperLut) + { + const AZ::Name acesLutName("AcesLutImage"); + auto it = m_ownedLuts.find(acesLutName); + if (it == m_ownedLuts.end()) + { + InitializeLutImage(acesLutName); + + it = m_ownedLuts.find(acesLutName); + AZ_Assert(it != m_ownedLuts.end(), "AcesDisplayMapperFeatureProcessor unable to create ACES LUT image"); + } + displayMapperLut = it->second; + } + + void AcesDisplayMapperFeatureProcessor::GetLutFromAssetLocation(DisplayMapperAssetLut& displayMapperAssetLut, const AZStd::string& assetPath) + { + Data::AssetId assetId = RPI::AssetUtils::GetAssetIdForProductPath(assetPath.c_str(), RPI::AssetUtils::TraceLevel::Error); + GetLutFromAssetId(displayMapperAssetLut, assetId); + } + + void AcesDisplayMapperFeatureProcessor::GetLutFromAssetId(DisplayMapperAssetLut& displayMapperAssetLut, const AZ::Data::AssetId assetId) + { + if (!assetId.IsValid()) + { + return; } - void AcesDisplayMapperFeatureProcessor::Render([[maybe_unused]] const FeatureProcessor::RenderPacket& packet) + // Check first if this already exists + auto it = m_assetLuts.find(assetId.ToString()); + if (it != m_assetLuts.end()) { + displayMapperAssetLut = it->second; + return; } - void AcesDisplayMapperFeatureProcessor::ApplyLdrOdtParameters(DisplayMapperParameters* displayMapperParameters) + // Read the lut which is a .3dl file embedded within an azasset file. + Data::Asset asset = RPI::AssetUtils::LoadAssetById(assetId, RPI::AssetUtils::TraceLevel::Error); + const LookupTableAsset* lutAsset = RPI::GetDataFromAnyAsset(asset); + + if (lutAsset == nullptr) { - AZ_Assert(displayMapperParameters != nullptr, "The pOutParameters must not to be null pointer."); - if (displayMapperParameters == nullptr) - { - return; - } - - // These values in the ODT parameter are taken from the reference ACES transform. - // - // The original ACES references. - // Common: - // https://github.com/ampas/aces-dev/blob/master/transforms/ctl/lib/ACESlib.ODT_Common.ctl - // For sRGB: - // https://github.com/ampas/aces-dev/tree/master/transforms/ctl/odt/sRGB - displayMapperParameters->m_cinemaLimits[0] = 0.02f; - displayMapperParameters->m_cinemaLimits[1] = 48.0f; - displayMapperParameters->m_acesSplineParams = GetAcesODTParameters(OutputDeviceTransformType_48Nits); - displayMapperParameters->m_OutputDisplayTransformFlags = AlterSurround | ApplyDesaturation | ApplyCATD60toD65; - displayMapperParameters->m_OutputDisplayTransformMode = Srgb; - ColorConvertionMatrixType colorMatrixType = XYZ_To_Rec709; - switch (displayMapperParameters->m_OutputDisplayTransformMode) - { - case Srgb: - colorMatrixType = XYZ_To_Rec709; - break; - case PerceptualQuantizer: - case Ldr: - colorMatrixType = XYZ_To_Bt2020; - break; - default: - break; - } - displayMapperParameters->m_XYZtoDisplayPrimaries = GetColorConvertionMatrix(colorMatrixType); - - displayMapperParameters->m_surroundGamma = 0.9811f; - displayMapperParameters->m_gamma = 2.2f; + AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Unable to read LUT from asset."); + asset.Release(); + return; } - void AcesDisplayMapperFeatureProcessor::ApplyHdrOdtParameters(DisplayMapperParameters* displayMapperParameters, const OutputDeviceTransformType& odtType) + // The first row of numbers in a 3dl file is a number of vertices that partition the space from [0,..1023] + // This assumes that the vertices are evenly spaced apart. Non-uniform spacing is supported by the format, + // but haven't been encountered yet. + const size_t lutSize = lutAsset->m_intervals.size(); + + if (lutSize == 0) { - AZ_Assert(displayMapperParameters != nullptr, "The pOutParameters must not to be null pointer."); - if (displayMapperParameters == nullptr) - { - return; - } - - // Dynamic range limit values taken from NVIDIA HDR sample. - // These values represent and low and high end of the dynamic range in terms of stops from middle grey (0.18) - float lowerDynamicRangeInStops = -12.f; - float higherDynamicRangeInStops = 10.f; - const float MIDDLE_GREY = 0.18f; - - switch (odtType) - { - case OutputDeviceTransformType_1000Nits: - higherDynamicRangeInStops = 10.f; - break; - case OutputDeviceTransformType_2000Nits: - higherDynamicRangeInStops = 11.f; - break; - case OutputDeviceTransformType_4000Nits: - higherDynamicRangeInStops = 12.f; - break; - default: - AZ_Assert(false, "Invalid output device transform type."); - break; - } - - displayMapperParameters->m_cinemaLimits[0] = MIDDLE_GREY * exp2(lowerDynamicRangeInStops); - displayMapperParameters->m_cinemaLimits[1] = MIDDLE_GREY * exp2(higherDynamicRangeInStops); - displayMapperParameters->m_acesSplineParams = GetAcesODTParameters(odtType); - displayMapperParameters->m_OutputDisplayTransformFlags = AlterSurround | ApplyDesaturation | ApplyCATD60toD65; - displayMapperParameters->m_OutputDisplayTransformMode = PerceptualQuantizer; - ColorConvertionMatrixType colorMatrixType = XYZ_To_Bt2020; - displayMapperParameters->m_XYZtoDisplayPrimaries = GetColorConvertionMatrix(colorMatrixType); - - // Surround gamma value is from the dim surround gamma from the ACES reference transforms. - // https://github.com/ampas/aces-dev/blob/master/transforms/ctl/lib/ACESlib.ODT_Common.ctl - displayMapperParameters->m_surroundGamma = 0.9811f; - displayMapperParameters->m_gamma = 1.0f; // gamma not used with perceptual quantizer, but just set to 1.0 anyways + AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Lut asset has invalid size."); + asset.Release(); + return; } - OutputDeviceTransformType AcesDisplayMapperFeatureProcessor::GetOutputDeviceTransformType(RHI::Format bufferFormat) + // Create a buffer of half floats from the LUT and use it to initialize a 3d texture. + + const size_t kChannels = 4; + const size_t kChannelBytes = 2; + const size_t bytesPerRow = lutSize * kChannels * kChannelBytes; + const size_t bytesPerSlice = bytesPerRow * lutSize; + + AZStd::vector u16Buffer; + const size_t bufferSize = lutSize * lutSize * lutSize * kChannels; + u16Buffer.resize(bufferSize); + + for (size_t slice = 0; slice < lutSize; slice++) { - OutputDeviceTransformType outputDeviceTransformType = OutputDeviceTransformType_48Nits; - if (bufferFormat == RHI::Format::R8G8B8A8_UNORM || - bufferFormat == RHI::Format::B8G8R8A8_UNORM) + for (size_t column = 0; column < lutSize; column++) { - outputDeviceTransformType = OutputDeviceTransformType_48Nits; - } - else if (bufferFormat == RHI::Format::R10G10B10A2_UNORM) - { - outputDeviceTransformType = OutputDeviceTransformType_1000Nits; - } - else - { - AZ_Assert(false, "Not yet supported."); - // To work normally on unsupported environment, initialize the display parameters by OutputDeviceTransformType_48Nits. - outputDeviceTransformType = OutputDeviceTransformType_48Nits; - } - return outputDeviceTransformType; - } - - void AcesDisplayMapperFeatureProcessor::GetAcesDisplayMapperParameters(DisplayMapperParameters* displayMapperParameters, OutputDeviceTransformType odtType) - { - switch (odtType) - { - case OutputDeviceTransformType_48Nits: - ApplyLdrOdtParameters(displayMapperParameters); - break; - case OutputDeviceTransformType_1000Nits: - case OutputDeviceTransformType_2000Nits: - case OutputDeviceTransformType_4000Nits: - ApplyHdrOdtParameters(displayMapperParameters, odtType); - break; - default: - AZ_Assert(false, "This ODT type[%d] is not supported.", odtType); - break; - } - } - - void AcesDisplayMapperFeatureProcessor::GetOwnedLut(DisplayMapperLut& displayMapperLut, const AZ::Name& lutName) - { - auto it = m_ownedLuts.find(lutName); - if (it == m_ownedLuts.end()) - { - InitializeLutImage(lutName); - it = m_ownedLuts.find(lutName); - AZ_Assert(it != m_ownedLuts.end(), "AcesDisplayMapperFeatureProcessor unable to create LUT %s", lutName.GetCStr()); - } - displayMapperLut = it->second; - } - - void AcesDisplayMapperFeatureProcessor::GetDisplayMapperLut(DisplayMapperLut& displayMapperLut) - { - const AZ::Name acesLutName("AcesLutImage"); - auto it = m_ownedLuts.find(acesLutName); - if (it == m_ownedLuts.end()) - { - InitializeLutImage(acesLutName); - - it = m_ownedLuts.find(acesLutName); - AZ_Assert(it != m_ownedLuts.end(), "AcesDisplayMapperFeatureProcessor unable to create ACES LUT image"); - } - displayMapperLut = it->second; - } - - void AcesDisplayMapperFeatureProcessor::GetLutFromAssetLocation(DisplayMapperAssetLut& displayMapperAssetLut, const AZStd::string& assetPath) - { - Data::AssetId assetId = RPI::AssetUtils::GetAssetIdForProductPath(assetPath.c_str(), RPI::AssetUtils::TraceLevel::Error); - GetLutFromAssetId(displayMapperAssetLut, assetId); - } - - void AcesDisplayMapperFeatureProcessor::GetLutFromAssetId(DisplayMapperAssetLut& displayMapperAssetLut, const AZ::Data::AssetId assetId) - { - if (!assetId.IsValid()) - { - return; - } - - // Check first if this already exists - auto it = m_assetLuts.find(assetId.ToString()); - if (it != m_assetLuts.end()) - { - displayMapperAssetLut = it->second; - return; - } - - // Read the lut which is a .3dl file embedded within an azasset file. - Data::Asset asset = RPI::AssetUtils::LoadAssetById(assetId, RPI::AssetUtils::TraceLevel::Error); - const LookupTableAsset* lutAsset = RPI::GetDataFromAnyAsset(asset); - - if (lutAsset == nullptr) - { - AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Unable to read LUT from asset."); - asset.Release(); - return; - } - - // The first row of numbers in a 3dl file is a number of vertices that partition the space from [0,..1023] - // This assumes that the vertices are evenly spaced apart. Non-uniform spacing is supported by the format, - // but haven't been encountered yet. - uint32_t lutSize = static_cast(lutAsset->m_intervals.size()); - - if (lutSize == 0) - { - AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Lut asset has invalid size."); - asset.Release(); - return; - } - - // The vertices in the file are given as a positive integer value in [0,..4095] and need to be normalized - // and stored into a linear unaligned buffer used to initialize the streaming image. - const float normalizeValue = 4095.0f; - const int kChannels = 4; - const int kChannelBytes = 2; - int bytesPerRow = lutSize * kChannels * kChannelBytes; - int bytesPerSlice = bytesPerRow * lutSize; - - AZStd::vector u16Buffer; - size_t bufferSize = (bytesPerSlice * lutSize) / sizeof(uint16_t); - u16Buffer.resize(bufferSize); - uint16_t* data = u16Buffer.data(); - for (int slice = 0; slice < (int)lutSize; slice++) - { - for (int column = 0; column < (int)lutSize; column++) + for (size_t row = 0; row < lutSize; row++) { - for (int row = 0; row < (int)lutSize; row++) - { - // Index in the LUT texture data - int idx = (column * kChannels) + - (bytesPerRow * row / sizeof(uint16_t)) + - ((bytesPerSlice * slice) / sizeof(uint16_t)); + // Index in the LUT texture data + size_t idx = (column * kChannels) + + ((bytesPerRow * row) / kChannelBytes) + + ((bytesPerSlice * slice) / kChannelBytes); - // Vertices the .3dl file are listed first by increasing slice, then row, and finally column coordinate - // This corresponds to blue, green, and red channels, respectively. - int assetIdx = slice + lutSize * row + (lutSize * lutSize * column); + // Vertices the .3dl file are listed first by increasing slice, then row, and finally column coordinate + // This corresponds to blue, green, and red channels, respectively. + size_t assetIdx = slice + lutSize * row + (lutSize * lutSize * column); - AZ::u64 red = lutAsset->m_values[assetIdx * 3 + 0]; - AZ::u64 green = lutAsset->m_values[assetIdx * 3 + 1]; - AZ::u64 blue = lutAsset->m_values[assetIdx * 3 + 2]; - data[idx + 0] = ConvertFloatToHalf(static_cast(red) / normalizeValue); - data[idx + 1] = ConvertFloatToHalf(static_cast(green) / normalizeValue); - data[idx + 2] = ConvertFloatToHalf(static_cast(blue) / normalizeValue); - data[idx + 3] = 0x3b00; // 1.0 in half - } + AZ::u64 red = lutAsset->m_values[assetIdx * 3 + 0]; + AZ::u64 green = lutAsset->m_values[assetIdx * 3 + 1]; + AZ::u64 blue = lutAsset->m_values[assetIdx * 3 + 2]; + + // The vertices in the file are given as a positive integer value in [0,..4095] and need to be normalized + constexpr float NormalizeValue = 4095.0f; + + u16Buffer[idx + 0] = ConvertFloatToHalf(static_cast(red) / NormalizeValue); + u16Buffer[idx + 1] = ConvertFloatToHalf(static_cast(green) / NormalizeValue); + u16Buffer[idx + 2] = ConvertFloatToHalf(static_cast(blue) / NormalizeValue); + u16Buffer[idx + 3] = 0x3b00; // 1.0 in half } } - - asset.Release(); - - Data::Instance streamingImagePool = RPI::ImageSystemInterface::Get()->GetSystemStreamingPool(); - - RHI::Size imageSize; - imageSize.m_width = static_cast(lutSize); - imageSize.m_height = static_cast(lutSize); - imageSize.m_depth = static_cast(lutSize); - size_t imageDataSize = bytesPerSlice * lutSize; - - Data::Instance lutStreamingImage = RPI::StreamingImage::CreateFromCpuData( - *streamingImagePool, RHI::ImageDimension::Image3D, imageSize, LutFormat, data, imageDataSize); - - AZ_Error("AcesDisplayMapperFeatureProcessor", lutStreamingImage, "Failed to initialize the lut assetId %s.", assetId.ToString().c_str()); - - DisplayMapperAssetLut assetLut; - assetLut.m_lutStreamingImage = lutStreamingImage; - - // Add to the list of LUT asset resources - m_assetLuts.insert(AZStd::pair(assetId.ToString(), assetLut)); - displayMapperAssetLut = assetLut; } - void AcesDisplayMapperFeatureProcessor::InitializeImagePool() + asset.Release(); + + Data::Instance streamingImagePool = RPI::ImageSystemInterface::Get()->GetSystemStreamingPool(); + + RHI::Size imageSize; + imageSize.m_width = static_cast(lutSize); + imageSize.m_height = static_cast(lutSize); + imageSize.m_depth = static_cast(lutSize); + size_t imageDataSize = bytesPerSlice * lutSize; + + Data::Instance lutStreamingImage = RPI::StreamingImage::CreateFromCpuData( + *streamingImagePool, RHI::ImageDimension::Image3D, imageSize, LutFormat, u16Buffer.data(), imageDataSize); + + AZ_Error("AcesDisplayMapperFeatureProcessor", lutStreamingImage, "Failed to initialize the lut assetId %s.", assetId.ToString().c_str()); + + DisplayMapperAssetLut assetLut; + assetLut.m_lutStreamingImage = lutStreamingImage; + + // Add to the list of LUT asset resources + m_assetLuts.insert(AZStd::pair(assetId.ToString(), assetLut)); + displayMapperAssetLut = assetLut; + } + + void AcesDisplayMapperFeatureProcessor::InitializeImagePool() + { + AZ::RHI::Factory& factory = RHI::Factory::Get(); + m_displayMapperImagePool = factory.CreateImagePool(); + m_displayMapperImagePool->SetName(Name("DisplayMapperImagePool")); + + RHI::ImagePoolDescriptor imagePoolDesc = {}; + imagePoolDesc.m_bindFlags = RHI::ImageBindFlags::ShaderReadWrite; + imagePoolDesc.m_budgetInBytes = ImagePoolBudget; + + RHI::Device* device = RHI::RHISystemInterface::Get()->GetDevice(); + RHI::ResultCode resultCode = m_displayMapperImagePool->Init(*device, imagePoolDesc); + if (resultCode != RHI::ResultCode::Success) { - AZ::RHI::Factory& factory = RHI::Factory::Get(); - m_displayMapperImagePool = factory.CreateImagePool(); - m_displayMapperImagePool->SetName(Name("DisplayMapperImagePool")); - - RHI::ImagePoolDescriptor imagePoolDesc = {}; - imagePoolDesc.m_bindFlags = RHI::ImageBindFlags::ShaderReadWrite; - imagePoolDesc.m_budgetInBytes = ImagePoolBudget; - - RHI::Device* device = RHI::RHISystemInterface::Get()->GetDevice(); - RHI::ResultCode resultCode = m_displayMapperImagePool->Init(*device, imagePoolDesc); - if (resultCode != RHI::ResultCode::Success) - { - AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Failed to initialize image pool."); - return; - } + AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Failed to initialize image pool."); + return; } + } - void AcesDisplayMapperFeatureProcessor::InitializeLutImage(const AZ::Name& lutName) + void AcesDisplayMapperFeatureProcessor::InitializeLutImage(const AZ::Name& lutName) + { + if (!m_displayMapperImagePool) { - if (!m_displayMapperImagePool) - { - InitializeImagePool(); - } - - DisplayMapperLut lutResource; - lutResource.m_lutImage = RHI::Factory::Get().CreateImage(); - lutResource.m_lutImage->SetName(lutName); - - RHI::ImageInitRequest imageRequest; - imageRequest.m_image = lutResource.m_lutImage.get(); - imageRequest.m_descriptor = RHI::ImageDescriptor::Create3D(RHI::ImageBindFlags::ShaderReadWrite, LutSize, LutSize, LutSize, LutFormat); - RHI::ResultCode resultCode = m_displayMapperImagePool->InitImage(imageRequest); - - if (resultCode != RHI::ResultCode::Success) - { - AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Failed to initialize LUT image."); - return; - } - - lutResource.m_lutImageViewDescriptor = RHI::ImageViewDescriptor::Create(LutFormat, 0, 0); - lutResource.m_lutImageView = lutResource.m_lutImage->GetImageView(lutResource.m_lutImageViewDescriptor); - if (!lutResource.m_lutImageView.get()) - { - AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Failed to initialize LUT image view."); - return; - } - - // Add to the list of lut resources - lutResource.m_lutImageView->SetName(lutName); - m_ownedLuts[lutName] = lutResource; + InitializeImagePool(); } - ShaperParams AcesDisplayMapperFeatureProcessor::GetShaperParameters(ShaperPresetType shaperPreset) + DisplayMapperLut lutResource; + lutResource.m_lutImage = RHI::Factory::Get().CreateImage(); + lutResource.m_lutImage->SetName(lutName); + + RHI::ImageInitRequest imageRequest; + imageRequest.m_image = lutResource.m_lutImage.get(); + static const int LutSize = 32; + imageRequest.m_descriptor = RHI::ImageDescriptor::Create3D(RHI::ImageBindFlags::ShaderReadWrite, LutSize, LutSize, LutSize, LutFormat); + RHI::ResultCode resultCode = m_displayMapperImagePool->InitImage(imageRequest); + + if (resultCode != RHI::ResultCode::Success) { - // Default is a linear shaper with bias 0.0 and scale 1.0. That is, fx = x*1.0 + 0.0 - ShaperParams shaperParams = { ShaperType::Linear, 0.0, 1.f }; - OutputDeviceTransformType outputDeviceTransformType = OutputDeviceTransformType::NumOutputDeviceTransformTypes; - switch (shaperPreset) - { - case ShaperPresetType::None: - break; - case ShaperPresetType::Log2_48_nits: - outputDeviceTransformType = OutputDeviceTransformType::OutputDeviceTransformType_48Nits; - break; - case ShaperPresetType::Log2_1000_nits: - outputDeviceTransformType = OutputDeviceTransformType::OutputDeviceTransformType_1000Nits; - break; - case ShaperPresetType::Log2_2000_nits: - outputDeviceTransformType = OutputDeviceTransformType::OutputDeviceTransformType_2000Nits; - break; - case ShaperPresetType::Log2_4000_nits: - outputDeviceTransformType = OutputDeviceTransformType::OutputDeviceTransformType_4000Nits; - break; - default: - AZ_Error("DisplayMapperPass", false, "Invalid shaper preset type."); - break; - } - if (outputDeviceTransformType < OutputDeviceTransformType::NumOutputDeviceTransformTypes) - { - shaperParams = GetAcesShaperParameters(outputDeviceTransformType); - } - return shaperParams; + AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Failed to initialize LUT image."); + return; } - void AcesDisplayMapperFeatureProcessor::GetDefaultDisplayMapperConfiguration(DisplayMapperConfigurationDescriptor& config) + lutResource.m_lutImageViewDescriptor = RHI::ImageViewDescriptor::Create(LutFormat, 0, 0); + lutResource.m_lutImageView = lutResource.m_lutImage->GetImageView(lutResource.m_lutImageViewDescriptor); + if (!lutResource.m_lutImageView.get()) { - // Default configuration is ACES with LDR color grading LUT disabled. - config.m_operationType = DisplayMapperOperationType::Aces; - config.m_ldrGradingLutEnabled = false; - config.m_ldrColorGradingLut.Release(); + AZ_Error("AcesDisplayMapperFeatureProcessor", false, "Failed to initialize LUT image view."); + return; } - void AcesDisplayMapperFeatureProcessor::RegisterDisplayMapperConfiguration(const DisplayMapperConfigurationDescriptor& config) - { - m_displayMapperConfiguration = config; - } + // Add to the list of lut resources + lutResource.m_lutImageView->SetName(lutName); + m_ownedLuts[lutName] = lutResource; + } - DisplayMapperConfigurationDescriptor AcesDisplayMapperFeatureProcessor::GetDisplayMapperConfiguration() + ShaperParams AcesDisplayMapperFeatureProcessor::GetShaperParameters(ShaperPresetType shaperPreset, float customMinEv, float customMaxEv) + { + // Default is a linear shaper with bias 0.0 and scale 1.0. That is, fx = x*1.0 + 0.0 + ShaperParams shaperParams = { ShaperType::Linear, 0.0, 1.f }; + switch (shaperPreset) { - return m_displayMapperConfiguration; + case ShaperPresetType::None: + break; + case ShaperPresetType::Log2_48Nits: + shaperParams = GetAcesShaperParameters(OutputDeviceTransformType::OutputDeviceTransformType_48Nits); + break; + case ShaperPresetType::Log2_1000Nits: + shaperParams = GetAcesShaperParameters(OutputDeviceTransformType::OutputDeviceTransformType_1000Nits); + break; + case ShaperPresetType::Log2_2000Nits: + shaperParams = GetAcesShaperParameters(OutputDeviceTransformType::OutputDeviceTransformType_2000Nits); + break; + case ShaperPresetType::Log2_4000Nits: + shaperParams = GetAcesShaperParameters(OutputDeviceTransformType::OutputDeviceTransformType_4000Nits); + break; + case ShaperPresetType::LinearCustomRange: + { + // Map the range min exposure - max exposure to 0-1. Convert EV values to linear values here to avoid that work in the shader. + // Shader equation becomes (x - bias) / scale; + constexpr float MediumGray = 0.18f; + const float minValue = MediumGray * powf(2, customMinEv); + const float maxValue = MediumGray * powf(2, customMaxEv); + shaperParams.m_type = ShaperType::Linear; + shaperParams.m_scale = 1.0f / (maxValue - minValue); + shaperParams.m_bias = -minValue * shaperParams.m_scale; + break; } - } // namespace Render -} // namespace AZ + case ShaperPresetType::Log2CustomRange: + shaperParams = GetLog2ShaperParameters(customMinEv, customMaxEv); + break; + case ShaperPresetType::PqSmpteSt2084: + shaperParams.m_type = ShaperType::PqSmpteSt2084; + break; + default: + AZ_Error("DisplayMapperPass", false, "Invalid shaper preset type."); + break; + } + return shaperParams; + } + + void AcesDisplayMapperFeatureProcessor::GetDefaultDisplayMapperConfiguration(DisplayMapperConfigurationDescriptor& config) + { + // Default configuration is ACES with LDR color grading LUT disabled. + config.m_operationType = DisplayMapperOperationType::Aces; + config.m_ldrGradingLutEnabled = false; + config.m_ldrColorGradingLut.Release(); + } + + void AcesDisplayMapperFeatureProcessor::RegisterDisplayMapperConfiguration(const DisplayMapperConfigurationDescriptor& config) + { + m_displayMapperConfiguration = config; + } + + DisplayMapperConfigurationDescriptor AcesDisplayMapperFeatureProcessor::GetDisplayMapperConfiguration() + { + return m_displayMapperConfiguration; + } +} // namespace AZ::Render 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 8a274beb2f..0045311bef 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..10dab85dcb 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(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(AZ::Debug::ProfileCategory::Renderer); + AZ_PROFILE_FUNCTION(AzRender); 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/DisplayMapper/AcesOutputTransformLutPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/AcesOutputTransformLutPass.cpp index a00f879bca..3b2913aefd 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/AcesOutputTransformLutPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/AcesOutputTransformLutPass.cpp @@ -91,8 +91,8 @@ namespace AZ m_shaderResourceGroup->SetImageView(m_shaderInputLutImageIndex, m_displayMapperLut.m_lutImageView.get()); } - m_shaderResourceGroup->SetConstant(m_shaderInputShaperBiasIndex, m_shaperParams.bias); - m_shaderResourceGroup->SetConstant(m_shaderInputShaperScaleIndex, m_shaperParams.scale); + m_shaderResourceGroup->SetConstant(m_shaderInputShaperBiasIndex, m_shaperParams.m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputShaperScaleIndex, m_shaperParams.m_scale); } BindPassSrg(context, m_shaderResourceGroup); diff --git a/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/ApplyShaperLookupTablePass.cpp b/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/ApplyShaperLookupTablePass.cpp index eec511c07a..f4325f0421 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/ApplyShaperLookupTablePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/ApplyShaperLookupTablePass.cpp @@ -109,9 +109,9 @@ namespace AZ { m_shaderResourceGroup->SetImageView(m_shaderInputLutImageIndex, m_lutResource.m_lutStreamingImage->GetImageView()); - m_shaderResourceGroup->SetConstant(m_shaderShaperTypeIndex, m_shaperParams.type); - m_shaderResourceGroup->SetConstant(m_shaderShaperBiasIndex, m_shaperParams.bias); - m_shaderResourceGroup->SetConstant(m_shaderShaperScaleIndex, m_shaperParams.scale); + m_shaderResourceGroup->SetConstant(m_shaderShaperTypeIndex, m_shaperParams.m_type); + m_shaderResourceGroup->SetConstant(m_shaderShaperBiasIndex, m_shaperParams.m_bias); + m_shaderResourceGroup->SetConstant(m_shaderShaperScaleIndex, m_shaperParams.m_scale); } } } diff --git a/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/BakeAcesOutputTransformLutPass.cpp b/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/BakeAcesOutputTransformLutPass.cpp index f7ecfc3461..a8d1b68d63 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/BakeAcesOutputTransformLutPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DisplayMapper/BakeAcesOutputTransformLutPass.cpp @@ -94,8 +94,8 @@ namespace AZ m_shaderResourceGroup->SetImageView(m_shaderInputLutImageIndex, m_displayMapperLut.m_lutImageView.get()); - m_shaderResourceGroup->SetConstant(m_shaderInputShaperBiasIndex, m_shaperParams.bias); - m_shaderResourceGroup->SetConstant(m_shaderInputShaperScaleIndex, m_shaperParams.scale); + m_shaderResourceGroup->SetConstant(m_shaderInputShaperBiasIndex, m_shaperParams.m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputShaperScaleIndex, m_shaperParams.m_scale); } BindPassSrg(context, m_shaderResourceGroup); diff --git a/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp b/Gems/Atom/Feature/Common/Code/Source/ImGui/ImGuiPass.cpp index 9f2a7303a5..f73b0d71eb 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 54ef40ce6c..6ed37ce972 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/PostProcess/LookModification/LookModificationSettings.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.cpp index d2e28e3a68..cbc357db61 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.cpp @@ -26,6 +26,8 @@ namespace AZ seed = TypeHash64(m_overrideStrength, seed); seed = TypeHash64(m_assetId.GetId(), seed); seed = TypeHash64(m_shaperPreset, seed); + seed = TypeHash64(m_customMinExposure, seed); + seed = TypeHash64(m_customMaxExposure, seed); return seed; } @@ -50,6 +52,9 @@ namespace AZ lutBlend.m_intensity = GetColorGradingLutIntensity(); lutBlend.m_overrideStrength = GetColorGradingLutOverride() * alpha; lutBlend.m_assetId = lutAssetId; + lutBlend.m_shaperPreset = GetShaperPresetType(); + lutBlend.m_customMinExposure = GetCustomMinExposure(); + lutBlend.m_customMaxExposure = GetCustomMaxExposure(); target->AddLutBlend(lutBlend); } } @@ -87,6 +92,9 @@ namespace AZ blendItem.m_intensity = GetColorGradingLutIntensity(); blendItem.m_overrideStrength = GetColorGradingLutOverride(); blendItem.m_assetId = GetColorGradingLut(); + blendItem.m_shaperPreset = GetShaperPresetType(); + blendItem.m_customMinExposure = GetCustomMinExposure(); + blendItem.m_customMaxExposure = GetCustomMaxExposure(); m_lutBlendStack.insert(m_lutBlendStack.begin(), blendItem); } } diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.h b/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.h index 19bf07010b..d91a029ced 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.h +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcess/LookModification/LookModificationSettings.h @@ -33,7 +33,10 @@ namespace AZ //! Asset ID of LUT Data::Asset m_assetId; //! Shaper preset type - ShaperPresetType m_shaperPreset = AZ::Render::ShaperPresetType::Log2_48_nits; + ShaperPresetType m_shaperPreset = AZ::Render::ShaperPresetType::Log2_48Nits; + //! When shaper preset is custom, these values set min and max exposure. + float m_customMinExposure = -6.5; + float m_customMaxExposure = 6.5; HashValue64 GetHash(HashValue64 seed) const; }; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp index fe5db0b441..8631ae2eb3 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.cpp @@ -21,7 +21,7 @@ namespace AZ namespace Render { static const char* const NumSourceLutsShaderVariantOptionName{ "o_numSourceLuts" }; - + RPI::Ptr BlendColorGradingLutsPass::Create(const RPI::PassDescriptor& descriptor) { RPI::Ptr pass = aznew BlendColorGradingLutsPass(descriptor); @@ -151,9 +151,9 @@ namespace AZ { m_shaderResourceGroup->SetImageView(m_shaderInputBlendedLutImageIndex, m_blendedLut.m_lutImageView.get()); m_shaderResourceGroup->SetConstant(m_shaderInputBlendedLutDimensionsIndex, m_blendedLutDimensions); - m_shaderResourceGroup->SetConstant(m_shaderInputBlendedLutShaperTypeIndex, m_blendedLutShaperParams.type); - m_shaderResourceGroup->SetConstant(m_shaderInputBlendededLutShaperBiasIndex, m_blendedLutShaperParams.bias); - m_shaderResourceGroup->SetConstant(m_shaderInputBlendededLutShaperScaleIndex, m_blendedLutShaperParams.scale); + m_shaderResourceGroup->SetConstant(m_shaderInputBlendedLutShaperTypeIndex, m_blendedLutShaperParams.m_type); + m_shaderResourceGroup->SetConstant(m_shaderInputBlendededLutShaperBiasIndex, m_blendedLutShaperParams.m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputBlendededLutShaperScaleIndex, m_blendedLutShaperParams.m_scale); m_shaderResourceGroup->SetConstant(m_shaderInputWeight0Index, m_weights[0]); m_shaderResourceGroup->SetConstant(m_shaderInputWeight1Index, m_weights[1]); m_shaderResourceGroup->SetConstant(m_shaderInputWeight2Index, m_weights[2]); @@ -163,33 +163,33 @@ namespace AZ if (m_colorGradingLuts[0].m_lutStreamingImage) { m_shaderResourceGroup->SetImageView(m_shaderInputSourceLut1ImageIndex, m_colorGradingLuts[0].m_lutStreamingImage->GetImageView()); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut1ShaperTypeIndex, m_colorGradingShaperParams[0].type); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut1ShaperBiasIndex, m_colorGradingShaperParams[0].bias); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut1ShaperScaleIndex, m_colorGradingShaperParams[0].scale); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut1ShaperTypeIndex, m_colorGradingShaperParams[0].m_type); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut1ShaperBiasIndex, m_colorGradingShaperParams[0].m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut1ShaperScaleIndex, m_colorGradingShaperParams[0].m_scale); } if (m_colorGradingLuts[1].m_lutStreamingImage) { m_shaderResourceGroup->SetImageView(m_shaderInputSourceLut2ImageIndex, m_colorGradingLuts[1].m_lutStreamingImage->GetImageView()); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut2ShaperTypeIndex, m_colorGradingShaperParams[1].type); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut2ShaperBiasIndex, m_colorGradingShaperParams[1].bias); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut2ShaperScaleIndex, m_colorGradingShaperParams[1].scale); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut2ShaperTypeIndex, m_colorGradingShaperParams[1].m_type); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut2ShaperBiasIndex, m_colorGradingShaperParams[1].m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut2ShaperScaleIndex, m_colorGradingShaperParams[1].m_scale); } if (m_colorGradingLuts[2].m_lutStreamingImage) { m_shaderResourceGroup->SetImageView(m_shaderInputSourceLut3ImageIndex, m_colorGradingLuts[2].m_lutStreamingImage->GetImageView()); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut3ShaperTypeIndex, m_colorGradingShaperParams[2].type); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut3ShaperBiasIndex, m_colorGradingShaperParams[2].bias); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut3ShaperScaleIndex, m_colorGradingShaperParams[2].scale); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut3ShaperTypeIndex, m_colorGradingShaperParams[2].m_type); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut3ShaperBiasIndex, m_colorGradingShaperParams[2].m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut3ShaperScaleIndex, m_colorGradingShaperParams[2].m_scale); } if (m_colorGradingLuts[3].m_lutStreamingImage) { m_shaderResourceGroup->SetImageView(m_shaderInputSourceLut4ImageIndex, m_colorGradingLuts[3].m_lutStreamingImage->GetImageView()); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut4ShaperTypeIndex, m_colorGradingShaperParams[3].type); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut4ShaperBiasIndex, m_colorGradingShaperParams[3].bias); - m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut4ShaperScaleIndex, m_colorGradingShaperParams[3].scale); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut4ShaperTypeIndex, m_colorGradingShaperParams[3].m_type); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut4ShaperBiasIndex, m_colorGradingShaperParams[3].m_bias); + m_shaderResourceGroup->SetConstant(m_shaderInputSourceLut4ShaperScaleIndex, m_colorGradingShaperParams[3].m_scale); } if (m_shaderResourceGroup->HasShaderVariantKeyFallbackEntry()) @@ -244,7 +244,170 @@ namespace AZ m_blendedLutShaperParams = shaperParams; } + + AZStd::optional BlendColorGradingLutsPass::GetCommonShaperParams() const + { + LookModificationSettings* settings = GetLookModificationSettings(); + if (settings) + { + settings->PrepareLutBlending(); + + ShaperPresetType type = ShaperPresetType::NumShaperTypes; + float customMinExposure = 0.0; + float customMaxExposure = 0.0; + + for (size_t lutIndex = 0; lutIndex < settings->GetLutBlendStackSize(); lutIndex++) + { + LutBlendItem& lutBlendItem = settings->GetLutBlendItem(lutIndex); + + if (lutIndex == 0) + { + type = lutBlendItem.m_shaperPreset; + customMinExposure = lutBlendItem.m_customMinExposure; + customMaxExposure = lutBlendItem.m_customMaxExposure; + } + else if (type != lutBlendItem.m_shaperPreset) + { + // Shapers are different + return AZStd::nullopt; + } + else if (type == ShaperPresetType::LinearCustomRange || type == ShaperPresetType::Log2CustomRange) + { + if (lutBlendItem.m_customMinExposure != customMinExposure || + lutBlendItem.m_customMaxExposure != customMaxExposure) + { + // Shapers are same, but custom exposure for custom type is different. + return AZStd::nullopt; + } + } + } + + // Only calculate shaper params when there's at least one lut blend. + if (settings->GetLutBlendStackSize() > 0) + { + return AcesDisplayMapperFeatureProcessor::GetShaperParameters(type, customMinExposure, customMaxExposure); + } + } + return AZStd::nullopt; + } + void BlendColorGradingLutsPass::CheckLutBlendSettings() + { + LookModificationSettings* settings = GetLookModificationSettings(); + if (settings) + { + settings->PrepareLutBlending(); + + // Early out if the settings have not chanced + HashValue64 hash = settings->GetHash(); + if (hash == m_lutBlendHash) + { + return; + } + m_lutBlendHash = hash; + + m_needToUpdateLut = true; + + // Calculate all the weights and LUT assets and check if there has been a change + // Only the top N LUTs will be blended where N = LookModificationSettings::MaxBlendLuts + // Weight 0 is used for the base color, and the other weights are for the LUTs in increasing priority + size_t numLuts = settings->GetLutBlendStackSize(); + + float intensity[LookModificationSettings::MaxBlendLuts]; + float one_intensity[LookModificationSettings::MaxBlendLuts]; + float over[LookModificationSettings::MaxBlendLuts]; + float one_over[LookModificationSettings::MaxBlendLuts]; + + for (int curLutIndex = 0; curLutIndex < LookModificationSettings::MaxBlendLuts; curLutIndex++) + { + intensity[curLutIndex] = 0.f; + one_intensity[curLutIndex] = 1.f; + over[curLutIndex] = 0.f; + one_over[curLutIndex] = 1.f; + } + + int current = 0; + for (size_t lutIndex = 0; lutIndex < numLuts; lutIndex++) + { + LutBlendItem& lutBlendItem = settings->GetLutBlendItem(lutIndex); + const auto assetId = lutBlendItem.m_assetId.GetId(); + + if (assetId.IsValid()) + { + AcesDisplayMapperFeatureProcessor* dmfp = GetScene()->GetFeatureProcessor(); + dmfp->GetLutFromAssetId(m_colorGradingLuts[current], assetId); + if (!m_colorGradingLuts[current].m_lutStreamingImage) + { + AZ_Warning("BlendColorGradingLutsPass", false, "Unable to load grading LUT from asset %s", + lutBlendItem.m_assetId.ToString().c_str()); + // Skip this LUT + continue; + } + } + + intensity[current] = lutBlendItem.m_intensity; + one_intensity[current] = 1.0f - lutBlendItem.m_intensity; + over[current] = lutBlendItem.m_overrideStrength; + one_over[current] = 1.0f - lutBlendItem.m_overrideStrength; + + m_colorGradingShaperParams[current] = AcesDisplayMapperFeatureProcessor::GetShaperParameters( + lutBlendItem.m_shaperPreset, + lutBlendItem.m_customMinExposure, + lutBlendItem.m_customMaxExposure + ); + + ++current; + if (current == LookModificationSettings::MaxBlendLuts) + { + break; + } + } + + m_weights[0] = 0.f; + // Handle the case where there are no LUTs to be blended, and hence an identity LUT will be generated + if (current == 0) + { + m_weights[0] = 1.f; + // These weights would not be used in the shader in this case, but setting to zero anyways. + for (int lutIndex = 1; lutIndex < LookModificationSettings::MaxBlendLuts + 1; lutIndex++) + { + m_weights[lutIndex] = 0.f; + } + } + else + { + // Compute all the weights + // First compute the weight of the ungraded color value + for (int lutIndex = 0; lutIndex < current; lutIndex++) + { + float weight = one_intensity[lutIndex] * over[lutIndex]; + for (int overrideLutIndex = lutIndex + 1; overrideLutIndex < LookModificationSettings::MaxBlendLuts; overrideLutIndex++) + { + weight *= one_over[overrideLutIndex]; + } + m_weights[0] += weight; + } + // Then compute the weights for the LUTs + for (int weightIndex = 0; weightIndex < current; weightIndex++) + { + m_weights[weightIndex + 1] = intensity[weightIndex] * over[weightIndex]; + for (int lutIndex = weightIndex + 1; lutIndex < LookModificationSettings::MaxBlendLuts; lutIndex++) + { + m_weights[weightIndex + 1] *= one_over[lutIndex]; + } + } + } + + // If the number of source LUTs have changed, the shader variant will need to be updated + if (m_numSourceLuts != current) + { + m_numSourceLuts = current; + m_needToUpdateShaderVariant = true; + } + } + } + + LookModificationSettings* BlendColorGradingLutsPass::GetLookModificationSettings() const { AZ::RPI::Scene* scene = GetScene(); if (scene) @@ -259,109 +422,12 @@ namespace AZ LookModificationSettings* settings = postProcessSettings->GetLookModificationSettings(); if (settings) { - settings->PrepareLutBlending(); - - // Early out if the settings have not chanced - HashValue64 hash = settings->GetHash(); - if (hash == m_lutBlendHash) - { - return; - } - m_lutBlendHash = hash; - - m_needToUpdateLut = true; - - // Calculate all the weights and LUT assets and check if there has been a change - // Only the top N LUTs will be blended where N = LookModificationSettings::MaxBlendLuts - // Weight 0 is used for the base color, and the other weights are for the LUTs in increasing priority - size_t numLuts = settings->GetLutBlendStackSize(); - float intensity[LookModificationSettings::MaxBlendLuts]; - float one_intensity[LookModificationSettings::MaxBlendLuts]; - float over[LookModificationSettings::MaxBlendLuts]; - float one_over[LookModificationSettings::MaxBlendLuts]; - for (int curLutIndex = 0; curLutIndex < LookModificationSettings::MaxBlendLuts; curLutIndex++) - { - intensity[curLutIndex] = 0.f; - one_intensity[curLutIndex] = 1.f; - over[curLutIndex] = 0.f; - one_over[curLutIndex] = 1.f; - } - - int current = 0; - for (size_t lutIndex = 0; lutIndex < numLuts; lutIndex++) - { - LutBlendItem& lutBlendItem = settings->GetLutBlendItem(lutIndex); - auto assetId = lutBlendItem.m_assetId.GetId(); - if (assetId.IsValid()) - { - AcesDisplayMapperFeatureProcessor* dmfp = scene->GetFeatureProcessor(); - dmfp->GetLutFromAssetId(m_colorGradingLuts[lutIndex], assetId); - if (!m_colorGradingLuts[lutIndex].m_lutStreamingImage) - { - AZ_Warning("BlendColorGradingLutsPass", false, "Unable to load grading LUT from asset %s", lutBlendItem.m_assetId.ToString().c_str()); - // Skip this LUT - continue; - } - } - intensity[current] = lutBlendItem.m_intensity; - one_intensity[current] = 1.f - intensity[lutIndex]; - over[current] = lutBlendItem.m_overrideStrength; - one_over[current] = 1.f - over[lutIndex]; - m_colorGradingLutAssets[current] = lutBlendItem.m_assetId; - m_colorGradingShaperPresets[current] = lutBlendItem.m_shaperPreset; - m_colorGradingShaperParams[current] = AcesDisplayMapperFeatureProcessor::GetShaperParameters(m_colorGradingShaperPresets[lutIndex]); - current++; - if (current == LookModificationSettings::MaxBlendLuts) - { - break; - } - } - - m_weights[0] = 0.f; - // Handle the case where there are no LUTs to be blended, and hence an identity LUT will be generated - if (current == 0) - { - m_weights[0] = 1.f; - // These weights would not be used in the shader in this case, but setting to zero anyways. - for (int lutIndex = 1; lutIndex < LookModificationSettings::MaxBlendLuts + 1; lutIndex++) - { - m_weights[lutIndex] = 0.f; - } - } - else - { - // Compute all the weights - // First compute the weight of the ungraded color value - for (int lutIndex = 0; lutIndex < LookModificationSettings::MaxBlendLuts; lutIndex++) - { - float weight = one_intensity[lutIndex] * over[lutIndex]; - for (int overrideLutIndex = lutIndex + 1; overrideLutIndex < LookModificationSettings::MaxBlendLuts; overrideLutIndex++) - { - weight *= one_over[overrideLutIndex]; - } - m_weights[0] += weight; - } - // Then compute the weights for the LUTs - for (int weightIndex = 0; weightIndex < LookModificationSettings::MaxBlendLuts; weightIndex++) - { - m_weights[weightIndex + 1] = intensity[weightIndex] * over[weightIndex]; - for (int lutIndex = weightIndex + 1; lutIndex < LookModificationSettings::MaxBlendLuts; lutIndex++) - { - m_weights[weightIndex + 1] *= one_over[lutIndex]; - } - } - } - - // If the number of source LUTs have changed, the shader variant will need to be updated - if (m_numSourceLuts != static_cast(current)) - { - m_numSourceLuts = current; - m_needToUpdateShaderVariant = true; - } + return settings; } } } } + return nullptr; } } // namespace Render } // namespace AZ diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.h b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.h index d0e6aad4aa..7b37d2c4ec 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.h +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BlendColorGradingLutsPass.h @@ -47,6 +47,7 @@ namespace AZ static RPI::Ptr Create(const RPI::PassDescriptor& descriptor); void SetShaperParameters(const ShaperParams& shaperParams); + AZStd::optional GetCommonShaperParams() const; private: explicit BlendColorGradingLutsPass(const RPI::PassDescriptor& descriptor); @@ -66,6 +67,7 @@ namespace AZ void ReleaseLutImage(); void CheckLutBlendSettings(); + LookModificationSettings* GetLookModificationSettings() const; bool m_resourcesInitialized = false; @@ -111,8 +113,6 @@ namespace AZ AZStd::array m_blendedLutDimensions; float m_weights[LookModificationSettings::MaxBlendLuts + 1]; // The first index is reserved for the weight of the non color graded value - Data::Asset m_colorGradingLutAssets[LookModificationSettings::MaxBlendLuts]; - ShaperPresetType m_colorGradingShaperPresets[LookModificationSettings::MaxBlendLuts]; Render::ShaperParams m_colorGradingShaperParams[LookModificationSettings::MaxBlendLuts]; Render::DisplayMapperAssetLut m_colorGradingLuts[LookModificationSettings::MaxBlendLuts]; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.cpp index 40f8f8355d..85c45de96b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.cpp @@ -9,11 +9,15 @@ #include #include #include +#include +#include #include #include #include +#include + #include #include #include @@ -22,6 +26,22 @@ namespace AZ { namespace Render { + AZ_CVAR(uint8_t, + r_lutSampleQuality, + 0, + [](const uint8_t& value) + { + auto passes = RPI::PassSystem::Get()->FindPasses(RPI::PassClassFilter()); + for (auto* pass : passes) + { + LookModificationCompositePass* lookModPass = azrtti_cast(pass); + lookModPass->SetSampleQuality(LookModificationCompositePass::SampleQuality(value)); + } + }, + ConsoleFunctorFlags::Null, + "This can be increased to deal with particularly tricky luts. Range (0-2). 0 (default) - Standard linear sampling. 1 - 7 tap b-spline sampling. 2 - 19 tap b-spline sampling." + ); + RPI::Ptr LookModificationCompositePass::Create(const RPI::PassDescriptor& descriptor) { RPI::Ptr pass = aznew LookModificationCompositePass(descriptor); @@ -30,8 +50,6 @@ namespace AZ LookModificationCompositePass::LookModificationCompositePass(const RPI::PassDescriptor& descriptor) : AZ::RPI::FullscreenTrianglePass(descriptor) - , m_exposureShaderVariantOptionName(ExposureShaderVariantOptionName) - , m_colorGradingShaderVariantOptionName(ColorGradingShaderVariantOptionName) { } @@ -60,19 +78,38 @@ namespace AZ { AZ_Assert(m_shader != nullptr, "LookModificationCompositePass %s has a null shader when calling InitializeShaderVariant.", GetPathName().GetCStr()); - AZStd::vector exposureVariationTypes = { AZ::Name("true"), AZ::Name("false") }; - AZStd::vector colorGradingVariationTypes = { AZ::Name("true"), AZ::Name("false") }; + struct OptionSettings + { + AZ::Name m_enableExposureControl; + AZ::Name m_enableColorGrading; + RPI::ShaderOptionValue m_lutSampleQuality; - auto exposureVariationTypeCount = exposureVariationTypes.size(); - auto totalVariationCount = exposureVariationTypes.size() * colorGradingVariationTypes.size(); + OptionSettings(const char* enableExposureControl, const char* enableColorGrading, SampleQuality sampleQuality) + : m_enableExposureControl(Name(enableExposureControl)) + , m_enableColorGrading(Name(enableColorGrading)) + , m_lutSampleQuality(RPI::ShaderOptionValue(sampleQuality)) + {} + }; + + AZStd::vector options = + { + { "false", "false", SampleQuality::Linear }, + { "true", "false", SampleQuality::Linear }, + { "false", "true", SampleQuality::Linear }, + { "false", "true", SampleQuality::BSpline7Tap }, + { "false", "true", SampleQuality::BSpline19Tap }, + { "true", "true", SampleQuality::Linear }, + { "true", "true", SampleQuality::BSpline7Tap }, + { "true", "true", SampleQuality::BSpline19Tap }, + }; // Caching all pipeline state for each shader variation for performance reason. - for (auto shaderVariantIndex = 0; shaderVariantIndex < totalVariationCount; ++shaderVariantIndex) + for (auto shaderVariantIndex = 0; shaderVariantIndex < options.size(); ++shaderVariantIndex) { auto shaderOption = m_shader->CreateShaderOptionGroup(); - shaderOption.SetValue(m_exposureShaderVariantOptionName, exposureVariationTypes[shaderVariantIndex % exposureVariationTypeCount]); - shaderOption.SetValue(m_colorGradingShaderVariantOptionName, colorGradingVariationTypes[shaderVariantIndex / exposureVariationTypeCount]); - + shaderOption.SetValue(m_exposureShaderVariantOptionName, options.at(shaderVariantIndex).m_enableExposureControl); + shaderOption.SetValue(m_colorGradingShaderVariantOptionName, options.at(shaderVariantIndex).m_enableColorGrading); + shaderOption.SetValue(m_lutSampleQualityShaderVariantOptionName, options.at(shaderVariantIndex).m_lutSampleQuality); PreloadShaderVariant(m_shader, shaderOption, GetRenderAttachmentConfiguration(), GetMultisampleState()); } @@ -173,9 +210,9 @@ namespace AZ { m_shaderResourceGroup->SetImageView(m_shaderColorGradingLutImageIndex, m_blendedColorGradingLut.m_lutImageView.get()); - m_shaderResourceGroup->SetConstant(m_shaderColorGradingShaperTypeIndex, m_colorGradingShaperParams.type); - m_shaderResourceGroup->SetConstant(m_shaderColorGradingShaperBiasIndex, m_colorGradingShaperParams.bias); - m_shaderResourceGroup->SetConstant(m_shaderColorGradingShaperScaleIndex, m_colorGradingShaperParams.scale); + m_shaderResourceGroup->SetConstant(m_shaderColorGradingShaperTypeIndex, m_colorGradingShaperParams.m_type); + m_shaderResourceGroup->SetConstant(m_shaderColorGradingShaperBiasIndex, m_colorGradingShaperParams.m_bias); + m_shaderResourceGroup->SetConstant(m_shaderColorGradingShaperScaleIndex, m_colorGradingShaperParams.m_scale); } } @@ -192,7 +229,8 @@ namespace AZ // Decide which shader to use. shaderOption.SetValue(m_exposureShaderVariantOptionName, m_exposureControlEnabled ? AZ::Name("true") : AZ::Name("false")); shaderOption.SetValue(m_colorGradingShaderVariantOptionName, m_colorGradingLutEnabled ? AZ::Name("true") : AZ::Name("false")); - + shaderOption.SetValue(m_lutSampleQualityShaderVariantOptionName, RPI::ShaderOptionValue(m_sampleQuality)); + UpdateShaderVariant(shaderOption); m_needToUpdateShaderVariant = false; @@ -218,5 +256,12 @@ namespace AZ { m_colorGradingShaperParams = shaperParams; } + + void LookModificationCompositePass::SetSampleQuality(SampleQuality sampleQuality) + { + m_sampleQuality = sampleQuality; + m_needToUpdateShaderVariant = true; + } + } // namespace Render } // namespace AZ diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.h b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.h index 49a0e88a54..b269225445 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.h +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationCompositePass.h @@ -30,8 +30,6 @@ namespace AZ namespace Render { static const char* const LookModificationTransformPassTemplateName{ "LookModificationTransformTemplate" }; - static const char* const ExposureShaderVariantOptionName{ "o_enableExposureControlFeature" }; - static const char* const ColorGradingShaderVariantOptionName{ "o_enableColorGradingLut" }; /** * The look modification composite pass. If color grading LUTs are enabled, this pass will apply the blended LUT. @@ -43,6 +41,14 @@ namespace AZ public: AZ_RTTI(LookModificationCompositePass, "{D7DF3E8A-B642-4D51-ABC2-ADB2B60FCE1D}", AZ::RPI::FullscreenTrianglePass); AZ_CLASS_ALLOCATOR(LookModificationCompositePass, SystemAllocator, 0); + + enum class SampleQuality : uint8_t + { + Linear = 0, + BSpline7Tap = 1, + BSpline19Tap = 2, + }; + virtual ~LookModificationCompositePass() = default; //! Creates a LookModificationPass @@ -54,6 +60,8 @@ namespace AZ //! Set shaper parameters void SetShaperParameters(const ShaperParams& shaperParams); + void SetSampleQuality(SampleQuality sampleQuality); + protected: LookModificationCompositePass(const RPI::PassDescriptor& descriptor); @@ -76,11 +84,15 @@ namespace AZ bool m_exposureControlEnabled = false; bool m_colorGradingLutEnabled = false; + SampleQuality m_sampleQuality = SampleQuality::Linear; + Render::DisplayMapperLut m_blendedColorGradingLut; Render::ShaperParams m_colorGradingShaperParams; - const AZ::Name m_exposureShaderVariantOptionName; - const AZ::Name m_colorGradingShaderVariantOptionName; + const AZ::Name m_exposureShaderVariantOptionName{ "o_enableExposureControlFeature" }; + const AZ::Name m_colorGradingShaderVariantOptionName{ "o_enableColorGradingLut" }; + const AZ::Name m_lutSampleQualityShaderVariantOptionName{ "o_lutSampleQuality" }; + bool m_needToUpdateShaderVariant = true; RHI::ShaderInputNameIndex m_shaderColorGradingLutImageIndex = "m_gradingLut"; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationTransformPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationTransformPass.cpp index cde7d6586b..e33a63a4bb 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationTransformPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/LookModificationTransformPass.cpp @@ -47,29 +47,32 @@ namespace AZ swapChainFormat = m_swapChainAttachmentBinding->m_attachment->GetTransientImageDescriptor().m_imageDescriptor.m_format; } - if (m_displayBufferFormat != swapChainFormat) + // Update the children passes + RPI::Ptr blendPass = FindChildPass(); + if (blendPass) { - m_displayBufferFormat = swapChainFormat; - m_outputDeviceTransformType = AcesDisplayMapperFeatureProcessor::GetOutputDeviceTransformType(m_displayBufferFormat); - m_shaperParams = GetAcesShaperParameters(m_outputDeviceTransformType); - - // Update the children passes - for (const AZ::RPI::Ptr& child : m_children) + auto commonShaperParams = blendPass->GetCommonShaperParams(); + if (commonShaperParams) { - BlendColorGradingLutsPass* blendPass = azrtti_cast(child.get()); - if (blendPass) - { - blendPass->SetShaperParameters(m_shaperParams); - continue; - } - LookModificationCompositePass* compositePass = azrtti_cast(child.get()); - if (compositePass) - { - compositePass->SetShaperParameters(m_shaperParams); - continue; - } + m_shaperParams = *commonShaperParams; + } + else + { + // Mix of shapers used, so shape them based on the output transform type. + m_displayBufferFormat = swapChainFormat; + m_outputDeviceTransformType = AcesDisplayMapperFeatureProcessor::GetOutputDeviceTransformType(m_displayBufferFormat); + m_shaperParams = GetAcesShaperParameters(m_outputDeviceTransformType); + } + + blendPass->SetShaperParameters(m_shaperParams); + + RPI::Ptr compositePass = FindChildPass(); + if (compositePass) + { + compositePass->SetShaperParameters(m_shaperParams); } } + ParentPass::FrameBeginInternal(params); } } // namespace Render 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 2f40ea82d8..4229416066 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/CMakeLists.txt b/Gems/Atom/RHI/DX12/Code/CMakeLists.txt index a16b958c66..b913ad58bf 100644 --- a/Gems/Atom/RHI/DX12/Code/CMakeLists.txt +++ b/Gems/Atom/RHI/DX12/Code/CMakeLists.txt @@ -11,15 +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(USE_PIX_DEFINE "USE_PIX") - set(PIX_BUILD_DEPENDENCY "3rdParty::pix") -else() - set(USE_PIX_DEFINE "") - set(PIX_BUILD_DEPENDENCY "") -endif() - - if(PAL_TRAIT_AFTERMATH_AVAILABLE) set(USE_NSIGHT_AFTERMATH_DEFINE $,"","USE_NSIGHT_AFTERMATH">) set(AFTERMATH_BUILD_DEPENDENCY "3rdParty::Aftermath") @@ -92,11 +83,7 @@ ly_add_target( BUILD_DEPENDENCIES PRIVATE AZ::AzCore - ${PIX_BUILD_DEPENDENCY} Gem::Atom_RHI.Reflect - COMPILE_DEFINITIONS - PRIVATE - ${USE_PIX_DEFINE} ) ly_add_target( @@ -121,10 +108,8 @@ ly_add_target( Gem::Atom_RHI_DX12.Reflect 3rdParty::d3dx12 ${AFTERMATH_BUILD_DEPENDENCY} - ${PIX_BUILD_DEPENDENCY} COMPILE_DEFINITIONS PRIVATE - ${USE_PIX_DEFINE} ${USE_NSIGHT_AFTERMATH_DEFINE} ) @@ -148,10 +133,6 @@ ly_add_target( Gem::Atom_RHI.Public 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..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,21 +18,8 @@ if(d3d12_dll) set(PAL_TRAIT_ATOM_RHI_DX12_SUPPORTED TRUE) 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/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..ab1a719ae6 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.h @@ -7,12 +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/StreamingImagePool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp index b6c4c029cf..11863cb70b 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 0d947085ba..8f44abccef 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 5d52dc8eeb..f31132f039 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/Include/Atom/RPI.Public/Pass/ParentPass.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/ParentPass.h index 7e341d43c3..36994ec03b 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/ParentPass.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Pass/ParentPass.h @@ -64,6 +64,9 @@ namespace AZ //! Find a child pass with a matching name and returns it. Return nullptr if none found. Ptr FindChildPass(const Name& passName) const; + + template + Ptr FindChildPass() const; //! Searches the tree for the first pass that has same pass name (Depth-first search). Return nullptr if none found. Ptr FindPassByNameRecursive(const Name& passName) const; @@ -132,5 +135,20 @@ namespace AZ // Generates child passes from source PassTemplate void CreatePassesFromTemplate(); }; + + template + inline Ptr ParentPass::FindChildPass() const + { + for (const Ptr& child : m_children) + { + PassType* pass = azrtti_cast(child.get()); + if (pass) + { + return pass; + } + } + return {}; + } + } // namespace RPI } // namespace AZ 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..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 @@ -399,7 +400,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 +408,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 +484,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 +534,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) { @@ -541,6 +542,7 @@ namespace AZ { view->FinalizeDrawLists(); } + AZ_PROFILE_END(); } else { @@ -556,7 +558,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/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( diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h index 5ee348a052..0bf9e752a2 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/PostProcess/LookModification/LookModificationComponentConfig.h @@ -39,6 +39,11 @@ namespace AZ void CopySettingsTo(LookModificationSettingsInterface* settings); bool ArePropertiesReadOnly() const { return !m_enabled; } + + bool IsUsingCustomShaper() const { + return m_shaperPresetType == ShaperPresetType::LinearCustomRange + || m_shaperPresetType == ShaperPresetType::Log2CustomRange; + } }; } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/LookModification/EditorLookModificationComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/LookModification/EditorLookModificationComponent.cpp index a7dfb76e95..310762863a 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/LookModification/EditorLookModificationComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/LookModification/EditorLookModificationComponent.cpp @@ -48,33 +48,44 @@ namespace AZ &LookModificationComponentConfig::m_enabled, "Enable look modification", "Enable look modification.") - ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) - + ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) ->DataElement(AZ::Edit::UIHandlers::Default, &LookModificationComponentConfig::m_colorGradingLut, "Color Grading LUT", "Color grading LUT") - ->ClassElement(Edit::ClassElements::EditorData, "") ->DataElement(Edit::UIHandlers::ComboBox, - &LookModificationComponentConfig::m_shaperPresetType, - "Shaper Type", - "Shaper Type.") - ->EnumAttribute(ShaperPresetType::None, "None") - ->EnumAttribute(ShaperPresetType::Log2_48_nits, "Log2_48_nits") - ->EnumAttribute(ShaperPresetType::Log2_1000_nits, "Log2_1000_nits") - ->EnumAttribute(ShaperPresetType::Log2_2000_nits, "Log2_2000_nits") - ->EnumAttribute(ShaperPresetType::Log2_4000_nits, "Log2_4000_nits") - ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) - + &LookModificationComponentConfig::m_shaperPresetType, "Shaper Type", "Shaper Type.") + ->EnumAttribute(ShaperPresetType::None, "None") + ->EnumAttribute(ShaperPresetType::LinearCustomRange, "Linear Custom Range") + ->EnumAttribute(ShaperPresetType::Log2_48Nits, "Log2 48 nits") + ->EnumAttribute(ShaperPresetType::Log2_1000Nits, "Log2 1000 nits") + ->EnumAttribute(ShaperPresetType::Log2_2000Nits, "Log2 2000 nits") + ->EnumAttribute(ShaperPresetType::Log2_4000Nits, "Log2 4000 nits") + ->EnumAttribute(ShaperPresetType::Log2CustomRange, "Log2 Custom Range") + ->EnumAttribute(ShaperPresetType::PqSmpteSt2084, "PQ (SMPTE ST 2084)") + ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::EntireTree) + ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_customMinExposure, "Minimum Exposure", "The minimum exposure this LUT supports. Values smaller than this will be clamped to 0.") + ->Attribute(AZ::Edit::Attributes::Min, -50.0f) + ->Attribute(AZ::Edit::Attributes::Max, 0.0f) + ->Attribute(AZ::Edit::Attributes::SoftMin, -20.0f) + ->Attribute(AZ::Edit::Attributes::SoftMax, 0.0f) + ->Attribute(Edit::Attributes::Visibility, &LookModificationComponentConfig::IsUsingCustomShaper) + ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) + ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_customMaxExposure, "Maximum Exposure", "The maximum exposure this LUT supports. Values larger than this will be clamped.") + ->Attribute(AZ::Edit::Attributes::Min, 0.0f) + ->Attribute(AZ::Edit::Attributes::Max, 50.0f) + ->Attribute(AZ::Edit::Attributes::SoftMin, 0.0f) + ->Attribute(AZ::Edit::Attributes::SoftMax, 20.0f) + ->Attribute(Edit::Attributes::Visibility, &LookModificationComponentConfig::IsUsingCustomShaper) + ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutIntensity, "LUT Intensity", "Blend intensity of this LUT.") - ->Attribute(AZ::Edit::Attributes::Min, 0.0f) - ->Attribute(AZ::Edit::Attributes::Max, 1.0f) - ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) - ->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly) - + ->Attribute(AZ::Edit::Attributes::Min, 0.0f) + ->Attribute(AZ::Edit::Attributes::Max, 1.0f) + ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) + ->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly) ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutOverride, "LUT Override", "Blend intensity of this LUT.") - ->Attribute(AZ::Edit::Attributes::Min, 0.0f) - ->Attribute(AZ::Edit::Attributes::Max, 1.0f) - ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) - ->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly) + ->Attribute(AZ::Edit::Attributes::Min, 0.0f) + ->Attribute(AZ::Edit::Attributes::Max, 1.0f) + ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) + ->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly) // Overrides ->ClassElement(AZ::Edit::ClassElements::Group, "Overrides") 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/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/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..295d42228d 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_FUNCTION(ExpressionEvaluation); 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 bc154d24b2..1c3eda6709 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 3d291e2e85..ecf2bd0a54 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..77223ba566 100644 --- a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp +++ b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp @@ -106,26 +106,26 @@ 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; } 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) { - 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 ce604bd9f1..a2866b5a09 100644 --- a/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp +++ b/Gems/PhysX/Code/Source/Scene/PhysXScene.cpp @@ -530,7 +530,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()) { @@ -538,7 +538,7 @@ namespace PhysX } { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "OnSceneSimulationStartEvent::Signaled"); + AZ_PROFILE_SCOPE(Physics, "OnSceneSimulationStartEvent::Signaled"); m_sceneSimuationStartEvent.Signal(m_sceneHandle, deltatime); } @@ -550,7 +550,7 @@ namespace PhysX void PhysXScene::FinishSimulation() { - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysXScene::FinishSimulation"); + AZ_PROFILE_SCOPE(Physics, "PhysXScene::FinishSimulation"); if (!IsEnabled()) { @@ -558,7 +558,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. @@ -570,7 +570,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; @@ -581,7 +581,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); @@ -603,7 +603,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); } @@ -1109,7 +1109,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()) @@ -1136,7 +1136,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()) @@ -1182,7 +1182,7 @@ namespace PhysX return; } - AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Physics, "PhysX::Statistics"); + AZ_PROFILE_SCOPE(Physics, "PhysX::Statistics"); physx::PxSimulationStatistics stats; @@ -1194,33 +1194,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; @@ -1241,16 +1241,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 0c3e6d0b31..ebdfc5d417 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 e9948d2eb0..65115f2790 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(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)); 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 b76d36d189..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(AZ::Debug::ProfileCategory::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 56dc8f310a..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(AZ::Debug::ProfileCategory::MemoryReserved)) | (s_memCaptureEnabled ? AZ_PROFILE_CAT_TO_RAD_CAPFLAGS(AZ::Debug::ProfileCategory::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/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..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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); 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..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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("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_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); if (slotEntity) { slotEntity->Init(); @@ -1166,7 +1166,7 @@ namespace ScriptCanvasEditor::Nodes return AZ::EntityId(); } - AZ_PROFILE_TIMER("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_TIMER("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_TIMER("ScriptCanvas", __FUNCTION__); + AZ_PROFILE_FUNCTION(ScriptCanvas); GraphCanvas::ExtenderSlotConfiguration graphCanvasConfiguration; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja index 00c23b9f35..d743a95ee1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja @@ -77,7 +77,7 @@ public: \ {% if Class.attrib['GraphEntryPoint'] is defined %} bool IsEntryPoint() const override { return {%if Class.attrib['GraphEntryPoint'] == "True" %}true{%else%}false{%endif%}; } \ {% endif %} public: \ - friend struct ::{{ className | replace(' ','') }}Property; + friend struct {% if attribute_Namespace is not defined %}::{% endif %}{{ className | replace(' ','') }}Property; // Helpers for easily accessing properties and slots struct {{ className | replace(' ','') }}Property diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Source.jinja b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Source.jinja index 205e6ebd8c..6a381398c1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Source.jinja +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Source.jinja @@ -26,6 +26,20 @@ SPDX-License-Identifier: Apache-2.0 OR MIT #include "{{ xml.attrib['Include'] }}" {% for Class in xml.iter('Class') %} + +{% set attribute_Namespace = undefined %} +{%- if Class.attrib['Namespace'] is defined %} +{% if Class.attrib['Namespace'] != "None" %} +{% set attribute_Namespace = Class.attrib['Namespace'] %} +{% endif %} +{% endif %} + +{% if attribute_Namespace is defined %} +namespace {{attribute_Namespace}} +{ +{% endif %} + + void {{ Class.attrib['QualifiedName'] }}::ConfigureSlots() { {% if Class.attrib['Base'] is defined %} @@ -269,7 +283,12 @@ void {{ Class.attrib['QualifiedName'] }}::Reflect(AZ::ReflectContext* context) return datumValue ? *datumValue : {{ Property.attrib['Type'] }}(); } - {% endfor %} + +{% if attribute_Namespace is defined %} +} +{% endif %} + + {% endfor %} {% endfor %} 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 ff1fadb8c2..28f0519552 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 179c5b008a..27a1a95f37 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 5c281c55fe..874e25eb3d 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 a7834100b5..961eef2176 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -255,7 +255,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()) { @@ -276,7 +276,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()); @@ -293,7 +293,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; @@ -327,7 +327,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()) { @@ -349,7 +349,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()); @@ -367,7 +367,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; @@ -485,7 +485,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()); @@ -588,7 +588,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()); @@ -602,7 +602,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()); @@ -616,7 +616,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); @@ -639,7 +639,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); @@ -665,7 +665,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); @@ -681,7 +681,7 @@ namespace WhiteBox EdgeHandles MeshPolygonEdgeHandles(const WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); auto polygonHandles = MeshPolygonHandles(whiteBox); @@ -700,7 +700,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()); @@ -714,7 +714,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()); @@ -734,7 +734,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)); } @@ -796,7 +796,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); @@ -868,7 +868,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); @@ -883,7 +883,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); @@ -900,7 +900,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); @@ -919,7 +919,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); @@ -938,7 +938,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)) { @@ -959,7 +959,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( @@ -971,7 +971,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; @@ -1071,7 +1071,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)); @@ -1080,7 +1080,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()); @@ -1103,14 +1103,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) @@ -1134,7 +1134,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)); } @@ -1254,7 +1254,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))); @@ -1278,7 +1278,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 @@ -1351,7 +1351,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(); @@ -1359,7 +1359,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); @@ -1407,7 +1407,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), @@ -1431,7 +1431,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) @@ -1452,7 +1452,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); @@ -1497,7 +1497,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); @@ -1577,7 +1577,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; @@ -1638,7 +1638,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); @@ -1672,7 +1672,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 = @@ -1700,7 +1700,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(), @@ -1714,7 +1714,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); @@ -1732,7 +1732,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); } @@ -1740,7 +1740,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)); } @@ -1748,7 +1748,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)); @@ -1766,7 +1766,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); @@ -1783,7 +1783,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{}, @@ -1804,7 +1804,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)); } @@ -1812,7 +1812,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; @@ -1829,7 +1829,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); } @@ -1856,7 +1856,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); @@ -1876,7 +1876,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); @@ -1933,13 +1933,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)); } @@ -1966,7 +1966,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)); @@ -1991,7 +1991,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) @@ -2014,7 +2014,7 @@ namespace WhiteBox void CalculatePlanarUVs(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); CalculatePlanarUVs(whiteBox, MeshFaceHandles(whiteBox)); } @@ -2024,7 +2024,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; @@ -2121,7 +2121,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)) @@ -2233,7 +2233,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) { @@ -2298,7 +2298,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); @@ -2342,7 +2342,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); @@ -2443,7 +2443,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); @@ -2464,7 +2464,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}}); } @@ -2476,7 +2476,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}}); } @@ -2484,7 +2484,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); @@ -2512,7 +2512,7 @@ namespace WhiteBox PolygonHandles InitializeAsUnitCube(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // generate vertices VertexHandle vertexHandles[8]; @@ -2552,7 +2552,7 @@ namespace WhiteBox PolygonHandle InitializeAsUnitQuad(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // generate vertices VertexHandle vertexHandles[4]; @@ -2575,7 +2575,7 @@ namespace WhiteBox PolygonHandle InitializeAsUnitTriangle(WhiteBoxMesh& whiteBox) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); // generate vertices VertexHandle vertexHandles[3]; @@ -2604,7 +2604,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); } @@ -2615,7 +2615,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); @@ -2624,7 +2624,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)); } @@ -2634,21 +2634,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()) { @@ -2694,7 +2694,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) @@ -2709,7 +2709,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); @@ -2746,7 +2746,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( @@ -2853,7 +2853,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) @@ -2914,7 +2914,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(); @@ -3016,7 +3016,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()); @@ -3070,7 +3070,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); @@ -3148,7 +3148,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); @@ -3263,7 +3263,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; } @@ -3273,7 +3273,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) @@ -3290,7 +3290,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); @@ -3308,7 +3308,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) @@ -3331,7 +3331,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; @@ -3361,7 +3361,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)) @@ -3377,7 +3377,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); @@ -3401,7 +3401,7 @@ namespace WhiteBox ReadResult ReadMesh(WhiteBoxMesh& whiteBox, const WhiteBoxMeshStream& input) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + AZ_PROFILE_FUNCTION(AzToolsFramework); if (input.empty()) { @@ -3436,7 +3436,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( 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..e4652467ac 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 found: ${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/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/Gems/Atom/RHI/DX12/3rdParty/Platform/Windows/pix_windows.cmake b/cmake/3rdParty/Platform/Windows/pix_windows.cmake similarity index 100% rename from Gems/Atom/RHI/DX12/3rdParty/Platform/Windows/pix_windows.cmake rename to cmake/3rdParty/Platform/Windows/pix_windows.cmake 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/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) 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( 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",