diff --git a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py index c3c1c76611..90f9399c1c 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/atom_utils/material_editor_utils.py @@ -162,11 +162,11 @@ def select_model_config(configname): azlmbr.materialeditor.MaterialViewportRequestBus(azlmbr.bus.Broadcast, "SelectModelPresetByName", configname) -def destroy_main_window(): +def exit(): """ - Closes the Material Editor window + Closes the Material Editor """ - azlmbr.atomtools.AtomToolsMainWindowFactoryRequestBus(azlmbr.bus.Broadcast, "DestroyMainWindow") + azlmbr.atomtools.general.exit() def wait_for_condition(function, timeout_in_seconds=1.0): diff --git a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomMaterialEditor_BasicTests.py b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomMaterialEditor_BasicTests.py index bd00a84919..f881660f33 100644 --- a/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomMaterialEditor_BasicTests.py +++ b/AutomatedTesting/Gem/PythonTests/Atom/tests/hydra_AtomMaterialEditor_BasicTests.py @@ -214,7 +214,7 @@ def run(): (not material_editor.is_open(document1_id)) and (not material_editor.is_open(document2_id)) and (not material_editor.is_open(document3_id)), 2.0) - material_editor.destroy_main_window() + material_editor.exit() if __name__ == "__main__": diff --git a/AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Periodic.py b/AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Periodic.py index 887bfe2426..58a0b42394 100755 --- a/AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Periodic.py +++ b/AutomatedTesting/Gem/PythonTests/scripting/TestSuite_Periodic.py @@ -61,6 +61,7 @@ class TestAutomation(TestAutomationBase): from . import Graph_HappyPath_ZoomInZoomOut as test_module self._run_test(request, workspace, editor, test_module) + @pytest.mark.xfail(reason="Test fails on nightly build builds, it needs to be fixed.") def test_NodePalette_HappyPath_CanSelectNode(self, request, workspace, editor, launcher_platform): from . import NodePalette_HappyPath_CanSelectNode as test_module self._run_test(request, workspace, editor, test_module) @@ -113,6 +114,7 @@ class TestAutomation(TestAutomationBase): from . import Debugger_HappyPath_TargetMultipleGraphs as test_module self._run_test(request, workspace, editor, test_module) + @pytest.mark.xfail(reason="Test fails on nightly build builds, it needs to be fixed.") @pytest.mark.parametrize("level", ["tmp_level"]) def test_Debugger_HappyPath_TargetMultipleEntities(self, request, workspace, editor, launcher_platform, project, level): def teardown(): @@ -174,6 +176,7 @@ class TestAutomation(TestAutomationBase): from . import ScriptEvents_ReturnSetType_Successfully as test_module self._run_test(request, workspace, editor, test_module) + @pytest.mark.xfail(reason="Test fails on nightly build builds, it needs to be fixed.") def test_NodeCategory_ExpandOnClick(self, request, workspace, editor, launcher_platform): from . import NodeCategory_ExpandOnClick as test_module self._run_test(request, workspace, editor, test_module) @@ -187,6 +190,7 @@ class TestAutomation(TestAutomationBase): from . import VariableManager_UnpinVariableType_Works as test_module self._run_test(request, workspace, editor, test_module) + @pytest.mark.xfail(reason="Test fails on nightly build builds, it needs to be fixed.") def test_Node_HappyPath_DuplicateNode(self, request, workspace, editor, launcher_platform): from . import Node_HappyPath_DuplicateNode as test_module self._run_test(request, workspace, editor, test_module) @@ -263,6 +267,7 @@ class TestScriptCanvasTests(object): timeout=60, ) + @pytest.mark.xfail(reason="Test fails on nightly build builds, it needs to be fixed.") def test_VariableManager_Default_CreateDeleteVars(self, request, editor, launcher_platform): var_types = ["Boolean", "Color", "EntityID", "Number", "String", "Transform", "Vector2", "Vector3", "Vector4"] expected_lines = [f"Success: {var_type} variable is created" for var_type in var_types] diff --git a/AutomatedTesting/Levels/Graphics/macbeth_shaderballs/macbeth_shaderballs.prefab b/AutomatedTesting/Levels/Graphics/macbeth_shaderballs/macbeth_shaderballs.prefab index 22504f168a..69b1eac762 100644 --- a/AutomatedTesting/Levels/Graphics/macbeth_shaderballs/macbeth_shaderballs.prefab +++ b/AutomatedTesting/Levels/Graphics/macbeth_shaderballs/macbeth_shaderballs.prefab @@ -38,7 +38,10 @@ }, "Component_[7874177159288365422]": { "$type": "EditorEntitySortComponent", - "Id": 7874177159288365422 + "Id": 7874177159288365422, + "Child Entity Order": [ + "Entity_[471076350497]" + ] }, "Component_[8018146290632383969]": { "$type": "EditorEntityIconComponent", @@ -110,34 +113,14 @@ "Component_[16871442125196328877]": { "$type": "EditorEntitySortComponent", "Id": 16871442125196328877, - "ChildEntityOrderEntryArray": [ - { - "EntityId": "Entity_[604220336673]" - }, - { - "EntityId": "Entity_[599925369377]", - "SortIndex": 1 - }, - { - "EntityId": "Entity_[475371317793]", - "SortIndex": 2 - }, - { - "EntityId": "Entity_[509731056161]", - "SortIndex": 3 - }, - { - "EntityId": "Entity_[505436088865]", - "SortIndex": 4 - }, - { - "EntityId": "Entity_[539795827233]", - "SortIndex": 5 - }, - { - "EntityId": "Entity_[569860598305]", - "SortIndex": 6 - } + "Child Entity Order": [ + "Entity_[604220336673]", + "Entity_[599925369377]", + "Entity_[475371317793]", + "Entity_[509731056161]", + "Entity_[505436088865]", + "Entity_[539795827233]", + "Entity_[569860598305]" ] }, "Component_[18389136819207633744]": { @@ -263,10 +246,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -370,10 +353,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -477,10 +460,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -584,10 +567,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -691,10 +674,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -798,10 +781,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -905,10 +888,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -944,30 +927,13 @@ "Component_[11056805018150955063]": { "$type": "EditorEntitySortComponent", "Id": 11056805018150955063, - "ChildEntityOrderEntryArray": [ - { - "EntityId": "Entity_[488256219681]" - }, - { - "EntityId": "Entity_[483961252385]", - "SortIndex": 1 - }, - { - "EntityId": "Entity_[479666285089]", - "SortIndex": 2 - }, - { - "EntityId": "Entity_[492551186977]", - "SortIndex": 3 - }, - { - "EntityId": "Entity_[496846154273]", - "SortIndex": 4 - }, - { - "EntityId": "Entity_[501141121569]", - "SortIndex": 5 - } + "Child Entity Order": [ + "Entity_[488256219681]", + "Entity_[483961252385]", + "Entity_[479666285089]", + "Entity_[492551186977]", + "Entity_[496846154273]", + "Entity_[501141121569]" ] }, "Component_[11466054095979053511]": { @@ -1028,30 +994,13 @@ "Component_[11056805018150955063]": { "$type": "EditorEntitySortComponent", "Id": 11056805018150955063, - "ChildEntityOrderEntryArray": [ - { - "EntityId": "Entity_[522615958049]" - }, - { - "EntityId": "Entity_[518320990753]", - "SortIndex": 1 - }, - { - "EntityId": "Entity_[514026023457]", - "SortIndex": 2 - }, - { - "EntityId": "Entity_[526910925345]", - "SortIndex": 3 - }, - { - "EntityId": "Entity_[531205892641]", - "SortIndex": 4 - }, - { - "EntityId": "Entity_[535500859937]", - "SortIndex": 5 - } + "Child Entity Order": [ + "Entity_[522615958049]", + "Entity_[518320990753]", + "Entity_[514026023457]", + "Entity_[526910925345]", + "Entity_[531205892641]", + "Entity_[535500859937]" ] }, "Component_[11466054095979053511]": { @@ -1180,10 +1129,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -1287,10 +1236,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -1394,10 +1343,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -1501,10 +1450,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -1608,10 +1557,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -1715,10 +1664,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -1754,30 +1703,13 @@ "Component_[11056805018150955063]": { "$type": "EditorEntitySortComponent", "Id": 11056805018150955063, - "ChildEntityOrderEntryArray": [ - { - "EntityId": "Entity_[552680729121]" - }, - { - "EntityId": "Entity_[548385761825]", - "SortIndex": 1 - }, - { - "EntityId": "Entity_[544090794529]", - "SortIndex": 2 - }, - { - "EntityId": "Entity_[556975696417]", - "SortIndex": 3 - }, - { - "EntityId": "Entity_[561270663713]", - "SortIndex": 4 - }, - { - "EntityId": "Entity_[565565631009]", - "SortIndex": 5 - } + "Child Entity Order": [ + "Entity_[552680729121]", + "Entity_[548385761825]", + "Entity_[544090794529]", + "Entity_[556975696417]", + "Entity_[561270663713]", + "Entity_[565565631009]" ] }, "Component_[11466054095979053511]": { @@ -1906,10 +1838,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2013,10 +1945,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2120,10 +2052,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2227,10 +2159,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2334,10 +2266,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2441,10 +2373,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2480,30 +2412,13 @@ "Component_[11056805018150955063]": { "$type": "EditorEntitySortComponent", "Id": 11056805018150955063, - "ChildEntityOrderEntryArray": [ - { - "EntityId": "Entity_[582745500193]" - }, - { - "EntityId": "Entity_[578450532897]", - "SortIndex": 1 - }, - { - "EntityId": "Entity_[574155565601]", - "SortIndex": 2 - }, - { - "EntityId": "Entity_[587040467489]", - "SortIndex": 3 - }, - { - "EntityId": "Entity_[591335434785]", - "SortIndex": 4 - }, - { - "EntityId": "Entity_[595630402081]", - "SortIndex": 5 - } + "Child Entity Order": [ + "Entity_[582745500193]", + "Entity_[578450532897]", + "Entity_[574155565601]", + "Entity_[587040467489]", + "Entity_[591335434785]", + "Entity_[595630402081]" ] }, "Component_[11466054095979053511]": { @@ -2632,10 +2547,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2739,10 +2654,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2846,10 +2761,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -2953,10 +2868,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -3060,10 +2975,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } @@ -3167,10 +3082,10 @@ "Configuration": { "ModelAsset": { "assetId": { - "guid": "{D0F73AAF-52B7-507C-B045-DBE2FE2D4403}", - "subId": 268677693 + "guid": "{FD340C30-755C-5911-92A3-19A3F7A77931}", + "subId": 281415304 }, - "assetHint": "objects/shaderball_simple/shaberball_simple_1m.azmodel" + "assetHint": "objects/shaderball/shaderball_default_1m.azmodel" }, "LodOverride": 255 } diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.h b/Code/Framework/AzCore/AzCore/IO/Path/Path.h index 235310a5da..3c2c4f0a8c 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.h +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.h @@ -709,7 +709,10 @@ namespace AZ::IO constexpr reference operator*() const; - constexpr pointer operator->() const; + constexpr pointer operator->() const + { + return &m_stashed_elem; + } constexpr PathIterator& operator++(); diff --git a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl index bde2353112..5046b43127 100644 --- a/Code/Framework/AzCore/AzCore/IO/Path/Path.inl +++ b/Code/Framework/AzCore/AzCore/IO/Path/Path.inl @@ -1397,12 +1397,6 @@ namespace AZ::IO return m_stashed_elem; } - template - constexpr auto PathIterator::operator->() const -> pointer - { - return &m_stashed_elem; - } - template constexpr auto PathIterator::operator++() -> PathIterator& { @@ -1542,3 +1536,13 @@ namespace AZ::IO extern template bool operator!=(const PathIterator& lhs, const PathIterator& rhs); } + +namespace AZStd::ranges +{ + // A PathView is a borrowed range, it does not own the content of the Path it is viewing + template<> + inline constexpr bool enable_borrowed_range = true; + + template<> + inline constexpr bool enable_view = true; +} diff --git a/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp index 5e0e3e2de8..9af99a05b9 100644 --- a/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp @@ -13,6 +13,7 @@ #include // required by certain platforms #include #include +#include #include #ifdef _DEBUG @@ -56,212 +57,6 @@ namespace AZ { // Enabled mutex per bucket #define USE_MUTEX_PER_BUCKET - ////////////////////////////////////////////////////////////////////////// - // TODO: Replace with AZStd::intrusive_list - class intrusive_list_base - { - public: - class node_base - { - node_base* mPrev; - node_base* mNext; - public: - node_base* next() const {return mNext; } - node_base* prev() const {return mPrev; } - void reset() - { - mPrev = this; - mNext = this; - } - void unlink() - { - mNext->mPrev = mPrev; - mPrev->mNext = mNext; - } - void link(node_base* node) - { - mPrev = node->mPrev; - mNext = node; - node->mPrev = this; - mPrev->mNext = this; - } - }; - intrusive_list_base() - { - mHead.reset(); - } - intrusive_list_base(const intrusive_list_base&) - { - mHead.reset(); - } - bool empty() const {return mHead.next() == &mHead; } - void swap(intrusive_list_base& other) - { - node_base* node = &other.mHead; - if (!empty()) - { - node = mHead.next(); - mHead.unlink(); - mHead.reset(); - } - node_base* other_node = &mHead; - if (!other.empty()) - { - other_node = other.mHead.next(); - other.mHead.unlink(); - other.mHead.reset(); - } - mHead.link(other_node); - other.mHead.link(node); - } - protected: - node_base mHead; - }; - - ////////////////////////////////////////////////////////////////////////// - // TODO: Replace with AZStd::intrusive_list - template - class intrusive_list - : public intrusive_list_base - { - intrusive_list(const intrusive_list& rhs); - intrusive_list& operator=(const intrusive_list& rhs); - public: - class node - : public node_base - { - public: - T* next() const {return static_cast(node_base::next()); } - T* prev() const {return static_cast(node_base::prev()); } - const T& data() const {return *static_cast(this); } - T& data() {return *static_cast(this); } - }; - - class const_iterator; - class iterator - { - using reference = T&; - using pointer = T*; - friend class const_iterator; - T* mPtr; - public: - iterator() - : mPtr(0) {} - explicit iterator(T* ptr) - : mPtr(ptr) {} - reference operator*() const {return mPtr->data(); } - pointer operator->() const {return &mPtr->data(); } - operator pointer() const { - return &mPtr->data(); - } - iterator& operator++() - { - mPtr = mPtr->next(); - return *this; - } - iterator& operator--() - { - mPtr = mPtr->prev(); - return *this; - } - bool operator==(const iterator& rhs) const {return mPtr == rhs.mPtr; } - bool operator!=(const iterator& rhs) const {return mPtr != rhs.mPtr; } - T* ptr() const {return mPtr; } - }; - - class const_iterator - { - using reference = const T &; - using pointer = const T *; - const T* mPtr; - public: - const_iterator() - : mPtr(0) {} - explicit const_iterator(const T* ptr) - : mPtr(ptr) {} - const_iterator(const iterator& it) - : mPtr(it.mPtr) {} - reference operator*() const {return mPtr->data(); } - pointer operator->() const {return &mPtr->data(); } - operator pointer() const { - return &mPtr->data(); - } - const_iterator& operator++() - { - mPtr = mPtr->next(); - return *this; - } - const_iterator& operator--() - { - mPtr = mPtr->prev(); - return *this; - } - bool operator==(const const_iterator& rhs) const {return mPtr == rhs.mPtr; } - bool operator!=(const const_iterator& rhs) const {return mPtr != rhs.mPtr; } - const T* ptr() const {return mPtr; } - }; - - intrusive_list() - : intrusive_list_base() {} - ~intrusive_list() {clear(); } - - const_iterator begin() const {return const_iterator((const T*)mHead.next()); } - iterator begin() {return iterator((T*)mHead.next()); } - const_iterator end() const {return const_iterator((const T*)&mHead); } - iterator end() {return iterator((T*)&mHead); } - - const T& front() const - { - HPPA_ASSERT(!empty()); - return *begin(); - } - T& front() - { - HPPA_ASSERT(!empty()); - return *begin(); - } - const T& back() const - { - HPPA_ASSERT(!empty()); - return *(--end()); - } - T& back() - { - HPPA_ASSERT(!empty()); - return *(--end()); - } - - void push_front(T* v) {insert(this->begin(), v); } - void pop_front() {erase(this->begin()); } - void push_back(T* v) {insert(this->end(), v); } - void pop_back() {erase(--(this->end())); } - - iterator insert(iterator where, T* node) - { - T* newLink = node; - newLink->link(where.ptr()); - return iterator(newLink); - } - iterator erase(iterator where) - { - T* node = where.ptr(); - ++where; - node->unlink(); - return where; - } - void erase(T* node) - { - node->unlink(); - } - void clear() - { - while (!this->empty()) - { - this->pop_back(); - } - } - }; - ////////////////////////////////////////////////////////////////////////// class HpAllocator { @@ -376,7 +171,7 @@ namespace AZ { }; struct page : public block_header_proxy /* must be first */ - , public intrusive_list::node + , public AZStd::list_base_hook::node_type { page(size_t elemSize, size_t pageSize, size_t marker) : mBucketIndex((unsigned short)bucket_spacing_function_aligned(elemSize)) @@ -415,7 +210,7 @@ namespace AZ { void dec_ref() { HPPA_ASSERT(mUseCount > 0); mUseCount--; } bool check_marker(size_t marker) const { return mMarker == (marker ^ ((size_t)this)); } }; - using page_list = intrusive_list; + using page_list = AZStd::intrusive_list>; class bucket { page_list mPageList; @@ -442,16 +237,17 @@ namespace AZ { #endif #endif size_t marker() const {return mMarker; } - const page* page_list_begin() const {return mPageList.begin(); } - page* page_list_begin() {return mPageList.begin(); } - const page* page_list_end() const {return mPageList.end(); } - page* page_list_end() {return mPageList.end(); } + auto page_list_begin() const {return mPageList.begin(); } + auto page_list_begin() {return mPageList.begin(); } + auto page_list_end() const {return mPageList.end(); } + auto page_list_end() {return mPageList.end(); } bool page_list_empty() const {return mPageList.empty(); } - void add_free_page(page* p) {mPageList.push_front(p); } + void add_free_page(page* p) {mPageList.push_front(*p); } page* get_free_page(); const page* get_free_page() const; void* alloc(page* p); void free(page* p, void* ptr); + void unlink(page* p); }; void* bucket_system_alloc(); void bucket_system_free(void* ptr); @@ -1278,8 +1074,8 @@ namespace AZ { if (!next) { // if full, auto sort to back - p->unlink(); - mPageList.push_back(p); + mPageList.erase(*p); + mPageList.push_back(*p); } return (void*)free; } @@ -1295,11 +1091,16 @@ namespace AZ { if (!free) { // if the page was previously full, auto sort to front - p->unlink(); - mPageList.push_front(p); + mPageList.erase(*p); + mPageList.push_front(*p); } } + void HpAllocator::bucket::unlink(page* p) + { + mPageList.erase(*p); + } + void* HpAllocator::bucket_system_alloc() { void* ptr; @@ -1522,8 +1323,8 @@ namespace AZ { AZStd::lock_guard lock(m_mutex); #endif #endif - const page* pageEnd = mBuckets[i].page_list_end(); - for (const page* p = mBuckets[i].page_list_begin(); p != pageEnd; ) + auto pageEnd = mBuckets[i].page_list_end(); + for (auto p = mBuckets[i].page_list_begin(); p != pageEnd; ) { // early out if we reach fully occupied page (the remaining should all be full) if (p->mFreeList == nullptr) @@ -1537,7 +1338,7 @@ namespace AZ { { AZ_TracePrintf("System", "Unused Bucket %d page %p elementSize: %d available: %d elements\n", i, p, elementSize, availableMemory / elementSize); } - p = p->next(); + p = p->m_next; } } return unusedMemory; @@ -1554,21 +1355,21 @@ namespace AZ { AZStd::lock_guard lock(m_mutex); #endif #endif - page* pageEnd = mBuckets[i].page_list_end(); - for (page* p = mBuckets[i].page_list_begin(); p != pageEnd; ) + auto pageEnd = mBuckets[i].page_list_end(); + for (auto p = mBuckets[i].page_list_begin(); p != pageEnd; ) { // early out if we reach fully occupied page (the remaining should all be full) if (p->mFreeList == nullptr) { break; } - page* next = p->next(); + page* next = p->m_next; if (p->empty()) { HPPA_ASSERT(p->mFreeList); - p->unlink(); + mBuckets[i].unlink(AZStd::to_address(p)); p->setInvalid(); - bucket_system_free(p); + bucket_system_free(AZStd::to_address(p)); } p = next; } @@ -2239,11 +2040,17 @@ namespace AZ { size_t HpAllocator::tree_get_max_allocation() const { +#ifdef MULTITHREADED + AZStd::lock_guard lock(mTreeMutex); +#endif return mFreeTree.maximum()->get_block()->size(); } size_t HpAllocator::tree_get_unused_memory(bool isPrint) const { +#ifdef MULTITHREADED + AZStd::lock_guard lock(mTreeMutex); +#endif size_t unusedMemory = 0; for (free_node_tree::const_iterator it = mFreeTree.begin(); it != mFreeTree.end(); ++it) { diff --git a/Code/Framework/AzCore/AzCore/PlatformDef.h b/Code/Framework/AzCore/AzCore/PlatformDef.h index 8416099f15..d10b155127 100644 --- a/Code/Framework/AzCore/AzCore/PlatformDef.h +++ b/Code/Framework/AzCore/AzCore/PlatformDef.h @@ -83,7 +83,7 @@ #define AZ_PUSH_DISABLE_WARNING_GCC(_gccOption) /// Compiler specific AZ_POP_DISABLE_WARNING. This needs to be matched with the compiler specific AZ_PUSH_DISABLE_WARNINGs -#define AZ_POP_DISABLE_WARNING_CLANG +#define AZ_POP_DISABLE_WARNING_CLANG #define AZ_POP_DISABLE_WARNING_MSVC \ __pragma(warning(pop)) #define AZ_POP_DISABLE_WARNING_GCC @@ -176,7 +176,7 @@ #define AZ_PUSH_DISABLE_WARNING_3(_1, _2, _gccOption) AZ_PUSH_DISABLE_WARNING_GCC(_gccOption) /// Pops the warning stack. For use matched with an AZ_PUSH_DISABLE_WARNING -#define AZ_POP_DISABLE_WARNING +#define AZ_POP_DISABLE_WARNING _Pragma("GCC diagnostic pop") #endif // defined(AZ_COMPILER_CLANG) @@ -303,3 +303,10 @@ #if !defined(az_has_builtin_wmemmove) #define az_has_builtin_wmemmove false #endif + +// no unique address attribute support in C++17 +#if __has_cpp_attribute(no_unique_address) + #define AZ_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define AZ_NO_UNIQUE_ADDRESS +#endif diff --git a/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl b/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl index bba79e36f7..af814fbd32 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl +++ b/Code/Framework/AzCore/AzCore/RTTI/AzStdOnDemandReflection.inl @@ -13,6 +13,7 @@ #include #include #include +#include #ifndef AZ_USE_CUSTOM_SCRIPT_BIND struct lua_State; @@ -47,10 +48,6 @@ namespace AZStd class intrusive_ptr; template class shared_ptr; - - // Wrapper types - template - class optional; } namespace AZ diff --git a/Code/Framework/AzCore/AzCore/RTTI/TypeInfo.h b/Code/Framework/AzCore/AzCore/RTTI/TypeInfo.h index 2cff17a638..0f292140dc 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/TypeInfo.h +++ b/Code/Framework/AzCore/AzCore/RTTI/TypeInfo.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -89,9 +90,6 @@ namespace AZStd template class function; - template - class optional; - struct monostate; template @@ -150,7 +148,7 @@ namespace AZ template