diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/ap_fixtures/bundler_batch_setup_fixture.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/ap_fixtures/bundler_batch_setup_fixture.py index a543527ed7..ff362c732c 100755 --- a/AutomatedTesting/Gem/PythonTests/assetpipeline/ap_fixtures/bundler_batch_setup_fixture.py +++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/ap_fixtures/bundler_batch_setup_fixture.py @@ -342,7 +342,7 @@ def bundler_batch_setup_fixture(request, workspace, asset_processor, timeout) -> # Run a full scan to ENSURE that both caches (pc and osx) are COMPLETELY POPULATED # Needed for asset bundling # fmt:off - assert asset_processor.batch_process(fastscan=False, timeout=timeout * len(platforms), platforms=platforms_list), \ + assert asset_processor.batch_process(fastscan=True, timeout=timeout * len(platforms), platforms=platforms_list), \ "AP Batch failed to process in bundler_batch_fixture" # fmt:on diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt index 3d7a9204e2..5a5809595e 100644 --- a/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/asset_processor_tests/CMakeLists.txt @@ -92,25 +92,12 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) AZ::AssetProcessor ) - # Issue #3017 - #ly_add_pytest( - # NAME AssetPipelineTests.AssetBundler - # PATH ${CMAKE_CURRENT_LIST_DIR}/asset_bundler_batch_tests.py - # EXCLUDE_TEST_RUN_TARGET_FROM_IDE - # TEST_SERIAL - # TEST_SUITE periodic - # RUNTIME_DEPENDENCIES - # AZ::AssetProcessor - # AZ::AssetBundlerBatch - #) - ly_add_pytest( - NAME AssetPipelineTests.AssetBundler_SandBox - TEST_SUITE sandbox + NAME AssetPipelineTests.AssetBundler PATH ${CMAKE_CURRENT_LIST_DIR}/asset_bundler_batch_tests.py - PYTEST_MARKS "SUITE_sandbox" # run only sandbox tests in this file EXCLUDE_TEST_RUN_TARGET_FROM_IDE TEST_SERIAL + TEST_SUITE periodic RUNTIME_DEPENDENCIES AZ::AssetProcessor AZ::AssetBundlerBatch diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/PhysXColliderSurfaceTagEmitter_E2E_Editor.py b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/PhysXColliderSurfaceTagEmitter_E2E_Editor.py index beb5c2af72..2052c59a94 100755 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/PhysXColliderSurfaceTagEmitter_E2E_Editor.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/dyn_veg/EditorScripts/PhysXColliderSurfaceTagEmitter_E2E_Editor.py @@ -10,6 +10,7 @@ import sys sys.path.append(os.path.dirname(os.path.abspath(__file__))) import azlmbr.asset as asset +import azlmbr.editor as editor import azlmbr.legacy.general as general import azlmbr.bus as bus import azlmbr.math as math @@ -107,7 +108,7 @@ class TestPhysXColliderSurfaceTagEmitter(EditorTestHelper): # Create an entity with a PhysX Collider and our PhysX Collider Surface Tag Emitter collider_entity = hydra.Entity("Collider Surface") collider_entity.create_entity( - entity_center_point, + entity_center_point, ["PhysX Collider", "PhysX Collider Surface Tag Emitter"] ) if collider_entity.id.IsValid(): @@ -153,23 +154,29 @@ class TestPhysXColliderSurfaceTagEmitter(EditorTestHelper): self.test_success = self.test_success and baseline_success # Setup collider entity with a PhysX Mesh - test_physx_mesh_asset_path = asset.AssetCatalogRequestBus( + test_physx_mesh_asset_id = asset.AssetCatalogRequestBus( bus.Broadcast, "GetAssetIdByPath", os.path.join("levels", "physics", "c4044697_material_perfacematerialvalidation", "test.pxmesh"), math.Uuid(), False) - hydra.get_set_test(collider_entity, 0, "Shape Configuration|Shape", 7) - hydra.get_set_test(collider_entity, 0, "Shape Configuration|Asset|PhysX Mesh", test_physx_mesh_asset_path) + + # Remove/re-add component due to LYN-5496 + collider_entity.remove_component("PhysX Collider") + collider_entity.add_component("PhysX Collider") + self.wait_for_condition(lambda: editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', + collider_entity.components[1]), 5.0) + hydra.get_set_test(collider_entity, 1, "Shape Configuration|Shape", 7) + hydra.get_set_test(collider_entity, 1, "Shape Configuration|Asset|PhysX Mesh", test_physx_mesh_asset_id) # Set the asset scale to match the test heights of the shapes tested asset_scale = math.Vector3(1.0, 1.0, 9.0) - collider_entity.get_set_test(0, "Shape Configuration|Asset|Configuration|Asset Scale", asset_scale) + collider_entity.get_set_test(1, "Shape Configuration|Asset|Configuration|Asset Scale", asset_scale) # Test: Generate a new surface on the collider. # There should be one instance at the very top of the collider mesh, and none on the baseline surface # (We use a small query box to only check for one placed instance point) self.log("Starting PhysX Mesh Collider Test") - hydra.get_set_test(collider_entity, 1, "Configuration|Generated Tags", [surface_tag]) - hydra.get_set_test(collider_entity, 1, "Configuration|Extended Tags", [invalid_tag]) + hydra.get_set_test(collider_entity, 0, "Configuration|Generated Tags", [surface_tag]) + hydra.get_set_test(collider_entity, 0, "Configuration|Extended Tags", [invalid_tag]) top_point_success = self.wait_for_condition(lambda: dynveg.validate_instance_count(top_point, 0.25, 1), 5.0) self.test_success = self.test_success and top_point_success baseline_success = self.wait_for_condition(lambda: dynveg.validate_instance_count(baseline_surface_point, @@ -180,8 +187,8 @@ class TestPhysXColliderSurfaceTagEmitter(EditorTestHelper): # There should be no instances at the very top of the collider mesh, and none on the baseline surface within # our query box as PhysX meshes are treated as hollow shells, not solid volumes. # (We use a small query box to only check for one placed instance point) - hydra.get_set_test(collider_entity, 1, "Configuration|Generated Tags", [invalid_tag]) - hydra.get_set_test(collider_entity, 1, "Configuration|Extended Tags", [surface_tag]) + hydra.get_set_test(collider_entity, 0, "Configuration|Generated Tags", [invalid_tag]) + hydra.get_set_test(collider_entity, 0, "Configuration|Extended Tags", [surface_tag]) top_point_success = self.wait_for_condition(lambda: dynveg.validate_instance_count(top_point, 0.25, 0), 5.0) self.test_success = self.test_success and top_point_success baseline_success = self.wait_for_condition(lambda: dynveg.validate_instance_count(baseline_surface_point, diff --git a/AutomatedTesting/Registry/C15556261_PhysXMaterials_CharacterControllerMaterialAssignment.setreg_override b/AutomatedTesting/Registry/C15556261_PhysXMaterials_CharacterControllerMaterialAssignment.setreg_override index a329434623..aa82265c98 100644 --- a/AutomatedTesting/Registry/C15556261_PhysXMaterials_CharacterControllerMaterialAssignment.setreg_override +++ b/AutomatedTesting/Registry/C15556261_PhysXMaterials_CharacterControllerMaterialAssignment.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C18977601_Material_FrictionCombinePriority.setreg_override b/AutomatedTesting/Registry/C18977601_Material_FrictionCombinePriority.setreg_override index 44a91c67cb..7050a57206 100644 --- a/AutomatedTesting/Registry/C18977601_Material_FrictionCombinePriority.setreg_override +++ b/AutomatedTesting/Registry/C18977601_Material_FrictionCombinePriority.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C18981526_Material_RestitutionCombinePriority.setreg_override b/AutomatedTesting/Registry/C18981526_Material_RestitutionCombinePriority.setreg_override index 8de10787f1..c78018bdbb 100644 --- a/AutomatedTesting/Registry/C18981526_Material_RestitutionCombinePriority.setreg_override +++ b/AutomatedTesting/Registry/C18981526_Material_RestitutionCombinePriority.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override b/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override index e4ea71f652..b82acaf0ae 100644 --- a/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override +++ b/AutomatedTesting/Registry/C3510644_Collider_CollisionGroups.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4044456_Material_FrictionCombine.setreg_override b/AutomatedTesting/Registry/C4044456_Material_FrictionCombine.setreg_override index 83f7079e1f..806d71a158 100644 --- a/AutomatedTesting/Registry/C4044456_Material_FrictionCombine.setreg_override +++ b/AutomatedTesting/Registry/C4044456_Material_FrictionCombine.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4044457_Material_RestitutionCombine.setreg_override b/AutomatedTesting/Registry/C4044457_Material_RestitutionCombine.setreg_override index 96836b6ae4..fa77daac9f 100644 --- a/AutomatedTesting/Registry/C4044457_Material_RestitutionCombine.setreg_override +++ b/AutomatedTesting/Registry/C4044457_Material_RestitutionCombine.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4044459_Material_DynamicFriction.setreg_override b/AutomatedTesting/Registry/C4044459_Material_DynamicFriction.setreg_override index 88a7b5c309..5deb5635d1 100644 --- a/AutomatedTesting/Registry/C4044459_Material_DynamicFriction.setreg_override +++ b/AutomatedTesting/Registry/C4044459_Material_DynamicFriction.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4044461_Material_Restitution.setreg_override b/AutomatedTesting/Registry/C4044461_Material_Restitution.setreg_override index 21b285506b..b70e0f1326 100644 --- a/AutomatedTesting/Registry/C4044461_Material_Restitution.setreg_override +++ b/AutomatedTesting/Registry/C4044461_Material_Restitution.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4044697_Material_PerfaceMaterialValidation.setreg_override b/AutomatedTesting/Registry/C4044697_Material_PerfaceMaterialValidation.setreg_override index d585a4c468..5a93ae2314 100644 --- a/AutomatedTesting/Registry/C4044697_Material_PerfaceMaterialValidation.setreg_override +++ b/AutomatedTesting/Registry/C4044697_Material_PerfaceMaterialValidation.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override b/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override index e53d3893f8..7065f0dfeb 100644 --- a/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override +++ b/AutomatedTesting/Registry/C4976227_Collider_NewGroup.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override b/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override index e4ea71f652..b82acaf0ae 100644 --- a/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override +++ b/AutomatedTesting/Registry/C4976244_Collider_SameGroupSameLayerCollision.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override b/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override index e4ea71f652..b82acaf0ae 100644 --- a/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override +++ b/AutomatedTesting/Registry/C4976245_PhysXCollider_CollisionLayerTest.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override b/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override index e4ea71f652..b82acaf0ae 100644 --- a/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override +++ b/AutomatedTesting/Registry/C4982593_PhysXCollider_CollisionLayer.setreg_override @@ -69,7 +69,7 @@ {}, {}, {}, - "TouchBend" + {} ] }, "Groups": { diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp index cb97632e07..b164323238 100644 --- a/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp +++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp @@ -675,14 +675,14 @@ void AzAssetBrowserRequestHandler::OpenAssetInAssociatedEditor(const AZ::Data::A firstValidOpener = &openerDetails; } // bind a callback such that when the menu item is clicked, it sets that as the opener to use. - menu.addAction(openerDetails.m_iconToUse, QObject::tr(openerDetails.m_displayText.c_str()), mainWindow, AZStd::bind(switchToOpener, &openerDetails)); + menu.addAction(openerDetails.m_iconToUse, QObject::tr(openerDetails.m_displayText.c_str()), mainWindow, [switchToOpener, details = &openerDetails] { return switchToOpener(details); }); } } if (numValidOpeners > 1) // more than one option was added { menu.addSeparator(); - menu.addAction(QObject::tr("Cancel"), AZStd::bind(switchToOpener, nullptr)); // just something to click on to avoid doing anything. + menu.addAction(QObject::tr("Cancel"), [switchToOpener] { return switchToOpener(nullptr); }); // just something to click on to avoid doing anything. menu.exec(QCursor::pos()); } else if (numValidOpeners == 1) diff --git a/Code/Editor/Controls/ReflectedPropertyControl/PropertyMiscCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/PropertyMiscCtrl.cpp index 92c33aefc2..b9f7e12e95 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/PropertyMiscCtrl.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/PropertyMiscCtrl.cpp @@ -145,7 +145,7 @@ bool UserPopupWidgetHandler::ReadValuesIntoGUI(size_t index, UserPropertyEditor* QWidget* FloatCurveHandler::CreateGUI(QWidget *pParent) { CSplineCtrl *cSpline = new CSplineCtrl(pParent); - cSpline->SetUpdateCallback(AZStd::bind(&FloatCurveHandler::OnSplineChange, this, AZStd::placeholders::_1)); + cSpline->SetUpdateCallback([this](CSplineCtrl* spl) { OnSplineChange(spl); }); cSpline->SetTimeRange(0, 1); cSpline->SetValueRange(0, 1); cSpline->SetGrid(12, 12); diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp index 303f86d270..af418c6e0d 100644 --- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp +++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyItem.cpp @@ -172,8 +172,8 @@ ReflectedPropertyItem::ReflectedPropertyItem(ReflectedPropertyControl *control, if (parent) parent->AddChild(this); - m_onSetCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableChange, this, AZStd::placeholders::_1); - m_onSetEnumCallback = AZStd::bind(&ReflectedPropertyItem::OnVariableEnumChange, this, AZStd::placeholders::_1); + m_onSetCallback = [this](IVariable* var) { OnVariableChange(var); }; + m_onSetEnumCallback = [this](IVariable* var) { OnVariableEnumChange(var); }; } ReflectedPropertyItem::~ReflectedPropertyItem() diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c305b1be6c..ec965cc51f 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -2634,7 +2634,6 @@ void EditorViewportWidget::ShowCursor() ////////////////////////////////////////////////////////////////////////// void EditorViewportWidget::PushDisableRendering() { - assert(m_disableRenderingCount >= 0); ++m_disableRenderingCount; } diff --git a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp index c994458baa..6fcf3faffd 100644 --- a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp +++ b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp @@ -37,7 +37,7 @@ namespace UnitTest m_inputChannelMapper = AZStd::make_unique(m_rootWidget.get(), TestViewportId); } - void TearDown() + void TearDown() override { m_inputChannelMapper.reset(); diff --git a/Code/Editor/Lib/Tests/test_ViewportManipulatorController.cpp b/Code/Editor/Lib/Tests/test_ViewportManipulatorController.cpp index 9dc7e65cef..8c7023634e 100644 --- a/Code/Editor/Lib/Tests/test_ViewportManipulatorController.cpp +++ b/Code/Editor/Lib/Tests/test_ViewportManipulatorController.cpp @@ -24,10 +24,10 @@ namespace UnitTest void Disconnect(); // EditorInteractionSystemViewportSelectionRequestBus overrides ... - void SetHandler(const AzToolsFramework::ViewportSelectionRequestsBuilderFn& interactionRequestsBuilder); - void SetDefaultHandler(); - bool InternalHandleMouseViewportInteraction(const MouseInteractionEvent& mouseInteraction); - bool InternalHandleMouseManipulatorInteraction(const MouseInteractionEvent& mouseInteraction); + void SetHandler(const AzToolsFramework::ViewportSelectionRequestsBuilderFn& interactionRequestsBuilder) override; + void SetDefaultHandler() override; + bool InternalHandleMouseViewportInteraction(const MouseInteractionEvent& mouseInteraction) override; + bool InternalHandleMouseManipulatorInteraction(const MouseInteractionEvent& mouseInteraction) override; AZStd::function m_internalHandleMouseViewportInteraction; AZStd::function m_internalHandleMouseManipulatorInteraction; @@ -92,7 +92,7 @@ namespace UnitTest m_inputChannelMapper = AZStd::make_unique(m_rootWidget.get(), TestViewportId); } - void TearDown() + void TearDown() override { m_inputChannelMapper.reset(); diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index fbd8e85482..fa2e792cc8 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -1767,7 +1767,7 @@ void MainWindow::RegisterOpenWndCommands() cmdUI.tooltip = (QString("Open ") + className).toUtf8().data(); cmdUI.iconFilename = className.toUtf8().data(); GetIEditor()->GetCommandManager()->RegisterUICommand("editor", openCommandName.toUtf8().data(), - "", "", AZStd::bind(&CEditorOpenViewCommand::Execute, pCmd), cmdUI); + "", "", [pCmd] { pCmd->Execute(); }, cmdUI); GetIEditor()->GetCommandManager()->GetUIInfo("editor", openCommandName.toUtf8().data(), cmdUI); } } diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index 8eb3bb83c1..c89bd50559 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -1515,8 +1515,8 @@ void CBaseObject::Serialize(CObjectArchive& ar) SetFrozen(bFrozen); SetHidden(bHidden); - ar.SetResolveCallback(this, parentId, AZStd::bind(&CBaseObject::ResolveParent, this, AZStd::placeholders::_1 )); - ar.SetResolveCallback(this, lookatId, AZStd::bind(&CBaseObject::SetLookAt, this, AZStd::placeholders::_1)); + ar.SetResolveCallback(this, parentId, [this](CBaseObject* parent) { ResolveParent(parent); }); + ar.SetResolveCallback(this, lookatId, [this](CBaseObject* target) { SetLookAt(target); }); InvalidateTM(0); SetModified(false); @@ -2038,7 +2038,7 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos) ////////////////////////////////////////////////////////////////////////// CBaseObject* CBaseObject::GetChild(size_t const i) const { - assert(i >= 0 && i < m_childs.size()); + assert(i < m_childs.size()); return m_childs[i]; } @@ -2729,7 +2729,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren) // Set min spec for all childs. if (bSetChildren) { - for (size_t i = m_childs.size() - 1; i >= 0; --i) + for (int i = static_cast(m_childs.size()) - 1; i >= 0; --i) { m_childs[i]->SetMinSpec(nSpec, true); } diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index d2a2ae7d18..68264f9ea4 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -230,25 +230,25 @@ CEntityObject::CEntityObject() m_attachmentType = eAT_Pivot; // cache all the variable callbacks, must match order of enum defined in header - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaHeightChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaLightChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaLightSizeChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnAreaWidthChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxHeightChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxLengthChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxProjectionChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeXChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeYChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxSizeZChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnBoxWidthChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnColorChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnInnerRadiusChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnOuterRadiusChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectInAllDirsChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectorFOVChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnProjectorTextureChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnPropertyChange, this, AZStd::placeholders::_1)); - m_onSetCallbacksCache.push_back(AZStd::bind(&CEntityObject::OnRadiusChange, this, AZStd::placeholders::_1)); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaHeightChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaLightSizeChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnAreaWidthChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxHeightChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxLengthChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxProjectionChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeXChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeYChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxSizeZChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnBoxWidthChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnColorChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnInnerRadiusChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnOuterRadiusChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectInAllDirsChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorFOVChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnProjectorTextureChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnPropertyChange(var); }); + m_onSetCallbacksCache.emplace_back([this](IVariable* var) { OnRadiusChange(var); }); } CEntityObject::~CEntityObject() @@ -938,11 +938,14 @@ void CEntityObject::Serialize(CObjectArchive& ar) eventTarget->getAttr("TargetId", targetId); eventTarget->getAttr("Event", et.event); eventTarget->getAttr("SourceEvent", et.sourceEvent); - m_eventTargets.push_back(et); + m_eventTargets.emplace_back(AZStd::move(et)); if (targetId != GUID_NULL) { using namespace AZStd::placeholders; - ar.SetResolveCallback(this, targetId, AZStd::bind(&CEntityObject::ResolveEventTarget, this, _1, _2), i); + ar.SetResolveCallback( + this, targetId, + [this](CBaseObject* object, unsigned int index) { ResolveEventTarget(object, index); }, + i); } } } @@ -1413,7 +1416,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx void CEntityObject::ResolveEventTarget(CBaseObject* object, unsigned int index) { // Find target id. - assert(index >= 0 && index < m_eventTargets.size()); + assert(index < m_eventTargets.size()); if (object) { object->AddEventListener(this); diff --git a/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp b/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp index 6a5c5b6427..2fd46b0fc5 100644 --- a/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp +++ b/Code/Editor/TrackView/TrackViewKeyPropertiesDlg.cpp @@ -110,7 +110,7 @@ void CTrackViewKeyPropertiesDlg::PopulateVariables() m_wndProps->RemoveAllItems(); m_wndProps->AddVarBlock(m_pVarBlock); - m_wndProps->SetUpdateCallback(AZStd::bind(&CTrackViewKeyPropertiesDlg::OnVarChange, this, AZStd::placeholders::_1)); + m_wndProps->SetUpdateCallback([this](IVariable* var) { OnVarChange(var); }); //m_wndProps->m_props.ExpandAll(); diff --git a/Code/Editor/Undo/Undo.cpp b/Code/Editor/Undo/Undo.cpp index b49c6ea567..910a670bee 100644 --- a/Code/Editor/Undo/Undo.cpp +++ b/Code/Editor/Undo/Undo.cpp @@ -49,7 +49,7 @@ public: } void Undo(bool bUndo) override { - for (size_t i = m_undoSteps.size() - 1; i >= 0; i--) + for (int i = static_cast(m_undoSteps.size()) - 1; i >= 0; i--) { m_undoSteps[i]->Undo(bUndo); } diff --git a/Code/Editor/Util/3DConnexionDriver.cpp b/Code/Editor/Util/3DConnexionDriver.cpp index c1c3b47c4b..9dc1600185 100644 --- a/Code/Editor/Util/3DConnexionDriver.cpp +++ b/Code/Editor/Util/3DConnexionDriver.cpp @@ -58,36 +58,26 @@ bool C3DConnexionDriver::InitDevice() //Doc says RIM_TYPEHID: Data comes from an HID that is not a keyboard or a mouse. if (m_pRawInputDeviceList[i].dwType == RIM_TYPEHID) { - UINT nchars = 300; - TCHAR deviceName[300]; - if (GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice, - RIDI_DEVICENAME, deviceName, &nchars) >= 0) - { - //_RPT3(_CRT_WARN, "Device[%d]: handle=0x%x name = %S\n", i, g_pRawInputDeviceList[i].hDevice, deviceName); - } - RID_DEVICE_INFO dinfo; UINT sizeofdinfo = sizeof(dinfo); dinfo.cbSize = sizeofdinfo; - if (GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice, - RIDI_DEVICEINFO, &dinfo, &sizeofdinfo) >= 0) + GetRawInputDeviceInfo(m_pRawInputDeviceList[i].hDevice, + RIDI_DEVICEINFO, &dinfo, &sizeofdinfo); + if (dinfo.dwType == RIM_TYPEHID) { - if (dinfo.dwType == RIM_TYPEHID) + RID_DEVICE_INFO_HID* phidInfo = &dinfo.hid; + // Add this one to the list of interesting devices? + // Actually only have to do this once to get input from all usage 1, usagePage 8 devices + // This just keeps out the other usages. + // You might want to put up a list for users to select amongst the different devices. + // In particular, to assign separate functionality to the different devices. + if (phidInfo->usUsagePage == 1 && phidInfo->usUsage == 8) { - RID_DEVICE_INFO_HID* phidInfo = &dinfo.hid; - // Add this one to the list of interesting devices? - // Actually only have to do this once to get input from all usage 1, usagePage 8 devices - // This just keeps out the other usages. - // You might want to put up a list for users to select amongst the different devices. - // In particular, to assign separate functionality to the different devices. - if (phidInfo->usUsagePage == 1 && phidInfo->usUsage == 8) - { - m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage; - m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage; - m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0; - m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr; - m_nUsagePage1Usage8Devices++; - } + m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsagePage = phidInfo->usUsagePage; + m_pRawInputDevices[m_nUsagePage1Usage8Devices].usUsage = phidInfo->usUsage; + m_pRawInputDevices[m_nUsagePage1Usage8Devices].dwFlags = 0; + m_pRawInputDevices[m_nUsagePage1Usage8Devices].hwndTarget = nullptr; + m_nUsagePage1Usage8Devices++; } } } diff --git a/Code/Editor/Util/KDTree.cpp b/Code/Editor/Util/KDTree.cpp index 182b9b8eb1..af06a58c9f 100644 --- a/Code/Editor/Util/KDTree.cpp +++ b/Code/Editor/Util/KDTree.cpp @@ -467,7 +467,7 @@ bool CKDTree::FindNearestVertexRecursively(KDTreeNode* pNode, const Vec3& raySrc uint32 nVertexIndex = pNode->GetVertexIndex(i); uint32 nObjIndex = pNode->GetObjIndex(i); - assert(nObjIndex < m_StatObjectList.size() && nObjIndex >= 0); + assert(nObjIndex < m_StatObjectList.size()); const SStatObj* pStatObjInfo = &(m_StatObjectList[nObjIndex]); diff --git a/Code/Editor/ViewPane.cpp b/Code/Editor/ViewPane.cpp index a932f05c79..421db8394e 100644 --- a/Code/Editor/ViewPane.cpp +++ b/Code/Editor/ViewPane.cpp @@ -769,7 +769,9 @@ namespace void PySetViewPaneLayout(unsigned int layoutId) { + AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option") if ((layoutId >= ET_Layout0) && (layoutId <= ET_Layout8)) + AZ_POP_DISABLE_WARNING { CLayoutWnd* layout = GetIEditor()->GetViewManager()->GetLayout(); if (layout) diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index 0c4eaf8383..1c81a15bda 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -1850,7 +1850,7 @@ namespace AZ * { * // do any conversion of caching of the "data" here and forward this to behavior (often the reason for this is that you can't pass everything to behavior * // plus behavior can't really handle all constructs pointer to pointer, rvalues, etc. as they don't make sense for most script environments - * int result = 0; // set the default value for your result if the behavior if there is no implmentation + * int result = 0; // set the default value for your result if the behavior if there is no implementation * // The AZ_EBUS_BEHAVIOR_BINDER defines FN_EventName for each index. You can also cache it yourself (but it's slower), static int cacheIndex = GetFunctionIndex("OnEvent1"); and use that . * CallResult(result, FN_OnEvent1, data); // forward to the binding (there can be none, this is why we need to always have properly set result, when there is one) * return result; // return the result like you will in any normal EBus even with result diff --git a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/Streamer/StreamerContext_WinAPI.cpp b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/Streamer/StreamerContext_WinAPI.cpp index cda0a3f056..8f46bc5eba 100644 --- a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/Streamer/StreamerContext_WinAPI.cpp +++ b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/IO/Streamer/StreamerContext_WinAPI.cpp @@ -49,7 +49,7 @@ namespace AZ::Platform AZ_Assert(m_events[0], "There is no synchronization event created for the main streamer thread to use to suspend."); DWORD result = ::WaitForMultipleObjects(m_handleCount, m_events, false, INFINITE); - if (result >= WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + m_handleCount) + if (result < WAIT_OBJECT_0 + m_handleCount) { DWORD index = result - WAIT_OBJECT_0; ::ResetEvent(m_events[index]); diff --git a/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp b/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp index dd10d20ef8..933db73c3f 100644 --- a/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp @@ -36,12 +36,23 @@ using namespace UnitTestInternal; /** * Validate a vector for certain number of elements. */ -#define AZ_TEST_VALIDATE_VECTOR(_Vector, _NumElements) \ - EXPECT_TRUE(_Vector.validate()); \ - EXPECT_EQ(_NumElements, _Vector.size()); \ - EXPECT_TRUE((_NumElements > 0) ? !_Vector.empty() : _Vector.empty()); \ - EXPECT_TRUE((_NumElements > 0) ? _Vector.capacity() >= _NumElements : true); \ - EXPECT_TRUE((_NumElements > 0) ? _Vector.begin() != _Vector.end() : _Vector.begin() == _Vector.end()); \ +#define AZ_TEST_VALIDATE_VECTOR(_Vector, _NumElements) \ + EXPECT_NE(_NumElements, 0); \ + EXPECT_TRUE(_Vector.validate()); \ + EXPECT_EQ(_NumElements, _Vector.size()); \ + EXPECT_TRUE(!_Vector.empty()); \ + EXPECT_TRUE(_Vector.capacity() >= _NumElements); \ + EXPECT_TRUE(_Vector.begin() != _Vector.end()); \ + EXPECT_NE(nullptr, _Vector.data()) + + /** + * Validate a vector for 0 number of elements. The above macro creates expressions that are always true for size == 0 + */ +#define AZ_TEST_VALIDATE_VECTOR_0(_Vector) \ + EXPECT_TRUE(_Vector.validate()); \ + EXPECT_EQ(0, _Vector.size()); \ + EXPECT_TRUE(_Vector.empty()); \ + EXPECT_TRUE(_Vector.begin() == _Vector.end()); \ EXPECT_NE(nullptr, _Vector.data()) namespace UnitTest @@ -312,7 +323,7 @@ namespace UnitTest // erase int_vector1.erase(int_vector1.begin(), int_vector1.end()); - AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); // Zero elements but valid capacity. + AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // Zero elements but valid capacity. int_vector1.push_back(10); int_vector1.push_back(20); @@ -324,11 +335,11 @@ namespace UnitTest // clear int_vector1.clear(); - AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); // Zero elements but valid capacity. + AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // Zero elements but valid capacity. // swap int_vector1.swap(int_vector); - AZ_TEST_VALIDATE_VECTOR(int_vector, 0); + AZ_TEST_VALIDATE_VECTOR_0(int_vector); AZ_TEST_VALIDATE_VECTOR(int_vector1, 33); AZ_TEST_ASSERT(int_vector1.front() == 55); @@ -524,11 +535,11 @@ namespace UnitTest // Default vector (integral type). fixed_vector int_vector_default; - AZ_TEST_VALIDATE_VECTOR(int_vector_default, 0); + AZ_TEST_VALIDATE_VECTOR_0(int_vector_default); // Default vector (non-integral type). fixed_vector myclass_vector_default; - AZ_TEST_VALIDATE_VECTOR(myclass_vector_default, 0); + AZ_TEST_VALIDATE_VECTOR_0(myclass_vector_default); // Create a vector (using fill ctor, with memset optimization to set the values) typedef fixed_vector char_10_type; @@ -633,7 +644,7 @@ namespace UnitTest // erase int_vector1.erase(int_vector1.begin(), int_vector1.end()); - AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); + AZ_TEST_VALIDATE_VECTOR_0(int_vector1); int_vector1.push_back(10); int_vector1.push_back(20); @@ -645,11 +656,11 @@ namespace UnitTest // clear int_vector1.clear(); - AZ_TEST_VALIDATE_VECTOR(int_vector1, 0); + AZ_TEST_VALIDATE_VECTOR_0(int_vector1); // swap int_vector1.swap(int_vector); - AZ_TEST_VALIDATE_VECTOR(int_vector, 0); + AZ_TEST_VALIDATE_VECTOR_0(int_vector); AZ_TEST_VALIDATE_VECTOR(int_vector1, 33); AZ_TEST_ASSERT(int_vector1.front() == 55); @@ -963,7 +974,7 @@ namespace UnitTest AZ_TEST_VALIDATE_VECTOR(deep_vec_2, 12); deep_vec_2.clear(); - AZ_TEST_VALIDATE_VECTOR(deep_vec_2, 0); + AZ_TEST_VALIDATE_VECTOR_0(deep_vec_2); } #endif // AZ_UNIT_TEST_SKIP_STD_VECTOR_AND_ARRAY_TESTS diff --git a/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp b/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp index 75b43100c5..25bc31b760 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp @@ -1081,16 +1081,6 @@ namespace AZ return ResultCode::Error; } - //bound check - //note that seeking beyond end or before beginning is system dependent - //therefore we will define that on all platforms it is not allowed - if (newFilePosition < 0) - { - AZ_TracePrintf(RemoteFileIOChannel, "RemoteFileIO::Seek(fileHandle=%u, offset=%i, type=%s) seek to a position before the begining of a file!", fileHandle, offset, type == SeekType::SeekFromCurrent ? "SeekFromCurrent" : type == SeekType::SeekFromEnd ? "SeekFromEnd" : type == SeekType::SeekFromStart ? "SeekFromStart" : "Unknown"); - REMOTEFILE_LOG_APPEND(AZStd::string::format("RemoteFileIO::Seek(fileHandle=%u, offset=%i, type=%s) seek to a position before the begining of a file!", fileHandle, offset, type == SeekType::SeekFromCurrent ? "SeekFromCurrent" : type == SeekType::SeekFromEnd ? "SeekFromEnd" : type == SeekType::SeekFromStart ? "SeekFromStart" : "Unknown").c_str()); - newFilePosition = 0; - } - else { AZ::u64 fileSize = 0; Size(fileHandle, fileSize); diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionGroups.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionGroups.cpp index 3ffeb0cf5b..84e0184462 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionGroups.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionGroups.cpp @@ -13,14 +13,6 @@ #include -//This bit is defined in the TouchBending Gem wscript. -//Make sure the bit has a valid value. -#ifdef TOUCHBENDING_LAYER_BIT -#if (TOUCHBENDING_LAYER_BIT < 1) || (TOUCHBENDING_LAYER_BIT > 63) -#error Invalid Bit Definition For the TouchBending Layer Bit -#endif -#endif //#ifdef TOUCHBENDING_LAYER_BIT - namespace AzPhysics { AZ_CLASS_ALLOCATOR_IMPL(CollisionGroup, AZ::SystemAllocator, 0); @@ -31,10 +23,6 @@ namespace AzPhysics const CollisionGroup CollisionGroup::None = 0x0000000000000000ULL; const CollisionGroup CollisionGroup::All = 0xFFFFFFFFFFFFFFFFULL; -#ifdef TOUCHBENDING_LAYER_BIT - const CollisionGroup CollisionGroup::All_NoTouchBend = CollisionGroup::All.GetMask() & ~CollisionLayer::TouchBend.GetMask(); -#endif - void CollisionGroupScriptConstructor(CollisionGroup* thisPtr, AZ::ScriptDataContext& scriptDataContext) { if (int numArgs = scriptDataContext.GetNumArguments(); diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionLayers.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionLayers.cpp index 924af41113..42ea38961f 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionLayers.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionLayers.cpp @@ -14,14 +14,6 @@ #include -//This bit is defined in the TouchBending Gem wscript. -//Make sure the bit has a valid value. -#ifdef TOUCHBENDING_LAYER_BIT -#if (TOUCHBENDING_LAYER_BIT < 1) || (TOUCHBENDING_LAYER_BIT > 63) -#error Invalid Bit Definition For the TouchBending Layer Bit -#endif -#endif //#ifdef TOUCHBENDING_LAYER_BIT - namespace AzPhysics { AZ_CLASS_ALLOCATOR_IMPL(CollisionLayer, AZ::SystemAllocator, 0); @@ -29,10 +21,6 @@ namespace AzPhysics const CollisionLayer CollisionLayer::Default = 0; -#ifdef TOUCHBENDING_LAYER_BIT - const CollisionLayer CollisionLayer::TouchBend = TOUCHBENDING_LAYER_BIT; -#endif - void CollisionLayer::Reflect(AZ::ReflectContext* context) { if (auto* serializeContext = azrtti_cast(context)) diff --git a/Code/Framework/AzFramework/AzFramework/Physics/SimulatedBodies/StaticRigidBody.h b/Code/Framework/AzFramework/AzFramework/Physics/SimulatedBodies/StaticRigidBody.h index 2cd3b9f7ae..8f84609379 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/SimulatedBodies/StaticRigidBody.h +++ b/Code/Framework/AzFramework/AzFramework/Physics/SimulatedBodies/StaticRigidBody.h @@ -32,12 +32,20 @@ namespace AzPhysics { public: AZ_CLASS_ALLOCATOR_DECL; - AZ_RTTI(StaticRigidBody, "{13A677BB-7085-4EDB-BCC8-306548238692}", SimulatedBody); + AZ_RTTI(AzPhysics::StaticRigidBody, "{13A677BB-7085-4EDB-BCC8-306548238692}", AzPhysics::SimulatedBody); static void Reflect(AZ::ReflectContext* context); - //Legacy API - may change with LYN-438 + //! Add a shape to the static rigid body. + //! @param shape A shared pointer of the shape to add. virtual void AddShape(const AZStd::shared_ptr& shape) = 0; + + //! Returns the number of shapes that make up this static rigid body. + //! @return Returns the number of shapes as a AZ::u32. virtual AZ::u32 GetShapeCount() { return 0; } + + //! Returns a shared pointer to the requested shape index. + //! @param index The index of the shapes to return. Expected to be between 0 and GetShapeCount(). + //! @return Returns a shared pointer of the shape requested or nullptr if index is out of bounds. virtual AZStd::shared_ptr GetShape([[maybe_unused]]AZ::u32 index) { return nullptr; } }; } diff --git a/Code/Framework/AzFramework/AzFramework/Terrain/TerrainDataRequestBus.h b/Code/Framework/AzFramework/AzFramework/Terrain/TerrainDataRequestBus.h index 2e7cd1d170..08e238434e 100644 --- a/Code/Framework/AzFramework/AzFramework/Terrain/TerrainDataRequestBus.h +++ b/Code/Framework/AzFramework/AzFramework/Terrain/TerrainDataRequestBus.h @@ -102,11 +102,25 @@ namespace AzFramework static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; ////////////////////////////////////////////////////////////////////////// - virtual void OnTerrainDataCreateBegin() {}; - virtual void OnTerrainDataCreateEnd() {}; + enum TerrainDataChangedMask : uint8_t + { + None = 0b00000000, + Settings = 0b00000001, + HeightData = 0b00000010, + ColorData = 0b00000100, + SurfaceData = 0b00001000 + }; + + virtual void OnTerrainDataCreateBegin() {} + virtual void OnTerrainDataCreateEnd() {} - virtual void OnTerrainDataDestroyBegin() {}; - virtual void OnTerrainDataDestroyEnd() {}; + virtual void OnTerrainDataDestroyBegin() {} + virtual void OnTerrainDataDestroyEnd() {} + + virtual void OnTerrainDataChanged( + [[maybe_unused]] const AZ::Aabb& dirtyRegion, [[maybe_unused]] TerrainDataChangedMask dataChangedMask) + { + } }; using TerrainDataNotificationBus = AZ::EBus; diff --git a/Code/Framework/AzFramework/CMakeLists.txt b/Code/Framework/AzFramework/CMakeLists.txt index 1ac60e299e..1164d81f04 100644 --- a/Code/Framework/AzFramework/CMakeLists.txt +++ b/Code/Framework/AzFramework/CMakeLists.txt @@ -10,8 +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_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( NAME AzFramework STATIC NAMESPACE AZ @@ -37,14 +35,6 @@ ly_add_target( 3rdParty::lz4 ) -ly_add_source_properties( - SOURCES - AzFramework/Physics/Collision/CollisionGroups.cpp - AzFramework/Physics/Collision/CollisionLayers.cpp - PROPERTY COMPILE_DEFINITIONS - VALUES TOUCHBENDING_LAYER_BIT=${LY_TOUCHBENDING_LAYER_BIT} -) - if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Tests/Platform/${PAL_PLATFORM_NAME}) diff --git a/Code/Legacy/CryCommon/HeightmapUpdateNotificationBus.h b/Code/Legacy/CryCommon/HeightmapUpdateNotificationBus.h deleted file mode 100644 index 618131159e..0000000000 --- a/Code/Legacy/CryCommon/HeightmapUpdateNotificationBus.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include - -namespace AZ -{ - /** - * the EBus is used to request information about potential vegetation surfaces - */ - class HeightmapUpdateNotification - : public AZ::EBusTraits - { - public: - //////////////////////////////////////////////////////////////////////// - // EBusTraits - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple; - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; - //////////////////////////////////////////////////////////////////////// - - // Occurs when the terrain height map is modified. - virtual void HeightmapModified(const AZ::Aabb& bounds) = 0; - }; - - typedef AZ::EBus HeightmapUpdateNotificationBus; -} diff --git a/Code/Legacy/CryCommon/IXml.h b/Code/Legacy/CryCommon/IXml.h index 80c2415f9c..2434b44664 100644 --- a/Code/Legacy/CryCommon/IXml.h +++ b/Code/Legacy/CryCommon/IXml.h @@ -745,7 +745,7 @@ private: void Update() { - if (m_index >= 0 && m_index < m_parentNode->getChildCount()) + if (m_index < m_parentNode->getChildCount()) { m_currentChildNode = m_parentNode->getChild(static_cast(m_index)); } diff --git a/Code/Legacy/CryCommon/crycommon_files.cmake b/Code/Legacy/CryCommon/crycommon_files.cmake index b8f73d064f..ba11de0215 100644 --- a/Code/Legacy/CryCommon/crycommon_files.cmake +++ b/Code/Legacy/CryCommon/crycommon_files.cmake @@ -53,7 +53,6 @@ set(FILES HMDBus.h VRCommon.h StereoRendererBus.h - HeightmapUpdateNotificationBus.h INavigationSystem.h IMNM.h SFunctor.h diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index 08292a6353..b5a6265493 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -1626,6 +1626,9 @@ AZ_POP_DISABLE_WARNING // Send out EBus event EBUS_EVENT(CrySystemEventBus, OnCrySystemInitialized, *this, startupParams); + // Execute any deferred commands that uses the CVar commands that were just registered + AZ::Interface::Get()->ExecuteDeferredConsoleCommands(); + // Verify that the Maestro Gem initialized the movie system correctly. This can be removed if and when Maestro is not a required Gem if (gEnv->IsEditor() && !gEnv->pMovieSystem) { @@ -1641,7 +1644,7 @@ AZ_POP_DISABLE_WARNING m_bInitializedSuccessfully = true; - return (true); + return true; } diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 2293352f7e..46eea1528c 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -3133,6 +3133,9 @@ char* CXConsole::GetCheatVarAt(uint32 nOffset) ////////////////////////////////////////////////////////////////////////// size_t CXConsole::GetSortedVars(AZStd::vector& pszArray, const char* szPrefix) { + // This method used to insert instead of push_back, so we need to clear first + pszArray.clear(); + size_t iPrefixLen = szPrefix ? strlen(szPrefix) : 0; // variables diff --git a/Code/Tools/AssetProcessor/native/resourcecompiler/rcjoblistmodel.cpp b/Code/Tools/AssetProcessor/native/resourcecompiler/rcjoblistmodel.cpp index d22823b496..a64e3bf5b9 100644 --- a/Code/Tools/AssetProcessor/native/resourcecompiler/rcjoblistmodel.cpp +++ b/Code/Tools/AssetProcessor/native/resourcecompiler/rcjoblistmodel.cpp @@ -197,11 +197,11 @@ namespace AssetProcessor m_jobsInFlight.insert(rcJob); - for(size_t jobIndex = m_jobs.size() - 1; jobIndex >= 0; --jobIndex) + for(int jobIndex = static_cast(m_jobs.size()) - 1; jobIndex >= 0; --jobIndex) { if(m_jobs[jobIndex] == rcJob) { - Q_EMIT dataChanged(index(aznumeric_caster(jobIndex), 0, QModelIndex()), index(aznumeric_caster(jobIndex), 0, QModelIndex())); + Q_EMIT dataChanged(index(jobIndex, 0, QModelIndex()), index(jobIndex, 0, QModelIndex())); return; } } @@ -240,7 +240,7 @@ namespace AssetProcessor foundInQueue = m_jobsInQueueLookup.erase(foundInQueue); } - for (size_t jobIndex = m_jobs.size() - 1; jobIndex >= 0; --jobIndex) + for (int jobIndex = static_cast(m_jobs.size()) - 1; jobIndex >= 0; --jobIndex) { if(m_jobs[jobIndex] == rcJob) { @@ -251,7 +251,7 @@ namespace AssetProcessor #if defined(DEBUG_RCJOB_MODEL) AZ_TracePrintf(AssetProcessor::DebugChannel, "JobTrace =>JobCompleted(%i %s,%s,%s)\n", rcJob, rcJob->GetJobEntry().m_databaseSourceName.toUtf8().constData(), rcJob->GetPlatformInfo().m_identifier.c_str(), rcJob->GetJobKey().toUtf8().constData()); #endif - beginRemoveRows(QModelIndex(), aznumeric_caster(jobIndex), aznumeric_caster(jobIndex)); + beginRemoveRows(QModelIndex(), jobIndex, jobIndex); m_jobs.erase(m_jobs.begin() + jobIndex); endRemoveRows(); diff --git a/Code/Tools/AssetProcessor/native/utilities/ByteArrayStream.cpp b/Code/Tools/AssetProcessor/native/utilities/ByteArrayStream.cpp index 187c872e08..4a7128be88 100644 --- a/Code/Tools/AssetProcessor/native/utilities/ByteArrayStream.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/ByteArrayStream.cpp @@ -52,7 +52,6 @@ namespace AssetProcessor SizeType finalPosition = GenericStream::ComputeSeekPosition(bytes, mode); AZ_Assert(finalPosition < INT_MAX, "Overflow of SizeType to int in ByteArrayStream."); - AZ_Assert(finalPosition >= 0, "underflow in seek in ByteArrayStream"); AZ_Assert(finalPosition <= m_activeArray->size(), "You cant seek beyond end of file"); // safety clamp! diff --git a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp index 5e005c117d..72a036bdaa 100644 --- a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp @@ -72,11 +72,6 @@ namespace AssetUtilsInternal bool FileCopyMoveWithTimeout(QString sourceFile, QString outputFile, bool isCopy, unsigned int waitTimeInSeconds) { - if (waitTimeInSeconds < 0) - { - AZ_Warning("Asset Processor", waitTimeInSeconds >= 0, "Invalid timeout specified by the user"); - waitTimeInSeconds = 0; - } bool failureOccurredOnce = false; // used for logging. bool operationSucceeded = false; QFile outFile(outputFile); diff --git a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp index fef31aaaf3..a0eccc7d45 100644 --- a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp +++ b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp @@ -173,10 +173,7 @@ namespace AreaChart void AreaChart::ConfigureVerticalAxis(QString label, unsigned int minimumHeight) { - if (minimumHeight >= 0) - { - SetMinimumValueRange(minimumHeight); - } + SetMinimumValueRange(minimumHeight); if (m_verticalAxis == nullptr) { @@ -323,7 +320,7 @@ namespace AreaChart // Need to handle the areas right at the edge of the polygons for (int i = -1; i <= 1; ++i) { - if ((counter+i) < 0 || (counter + i) >= m_hitAreas.size()) + if ((counter + i) >= m_hitAreas.size()) { continue; } diff --git a/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleUtils.cpp b/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleUtils.cpp index 47cdca11b1..61fb0a1707 100644 --- a/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleUtils.cpp +++ b/Code/Tools/TestImpactFramework/Frontend/Console/Code/Source/TestImpactConsoleUtils.cpp @@ -7,6 +7,7 @@ */ #include +#include namespace TestImpact { diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp index 16d0cf4241..0332ea7a76 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionActivity.cpp @@ -90,7 +90,7 @@ namespace AWSGameLift { auto gameliftCreateSessionRequest = azrtti_cast(&createSessionRequest); - return gameliftCreateSessionRequest && gameliftCreateSessionRequest->m_maxPlayer >= 0 && + return gameliftCreateSessionRequest && (!gameliftCreateSessionRequest->m_aliasId.empty() || !gameliftCreateSessionRequest->m_fleetId.empty()); } } // namespace CreateSessionActivity diff --git a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp index 1ac9c7db1c..52be365ea5 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftClient/Source/Activity/AWSGameLiftCreateSessionOnQueueActivity.cpp @@ -79,7 +79,7 @@ namespace AWSGameLift auto gameliftCreateSessionOnQueueRequest = azrtti_cast(&createSessionRequest); - return gameliftCreateSessionOnQueueRequest && gameliftCreateSessionOnQueueRequest->m_maxPlayer >= 0 && + return gameliftCreateSessionOnQueueRequest && !gameliftCreateSessionOnQueueRequest->m_queueName.empty() && !gameliftCreateSessionOnQueueRequest->m_placementId.empty(); } } // namespace CreateSessionOnQueueActivity diff --git a/Gems/Atom/Bootstrap/Code/CMakeLists.txt b/Gems/Atom/Bootstrap/Code/CMakeLists.txt index af09f3a288..1787af04ed 100644 --- a/Gems/Atom/Bootstrap/Code/CMakeLists.txt +++ b/Gems/Atom/Bootstrap/Code/CMakeLists.txt @@ -6,6 +6,8 @@ # # +ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME}) + ly_add_target( NAME Atom_Bootstrap.Headers HEADERONLY NAMESPACE Gem @@ -21,9 +23,12 @@ ly_add_target( NAMESPACE Gem FILES_CMAKE bootstrap_files.cmake + ${pal_dir}/bootstrap_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake + PLATFORM_INCLUDE_FILES INCLUDE_DIRECTORIES PRIVATE Source + ${pal_dir} PUBLIC Include BUILD_DEPENDENCIES diff --git a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp index f9d6ac63f7..11758138e0 100644 --- a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp +++ b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp @@ -38,6 +38,10 @@ #include #include +#include +#include + +AZ_CVAR(AZ::CVarFixedString, r_default_pipeline_name, AZ_TRAIT_BOOTSTRAPSYSTEMCOMPONENT_PIPELINE_NAME, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Default Render pipeline name"); namespace AZ { @@ -50,8 +54,7 @@ namespace AZ if (SerializeContext* serialize = azrtti_cast(context)) { serialize->Class() - ->Version(0) - ->Field("DefaultRenderPipelineAssetFile", &BootstrapSystemComponent::m_defaultPipelineAssetPath) + ->Version(1) ; if (EditContext* ec = serialize->GetEditContext()) @@ -60,8 +63,6 @@ namespace AZ ->ClassElement(Edit::ClassElements::EditorData, "") ->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) ->Attribute(Edit::Attributes::AutoExpand, true) - ->DataElement(Edit::UIHandlers::Default, &BootstrapSystemComponent::m_defaultPipelineAssetPath, "Default RenderPipeline Asset", - "The asset file path of default render pipeline for default window") ; } } @@ -314,13 +315,15 @@ namespace AZ // Create a render pipeline from the specified asset for the window context and add the pipeline to the scene. // When running with no Asset Processor (for example in release), CompileAssetSync will return AssetStatus_Unknown. AzFramework::AssetSystem::AssetStatus status = AzFramework::AssetSystem::AssetStatus_Unknown; - AzFramework::AssetSystemRequestBus::BroadcastResult( - status, &AzFramework::AssetSystemRequestBus::Events::CompileAssetSync, m_defaultPipelineAssetPath); - AZ_Assert(status == AzFramework::AssetSystem::AssetStatus_Compiled || status == AzFramework::AssetSystem::AssetStatus_Unknown, "Could not compile the default render pipeline at '%s'", m_defaultPipelineAssetPath.c_str()); + const AZ::CVarFixedString pipelineName = static_cast(r_default_pipeline_name); + AzFramework::AssetSystemRequestBus::BroadcastResult(status, &AzFramework::AssetSystemRequestBus::Events::CompileAssetSync, pipelineName.data()); + + AZ_Assert(status == AzFramework::AssetSystem::AssetStatus_Compiled || status == AzFramework::AssetSystem::AssetStatus_Unknown, "Could not compile the default render pipeline at '%s'", pipelineName.c_str()); - Data::Asset pipelineAsset = RPI::AssetUtils::LoadAssetByProductPath(m_defaultPipelineAssetPath.c_str(), RPI::AssetUtils::TraceLevel::Error); + Data::Asset pipelineAsset = RPI::AssetUtils::LoadAssetByProductPath(pipelineName.data(), RPI::AssetUtils::TraceLevel::Error); RPI::RenderPipelineDescriptor renderPipelineDescriptor = *RPI::GetDataFromAnyAsset(pipelineAsset); renderPipelineDescriptor.m_name = AZStd::string::format("%s_%i", renderPipelineDescriptor.m_name.c_str(), viewportContext->GetId()); + if (!scene->GetRenderPipeline(AZ::Name(renderPipelineDescriptor.m_name))) { RPI::RenderPipelinePtr renderPipeline = RPI::RenderPipeline::CreateRenderPipelineForWindow(renderPipelineDescriptor, *viewportContext->GetWindowContext().get()); diff --git a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h index 142b2d8769..bd5d417b8f 100644 --- a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h +++ b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h @@ -112,10 +112,7 @@ namespace AZ // The id of the render pipeline created by this component RPI::RenderPipelineId m_renderPipelineId; - - // Variables which are system component configuration - AZStd::string m_defaultPipelineAssetPath = "passes/MainRenderPipeline.azasset"; - + // Save a reference to the image created by the BRDF pipeline so it doesn't get auto deleted if it's ref count goes to zero // For example, if we delete all the passes, we won't have to recreate the BRDF pipeline to recreate the BRDF texture Data::Instance m_brdfTexture; diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/Android/BootstrapSystemComponent_Traits_Platform.h b/Gems/Atom/Bootstrap/Code/Source/Platform/Android/BootstrapSystemComponent_Traits_Platform.h new file mode 100644 index 0000000000..da63106e29 --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Android/BootstrapSystemComponent_Traits_Platform.h @@ -0,0 +1,9 @@ +/* + * 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 + * + */ + +#define AZ_TRAIT_BOOTSTRAPSYSTEMCOMPONENT_PIPELINE_NAME "passes/LowEndRenderPipeline.azasset" diff --git a/Code/Framework/AzCore/Platform/Common/azcore_profile_telemetry_files.cmake b/Gems/Atom/Bootstrap/Code/Source/Platform/Android/bootstrap_android_files.cmake similarity index 75% rename from Code/Framework/AzCore/Platform/Common/azcore_profile_telemetry_files.cmake rename to Gems/Atom/Bootstrap/Code/Source/Platform/Android/bootstrap_android_files.cmake index d23f8df790..bae11b561e 100644 --- a/Code/Framework/AzCore/Platform/Common/azcore_profile_telemetry_files.cmake +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Android/bootstrap_android_files.cmake @@ -7,6 +7,6 @@ # set(FILES - RadTelemetry/ProfileTelemetry.h - RadTelemetry/ProfileTelemetryBus.h + BootstrapSystemComponent_Traits_Platform.h ) + diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/Linux/BootstrapSystemComponent_Traits_Platform.h b/Gems/Atom/Bootstrap/Code/Source/Platform/Linux/BootstrapSystemComponent_Traits_Platform.h new file mode 100644 index 0000000000..d467de5e53 --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Linux/BootstrapSystemComponent_Traits_Platform.h @@ -0,0 +1,9 @@ +/* + * 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 + * + */ + +#define AZ_TRAIT_BOOTSTRAPSYSTEMCOMPONENT_PIPELINE_NAME "passes/MainRenderPipeline.azasset" diff --git a/cmake/3rdParty/FindRadTelemetry.cmake b/Gems/Atom/Bootstrap/Code/Source/Platform/Linux/bootstrap_linux_files.cmake similarity index 57% rename from cmake/3rdParty/FindRadTelemetry.cmake rename to Gems/Atom/Bootstrap/Code/Source/Platform/Linux/bootstrap_linux_files.cmake index 4af7423526..bae11b561e 100644 --- a/cmake/3rdParty/FindRadTelemetry.cmake +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Linux/bootstrap_linux_files.cmake @@ -6,9 +6,7 @@ # # -ly_add_external_target( - NAME RadTelemetry - 3RDPARTY_ROOT_DIRECTORY "${LY_RAD_TELEMETRY_INSTALL_ROOT}" - VERSION 3.5.0.17 - INCLUDE_DIRECTORIES Include +set(FILES + BootstrapSystemComponent_Traits_Platform.h ) + diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/Mac/BootstrapSystemComponent_Traits_Platform.h b/Gems/Atom/Bootstrap/Code/Source/Platform/Mac/BootstrapSystemComponent_Traits_Platform.h new file mode 100644 index 0000000000..d467de5e53 --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Mac/BootstrapSystemComponent_Traits_Platform.h @@ -0,0 +1,9 @@ +/* + * 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 + * + */ + +#define AZ_TRAIT_BOOTSTRAPSYSTEMCOMPONENT_PIPELINE_NAME "passes/MainRenderPipeline.azasset" diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/Mac/bootstrap_mac_files.cmake b/Gems/Atom/Bootstrap/Code/Source/Platform/Mac/bootstrap_mac_files.cmake new file mode 100644 index 0000000000..bae11b561e --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Mac/bootstrap_mac_files.cmake @@ -0,0 +1,12 @@ +# +# 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 + BootstrapSystemComponent_Traits_Platform.h +) + diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/Windows/BootstrapSystemComponent_Traits_Platform.h b/Gems/Atom/Bootstrap/Code/Source/Platform/Windows/BootstrapSystemComponent_Traits_Platform.h new file mode 100644 index 0000000000..d467de5e53 --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Windows/BootstrapSystemComponent_Traits_Platform.h @@ -0,0 +1,9 @@ +/* + * 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 + * + */ + +#define AZ_TRAIT_BOOTSTRAPSYSTEMCOMPONENT_PIPELINE_NAME "passes/MainRenderPipeline.azasset" diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/Windows/bootstrap_windows_files.cmake b/Gems/Atom/Bootstrap/Code/Source/Platform/Windows/bootstrap_windows_files.cmake new file mode 100644 index 0000000000..bae11b561e --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/Windows/bootstrap_windows_files.cmake @@ -0,0 +1,12 @@ +# +# 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 + BootstrapSystemComponent_Traits_Platform.h +) + diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/iOS/BootstrapSystemComponent_Traits_Platform.h b/Gems/Atom/Bootstrap/Code/Source/Platform/iOS/BootstrapSystemComponent_Traits_Platform.h new file mode 100644 index 0000000000..da63106e29 --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/iOS/BootstrapSystemComponent_Traits_Platform.h @@ -0,0 +1,9 @@ +/* + * 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 + * + */ + +#define AZ_TRAIT_BOOTSTRAPSYSTEMCOMPONENT_PIPELINE_NAME "passes/LowEndRenderPipeline.azasset" diff --git a/Gems/Atom/Bootstrap/Code/Source/Platform/iOS/bootstrap_ios_files.cmake b/Gems/Atom/Bootstrap/Code/Source/Platform/iOS/bootstrap_ios_files.cmake new file mode 100644 index 0000000000..bae11b561e --- /dev/null +++ b/Gems/Atom/Bootstrap/Code/Source/Platform/iOS/bootstrap_ios_files.cmake @@ -0,0 +1,12 @@ +# +# 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 + BootstrapSystemComponent_Traits_Platform.h +) + diff --git a/Gems/Atom/Feature/Common/Assets/Passes/LowEndRenderPipeline.azasset b/Gems/Atom/Feature/Common/Assets/Passes/LowEndRenderPipeline.azasset new file mode 100644 index 0000000000..fd0c9bd0ed --- /dev/null +++ b/Gems/Atom/Feature/Common/Assets/Passes/LowEndRenderPipeline.azasset @@ -0,0 +1,15 @@ +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "RenderPipelineDescriptor", + "ClassData": { + "Name": "LowEndPipeline", + "MainViewTag": "MainCamera", + "RootPassTemplate": "LowEndPipelineTemplate", + "RenderSettings": { + "MultisampleState": { + "samples": 1 + } + } + } +} diff --git a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/SphericalHarmonics/SphericalHarmonicsUtility.inl b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/SphericalHarmonics/SphericalHarmonicsUtility.inl index fb1e70b2a0..7446d2fa8f 100644 --- a/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/SphericalHarmonics/SphericalHarmonicsUtility.inl +++ b/Gems/Atom/Feature/Common/Code/Include/Atom/Feature/SphericalHarmonics/SphericalHarmonicsUtility.inl @@ -499,7 +499,7 @@ namespace AZ // outSH -> output SH coefficient array void EvalSHRotationFast(const float R[9], const uint32_t maxBand, const float* inSH, float* outSH) { - if (maxBand >= 0 && maxBand <= 2) + if (maxBand <= 2) { ZHF3(R, maxBand, inSH, outSH); } @@ -514,10 +514,7 @@ namespace AZ // outSH -> output SH coefficient array void EvalSHRotation(const float R[9], const uint32_t maxBand, const double* inSH, double* outSH) { - if (maxBand >= 0) - { - WignerD(R, maxBand, inSH, outSH); - } + WignerD(R, maxBand, inSH, outSH); } // Fast evaluation for first 3 bands diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/CapsuleLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/CapsuleLightFeatureProcessor.cpp index b75f0481ec..683295cf5b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/CapsuleLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/CapsuleLightFeatureProcessor.cpp @@ -107,8 +107,7 @@ namespace AZ if (m_deviceBufferNeedsUpdate) { - [[maybe_unused]] bool success = m_lightBufferHandler.UpdateBuffer(m_capsuleLightData.GetDataVector()); - AZ_Error(FeatureProcessorName, success, "Unable to update buffer during Simulate()."); + m_lightBufferHandler.UpdateBuffer(m_capsuleLightData.GetDataVector()); m_deviceBufferNeedsUpdate = false; } } diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalFeatureProcessor.cpp index b03d456505..4954ffc01c 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalFeatureProcessor.cpp @@ -112,8 +112,7 @@ namespace AZ if (m_deviceBufferNeedsUpdate) { - [[maybe_unused]] bool success = m_decalBufferHandler.UpdateBuffer(m_decalData.GetDataVector<0>()); - AZ_Error(FeatureProcessorName, success, "Unable to update buffer during Simulate()."); + m_decalBufferHandler.UpdateBuffer(m_decalData.GetDataVector<0>()); m_deviceBufferNeedsUpdate = false; } } diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp index 10dab85dcb..4ecfd7fc09 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp @@ -150,8 +150,7 @@ namespace AZ if (m_deviceBufferNeedsUpdate) { - [[maybe_unused]] bool success = m_decalBufferHandler.UpdateBuffer(m_decalData.GetDataVector()); - AZ_Error(FeatureProcessorName, success, "Unable to update buffer during Simulate()."); + m_decalBufferHandler.UpdateBuffer(m_decalData.GetDataVector()); m_deviceBufferNeedsUpdate = false; } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/BufferPool.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/BufferPool.h index abbd316bc7..2d226407c7 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/BufferPool.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/BufferPool.h @@ -223,6 +223,9 @@ namespace AZ /// Called when a buffer is being streamed asynchronously. virtual ResultCode StreamBufferInternal(const BufferStreamRequest& request); + //Called in order to do a simple mem copy allowing Null rhi to opt out + virtual void BufferCopy(void* destination, const void* source, size_t num); + ////////////////////////////////////////////////////////////////////////// BufferPoolDescriptor m_descriptor; diff --git a/Gems/Atom/RHI/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/Code/Source/RHI/BufferPool.cpp index 3c0359bf8a..9849db254e 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/BufferPool.cpp @@ -143,7 +143,7 @@ namespace AZ resultCode = MapBufferInternal(mapRequest, mapResponse); if (resultCode == ResultCode::Success) { - memcpy(mapResponse.m_data, initRequest.m_initialData, initRequest.m_descriptor.m_byteCount); + BufferCopy(mapResponse.m_data, initRequest.m_initialData, initRequest.m_descriptor.m_byteCount); UnmapBufferInternal(*initRequest.m_buffer); } } @@ -219,6 +219,11 @@ namespace AZ return m_descriptor; } + void BufferPool::BufferCopy(void* destination, const void* source, size_t num) + { + memcpy(destination, source, num); + } + ResultCode BufferPool::StreamBufferInternal([[maybe_unused]] const BufferStreamRequest& request) { return ResultCode::Unimplemented; diff --git a/Gems/Atom/RHI/Code/Source/RHI/BufferPoolBase.cpp b/Gems/Atom/RHI/Code/Source/RHI/BufferPoolBase.cpp index 8d61617da5..64f4454f0f 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/BufferPoolBase.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/BufferPoolBase.cpp @@ -34,7 +34,7 @@ namespace AZ if (!isDataValid) { - AZ_Warning("BufferPoolBase", false, "Failed to map buffer '%s'.", buffer.GetName().GetCStr()); + AZ_Error("BufferPoolBase", false, "Failed to map buffer '%s'.", buffer.GetName().GetCStr()); } ++buffer.m_mapRefCount; ++m_mapRefCount; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/IndirectBufferSignature.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/IndirectBufferSignature.cpp index 42c5f91817..526c913085 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/IndirectBufferSignature.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/IndirectBufferSignature.cpp @@ -111,6 +111,8 @@ namespace AZ void IndirectBufferSignature::ShutdownInternal() { + auto& device = static_cast(GetDevice()); + device.QueueForRelease(m_signature); m_signature = nullptr; m_stride = 0; } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.cpp index 5bb2be662d..f5eacfc576 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.cpp @@ -237,5 +237,14 @@ namespace AZ static constexpr D3D12_RANGE InvalidRange = {0,0}; m_readBackBuffer->Unmap(0, &InvalidRange); } + + void QueryPool::ShutdownInternal() + { + auto& device = static_cast(GetDevice()); + device.QueueForRelease(m_queryHeap); + m_queryHeap = nullptr; + device.QueueForRelease(m_readBackBuffer); + m_readBackBuffer = nullptr; + } } } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.h b/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.h index eca040b724..7b0ab512cc 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.h +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/QueryPool.h @@ -44,6 +44,7 @@ namespace AZ RHI::ResultCode InitInternal(RHI::Device& device, const RHI::QueryPoolDescriptor& descriptor) override; RHI::ResultCode InitQueryInternal(RHI::Query& query) override; RHI::ResultCode GetResultsInternal(uint32_t startIndex, uint32_t queryCount, uint64_t* results, uint32_t resultsCount, RHI::QueryResultFlagBits flags) override; + void ShutdownInternal() override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp index 383c5e5a79..05107128ad 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.cpp @@ -204,6 +204,7 @@ namespace AZ { RHI::Ptr nullMtlImagePtr = m_device->GetNullDescriptorManager().GetNullImage(shaderInputImage.m_type).GetMemory(); mtlTextures[imageArrayLen] = nullMtlImagePtr->GetGpuAddress>(); + m_useNullDescriptorHeap = true; } imageArrayLen++; } @@ -282,12 +283,16 @@ namespace AZ { RHI::Ptr nullMtlBufferMemPtr = nullDescriptorManager.GetNullImageBuffer().GetMemory(); mtlTextures[bufferArrayLen] = nullMtlBufferMemPtr->GetGpuAddress>(); + m_useNullDescriptorHeap = true; } else { RHI::Ptr nullMtlBufferMemPtr = nullDescriptorManager.GetNullBuffer().GetMemory(); mtlBuffers[bufferArrayLen] = nullMtlBufferMemPtr->GetGpuAddress>(); mtlBufferOffsets[bufferArrayLen] = nullDescriptorManager.GetNullBuffer().GetOffset(); + m_resourceBindings[shaderInputBuffer.m_name].insert( + ResourceBindingData{nullMtlBufferMemPtr, .m_bufferAccess = shaderInputBuffer.m_access} + ); } } @@ -499,5 +504,26 @@ namespace AZ resourcesToMakeResidentMap[key].emplace(mtlResourceToBind); } } + + bool ArgumentBuffer::IsNullHeapNeededForVertexStage(const ShaderResourceGroupVisibility& srgResourcesVisInfo) const + { + bool isUsedByVertexStage = false; + + //Iterate over all the SRG entries + for (const auto& it : srgResourcesVisInfo.m_resourcesStageMask) + { + //Only the ones not added to m_resourceBindings would require null heap + if( m_resourceBindings.find(it.first) == m_resourceBindings.end()) + { + isUsedByVertexStage |= RHI::CheckBitsAny(it.second, RHI::ShaderStageMask::Vertex); + } + } + return isUsedByVertexStage; + } + + bool ArgumentBuffer::IsNullDescHeapNeeded() const + { + return m_useNullDescriptorHeap; + } } } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.h b/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.h index cf229aeb75..a680516dc6 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.h +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ArgumentBuffer.h @@ -104,6 +104,8 @@ namespace AZ GraphicsResourcesToMakeResidentMap& resourcesToMakeResidentGraphics) const; void ClearResourceTracking(); + bool IsNullHeapNeededForVertexStage(const ShaderResourceGroupVisibility& srgResourcesVisInfo) const; + bool IsNullDescHeapNeeded() const; ////////////////////////////////////////////////////////////////////////// // RHI::DeviceObject @@ -153,6 +155,7 @@ namespace AZ MemoryView m_argumentBuffer; MemoryView m_constantBuffer; #endif + bool m_useNullDescriptorHeap = false; }; } } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandList.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandList.cpp index 2614addfe3..3c45e69d8b 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandList.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandList.cpp @@ -245,6 +245,8 @@ namespace AZ bool CommandList::SetArgumentBuffers(const PipelineState* pipelineState, RHI::PipelineStateType stateType) { + bool bindNullDescriptorHeap = false; + MTLRenderStages mtlRenderStagesForNullDescHeap = 0; ShaderResourceBindings& bindings = GetShaderResourceBindingsByPipelineType(stateType); const PipelineLayout& pipelineLayout = pipelineState->GetPipelineLayout(); @@ -280,7 +282,8 @@ namespace AZ uint32_t srgVisIndex = pipelineLayout.GetIndexBySlot(shaderResourceGroup->GetBindingSlot()); const RHI::ShaderStageMask& srgVisInfo = pipelineLayout.GetSrgVisibility(srgVisIndex); - + const ShaderResourceGroupVisibility& srgResourcesVisInfo = pipelineLayout.GetSrgResourcesVisibility(srgVisIndex); + bool isSrgUpdatd = bindings.m_srgsByIndex[slot] != shaderResourceGroup; if(isSrgUpdatd) { @@ -291,6 +294,9 @@ namespace AZ if(srgVisInfo != RHI::ShaderStageMask::None) { + bool isNullDescHeapNeeded = compiledArgBuffer.IsNullDescHeapNeeded(); + bindNullDescriptorHeap |= isNullDescHeapNeeded; + //For graphics and compute shader stages, cache all the argument buffers, offsets and track the min/max indices if(m_commandEncoderType == CommandEncoderType::Render) { @@ -300,7 +306,9 @@ namespace AZ mtlVertexArgBuffers[slotIndex] = argBuffer; mtlVertexArgBufferOffsets[slotIndex] = argBufferOffset; bufferVertexRegisterIdMin = AZStd::min(slotIndex, bufferVertexRegisterIdMin); - bufferVertexRegisterIdMax = AZStd::max(slotIndex, bufferVertexRegisterIdMax); + bufferVertexRegisterIdMax = AZStd::max(slotIndex, bufferVertexRegisterIdMax); + mtlRenderStagesForNullDescHeap = shaderResourceGroup->IsNullHeapNeededForVertexStage(srgResourcesVisInfo) ? + mtlRenderStagesForNullDescHeap | MTLRenderStageVertex : mtlRenderStagesForNullDescHeap; } if( numBitsSet > 1 || srgVisInfo == RHI::ShaderStageMask::Fragment) @@ -309,6 +317,7 @@ namespace AZ mtlFragmentOrComputeArgBufferOffsets[slotIndex] = argBufferOffset; bufferFragmentOrComputeRegisterIdMin = AZStd::min(slotIndex, bufferFragmentOrComputeRegisterIdMin); bufferFragmentOrComputeRegisterIdMax = AZStd::max(slotIndex, bufferFragmentOrComputeRegisterIdMax); + mtlRenderStagesForNullDescHeap = isNullDescHeapNeeded ? mtlRenderStagesForNullDescHeap | MTLRenderStageFragment : mtlRenderStagesForNullDescHeap; } } else if(m_commandEncoderType == CommandEncoderType::Compute) @@ -329,7 +338,7 @@ namespace AZ bindings.m_srgVisHashByIndex[slot] = srgResourcesVisHash; if(srgVisInfo != RHI::ShaderStageMask::None) { - const ShaderResourceGroupVisibility& srgResourcesVisInfo = pipelineLayout.GetSrgResourcesVisibility(srgVisIndex); + //For graphics and compute encoder make the resource resident (call UseResource) for the duration //of the work associated with the current scope and ensure that it's in a @@ -396,6 +405,10 @@ namespace AZ stages: key.first.second]; } + if(bindNullDescriptorHeap) + { + MakeHeapsResident(mtlRenderStagesForNullDescHeap); + } return true; } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.cpp index b3dd209926..e386c25515 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.cpp @@ -64,6 +64,7 @@ namespace AZ { [m_encoder endEncoding]; m_encoder = nil; + m_isNullDescHeapBound = false; #if AZ_TRAIT_ATOM_METAL_COUNTER_SAMPLING if (m_supportsInterDrawTimestamps) { @@ -73,18 +74,25 @@ namespace AZ } } - void CommandListBase::MakeHeapsResident() + void CommandListBase::MakeHeapsResident(MTLRenderStages renderStages) { + if(m_isNullDescHeapBound) + { + return; + } + switch(m_commandEncoderType) { case CommandEncoderType::Render: { - id renderEncoder = GetEncoder>(); - for (id residentHeap : *m_residentHeaps) + if(renderStages != 0) { - //MTLRenderStageVertex is not added to this as it was causing an immediate gpu crash on ios (first buffer commit) - [renderEncoder useHeap : residentHeap - stages : MTLRenderStageFragment]; + id renderEncoder = GetEncoder>(); + for (id residentHeap : *m_residentHeaps) + { + [renderEncoder useHeap : residentHeap + stages : renderStages]; + } } break; } @@ -102,6 +110,7 @@ namespace AZ AZ_Assert(false, "Encoder Type not supported"); } } + m_isNullDescHeapBound = true; } void CommandListBase::CreateEncoder(CommandEncoderType encoderType) @@ -119,16 +128,12 @@ namespace AZ m_commandEncoderType = CommandEncoderType::Render; m_encoder = [m_mtlCommandBuffer renderCommandEncoderWithDescriptor : m_renderPassDescriptor]; m_renderPassDescriptor = nil; - MakeHeapsResident(); - break; } case CommandEncoderType::Compute: { m_commandEncoderType = CommandEncoderType::Compute; m_encoder = [m_mtlCommandBuffer computeCommandEncoder]; - MakeHeapsResident(); - break; } case CommandEncoderType::Blit: diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.h b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.h index b2c548c9c5..2f8905d61c 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.h +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListBase.h @@ -89,12 +89,14 @@ namespace AZ /// Cache multisample state. Used mainly to validate the MSAA image descriptor against the one passed into the pipelinestate RHI::MultisampleState m_renderPassMultiSampleState; + //! Go through all the heaps and call UseHeap on them to make them resident for the upcoming pass. + void MakeHeapsResident(MTLRenderStages renderStages); private: - //! Go through all the heaps and call UseHeap on them to make them resident for the upcoming pass. - void MakeHeapsResident(); + bool m_isEncoded = false; + bool m_isNullDescHeapBound = false; RHI::HardwareQueueClass m_hardwareQueueClass = RHI::HardwareQueueClass::Graphics; NSString* m_encoderScopeName = nullptr; id m_mtlCommandBuffer = nil; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp index 5288ec8e5a..e86ba3c2c3 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp @@ -126,10 +126,10 @@ namespace AZ Device& device = static_cast(GetDevice()); m_nullBuffer.m_name = "NULL_DESCRIPTOR_BUFFER"; - m_nullBuffer.m_bufferDescriptor.m_byteCount = 64; + m_nullBuffer.m_bufferDescriptor.m_byteCount = 1024; m_nullBuffer.m_bufferDescriptor.m_bindFlags = RHI::BufferBindFlags::ShaderWrite; m_nullBuffer.m_memoryView = device.CreateBufferCommitted(m_nullBuffer.m_bufferDescriptor); - + m_nullBuffer.m_memoryView.SetName( m_nullBuffer.m_name.c_str()); if(!m_nullBuffer.m_memoryView.IsValid()) { AZ_Assert(false, "Couldnt create a null buffer for ArgumentTable"); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.cpp index 9c4e13f713..1cba62b988 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.cpp @@ -36,5 +36,10 @@ namespace AZ { GetCompiledArgumentBuffer().CollectUntrackedResources(commandEncoder, srgResourcesVisInfo, resourcesToMakeResidentCompute, resourcesToMakeResidentGraphics); } + + bool ShaderResourceGroup::IsNullHeapNeededForVertexStage(const ShaderResourceGroupVisibility& srgResourcesVisInfo) const + { + return GetCompiledArgumentBuffer().IsNullHeapNeededForVertexStage(srgResourcesVisInfo); + } } } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.h b/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.h index 52ffabe106..cb69c0975e 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.h +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroup.h @@ -47,7 +47,8 @@ namespace AZ const ShaderResourceGroupVisibility& srgResourcesVisInfo, ArgumentBuffer::ComputeResourcesToMakeResidentMap& resourcesToMakeResidentCompute, ArgumentBuffer::GraphicsResourcesToMakeResidentMap& resourcesToMakeResidentGraphics) const; - + bool IsNullHeapNeededForVertexStage(const ShaderResourceGroupVisibility& srgResourcesVisInfo) const; + private: ShaderResourceGroup() = default; diff --git a/Gems/Atom/RHI/Null/Code/Source/RHI/BufferPool.h b/Gems/Atom/RHI/Null/Code/Source/RHI/BufferPool.h index 8d1936fc56..5b69c765f2 100644 --- a/Gems/Atom/RHI/Null/Code/Source/RHI/BufferPool.h +++ b/Gems/Atom/RHI/Null/Code/Source/RHI/BufferPool.h @@ -39,9 +39,10 @@ namespace AZ RHI::ResultCode InitBufferInternal([[maybe_unused]] RHI::Buffer& buffer, [[maybe_unused]] const RHI::BufferDescriptor& rhiDescriptor) override{ return RHI::ResultCode::Success;} void ShutdownResourceInternal([[maybe_unused]] RHI::Resource& resource) override {} RHI::ResultCode OrphanBufferInternal([[maybe_unused]] RHI::Buffer& buffer) override { return RHI::ResultCode::Success;} - RHI::ResultCode MapBufferInternal([[maybe_unused]] const RHI::BufferMapRequest& mapRequest, [[maybe_unused]] RHI::BufferMapResponse& response) override { return RHI::ResultCode::Unimplemented;} + RHI::ResultCode MapBufferInternal([[maybe_unused]] const RHI::BufferMapRequest& mapRequest, [[maybe_unused]] RHI::BufferMapResponse& response) override { return RHI::ResultCode::Success;} void UnmapBufferInternal([[maybe_unused]] RHI::Buffer& buffer) override {} RHI::ResultCode StreamBufferInternal([[maybe_unused]] const RHI::BufferStreamRequest& request) override { return RHI::ResultCode::Success;} + void BufferCopy([[maybe_unused]] void* destination, [[maybe_unused]] const void* source, [[maybe_unused]] size_t num) override {} ////////////////////////////////////////////////////////////////////////// }; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp index 87e7605c71..2d812c602f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/Buffer.cpp @@ -176,8 +176,7 @@ namespace AZ return RHI::ResultCode::Success; } - // ResultCode::Unimplemented is used by Null Renderer and hence is a valid use case - AZ_Error("Buffer", resultCode == AZ::RHI::ResultCode::Unimplemented, "Buffer::Init() failed to initialize RHI buffer. Error code: %d", static_cast(resultCode)); + AZ_Error("Buffer", false, "Buffer::Init() failed to initialize RHI buffer. Error code: %d", static_cast(resultCode)); return resultCode; } @@ -241,11 +240,6 @@ namespace AZ { return response.m_data; } - else if (result == RHI::ResultCode::Unimplemented) - { - // ResultCode::Unimplemented is used by Null Renderer and hence is a valid use case - return nullptr; - } else { AZ_Error("RPI::Buffer", false, "Failed to update RHI buffer. Error code: %d", result); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp index bb66526ea0..77e32cd040 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Buffer/BufferSystem.cpp @@ -136,6 +136,7 @@ namespace AZ return false; } + bufferPool->SetName(Name(AZStd::string::format("RPI::CommonBufferPool_%i", static_cast(poolType)))); RHI::ResultCode resultCode = bufferPool->Init(*device, bufferPoolDesc); if (resultCode != RHI::ResultCode::Success) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp index 841607404a..f07262f2ca 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp @@ -31,7 +31,7 @@ #include #endif -//Enables more inner-loop profiling scopes (can create high overhead in RadTelemetry if there are many-many objects in a scene) +//Enables more inner-loop profiling scopes (can create high overhead in telemetry if there are many-many objects in a scene) //#define AZ_CULL_PROFILE_DETAILED //Enables more detailed profiling descriptions within the culling system, but adds some performance overhead. 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 bd0cad9f4d..b4a0e2e068 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp @@ -199,7 +199,6 @@ namespace AZ if ((shaderVariantId.m_mask & option.GetBitMask()).any()) { optionValues.push_back(option.DecodeBits(shaderVariantId.m_key)); - AZ_Assert(optionValues.back() >= 0, "Invalid shader variant key"); } else { diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Application/AtomToolsApplication.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Application/AtomToolsApplication.h index 6421c877b0..d55755a242 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Application/AtomToolsApplication.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Application/AtomToolsApplication.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -113,6 +114,8 @@ namespace AtomToolsFramework AzToolsFramework::TraceLogger m_traceLogger; + AZStd::unique_ptr m_styleManager; + //! Local user settings are used to store material browser tree expansion state AZ::UserSettingsProvider m_localUserSettings; diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp index 4cc98a15aa..b8426f7528 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Application/AtomToolsApplication.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include #include #include @@ -61,14 +63,26 @@ namespace AtomToolsFramework : Application(argc, argv) , AzQtApplication(*argc, *argv) { + // Suppress spam from the Source Control system + m_traceLogger.AddWindowFilter(AzToolsFramework::SCC_WINDOW); + + installEventFilter(new AzQtComponents::GlobalEventFilter(this)); + + AZ::IO::FixedMaxPath engineRootPath; + if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr) + { + settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder); + } + + m_styleManager.reset(new AzQtComponents::StyleManager(this)); + m_styleManager->initialize(this, engineRootPath); + connect(&m_timer, &QTimer::timeout, this, [&]() { this->PumpSystemEventLoopUntilEmpty(); this->Tick(); }); - // Suppress spam from the Source Control system - m_traceLogger.AddWindowFilter(AzToolsFramework::SCC_WINDOW); } AtomToolsApplication ::~AtomToolsApplication() diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/main.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/main.cpp index de29c27b71..05a044db0b 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/main.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/main.cpp @@ -6,46 +6,19 @@ * */ -#if !defined(Q_MOC_RUN) #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#endif - int main(int argc, char** argv) { AzQtComponents::AzQtApplication::InitializeDpiScaling(); MaterialEditor::MaterialEditorApplication app(&argc, &argv); - if (!app.LaunchLocalServer()) + if (app.LaunchLocalServer()) { - return 0; + app.Start(AZ::ComponentApplication::Descriptor{}); + app.exec(); + app.Stop(); } - app.installEventFilter(new AzQtComponents::GlobalEventFilter(&app)); - - AZ::IO::FixedMaxPath engineRootPath; - if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr) - { - settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder); - } - - AzQtComponents::StyleManager styleManager(&app); - styleManager.initialize(&app, engineRootPath); - - app.Start(AZ::ComponentApplication::Descriptor{}); - app.exec(); - app.Stop(); return 0; } diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/main.cpp b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/main.cpp index cf3f25cf6c..8291ce587e 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/main.cpp +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/main.cpp @@ -6,46 +6,19 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include +#include int main(int argc, char** argv) { AzQtComponents::AzQtApplication::InitializeDpiScaling(); ShaderManagementConsole::ShaderManagementConsoleApplication app(&argc, &argv); - if (!app.LaunchLocalServer()) + if (app.LaunchLocalServer()) { - return 0; + app.Start(AZ::ComponentApplication::Descriptor{}); + app.exec(); + app.Stop(); } - app.installEventFilter(new AzQtComponents::GlobalEventFilter(&app)); - - AZ::IO::FixedMaxPath engineRootPath; - if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr) - { - settingsRegistry->Get(engineRootPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder); - } - - AzQtComponents::StyleManager styleManager(&app); - styleManager.initialize(&app, engineRootPath); - - app.Start(AZ::ComponentApplication::Descriptor{}); - app.exec(); - app.Stop(); return 0; } diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index e6bde136f8..9ebd0f7a26 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -834,8 +834,10 @@ namespace AZ { // Check whether it should be sorted by name. const uint32_t sortType = static_cast(m_sortType); + AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option") bool sortByName = (sortType >= static_cast(ProfilerSortType::Alphabetical) && (sortType < static_cast(ProfilerSortType::AlphabeticalCount))); + AZ_POP_DISABLE_WARNING if (ImGui::Selectable("Pass Names", sortByName)) { @@ -1011,7 +1013,7 @@ namespace AZ const uint32_t countNumerical = static_cast(count); const uint32_t offset = static_cast(m_sortType) - startNumerical; - if (offset < countNumerical && offset >= 0u) + if (offset < countNumerical) { // Change the sorting order. m_sortType = static_cast(((offset + 1u) % countNumerical) + startNumerical); @@ -1107,7 +1109,7 @@ namespace AZ { ImGui::TableSetupColumn("Parent pool"); ImGui::TableSetupColumn("Name"); - ImGui::TableSetupColumn("Size (MB)", 0, 100.0f); + ImGui::TableSetupColumn("Size (MB)"); ImGui::TableSetupColumn("BindFlags", ImGuiTableColumnFlags_NoSort); ImGui::TableHeadersRow(); ImGui::TableNextColumn(); @@ -1133,7 +1135,7 @@ namespace AZ ImGui::TableNextColumn(); ImGui::Text(tableRow.m_bufImgName.GetCStr()); ImGui::TableNextColumn(); - ImGui::Text("%.2f", 1.0f * tableRow.m_sizeInBytes / GpuProfilerImGuiHelper::MB); + ImGui::Text("%.4f", 1.0f * tableRow.m_sizeInBytes / GpuProfilerImGuiHelper::MB); ImGui::TableNextColumn(); ImGui::Text(tableRow.m_bindFlags.c_str()); ImGui::TableNextColumn(); @@ -1271,6 +1273,7 @@ namespace AZ m_nameFilter.Draw("Search"); DrawTable(); } + ImGui::End(); } // --- ImGuiGpuProfiler --- diff --git a/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.h b/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.h index bdfc28c34c..d4855306be 100644 --- a/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.h +++ b/Gems/AtomLyIntegration/ImguiAtom/Code/Source/DebugConsole.h @@ -122,7 +122,6 @@ namespace AZ int m_currentHistoryIndex = -1; //!< The current index into the input history when browsing. int m_maxEntriesToDisplay = DefaultMaxEntriesToDisplay; //!< The maximum entries to display. int m_maxInputHistorySize = DefaultMaxInputHistorySize; //!< The maximum input history size. - int m_logLevelToSet = 0; //!< The minimum log level to set (see AZ::LogLevel). bool m_isShowing = false; //!< Is the debug console currently being displayed? bool m_autoScroll = true; //!< Should we auto-scroll as new entries are added? bool m_forceScroll = false; //!< Do we need to force scroll after input entered? diff --git a/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp b/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp index 738806a912..9a95f8bfa0 100644 --- a/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp +++ b/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -1779,8 +1780,8 @@ namespace Audio AK::MemoryMgr::CategoryStats categoryStats; AK::MemoryMgr::GetCategoryStats(memInfo.m_poolId, categoryStats); - memInfo.m_memoryUsed = categoryStats.uUsed; - memInfo.m_peakUsed = categoryStats.uPeakUsed; + memInfo.m_memoryUsed = static_cast(categoryStats.uUsed); + memInfo.m_peakUsed = static_cast(categoryStats.uPeakUsed); memInfo.m_numAllocs = categoryStats.uAllocs; memInfo.m_numFrees = categoryStats.uFrees; } @@ -1789,9 +1790,9 @@ namespace Audio AK::MemoryMgr::GetGlobalStats(globalStats); auto& memInfo = m_debugMemoryInfo.back(); - memInfo.m_memoryReserved = globalStats.uReserved; - memInfo.m_memoryUsed = globalStats.uUsed; - memInfo.m_peakUsed = globalStats.uMax; + memInfo.m_memoryReserved = static_cast(globalStats.uReserved); + memInfo.m_memoryUsed = static_cast(globalStats.uUsed); + memInfo.m_peakUsed = static_cast(globalStats.uMax); // return the memory infos... return m_debugMemoryInfo; diff --git a/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp b/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp index bfb1254e52..07113e09d3 100644 --- a/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp +++ b/Gems/AudioEngineWwise/Code/Source/Engine/FileIOHandler_wwise.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioInternalInterfaces.h b/Gems/AudioSystem/Code/Source/Engine/AudioInternalInterfaces.h index feb1cd8c0f..35d656c337 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioInternalInterfaces.h +++ b/Gems/AudioSystem/Code/Source/Engine/AudioInternalInterfaces.h @@ -769,124 +769,6 @@ namespace Audio return (eStatus == eARS_SUCCESS || eStatus == eARS_FAILURE); } -#if !defined(AUDIO_RELEASE) - // Debug Logging Helper - AZStd::string ToString() - { - static const AZStd::unordered_map managerRequests - { - { eAMRT_INIT_AUDIO_IMPL, "INIT IMPL" }, - { eAMRT_RELEASE_AUDIO_IMPL, "RELEASE IMPL" }, - { eAMRT_RESERVE_AUDIO_OBJECT_ID, "RESERVE OBJECT ID" }, - { eAMRT_CREATE_SOURCE, "CREATE SOURCE" }, - { eAMRT_DESTROY_SOURCE, "DESTROY SOURCE" }, - { eAMRT_PARSE_CONTROLS_DATA, "PARSE CONTROLS" }, - { eAMRT_PARSE_PRELOADS_DATA, "PARSE PRELOADS" }, - { eAMRT_CLEAR_CONTROLS_DATA, "CLEAR CONTROLS" }, - { eAMRT_CLEAR_PRELOADS_DATA, "CLEAR PRELOADS" }, - { eAMRT_PRELOAD_SINGLE_REQUEST, "PRELOAD SINGLE" }, - { eAMRT_UNLOAD_SINGLE_REQUEST, "UNLOAD SINGLE" }, - { eAMRT_UNLOAD_AFCM_DATA_BY_SCOPE, "UNLOAD SCOPE" }, - { eAMRT_REFRESH_AUDIO_SYSTEM, "REFRESH AUDIO SYSTEM" }, - { eAMRT_LOSE_FOCUS, "LOSE FOCUS" }, - { eAMRT_GET_FOCUS, "GET FOCUS" }, - { eAMRT_MUTE_ALL, "MUTE" }, - { eAMRT_UNMUTE_ALL, "UNMUTE" }, - { eAMRT_STOP_ALL_SOUNDS, "STOP ALL" }, - { eAMRT_DRAW_DEBUG_INFO, "DRAW DEBUG" }, - { eAMRT_CHANGE_LANGUAGE, "CHANGE LANGUAGE" }, - { eAMRT_SET_AUDIO_PANNING_MODE, "SET PANNING MODE" }, - }; - static const AZStd::unordered_map callbackRequests - { - { eACMRT_REPORT_STARTED_EVENT, "STARTED EVENT" }, - { eACMRT_REPORT_FINISHED_EVENT, "FINISHED EVENT" }, - { eACMRT_REPORT_FINISHED_TRIGGER_INSTANCE, "FINISHED TRIGGER INSTANCE" }, - }; - static const AZStd::unordered_map listenerRequests - { - { eALRT_SET_POSITION, "SET POSITION" }, - }; - static const AZStd::unordered_map objectRequests - { - { eAORT_PREPARE_TRIGGER, "PREPARE TRIGGER" }, - { eAORT_UNPREPARE_TRIGGER, "UNPREPARE TRIGGER" }, - { eAORT_EXECUTE_TRIGGER, "EXECUTE TRIGGER" }, - { eAORT_STOP_TRIGGER, "STOP TRIGGER" }, - { eAORT_STOP_ALL_TRIGGERS, "STOP ALL" }, - { eAORT_SET_POSITION, "SET POSITION" }, - { eAORT_SET_RTPC_VALUE, "SET RTPC" }, - { eAORT_SET_SWITCH_STATE, "SET SWITCH" }, - { eAORT_SET_ENVIRONMENT_AMOUNT, "SET ENV AMOUNT" }, - { eAORT_RESET_ENVIRONMENTS, "RESET ENVS" }, - { eAORT_RESET_RTPCS, "RESET RTPCS" }, - { eAORT_RELEASE_OBJECT, "RELEASE OBJECT" }, - { eAORT_EXECUTE_SOURCE_TRIGGER, "EXECUTE SOURCE TRIGGER" }, - { eAORT_SET_MULTI_POSITIONS, "SET MULTI POSITIONS" }, - }; - - std::stringstream ss; - - ss << "AudioRequest("; - - if (pData->eRequestType == eART_AUDIO_MANAGER_REQUEST) - { - ss << "AUDIO MANAGER : "; - auto requestStr = managerRequests.at(static_cast(pData.get())->eType); - ss << requestStr.c_str(); - } - - if (pData->eRequestType == eART_AUDIO_CALLBACK_MANAGER_REQUEST) - { - ss << "AUDIO CALLBACK MGR : "; - auto requestStr = callbackRequests.at(static_cast(pData.get())->eType); - ss << requestStr.c_str(); - } - - if (pData->eRequestType == eART_AUDIO_LISTENER_REQUEST) - { - ss << "AUDIO LISTENER : "; - auto requestStr = listenerRequests.at(static_cast(pData.get())->eType); - ss << requestStr.c_str(); - } - if (pData->eRequestType == eART_AUDIO_OBJECT_REQUEST) - { - ss << "AUDIO OBJECT : "; - auto requestStr = objectRequests.at(static_cast(pData.get())->eType); - ss << requestStr.c_str(); - } - - ss << "): ["; - if (nFlags & eARF_PRIORITY_NORMAL) - { - ss << "PRIORITY NORMAL, "; - } - if (nFlags & eARF_PRIORITY_HIGH) - { - ss << "PRIORITY HIGH, "; - } - if (nFlags & eARF_EXECUTE_BLOCKING) - { - ss << "EXECUTE BLOCKING, "; - } - if (nFlags & eARF_SYNC_CALLBACK) - { - ss << "SYNC CALLBACK, "; - } - if (nFlags & eARF_SYNC_FINISHED_CALLBACK) - { - ss << "SYNC FINISHED CALLBACK, "; - } - if (nFlags & eARF_THREAD_SAFE_PUSH) - { - ss << "THREAD SAFE PUSH, "; - } - ss << "]"; - - return AZStd::string(ss.str().c_str()); - } -#endif // !AUDIO_RELEASE - TATLEnumFlagsType nFlags; TAudioObjectID nAudioObjectID; void* pOwner; diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp index 43ab47266a..af1dfedfaa 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp @@ -616,7 +616,7 @@ namespace Audio void CAudioSystem::ProcessRequestThreadSafe(CAudioRequestInternal request) { // Audio Thread! - AZ_PROFILE_SCOPE(Audio, "Thread-Safe Request: %s", request.ToString().c_str()); + AZ_PROFILE_SCOPE(Audio, "Process Thread-Safe Request"); 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(Audio, "Normal Request: %s", request.ToString().c_str()); + AZ_PROFILE_SCOPE(Audio, "Process Normal Request"); 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(Audio, "Blocking Request: %s", request.ToString().c_str()); + AZ_PROFILE_SCOPE(Audio, "Process Blocking Request"); if (request.eStatus == eARS_NONE) { diff --git a/Gems/BarrierInput/Code/Source/BarrierInputKeyboard.cpp b/Gems/BarrierInput/Code/Source/BarrierInputKeyboard.cpp index 5e486df680..93c485a790 100644 --- a/Gems/BarrierInput/Code/Source/BarrierInputKeyboard.cpp +++ b/Gems/BarrierInput/Code/Source/BarrierInputKeyboard.cpp @@ -147,7 +147,7 @@ namespace BarrierInput { inputChannelId = InputChannelIdByScanCodeTable[scanCode]; } - else if (0 <= (scanCode - 0x100) && scanCode < InputChannelIdByScanCodeWithExtendedPrefixTable.size()) + else if (0x100 <= scanCode && scanCode < InputChannelIdByScanCodeWithExtendedPrefixTable.size()) { inputChannelId = InputChannelIdByScanCodeWithExtendedPrefixTable[scanCode - 0x100]; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp index b6a3870073..8396ad7b83 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp @@ -497,13 +497,13 @@ namespace CommandSystem } // verify port ranges - if (m_sourcePort >= static_cast(sourceNode->GetOutputPorts().size()) || m_sourcePort < 0) + if (m_sourcePort >= static_cast(sourceNode->GetOutputPorts().size())) { outResult = AZStd::string::format("The output port number is not valid for the given node. Node '%s' only has %zu output ports.", sourceNode->GetName(), sourceNode->GetOutputPorts().size()); return false; } - if (m_targetPort >= static_cast(targetNode->GetInputPorts().size()) || m_targetPort < 0) + if (m_targetPort >= static_cast(targetNode->GetInputPorts().size())) { outResult = AZStd::string::format("The input port number is not valid for the given node. Node '%s' only has %zu input ports.", targetNode->GetName(), targetNode->GetInputPorts().size()); return false; diff --git a/Gems/EMotionFX/Code/MCore/Source/StringConversions.cpp b/Gems/EMotionFX/Code/MCore/Source/StringConversions.cpp index c6b84a9e04..88a22db245 100644 --- a/Gems/EMotionFX/Code/MCore/Source/StringConversions.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/StringConversions.cpp @@ -30,7 +30,7 @@ namespace MCore // find the last letter index from the right size_t lastIndex = AZStd::string::npos; const size_t numCharacters = prefixString.size(); - for (size_t i = numCharacters - 1; i >= 0; --i) + for (int i = static_cast(numCharacters) - 1; i >= 0; --i) { if (!AZStd::is_digit(prefixString[i])) { diff --git a/Gems/GameState/Code/CMakeLists.txt b/Gems/GameState/Code/CMakeLists.txt index 7aa99446cb..debedd8500 100644 --- a/Gems/GameState/Code/CMakeLists.txt +++ b/Gems/GameState/Code/CMakeLists.txt @@ -17,8 +17,8 @@ ly_add_target( PUBLIC Include BUILD_DEPENDENCIES - PRIVATE - Legacy::CryCommon + PUBLIC + AZ::AzCore ) ly_add_target( @@ -33,7 +33,6 @@ ly_add_target( Include BUILD_DEPENDENCIES PRIVATE - Legacy::CryCommon Gem::GameState.Static ) @@ -58,7 +57,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) BUILD_DEPENDENCIES PRIVATE AZ::AzTest - Legacy::CryCommon Gem::GameState.Static ) ly_add_googletest( diff --git a/Gems/GameStateSamples/Code/CMakeLists.txt b/Gems/GameStateSamples/Code/CMakeLists.txt index 34132e67b1..5d1d180de0 100644 --- a/Gems/GameStateSamples/Code/CMakeLists.txt +++ b/Gems/GameStateSamples/Code/CMakeLists.txt @@ -21,6 +21,7 @@ ly_add_target( INTERFACE Gem::GameState Gem::LocalUser + Gem::LyShine.Static Gem::SaveData.Static Gem::MessagePopup.Static Legacy::CryCommon @@ -47,6 +48,7 @@ ly_add_target( Gem::LmbrCentral ) -# Clients and Servers use the above module. There is no editor or tools module required. -ly_create_alias(NAME GameStateSamples.Clients NAMESPACE Gem TARGETS GameStateSamples) -ly_create_alias(NAME GameStateSamples.Servers NAMESPACE Gem TARGETS GameStateSamples) +# Clients and Servers use the above module, and it contains assets so is needed by builders. +ly_create_alias(NAME GameStateSamples.Clients NAMESPACE Gem TARGETS Gem::GameStateSamples) +ly_create_alias(NAME GameStateSamples.Servers NAMESPACE Gem TARGETS Gem::GameStateSamples) +ly_create_alias(NAME GameStateSamples.Builders NAMESPACE Gem TARGETS Gem::UiBasics.Builders Gem::LyShineExamples.Builders) diff --git a/Gems/GameStateSamples/Code/Source/GameStateSamplesModule.cpp b/Gems/GameStateSamples/Code/Source/GameStateSamplesModule.cpp index 24a29c97ab..f175619bf4 100644 --- a/Gems/GameStateSamples/Code/Source/GameStateSamplesModule.cpp +++ b/Gems/GameStateSamples/Code/Source/GameStateSamplesModule.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -55,6 +56,7 @@ namespace GameStateSamples //! class GameStateSamplesModule : public CryHooksModule + , public AZ::TickBus::Handler , public GameOptionRequestBus::Handler { public: @@ -86,6 +88,22 @@ namespace GameStateSamples { CryHooksModule::OnCrySystemInitialized(system, systemInitParams); + AZ::TickBus::Handler::BusConnect(); + } + + void OnTick([[maybe_unused]]float deltaTime, [[maybe_unused]]AZ::ScriptTimePoint scriptTimePoint) override + { + // Ideally this would be called at startup (either above in OnCrySystemInitialized, or better during AZ system component + // initialisation), but because the initial game state depends on loading a UI canvas using LYShine we need to wait until + // the first tick, because LyShine in turn is not properly initialized until UiRenderer::OnBootstrapSceneReady has been + // called, which doesn't happen until a queued tick event that gets called right at the end of initialisation before we + // enter the main game loop. + CreateAndPushInitialGameState(); + AZ::TickBus::Handler::BusDisconnect(); + } + + void CreateAndPushInitialGameState() + { REGISTER_INT("sys_primaryUserSelectionEnabled", 2, VF_NULL, "Controls whether the game forces selection of a primary user at startup.\n" "0 : Skip selection of a primary user at startup on all platform.\n" diff --git a/Gems/GraphModel/Code/Tests/TestEnvironment.cpp b/Gems/GraphModel/Code/Tests/TestEnvironment.cpp index 67d2e7af80..b7724c6799 100644 --- a/Gems/GraphModel/Code/Tests/TestEnvironment.cpp +++ b/Gems/GraphModel/Code/Tests/TestEnvironment.cpp @@ -51,7 +51,7 @@ namespace GraphModelIntegrationTest GraphModel::DataTypePtr TestGraphContext::GetDataType(GraphModel::DataType::Enum typeEnum) const { - if (0 <= typeEnum && typeEnum < m_dataTypes.size()) + if (typeEnum < m_dataTypes.size()) { return m_dataTypes[typeEnum]; } diff --git a/Gems/LandscapeCanvas/Code/Source/Editor/Core/GraphContext.cpp b/Gems/LandscapeCanvas/Code/Source/Editor/Core/GraphContext.cpp index 9011a82069..615139333c 100644 --- a/Gems/LandscapeCanvas/Code/Source/Editor/Core/GraphContext.cpp +++ b/Gems/LandscapeCanvas/Code/Source/Editor/Core/GraphContext.cpp @@ -102,7 +102,7 @@ namespace LandscapeCanvas GraphModel::DataTypePtr GraphContext::GetDataType(GraphModel::DataType::Enum typeEnum) const { - if (0 <= typeEnum && typeEnum < m_dataTypes.size()) + if (typeEnum < m_dataTypes.size()) { return m_dataTypes[typeEnum]; } diff --git a/Gems/LmbrCentral/Code/include/LmbrCentral/Component/EditorWrappedComponentBase.inl b/Gems/LmbrCentral/Code/include/LmbrCentral/Component/EditorWrappedComponentBase.inl index 2c49710ddd..6a9fceabbf 100644 --- a/Gems/LmbrCentral/Code/include/LmbrCentral/Component/EditorWrappedComponentBase.inl +++ b/Gems/LmbrCentral/Code/include/LmbrCentral/Component/EditorWrappedComponentBase.inl @@ -212,8 +212,11 @@ namespace LmbrCentral template void EditorWrappedComponentBase::OnEntityVisibilityChanged(bool visibility) { - m_visible = visibility; - ConfigurationChanged(); + if (m_visible != visibility) + { + m_visible = visibility; + ConfigurationChanged(); + } } template diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp index 9da32d757a..39e84d24a7 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimPostFXNode.cpp @@ -294,7 +294,7 @@ unsigned int CAnimPostFXNode::GetParamCount() const //----------------------------------------------------------------------------- CAnimParamType CAnimPostFXNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)m_pDescription->m_nodeParams.size()) + if (nIndex < m_pDescription->m_nodeParams.size()) { return m_pDescription->m_nodeParams[nIndex].paramType; } diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp index 62cffcefb1..975e31d8cb 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimScreenFaderNode.cpp @@ -304,7 +304,7 @@ unsigned int CAnimScreenFaderNode::GetParamCount() const //----------------------------------------------------------------------------- CAnimParamType CAnimScreenFaderNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)s_screenFaderNodeParams.size()) + if (nIndex < s_screenFaderNodeParams.size()) { return s_screenFaderNodeParams[nIndex].paramType; } diff --git a/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp b/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp index fc58b91723..98bfef78a0 100644 --- a/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/CommentNode.cpp @@ -120,7 +120,7 @@ unsigned int CCommentNode::GetParamCount() const //----------------------------------------------------------------------------- CAnimParamType CCommentNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)s_nodeParameters.size()) + if (nIndex < s_nodeParameters.size()) { return s_nodeParameters[nIndex].paramType; } diff --git a/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp b/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp index 8c518f5a54..e2a9e816c6 100644 --- a/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/LayerNode.cpp @@ -144,7 +144,7 @@ unsigned int CLayerNode::GetParamCount() const //----------------------------------------------------------------------------- CAnimParamType CLayerNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)s_nodeParams.size()) + if (nIndex < (int)s_nodeParams.size()) { return s_nodeParams[nIndex].paramType; } diff --git a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp index 08d4d92e8b..74b0fb1063 100644 --- a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp @@ -180,7 +180,7 @@ unsigned int CAnimMaterialNode::GetParamCount() const ////////////////////////////////////////////////////////////////////////// CAnimParamType CAnimMaterialNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)s_nodeParams.size()) + if (nIndex < s_nodeParams.size()) { return s_nodeParams[nIndex].paramType; } diff --git a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp index d4b894dc92..79841e671b 100644 --- a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp @@ -260,7 +260,7 @@ unsigned int CAnimSceneNode::GetParamCount() const ////////////////////////////////////////////////////////////////////////// CAnimParamType CAnimSceneNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)s_nodeParams.size()) + if (nIndex < s_nodeParams.size()) { return s_nodeParams[nIndex].paramType; } diff --git a/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp b/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp index fd5e30199e..817c37483e 100644 --- a/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/ShadowsSetupNode.cpp @@ -87,7 +87,7 @@ unsigned int CShadowsSetupNode::GetParamCount() const //----------------------------------------------------------------------------- CAnimParamType CShadowsSetupNode::GetParamType(unsigned int nIndex) const { - if (nIndex >= 0 && nIndex < (int)ShadowSetupNode::s_shadowSetupParams.size()) + if (nIndex < ShadowSetupNode::s_shadowSetupParams.size()) { return ShadowSetupNode::s_shadowSetupParams[nIndex].paramType; } diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja index 84fdc9ae54..8cde9613b7 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Header.jinja @@ -130,9 +130,9 @@ void {{ PropertyName }}({{ ', '.join(paramDefines) }}); {# #} -{% macro DeclareRpcInvocations(Component, Section, HandleOn, ProctectedSection) %} +{% macro DeclareRpcInvocations(Component, Section, HandleOn, IsProtected) %} {% call(Property) AutoComponentMacros.ParseRemoteProcedures(Component, Section, HandleOn) %} -{% if Property.attrib['IsPublic']|booleanTrue == ProctectedSection %} +{% if Property.attrib['IsPublic']|booleanTrue != IsProtected %} {{ DeclareRpcInvocation(Property, HandleOn) -}} {% endif %} {% endcall %} @@ -386,8 +386,6 @@ namespace {{ Component.attrib['Namespace'] }} {{ DeclareNetworkPropertyAccessors(Component, 'Autonomous', 'Authority', false)|indent(8) -}} {{ DeclareNetworkPropertyAccessors(Component, 'Autonomous', 'Authority', true)|indent(8) -}} {{ DeclareArchetypePropertyGetters(Component)|indent(8) -}} - {{ DeclareRpcInvocations(Component, 'Server', 'Authority', false)|indent(8) -}} - {{ DeclareRpcInvocations(Component, 'Server', 'Authority', true)|indent(8) -}} {{ DeclareRpcInvocations(Component, 'Client', 'Authority', false)|indent(8) -}} {{ DeclareRpcInvocations(Component, 'Client', 'Authority', true)|indent(8) -}} {{ DeclareRpcInvocations(Component, 'Autonomous', 'Authority', false)|indent(8) -}} @@ -445,8 +443,8 @@ namespace {{ Component.attrib['Namespace'] }} static AZStd::unique_ptr AllocateComponentInput(); - {{ ComponentBaseName }}() = default; - ~{{ ComponentBaseName }}() override = default; + {{ ComponentBaseName }}(); + ~{{ ComponentBaseName }}() override; void Init() override; void Activate() override; diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index b89d1a2b2e..079cac329b 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -318,7 +318,11 @@ void {{ ClassName }}::{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.join(par constexpr AzNetworking::ReliabilityType isReliable = Multiplayer::ReliabilityType::Unreliable; {% endif %} +{% if InvokeFrom == 'Server' or InvokeFrom =='Client' %} + const Multiplayer::NetComponentId netComponentId = GetNetComponentId(); +{% else %} const Multiplayer::NetComponentId netComponentId = GetParent().GetNetComponentId(); +{% endif %} Multiplayer::NetworkEntityRpcMessage rpcMessage(Multiplayer::RpcDeliveryType::{{ InvokeFrom }}To{{ HandleOn }}, GetNetEntityId(), netComponentId, rpcId, isReliable); {% if paramNames|count > 0 %} {{ UpperFirst(Component.attrib['Name']) }}Internal::{{ UpperFirst(Property.attrib['Name']) }}RpcStruct rpcStruct({{ ', '.join(paramNames) }}); @@ -345,9 +349,9 @@ void {{ ClassName }}::Signal{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.jo {# #} -{% macro DefineRpcInvocations(Component, ClassName, InvokeFrom, HandleOn, ProctectedSection) %} +{% macro DefineRpcInvocations(Component, ClassName, InvokeFrom, HandleOn, IsProtected) %} {% call(Property) AutoComponentMacros.ParseRemoteProcedures(Component, InvokeFrom, HandleOn) %} -{% if Property.attrib['IsPublic']|booleanTrue == ProctectedSection %} +{% if Property.attrib['IsPublic']|booleanTrue != IsProtected %} {{ DefineRpcInvocation(Component, ClassName, Property, InvokeFrom, HandleOn) -}} {% if Property.attrib['GenerateEventBindings']|booleanTrue == true %} {{ DefineRpcSignal(Component, ClassName, Property, InvokeFrom) -}} @@ -1250,10 +1254,12 @@ namespace {{ Component.attrib['Namespace'] }} bool {{ RecordName }}::CanAttachRecord(Multiplayer::ReplicationRecord& replicationRecord) { bool canAttach{ true }; + AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option") // expression is always true canAttach &= replicationRecord.ContainsAuthorityToClientBits() ? (replicationRecord.GetRemainingAuthorityToClientBits() >= static_cast({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Authority', 'Client') }}::Count)) : true; canAttach &= replicationRecord.ContainsAuthorityToServerBits() ? (replicationRecord.GetRemainingAuthorityToServerBits() >= static_cast({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Authority', 'Server') }}::Count)) : true; canAttach &= replicationRecord.ContainsAuthorityToAutonomousBits() ? (replicationRecord.GetRemainingAuthorityToAutonomousBits() >= static_cast({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Authority', 'Autonomous') }}::Count)) : true; canAttach &= replicationRecord.ContainsAutonomousToAuthorityBits() ? (replicationRecord.GetRemainingAutonomousToAuthorityBits() >= static_cast({{ AutoComponentMacros.GetNetPropertiesDirtyEnumName(ComponentName, 'Autonomous', 'Authority') }}::Count)) : true; + AZ_POP_DISABLE_WARNING return canAttach; } @@ -1490,6 +1496,10 @@ namespace {{ Component.attrib['Namespace'] }} {% endif %} } + {{ ComponentBaseName }}::{{ ComponentBaseName }}() = default; + + {{ ComponentBaseName }}::~{{ ComponentBaseName }}() = default; + void {{ ComponentBaseName }}::Init() { if (m_netBindComponent == nullptr) diff --git a/Gems/PhysX/Code/CMakeLists.txt b/Gems/PhysX/Code/CMakeLists.txt index 80e8bee8e3..e2c3896356 100644 --- a/Gems/PhysX/Code/CMakeLists.txt +++ b/Gems/PhysX/Code/CMakeLists.txt @@ -226,13 +226,4 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) OUTPUT_SUBDIRECTORY Test.Assets/Gems/PhysX/Code/Tests ) -endif() - -ly_add_source_properties( - SOURCES - Editor/CollisionLayersWidget.cpp - Source/Collision.cpp - Source/Configuration/PhysXConfiguration.cpp - PROPERTY COMPILE_DEFINITIONS - VALUES TOUCHBENDING_LAYER_BIT=${LY_TOUCHBENDING_LAYER_BIT} -) +endif() \ No newline at end of file diff --git a/Gems/PhysX/Code/Editor/CollisionLayersWidget.cpp b/Gems/PhysX/Code/Editor/CollisionLayersWidget.cpp index 76a9c63ec0..49853312c6 100644 --- a/Gems/PhysX/Code/Editor/CollisionLayersWidget.cpp +++ b/Gems/PhysX/Code/Editor/CollisionLayersWidget.cpp @@ -22,9 +22,6 @@ namespace PhysX namespace Editor { const AZStd::string CollisionLayersWidget::s_defaultCollisionLayerName = "Default"; -#ifdef TOUCHBENDING_LAYER_BIT - const AZStd::string CollisionLayersWidget::s_touchBendCollisionLayerName = "TouchBend"; -#endif CollisionLayersWidget::CollisionLayersWidget(QWidget* parent) : QWidget(parent) @@ -150,12 +147,6 @@ namespace PhysX { lineEditCtrl->setEnabled(false); } -#ifdef TOUCHBENDING_LAYER_BIT - else if (lineEditCtrl->value() == s_touchBendCollisionLayerName) - { - lineEditCtrl->setEnabled(false); - } -#endif } } diff --git a/Gems/PhysX/Code/Editor/CollisionLayersWidget.h b/Gems/PhysX/Code/Editor/CollisionLayersWidget.h index ae21147cd2..2fb0af996b 100644 --- a/Gems/PhysX/Code/Editor/CollisionLayersWidget.h +++ b/Gems/PhysX/Code/Editor/CollisionLayersWidget.h @@ -35,9 +35,6 @@ namespace PhysX static const AZ::u32 s_maxCollisionLayerNameLength = 32; static const AZStd::string s_defaultCollisionLayerName; -#ifdef TOUCHBENDING_LAYER_BIT - static const AZStd::string s_touchBendCollisionLayerName; -#endif explicit CollisionLayersWidget(QWidget* parent = nullptr); diff --git a/Gems/PhysX/Code/Source/Collision.cpp b/Gems/PhysX/Code/Source/Collision.cpp index 0476dcfd09..361b1d13eb 100644 --- a/Gems/PhysX/Code/Source/Collision.cpp +++ b/Gems/PhysX/Code/Source/Collision.cpp @@ -38,21 +38,6 @@ namespace PhysX return physx::PxFilterFlag::eDEFAULT; } -//Enable/Disable this macro in the TouchBending Gem wscript -#ifdef TOUCHBENDING_LAYER_BIT - //If any of the actors is in the TouchBend layer then we are not interested - //in contact data, nor interested in eNOTIFY_* callbacks. - const AZ::u64 touchBendLayerMask = AzPhysics::CollisionLayer::TouchBend.GetMask(); - const AZ::u64 layer0 = Combine(filterData0.word0, filterData0.word1); - const AZ::u64 layer1 = Combine(filterData1.word0, filterData1.word1); - if (layer0 == touchBendLayerMask || layer1 == touchBendLayerMask) - { - pairFlags = physx::PxPairFlag::eSOLVE_CONTACT | - physx::PxPairFlag::eDETECT_DISCRETE_CONTACT; - return physx::PxFilterFlag::eDEFAULT; - } -#endif //TOUCHBENDING_LAYER_BIT - // generate contacts for all that were not filtered above pairFlags = physx::PxPairFlag::eCONTACT_DEFAULT | @@ -89,22 +74,6 @@ namespace PhysX return physx::PxFilterFlag::eDEFAULT; } -//Enable/Disable this macro in the TouchBending Gem wscript -#ifdef TOUCHBENDING_LAYER_BIT - //If any of the actors is in the TouchBend layer then we are not interested - //in contact data, nor interested in eNOTIFY_* callbacks. - const AZ::u64 layer0 = Combine(filterData0.word0, filterData0.word1); - const AZ::u64 layer1 = Combine(filterData1.word0, filterData1.word1); - const AZ::u64 touchBendLayerMask = AzPhysics::CollisionLayer::TouchBend.GetMask(); - if (layer0 == touchBendLayerMask || layer1 == touchBendLayerMask) - { - pairFlags = physx::PxPairFlag::eSOLVE_CONTACT | - physx::PxPairFlag::eDETECT_DISCRETE_CONTACT | - physx::PxPairFlag::eDETECT_CCD_CONTACT; - return physx::PxFilterFlag::eDEFAULT; - } -#endif - // generate contacts for all that were not filtered above pairFlags = physx::PxPairFlag::eCONTACT_DEFAULT | diff --git a/Gems/PhysX/Code/Source/Configuration/PhysXConfiguration.cpp b/Gems/PhysX/Code/Source/Configuration/PhysXConfiguration.cpp index 4e1b66017e..7a441a1c55 100644 --- a/Gems/PhysX/Code/Source/Configuration/PhysXConfiguration.cpp +++ b/Gems/PhysX/Code/Source/Configuration/PhysXConfiguration.cpp @@ -23,11 +23,6 @@ namespace PhysX configuration.m_collisionGroups.CreateGroup("All", AzPhysics::CollisionGroup::All, AzPhysics::CollisionGroups::Id(), true); configuration.m_collisionGroups.CreateGroup("None", AzPhysics::CollisionGroup::None, AzPhysics::CollisionGroups::Id::Create(), true); -#ifdef TOUCHBENDING_LAYER_BIT - configuration.m_collisionLayers.SetName(AzPhysics::CollisionLayer::TouchBend, "TouchBend"); - configuration.m_collisionGroups.CreateGroup("All_NoTouchBend", AzPhysics::CollisionGroup::All_NoTouchBend, AzPhysics::CollisionGroups::Id::Create(), true); -#endif - return configuration; } diff --git a/Gems/PhysX/Code/Source/RigidBodyStatic.cpp b/Gems/PhysX/Code/Source/RigidBodyStatic.cpp index 325c42960a..2d4d64e518 100644 --- a/Gems/PhysX/Code/Source/RigidBodyStatic.cpp +++ b/Gems/PhysX/Code/Source/RigidBodyStatic.cpp @@ -20,6 +20,8 @@ namespace PhysX { + AZ_CLASS_ALLOCATOR_IMPL(PhysX::StaticRigidBody, AZ::SystemAllocator, 0); + StaticRigidBody::StaticRigidBody(const AzPhysics::StaticRigidBodyConfiguration& configuration) { CreatePhysXActor(configuration); @@ -40,7 +42,7 @@ namespace PhysX // Invalidate user data so it sets m_pxStaticRigidBody->userData to nullptr. // It's appropriate to do this as m_pxStaticRigidBody is a shared pointer and - // techniqucally it could survive m_actorUserData life's spam. + // technically it could survive m_actorUserData life's span. m_actorUserData.Invalidate(); } diff --git a/Gems/PhysX/Code/Source/RigidBodyStatic.h b/Gems/PhysX/Code/Source/RigidBodyStatic.h index 5301fdce08..3226cae836 100644 --- a/Gems/PhysX/Code/Source/RigidBodyStatic.h +++ b/Gems/PhysX/Code/Source/RigidBodyStatic.h @@ -26,8 +26,8 @@ namespace PhysX : public AzPhysics::StaticRigidBody { public: - AZ_CLASS_ALLOCATOR(StaticRigidBody, AZ::SystemAllocator, 0); - AZ_RTTI(StaticRigidBody, "{06E960EF-E1F3-466F-B34F-800E32775092}", AzPhysics::StaticRigidBody); + AZ_CLASS_ALLOCATOR_DECL; + AZ_RTTI(PhysX::StaticRigidBody, "{06E960EF-E1F3-466F-B34F-800E32775092}", AzPhysics::StaticRigidBody); StaticRigidBody() = default; StaticRigidBody(const AzPhysics::StaticRigidBodyConfiguration& configuration); diff --git a/Gems/PhysX/Code/Tests/PhysXCollisionFilteringTest.cpp b/Gems/PhysX/Code/Tests/PhysXCollisionFilteringTest.cpp index dec01392b8..421cf375d9 100644 --- a/Gems/PhysX/Code/Tests/PhysXCollisionFilteringTest.cpp +++ b/Gems/PhysX/Code/Tests/PhysXCollisionFilteringTest.cpp @@ -24,7 +24,6 @@ namespace PhysX { protected: const AZStd::string DefaultLayer = "Default"; - const AZStd::string TouchBendLayer = "TouchBend"; const AZStd::string LayerA = "LayerA"; const AZStd::string LayerB = "LayerB"; const AZStd::string GroupA = "GroupA"; @@ -42,7 +41,6 @@ namespace PhysX AZStd::vector TestCollisionLayers = { DefaultLayer, - TouchBendLayer, // This is needed here as placeholder as collision events are disabled on this layer. LayerA, LayerB }; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h index e9586ac83a..90acd4fdc9 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h @@ -104,7 +104,9 @@ namespace ScriptCanvas private:\ static AZStd::string_view GetName(size_t i)\ {\ + AZ_PUSH_DISABLE_WARNING(4296, "-Wunknown-warning-option")\ static_assert(s_numArgs <= s_numNames, "Number of arguments is greater than number of names in " #NODE_NAME );\ + AZ_POP_DISABLE_WARNING\ /*static_assert(s_numResults <= s_numNames, "Number of results is greater than number of names in " #NODE_NAME );*/\ /*static_assert((s_numResults + s_numArgs) == s_numNames, "Argument name count + result name count != name count in " #NODE_NAME );*/\ static const AZStd::array s_names = {{ __VA_ARGS__ }};\ diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeableNodeOverloaded.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeableNodeOverloaded.cpp index 92039d3394..58af3a75de 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeableNodeOverloaded.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeableNodeOverloaded.cpp @@ -575,7 +575,7 @@ namespace ScriptCanvas const SlotExecution::Map* slotExecutionMap = GetSlotExecutionMap(); const auto& executionIns = slotExecutionMap->GetIns(); - if (methodIndex < 0 || methodIndex >= executionIns.size()) + if (methodIndex >= executionIns.size()) { return; } @@ -655,7 +655,7 @@ namespace ScriptCanvas AZ::Outcome NodeableNodeOverloaded::IsValidConfiguration(size_t methodIndex, const DataIndexMapping& inputMapping, const DataIndexMapping& outputMapping) { - if (methodIndex < 0 || methodIndex >= m_methodConfigurations.size()) + if (methodIndex >= m_methodConfigurations.size()) { return AZ::Failure(AZStd::string("Trying to access unknown method index.")); } @@ -716,7 +716,7 @@ namespace ScriptCanvas const SlotExecution::Map* slotExecutionMap = GetSlotExecutionMap(); const auto& executionIns = slotExecutionMap->GetIns(); - if (methodIndex < 0 || methodIndex >= executionIns.size()) + if (methodIndex >= executionIns.size()) { return AZ::Failure(AZStd::string("Invalid method index given to Nodeable"));; } @@ -785,7 +785,7 @@ namespace ScriptCanvas return AZ::Success(); } - if (methodIndex < 0 || methodIndex >= m_methodConfigurations.size()) + if (methodIndex >= m_methodConfigurations.size()) { return AZ::Failure(AZStd::string("Invalid Method index given to Nodeable Node Overloaded.")); } @@ -826,7 +826,7 @@ namespace ScriptCanvas { static const DataTypeSet k_emptySet; - if (methodIndex >= 0 && methodIndex < m_methodSelections.size()) + if (methodIndex < m_methodSelections.size()) { const OverloadConfiguration& overloadConfiguration = m_methodConfigurations[methodIndex]; size_t startIndex = NodeableNodeOverloadedCpp::AdjustForHiddenNodeableThisPointer(overloadConfiguration, 0); @@ -845,7 +845,7 @@ namespace ScriptCanvas return AZ::Success(); } - if (methodIndex < 0 || methodIndex >= m_methodConfigurations.size()) + if (methodIndex >= m_methodConfigurations.size()) { return AZ::Failure(AZStd::string("Invalid Method index given to Nodeable Node Overloaded.")); } @@ -883,7 +883,7 @@ namespace ScriptCanvas { static const DataTypeSet k_emptySet; - if (methodIndex >= 0 && methodIndex < m_methodSelections.size()) + if (methodIndex < m_methodSelections.size()) { return m_methodSelections[methodIndex].FindPossibleInputTypes(index); } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterface.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterface.cpp index 9d1626fb73..5a88036a0f 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterface.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterface.cpp @@ -37,7 +37,7 @@ namespace SubgraphInterfaceCpp AZ_INLINE const char* GetTabs(size_t tabs) { - AZ_Assert(tabs >= 0 && tabs <= k_maxTabs, "invalid argument to GetTabs"); + AZ_Assert(tabs <= k_maxTabs, "invalid argument to GetTabs"); static const char* const k_tabs[] = { diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/String/StringGenerics.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/String/StringGenerics.h index b3a4faae30..d5ee52cdb1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/String/StringGenerics.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/String/StringGenerics.h @@ -34,7 +34,7 @@ namespace ScriptCanvas { length = AZ::GetClamp(length, 0, aznumeric_cast(sourceString.size())); - if (length == 0 || index < 0 || index >= sourceString.size()) + if (length == 0 || index >= sourceString.size()) { return {}; } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp index 7c03102a71..a9ca526373 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/TranslationUtilities.cpp @@ -30,7 +30,7 @@ namespace TranslationUtilitiesCPP AZ_INLINE const char* GetTabs(size_t tabs) { - AZ_Assert(tabs >= 0 && tabs <= k_maxTabs, "invalid argument to GetTabs"); + AZ_Assert(tabs <= k_maxTabs, "invalid argument to GetTabs"); static const char* const k_tabs[] = { diff --git a/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventBroadcast.cpp b/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventBroadcast.cpp index c55495efad..1e5e741b5d 100644 --- a/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventBroadcast.cpp +++ b/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventBroadcast.cpp @@ -111,7 +111,7 @@ namespace ScriptEvents { // Iterate from end of parameters and count the number of consecutive valid BehaviorValue objects size_t numDefaultArguments = 0; - for (size_t i = GetNumArguments() - 1; i >= 0 && GetDefaultValue(i); --i, ++numDefaultArguments) + for (int i = static_cast(GetNumArguments()) - 1; i >= 0 && GetDefaultValue(static_cast(i)); --i, ++numDefaultArguments) { } return GetNumArguments() - numDefaultArguments; diff --git a/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventMethod.cpp b/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventMethod.cpp index 37f437670d..7153fda8bd 100644 --- a/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventMethod.cpp +++ b/Gems/ScriptEvents/Code/Include/ScriptEvents/Internal/BehaviorContextBinding/ScriptEventMethod.cpp @@ -121,7 +121,7 @@ namespace ScriptEvents { // Iterate from end of parameters and count the number of consecutive valid BehaviorValue objects size_t numDefaultArguments = 0; - for (size_t i = GetNumArguments() - 1; i >= 0 && GetDefaultValue(i); --i, ++numDefaultArguments) + for (int i = static_cast(GetNumArguments()) - 1; i >= 0 && GetDefaultValue(static_cast(i)); --i, ++numDefaultArguments) { } return GetNumArguments() - numDefaultArguments; diff --git a/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h b/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h index c72f725a07..29b3fac8c7 100644 --- a/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h +++ b/Gems/SurfaceData/Code/Include/SurfaceData/Utility/SurfaceDataUtility.h @@ -14,7 +14,6 @@ #include #include #include -#include namespace AZ { diff --git a/Gems/SurfaceData/Code/Source/SurfaceDataModule.cpp b/Gems/SurfaceData/Code/Source/SurfaceDataModule.cpp index 6c96ee9d27..4eef54669a 100644 --- a/Gems/SurfaceData/Code/Source/SurfaceDataModule.cpp +++ b/Gems/SurfaceData/Code/Source/SurfaceDataModule.cpp @@ -20,7 +20,7 @@ namespace SurfaceData SurfaceDataSystemComponent::CreateDescriptor(), SurfaceDataColliderComponent::CreateDescriptor(), SurfaceDataShapeComponent::CreateDescriptor(), - TerrainSurfaceDataSystemComponent::CreateDescriptor(), + Terrain::TerrainSurfaceDataSystemComponent::CreateDescriptor(), }); } @@ -28,7 +28,7 @@ namespace SurfaceData { return AZ::ComponentTypeList{ azrtti_typeid(), - azrtti_typeid(), + azrtti_typeid(), }; } } diff --git a/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.cpp b/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.cpp index 0f6eec73cd..a60bbc4034 100644 --- a/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.cpp +++ b/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.cpp @@ -6,20 +6,16 @@ * */ -#include "TerrainSurfaceDataSystemComponent.h" +#include #include #include #include #include -#include -#include #include #include #include -#include - -namespace SurfaceData +namespace Terrain { ////////////////////////////////////////////////////////////////////////// // TerrainSurfaceDataSystemConfig @@ -98,26 +94,23 @@ namespace SurfaceData void TerrainSurfaceDataSystemComponent::Activate() { - m_providerHandle = InvalidSurfaceDataRegistryHandle; - m_system = GetISystem(); - CrySystemEventBus::Handler::BusConnect(); - AZ::HeightmapUpdateNotificationBus::Handler::BusConnect(); + m_providerHandle = SurfaceData::InvalidSurfaceDataRegistryHandle; + AzFramework::Terrain::TerrainDataNotificationBus::Handler::BusConnect(); UpdateTerrainData(AZ::Aabb::CreateNull()); } void TerrainSurfaceDataSystemComponent::Deactivate() { - if (m_providerHandle != InvalidSurfaceDataRegistryHandle) + if (m_providerHandle != SurfaceData::InvalidSurfaceDataRegistryHandle) { - SurfaceDataSystemRequestBus::Broadcast(&SurfaceDataSystemRequestBus::Events::UnregisterSurfaceDataProvider, m_providerHandle); - m_providerHandle = InvalidSurfaceDataRegistryHandle; + SurfaceData::SurfaceDataSystemRequestBus::Broadcast( + &SurfaceData::SurfaceDataSystemRequestBus::Events::UnregisterSurfaceDataProvider, m_providerHandle); + m_providerHandle = SurfaceData::InvalidSurfaceDataRegistryHandle; } - SurfaceDataProviderRequestBus::Handler::BusDisconnect(); - AZ::HeightmapUpdateNotificationBus::Handler::BusDisconnect(); - CrySystemEventBus::Handler::BusDisconnect(); - m_system = nullptr; + SurfaceData::SurfaceDataProviderRequestBus::Handler::BusDisconnect(); + AzFramework::Terrain::TerrainDataNotificationBus::Handler::BusDisconnect(); // Clear the cached terrain bounds data { @@ -146,17 +139,8 @@ namespace SurfaceData return false; } - void TerrainSurfaceDataSystemComponent::OnCrySystemInitialized(ISystem& system, [[maybe_unused]] const SSystemInitParams& systemInitParams) - { - m_system = &system; - } - - void TerrainSurfaceDataSystemComponent::OnCrySystemShutdown([[maybe_unused]] ISystem& system) - { - m_system = nullptr; - } - - void TerrainSurfaceDataSystemComponent::GetSurfacePoints(const AZ::Vector3& inPosition, SurfacePointList& surfacePointList) const + void TerrainSurfaceDataSystemComponent::GetSurfacePoints( + const AZ::Vector3& inPosition, SurfaceData::SurfacePointList& surfacePointList) const { if (m_terrainBoundsIsValid) { @@ -168,12 +152,13 @@ namespace SurfaceData const float terrainHeight = terrain->GetHeight(inPosition, AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR, &isTerrainValidAtPoint); const bool isHole = !isTerrainValidAtPoint; - SurfacePoint point; + SurfaceData::SurfacePoint point; point.m_entityId = GetEntityId(); point.m_position = AZ::Vector3(inPosition.GetX(), inPosition.GetY(), terrainHeight); point.m_normal = terrain->GetNormal(inPosition); - const AZ::Crc32 terrainTag = isHole ? Constants::s_terrainHoleTagCrc : Constants::s_terrainTagCrc; - AddMaxValueForMasks(point.m_masks, terrainTag, 1.0f); + const AZ::Crc32 terrainTag = + isHole ? SurfaceData::Constants::s_terrainHoleTagCrc : SurfaceData::Constants::s_terrainTagCrc; + SurfaceData::AddMaxValueForMasks(point.m_masks, terrainTag, 1.0f); surfacePointList.push_back(point); } // Only one handler should exist. @@ -189,11 +174,11 @@ namespace SurfaceData return terrain ? terrain->GetTerrainAabb() : AZ::Aabb::CreateNull(); } - SurfaceTagVector TerrainSurfaceDataSystemComponent::GetSurfaceTags() const + SurfaceData::SurfaceTagVector TerrainSurfaceDataSystemComponent::GetSurfaceTags() const { - SurfaceTagVector tags; - tags.push_back(Constants::s_terrainHoleTagCrc); - tags.push_back(Constants::s_terrainTagCrc); + SurfaceData::SurfaceTagVector tags; + tags.push_back(SurfaceData::Constants::s_terrainHoleTagCrc); + tags.push_back(SurfaceData::Constants::s_terrainTagCrc); return tags; } @@ -203,7 +188,7 @@ namespace SurfaceData bool terrainValidAfterUpdate = false; AZ::Aabb terrainBoundsBeforeUpdate = m_terrainBounds; - SurfaceDataRegistryEntry registryEntry; + SurfaceData::SurfaceDataRegistryEntry registryEntry; registryEntry.m_entityId = GetEntityId(); registryEntry.m_bounds = GetSurfaceAabb(); registryEntry.m_tags = GetSurfaceTags(); @@ -215,38 +200,44 @@ namespace SurfaceData if (terrainValidBeforeUpdate && terrainValidAfterUpdate) { - AZ_Assert((m_providerHandle != InvalidSurfaceDataRegistryHandle), "Invalid surface data handle"); + AZ_Assert((m_providerHandle != SurfaceData::InvalidSurfaceDataRegistryHandle), "Invalid surface data handle"); // Our terrain was valid before and after, it just changed in some way. If we have a valid dirty region passed in // then it's possible that the heightmap has been modified in the Editor. Otherwise, just notify that the entire // terrain has changed in some way. if (dirtyRegion.IsValid()) { - SurfaceDataSystemRequestBus::Broadcast(&SurfaceDataSystemRequestBus::Events::RefreshSurfaceData, dirtyRegion); + SurfaceData::SurfaceDataSystemRequestBus::Broadcast( + &SurfaceData::SurfaceDataSystemRequestBus::Events::RefreshSurfaceData, dirtyRegion); } else { - SurfaceDataSystemRequestBus::Broadcast(&SurfaceDataSystemRequestBus::Events::UpdateSurfaceDataProvider, m_providerHandle, registryEntry); + SurfaceData::SurfaceDataSystemRequestBus::Broadcast( + &SurfaceData::SurfaceDataSystemRequestBus::Events::UpdateSurfaceDataProvider, m_providerHandle, registryEntry); } } else if (!terrainValidBeforeUpdate && terrainValidAfterUpdate) { // Our terrain has become valid, so register as a provider and save off the registry handles - AZ_Assert((m_providerHandle == InvalidSurfaceDataRegistryHandle), "Surface Provider data handle is initialized before our terrain became valid"); - SurfaceDataSystemRequestBus::BroadcastResult(m_providerHandle, &SurfaceDataSystemRequestBus::Events::RegisterSurfaceDataProvider, registryEntry); + AZ_Assert( + (m_providerHandle == SurfaceData::InvalidSurfaceDataRegistryHandle), + "Surface Provider data handle is initialized before our terrain became valid"); + SurfaceData::SurfaceDataSystemRequestBus::BroadcastResult( + m_providerHandle, &SurfaceData::SurfaceDataSystemRequestBus::Events::RegisterSurfaceDataProvider, registryEntry); // Start listening for surface data events - AZ_Assert((m_providerHandle != InvalidSurfaceDataRegistryHandle), "Invalid surface data handle"); - SurfaceDataProviderRequestBus::Handler::BusConnect(m_providerHandle); + AZ_Assert((m_providerHandle != SurfaceData::InvalidSurfaceDataRegistryHandle), "Invalid surface data handle"); + SurfaceData::SurfaceDataProviderRequestBus::Handler::BusConnect(m_providerHandle); } else if (terrainValidBeforeUpdate && !terrainValidAfterUpdate) { // Our terrain has stopped being valid, so unregister and stop listening for surface data events - AZ_Assert((m_providerHandle != InvalidSurfaceDataRegistryHandle), "Invalid surface data handle"); - SurfaceDataSystemRequestBus::Broadcast(&SurfaceDataSystemRequestBus::Events::UnregisterSurfaceDataProvider, m_providerHandle); - m_providerHandle = InvalidSurfaceDataRegistryHandle; + AZ_Assert((m_providerHandle != SurfaceData::InvalidSurfaceDataRegistryHandle), "Invalid surface data handle"); + SurfaceData::SurfaceDataSystemRequestBus::Broadcast( + &SurfaceData::SurfaceDataSystemRequestBus::Events::UnregisterSurfaceDataProvider, m_providerHandle); + m_providerHandle = SurfaceData::InvalidSurfaceDataRegistryHandle; - SurfaceDataProviderRequestBus::Handler::BusDisconnect(); + SurfaceData::SurfaceDataProviderRequestBus::Handler::BusDisconnect(); } else { @@ -255,8 +246,9 @@ namespace SurfaceData } - void TerrainSurfaceDataSystemComponent::HeightmapModified(const AZ::Aabb& bounds) + void TerrainSurfaceDataSystemComponent::OnTerrainDataChanged( + const AZ::Aabb& dirtyRegion, [[maybe_unused]] TerrainDataChangedMask dataChangedMask) { - UpdateTerrainData(bounds); + UpdateTerrainData(dirtyRegion); } } diff --git a/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.h b/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.h index aa5f4ab04c..a742eab78c 100644 --- a/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.h +++ b/Gems/SurfaceData/Code/Source/TerrainSurfaceDataSystemComponent.h @@ -10,12 +10,11 @@ #include #include #include -#include -#include +#include #include #include -namespace SurfaceData +namespace Terrain { class TerrainSurfaceDataSystemConfig : public AZ::ComponentConfig @@ -31,9 +30,8 @@ namespace SurfaceData */ class TerrainSurfaceDataSystemComponent : public AZ::Component - , private SurfaceDataProviderRequestBus::Handler - , private AZ::HeightmapUpdateNotificationBus::Handler - , private CrySystemEventBus::Handler + , private SurfaceData::SurfaceDataProviderRequestBus::Handler + , private AzFramework::Terrain::TerrainDataNotificationBus::Handler { friend class EditorTerrainSurfaceDataSystemComponent; TerrainSurfaceDataSystemComponent(const TerrainSurfaceDataSystemConfig&); @@ -58,25 +56,19 @@ namespace SurfaceData ////////////////////////////////////////////////////////////////////////// // SurfaceDataProviderRequestBus - void GetSurfacePoints(const AZ::Vector3& inPosition, SurfacePointList& surfacePointList) const; - - //////////////////////////////////////////////////////////////////////////// - // CrySystemEvents - void OnCrySystemInitialized(ISystem& system, const SSystemInitParams& systemInitParams) override; - void OnCrySystemShutdown(ISystem& system) override; + void GetSurfacePoints(const AZ::Vector3& inPosition, SurfaceData::SurfacePointList& surfacePointList) const; ////////////////////////////////////////////////////////////////////////// - // AZ::HeightmapUpdateNotificationBus - void HeightmapModified(const AZ::Aabb& bounds) override; + // AzFramework::Terrain::TerrainDataNotificationBus + void OnTerrainDataChanged(const AZ::Aabb& dirtyRegion, TerrainDataChangedMask dataChangedMask) override; private: void UpdateTerrainData(const AZ::Aabb& dirtyRegion); AZ::Aabb GetSurfaceAabb() const; - SurfaceTagVector GetSurfaceTags() const; - SurfaceDataRegistryHandle m_providerHandle = InvalidSurfaceDataRegistryHandle; + SurfaceData::SurfaceTagVector GetSurfaceTags() const; + SurfaceData::SurfaceDataRegistryHandle m_providerHandle = SurfaceData::InvalidSurfaceDataRegistryHandle; TerrainSurfaceDataSystemConfig m_configuration; - ISystem* m_system = nullptr; AZ::Aabb m_terrainBounds = AZ::Aabb::CreateNull(); AZStd::atomic_bool m_terrainBoundsIsValid{ false }; diff --git a/Tools/LyTestTools/ly_test_tools/report/rad_telemetry.py b/Tools/LyTestTools/ly_test_tools/report/rad_telemetry.py deleted file mode 100755 index 865cc4671c..0000000000 --- a/Tools/LyTestTools/ly_test_tools/report/rad_telemetry.py +++ /dev/null @@ -1,98 +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 - -Helpers for RAD Telemetry, currently only for Windows -""" - -import logging -import subprocess -import os - -import ly_test_tools.environment.process_utils as process_utils -from ly_test_tools import WINDOWS - -_RAD_DEFAULT_PORT = 4719 - -_CREATE_NEW_PROCESS_GROUP = 0x00000200 -_DETACHED_PROCESS = 0x00000008 -_WINDOWS_FLAGS = _CREATE_NEW_PROCESS_GROUP | _DETACHED_PROCESS - -RAD_TOOLS_SUBPATH = os.path.join("dev", "Gems", "RADTelemetry", "Tools") - -log = logging.getLogger(__name__) - - -def __set_firewall_rule(direction, port): - """ - Adds a Windows firewall rule if one does not yet exist. Requires administrator privilege. - - :param direction: Must be 'in' or 'out' - :param port: target port to open - :return: None - """ - - assert WINDOWS, "Only implemented for Windows platforms" - log.info(f"Setting firewall rule on port '{port}' for direction '{direction}'") - - show_rule = ['netsh', 'advfirewall', 'firewall', 'show', 'rule', 'name=RADTelemetry', f'dir={direction}'] - show_result = process_utils.safe_check_call(show_rule) - - if show_result == 0: - log.debug("Rule already exists") - else: - add_rule = ['netsh', 'advfirewall', 'firewall', 'add', 'rule', 'name=RADTelemetry', f'dir={direction}', - 'action=allow', 'protocol=TCP', f'localport={port}'] - process_utils.check_call(add_rule) - log.debug("Added new rule") - - -def set_firewall_rules(): - """ - Opens firewall ports necessary for a remote device to communicate with the RAD Telemetry server. - Requires administrator privilege. - - :return: None - """ - assert WINDOWS, "Only implemented for Windows platforms" - __set_firewall_rule(direction="in", port=_RAD_DEFAULT_PORT) - __set_firewall_rule(direction="out", port=_RAD_DEFAULT_PORT) - - -def launch_server(dev_path): - """ - Launches the RAD Telemetry server to collect telemetry captures. - - :param dev_path: path to the folder containing engineroot.txt - :return: None - """ - assert WINDOWS, "Only implemented for Windows platforms" - server_path = os.path.join(dev_path, RAD_TOOLS_SUBPATH, "tm_server.exe") - subprocess.Popen([server_path], creationflags=_WINDOWS_FLAGS, close_fds=True) - log.info(f"Launched RAD Server from {server_path}") - - -def terminate_servers(dev_path): - """ - Terminate the RAD Telemetry server and all related tools, important before collecting any of its captures - - :param dev_path: path to the folder containing engineroot.txt - :return: None - """ - assert WINDOWS, "Only implemented for Windows platforms" - rad_path = os.path.join(dev_path, RAD_TOOLS_SUBPATH) - process_utils.kill_processes_started_from(rad_path) - - -def get_capture_path(dev_path): - """ - Returns the path of the tm_server.exe file - - :return: path to the folder containing output for local servers - """ - assert WINDOWS, "Only implemented for Windows platforms" - get_folder_path = os.path.join(dev_path, RAD_TOOLS_SUBPATH, "tm_server.exe") - output = process_utils.check_output([get_folder_path]) - return output.strip() diff --git a/Tools/LyTestTools/tests/unit/test_builtin_helpers.py b/Tools/LyTestTools/tests/unit/test_builtin_helpers.py index 63dd051a62..9eb8a1703d 100755 --- a/Tools/LyTestTools/tests/unit/test_builtin_helpers.py +++ b/Tools/LyTestTools/tests/unit/test_builtin_helpers.py @@ -7,6 +7,7 @@ SPDX-License-Identifier: Apache-2.0 OR MIT Unit tests for ly_test_tools.builtin.helpers functions. """ import unittest.mock as mock +import os import pytest @@ -41,6 +42,8 @@ class MockedWorkspaceManager(ly_test_tools._internal.managers.workspace.Abstract ) +@mock.patch('ly_test_tools._internal.managers.abstract_resource_locator._find_project_json', + mock.MagicMock(return_value=os.path.join("mocked", "path"))) @mock.patch( 'ly_test_tools._internal.managers.abstract_resource_locator.AbstractResourceLocator', mock.MagicMock(return_value=MockedAbstractResourceLocator) diff --git a/Tools/LyTestTools/tests/unit/test_rad_telemetry.py b/Tools/LyTestTools/tests/unit/test_rad_telemetry.py deleted file mode 100755 index 76db056215..0000000000 --- a/Tools/LyTestTools/tests/unit/test_rad_telemetry.py +++ /dev/null @@ -1,88 +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 - -Unit Tests for ~/ly_test_tools/report/rad_telemetry.py -""" - -import unittest.mock as mock -import os -import pytest - -import ly_test_tools.report.rad_telemetry -from ly_test_tools import WINDOWS - -pytestmark = pytest.mark.SUITE_smoke - - -_RAD_DEFAULT_PORT = 4719 - -_CREATE_NEW_PROCESS_GROUP = 0x00000200 -_DETACHED_PROCESS = 0x00000008 -_WINDOWS_FLAGS = _CREATE_NEW_PROCESS_GROUP | _DETACHED_PROCESS - -RAD_TOOLS_SUBPATH = os.path.join("dev", "Gems", "RADTelemetry", "Tools") - - -@pytest.mark.skipif( - not WINDOWS, - reason="tests.unit.test_rad_telemetry is restricted to the Windows platform.") -class TestRADTelemetry: - - @mock.patch('ly_test_tools.environment.process_utils.check_call') - @mock.patch('ly_test_tools.environment.process_utils.safe_check_call') - def test_SetFirewallRules_ShowRuleResultNotZero_CallsAddRule(self, mock_safe_call, mock_call): - ly_test_tools.report.rad_telemetry.set_firewall_rules() - - mock_safe_call.call_args_list = [ - mock.call(['netsh', 'advfirewall', 'firewall', 'show', 'rule', 'name=RADTelemetry', 'dir=in']), - mock.call(['netsh', 'advfirewall', 'firewall', 'show', 'rule', 'name=RADTelemetry', 'dir=out']), - ] - mock_call.call_args_list = [ - mock.call( - ['netsh', 'advfirewall', 'firewall', 'add', 'rule', 'name=RADTelemetry', 'dir=in', - 'action=allow', 'protocol=TCP', 'localport={}'.format(_RAD_DEFAULT_PORT)]), - mock.call( - ['netsh', 'advfirewall', 'firewall', 'add', 'rule', 'name=RADTelemetry', 'dir=out', - 'action=allow', 'protocol=TCP', 'localport={}'.format(_RAD_DEFAULT_PORT)]), - ] - - assert mock_call.call_count == 2 - assert mock_safe_call.call_count == 2 - - @mock.patch('ly_test_tools.environment.process_utils.check_call') - @mock.patch('ly_test_tools.environment.process_utils.safe_check_call') - def test_SetFirewallRules_ShowRuleResultEqualsZero_AddRuleNotCalled(self, mock_safe_call, mock_call): - mock_safe_call.return_value = 0 - ly_test_tools.report.rad_telemetry.set_firewall_rules() - - mock_call.assert_not_called() - assert mock_safe_call.call_count == 2 - - @mock.patch('subprocess.Popen') - def test_LaunchServer_ValidDevPath_PopenSuccess(self, mock_popen): - mock_server_path = os.path.join('dev_path', RAD_TOOLS_SUBPATH, "tm_server.exe") - - ly_test_tools.report.rad_telemetry.launch_server('dev_path') - - mock_popen.assert_called_once_with([mock_server_path], creationflags=_WINDOWS_FLAGS, close_fds=True) - - @mock.patch('ly_test_tools.environment.process_utils.kill_processes_started_from') - def test_TerminateServer_ValidDevPath_KillsRADProcess(self, mock_kill_process): - mock_rad_path = os.path.join('dev_path', RAD_TOOLS_SUBPATH) - - ly_test_tools.report.rad_telemetry.terminate_servers('dev_path') - - mock_kill_process.assert_called_once_with(mock_rad_path) - - @mock.patch('ly_test_tools.environment.process_utils.check_output') - def test_TerminateServer_ValidDevPath_KillsRADProcess(self, mock_call): - mock_get_folder_path = os.path.join('dev_path', RAD_TOOLS_SUBPATH, "tm_server.exe") - mock_call.return_value = 'test' - - under_test = ly_test_tools.report.rad_telemetry.get_capture_path('dev_path') - - mock_call.assert_called_once_with([mock_get_folder_path]) - assert under_test == 'test' diff --git a/cmake/3rdParty/Platform/iOS/cmake_ios_files.cmake b/cmake/3rdParty/Platform/iOS/cmake_ios_files.cmake index dc02644f5b..10e3ad7ec2 100644 --- a/cmake/3rdParty/Platform/iOS/cmake_ios_files.cmake +++ b/cmake/3rdParty/Platform/iOS/cmake_ios_files.cmake @@ -8,6 +8,5 @@ set(FILES BuiltInPackages_ios.cmake - RadTelemetry_ios.cmake Wwise_ios.cmake ) diff --git a/cmake/3rdParty/cmake_files.cmake b/cmake/3rdParty/cmake_files.cmake index cf56031db6..5f67355965 100644 --- a/cmake/3rdParty/cmake_files.cmake +++ b/cmake/3rdParty/cmake_files.cmake @@ -10,7 +10,6 @@ set(FILES BuiltInPackages.cmake FindOpenGLInterface.cmake FindPIX.cmake - FindRadTelemetry.cmake FindVkValidation.cmake FindWwise.cmake ) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 0119f8d8bc..9353e4eb1c 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -39,11 +39,11 @@ ly_append_configurations_options( # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 - # /we4296 # 'operator': expression is always false + /we4296 # 'operator': expression is always false # /we4426 # optimization flags changed after including header, may be due to #pragma optimize() # /we4464 # relative include path contains '..' # /we4619 # #pragma warning: there is no warning number 'number' - # /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' looks useful + # /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' # /we5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file # /WE5032 # detected #pragma warning(push) with no corresponding #pragma warning(pop) diff --git a/scripts/build/package/Platform/3rdParty/package_filelists/3rdParty.json b/scripts/build/package/Platform/3rdParty/package_filelists/3rdParty.json index a9ed45daca..915368dd0b 100644 --- a/scripts/build/package/Platform/3rdParty/package_filelists/3rdParty.json +++ b/scripts/build/package/Platform/3rdParty/package_filelists/3rdParty.json @@ -12,7 +12,6 @@ "FbxSdk/2016.1.2-az.1/**": "#include", "OpenSSL/1.1.1b-noasm-az/**": "#include", "Qt/5.15.1.2-az/**": "#include", - "RadTelemetry/3.5.0.17/**": "#include", "tiff/3.9.5-az.3/**": "#include", "Wwise/2019.2.8.7432/**": "#include" }