Merge branch 'development' of https://github.com/o3de/o3de into Network/olexl/multiplayer_gem_profiler_markers_cr

development
Olex Lozitskiy 4 years ago
commit 4d8c8fdda3

@ -47,4 +47,18 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_BUILD_TESTS_SUPPORTED)
COMPONENT
Atom
)
ly_add_pytest(
NAME AutomatedTesting::Atom_TestSuite_Benchmark_GPU
TEST_SUITE main
TEST_REQUIRES gpu
TEST_SERIAL
TIMEOUT 700
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Benchmark_GPU.py
RUNTIME_DEPENDENCIES
AssetProcessor
AutomatedTesting.Assets
Editor
COMPONENT
Atom
)
endif()

@ -0,0 +1,59 @@
"""
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
"""
import logging
import os
import pytest
import editor_python_test_tools.hydra_test_utils as hydra
from ly_test_tools.benchmark.data_aggregator import BenchmarkDataAggregator
logger = logging.getLogger(__name__)
@pytest.mark.parametrize('rhi', ['dx12', 'vulkan'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ["windows_editor"])
@pytest.mark.parametrize("level", ["AtomFeatureIntegrationBenchmark"])
class TestPerformanceBenchmarkSuite(object):
def test_AtomFeatureIntegrationBenchmarkTest_UploadMetrics(
self, request, editor, workspace, rhi, project, launcher_platform, level):
"""
Please review the hydra script run by this test for more specific test info.
Tests the performance of the Simple level.
"""
expected_lines = [
"Benchmark metadata captured.",
"Pass timestamps captured.",
"CPU frame time captured.",
"Captured data successfully.",
"Exited game mode"
]
unexpected_lines = [
"Failed to capture data.",
"Failed to capture pass timestamps.",
"Failed to capture CPU frame time.",
"Failed to capture benchmark metadata."
]
hydra.launch_and_validate_results(
request,
os.path.join(os.path.dirname(__file__), "tests"),
editor,
"hydra_GPUTest_AtomFeatureIntegrationBenchmark.py",
timeout=600,
expected_lines=expected_lines,
unexpected_lines=unexpected_lines,
halt_on_unexpected=True,
cfg_args=[level],
null_renderer=False,
enable_prefab_system=False,
)
aggregator = BenchmarkDataAggregator(workspace, logger, 'periodic')
aggregator.upload_metrics(rhi)

@ -11,8 +11,7 @@ import pytest
import editor_python_test_tools.hydra_test_utils as hydra
import ly_test_tools.environment.file_system as file_system
from ly_test_tools.benchmark.data_aggregator import BenchmarkDataAggregator
from ly_test_tools.o3de.editor_test import EditorSharedTest, EditorTestSuite
from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorTestSuite
from Atom.atom_utils.atom_component_helper import compare_screenshot_to_golden_image, golden_images_directory
DEFAULT_SUBFOLDER_PATH = 'user/PythonTests/Automated/Screenshots'
@ -23,133 +22,137 @@ logger = logging.getLogger(__name__)
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
class TestAutomation(EditorTestSuite):
# Remove -autotest_mode from global_extra_cmdline_args since we need rendering for these tests.
global_extra_cmdline_args = ["-BatchMode"] # Default is ["-BatchMode", "-autotest_mode"]
global_extra_cmdline_args = ["-autotest_mode"] # Default is ["-BatchMode", "-autotest_mode"]
use_null_renderer = False # Default is True
enable_prefab_system = False
@pytest.mark.test_case_id("C34603773")
class AtomGPU_BasicLevelSetup_SetsUpLevel(EditorSharedTest):
use_null_renderer = False # Default is True
screenshot_name = "AtomBasicLevelSetup.ppm"
test_screenshots = [] # Gets set by setup()
screenshot_directory = "" # Gets set by setup()
# Clear existing test screenshots before starting test.
def setup(self, workspace):
screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
test_screenshots = [os.path.join(screenshot_directory, self.screenshot_name)]
file_system.delete(test_screenshots, True, True)
golden_images = [os.path.join(golden_images_directory(), screenshot_name)]
from Atom.tests import hydra_AtomGPU_BasicLevelSetup as test_module
assert compare_screenshot_to_golden_image(screenshot_directory, test_screenshots, golden_images, 0.99) is True
@pytest.mark.test_case_id("C34525095")
class AtomGPU_LightComponent_AreaLightScreenshotsMatchGoldenImages(EditorSharedTest):
use_null_renderer = False # Default is True
screenshot_names = [
"AreaLight_1.ppm",
"AreaLight_2.ppm",
"AreaLight_3.ppm",
"AreaLight_4.ppm",
"AreaLight_5.ppm",
]
test_screenshots = [] # Gets set by setup()
screenshot_directory = "" # Gets set by setup()
# Clear existing test screenshots before starting test.
def setup(self, workspace):
screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
for screenshot in self.screenshot_names:
screenshot_path = os.path.join(screenshot_directory, screenshot)
self.test_screenshots.append(screenshot_path)
file_system.delete(self.test_screenshots, True, True)
@staticmethod
def screenshot_setup(screenshot_directory, screenshot_names):
"""
:param screenshot_names: list of screenshot file names with extensions
:return: tuple test_screenshots, golden_images each a list of full file paths
"""
test_screenshots = []
golden_images = []
for screenshot in screenshot_names:
screenshot_path = os.path.join(screenshot_directory, screenshot)
test_screenshots.append(screenshot_path)
file_system.delete(test_screenshots, True, True)
for golden_image in screenshot_names:
golden_image_path = os.path.join(golden_images_directory(), golden_image)
golden_images.append(golden_image_path)
return test_screenshots, golden_images
@pytest.mark.test_case_id("C34525095")
class AtomGPU_LightComponent_AreaLightScreenshotsMatchGoldenImages_DX12(EditorSingleTest):
from Atom.tests import hydra_AtomGPU_AreaLightScreenshotTest as test_module
assert compare_screenshot_to_golden_image(screenshot_directory, test_screenshots, golden_images, 0.99) is True
extra_cmdline_args = ["-rhi=dx12"]
# Custom setup/teardown to remove old screenshots and establish paths to golden images
def setup(self, request, workspace, editor, editor_test_results, launcher_platform):
self.screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
self.screenshot_names = [
"AreaLight_1.ppm",
"AreaLight_2.ppm",
"AreaLight_3.ppm",
"AreaLight_4.ppm",
"AreaLight_5.ppm",
]
self.test_screenshots, self.golden_images = TestAutomation.screenshot_setup(
screenshot_directory=self.screenshot_directory,
screenshot_names=self.screenshot_names)
def wrap_run(self, request, workspace, editor, editor_test_results, launcher_platform):
yield
assert compare_screenshot_to_golden_image(self.screenshot_directory,
self.test_screenshots,
self.golden_images,
similarity_threshold=0.96) is True
@pytest.mark.test_case_id("C34525110")
class AtomGPU_LightComponent_SpotLightScreenshotsMatchGoldenImages(EditorSharedTest):
use_null_renderer = False # Default is True
screenshot_names = [
"SpotLight_1.ppm",
"SpotLight_2.ppm",
"SpotLight_3.ppm",
"SpotLight_4.ppm",
"SpotLight_5.ppm",
"SpotLight_6.ppm",
]
test_screenshots = [] # Gets set by setup()
screenshot_directory = "" # Gets set by setup()
# Clear existing test screenshots before starting test.
def setup(self, workspace):
screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
for screenshot in self.screenshot_names:
screenshot_path = os.path.join(screenshot_directory, screenshot)
self.test_screenshots.append(screenshot_path)
file_system.delete(self.test_screenshots, True, True)
@pytest.mark.test_case_id("C34525095")
class AtomGPU_LightComponent_AreaLightScreenshotsMatchGoldenImages_Vulkan(EditorSingleTest):
from Atom.tests import hydra_AtomGPU_AreaLightScreenshotTest as test_module
golden_images = []
for golden_image in screenshot_names:
golden_image_path = os.path.join(golden_images_directory(), golden_image)
golden_images.append(golden_image_path)
extra_cmdline_args = ["-rhi=vulkan"]
# Custom setup/teardown to remove old screenshots and establish paths to golden images
def setup(self, request, workspace, editor, editor_test_results, launcher_platform):
self.screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
self.screenshot_names = [
"AreaLight_1.ppm",
"AreaLight_2.ppm",
"AreaLight_3.ppm",
"AreaLight_4.ppm",
"AreaLight_5.ppm",
]
self.test_screenshots, self.golden_images = TestAutomation.screenshot_setup(
screenshot_directory=self.screenshot_directory,
screenshot_names=self.screenshot_names)
def wrap_run(self, request, workspace, editor, editor_test_results, launcher_platform):
yield
assert compare_screenshot_to_golden_image(self.screenshot_directory,
self.test_screenshots,
self.golden_images,
similarity_threshold=0.96) is True
@pytest.mark.test_case_id("C34525110")
class AtomGPU_LightComponent_SpotLightScreenshotsMatchGoldenImages_DX12(EditorSingleTest):
from Atom.tests import hydra_AtomGPU_SpotLightScreenshotTest as test_module
assert compare_screenshot_to_golden_image(screenshot_directory, test_screenshots, golden_images, 0.99) is True
extra_cmdline_args = ["-rhi=dx12"]
# Custom setup/teardown to remove old screenshots and establish paths to golden images
def setup(self, request, workspace, editor, editor_test_results, launcher_platform):
self.screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
self.screenshot_names = [
"SpotLight_1.ppm",
"SpotLight_2.ppm",
"SpotLight_3.ppm",
"SpotLight_4.ppm",
"SpotLight_5.ppm",
"SpotLight_6.ppm",
]
self.test_screenshots, self.golden_images = TestAutomation.screenshot_setup(
screenshot_directory=self.screenshot_directory,
screenshot_names=self.screenshot_names)
def wrap_run(self, request, workspace, editor, editor_test_results, launcher_platform):
yield
assert compare_screenshot_to_golden_image(self.screenshot_directory,
self.test_screenshots,
self.golden_images,
similarity_threshold=0.96) is True
@pytest.mark.test_case_id("C34525110")
class AtomGPU_LightComponent_SpotLightScreenshotsMatchGoldenImages_Vulkan(EditorSingleTest):
from Atom.tests import hydra_AtomGPU_SpotLightScreenshotTest as test_module
@pytest.mark.parametrize('rhi', ['dx12', 'vulkan'])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ["windows_editor"])
@pytest.mark.parametrize("level", ["AtomFeatureIntegrationBenchmark"])
class TestPerformanceBenchmarkSuite(object):
def test_AtomFeatureIntegrationBenchmark(
self, request, editor, workspace, rhi, project, launcher_platform, level):
"""
Please review the hydra script run by this test for more specific test info.
Tests the performance of the Simple level.
"""
expected_lines = [
"Benchmark metadata captured.",
"Pass timestamps captured.",
"CPU frame time captured.",
"Captured data successfully.",
"Exited game mode"
]
unexpected_lines = [
"Failed to capture data.",
"Failed to capture pass timestamps.",
"Failed to capture CPU frame time.",
"Failed to capture benchmark metadata."
]
hydra.launch_and_validate_results(
request,
os.path.join(os.path.dirname(__file__), "tests"),
editor,
"hydra_GPUTest_AtomFeatureIntegrationBenchmark.py",
timeout=600,
expected_lines=expected_lines,
unexpected_lines=unexpected_lines,
halt_on_unexpected=True,
cfg_args=[level],
null_renderer=False,
enable_prefab_system=False,
)
aggregator = BenchmarkDataAggregator(workspace, logger, 'periodic')
aggregator.upload_metrics(rhi)
extra_cmdline_args = ["-rhi=vulkan"]
# Custom setup/teardown to remove old screenshots and establish paths to golden images
def setup(self, request, workspace, editor, editor_test_results, launcher_platform):
self.screenshot_directory = os.path.join(workspace.paths.project(), DEFAULT_SUBFOLDER_PATH)
self.screenshot_names = [
"SpotLight_1.ppm",
"SpotLight_2.ppm",
"SpotLight_3.ppm",
"SpotLight_4.ppm",
"SpotLight_5.ppm",
"SpotLight_6.ppm",
]
self.test_screenshots, self.golden_images = TestAutomation.screenshot_setup(
screenshot_directory=self.screenshot_directory,
screenshot_names=self.screenshot_names)
def wrap_run(self, request, workspace, editor, editor_test_results, launcher_platform):
yield
assert compare_screenshot_to_golden_image(self.screenshot_directory,
self.test_screenshots,
self.golden_images,
similarity_threshold=0.96) is True
@pytest.mark.parametrize("project", ["AutomatedTesting"])

@ -86,9 +86,8 @@ def compare_screenshot_similarity(
if create_zip_archive:
create_screenshots_archive(screenshot_directory)
result = (
f"When comparing the test_screenshot: '{test_screenshot}' "
f"to golden_image: '{golden_image}' the mean similarity of '{mean_similarity}' "
f"was lower than the similarity threshold of '{similarity_threshold}'. ")
f"When comparing the test_screenshot: '{test_screenshot}' to golden_image: '{golden_image}'.\n"
f"The mean similarity ({mean_similarity}) was lower than the similarity threshold ({similarity_threshold})")
return result
@ -123,7 +122,9 @@ def initial_viewport_setup(screen_width=1280, screen_height=720):
import azlmbr.legacy.general as general
general.set_viewport_size(screen_width, screen_height)
general.idle_wait_frames(1)
general.update_viewport()
general.idle_wait_frames(1)
def enter_exit_game_mode_take_screenshot(screenshot_name, enter_game_tuple, exit_game_tuple, timeout_in_seconds=4):
@ -137,13 +138,18 @@ def enter_exit_game_mode_take_screenshot(screenshot_name, enter_game_tuple, exit
"""
import azlmbr.legacy.general as general
from editor_python_test_tools.utils import TestHelper
from editor_python_test_tools.utils import TestHelper, Report
from Atom.atom_utils.screenshot_utils import ScreenshotHelper
screenshot_helper = ScreenshotHelper(general.idle_wait_frames)
TestHelper.enter_game_mode(enter_game_tuple)
TestHelper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=timeout_in_seconds)
ScreenshotHelper(general.idle_wait_frames).capture_screenshot_blocking(screenshot_name)
screenshot_helper.prepare_viewport_for_screenshot(1920, 1080)
success_screenshot = TestHelper.wait_for_condition(
function=lambda: screenshot_helper.capture_screenshot_blocking(screenshot_name),
timeout_in_seconds=timeout_in_seconds)
Report.result(("Screenshot taken", "Screenshot failed to be taken"), success_screenshot)
TestHelper.exit_game_mode(exit_game_tuple)
TestHelper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=timeout_in_seconds)

@ -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):

@ -107,10 +107,8 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
18. Add Mesh component to Sphere Entity and set the Mesh Asset property for the Mesh component.
19. Create a Camera Entity as a child entity of the Default Level Entity then add a Camera component.
20. Set the Camera Entity rotation value and set the Camera component Field of View value.
21. Enter game mode.
22. Take screenshot.
23. Exit game mode.
24. Look for errors.
21. Enter/Exit game mode taking screenshot.
22. Look for errors.
:return: None
"""
@ -127,7 +125,7 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
from Atom.atom_utils.atom_constants import AtomComponentProperties
from Atom.atom_utils.atom_component_helper import initial_viewport_setup
from Atom.atom_utils.screenshot_utils import ScreenshotHelper
from Atom.atom_utils.atom_component_helper import enter_exit_game_mode_take_screenshot
DEGREE_RADIAN_FACTOR = 0.0174533
SCREENSHOT_NAME = "AtomBasicLevelSetup"
@ -300,18 +298,10 @@ def AtomGPU_BasicLevelSetup_SetsUpLevel():
Report.result(Tests.camera_fov_set, camera_component.get_component_property_value(
AtomComponentProperties.camera('Field of view')) == camera_fov_value)
# 21. Enter game mode.
TestHelper.enter_game_mode(Tests.enter_game_mode)
TestHelper.wait_for_condition(function=lambda: general.is_in_game_mode(), timeout_in_seconds=4.0)
# 21. Enter/Exit game mode taking screenshot.
enter_exit_game_mode_take_screenshot(f"{SCREENSHOT_NAME}.ppm", Tests.enter_game_mode, Tests.exit_game_mode)
# 22. Take screenshot.
ScreenshotHelper(general.idle_wait_frames).capture_screenshot_blocking(f"{SCREENSHOT_NAME}.ppm")
# 23. Exit game mode.
TestHelper.exit_game_mode(Tests.exit_game_mode)
TestHelper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=4.0)
# 24. Look for errors.
# 22. Look for errors.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")

@ -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__":

@ -67,3 +67,6 @@ add_subdirectory(Multiplayer)
## Integration tests for editor testing framework ##
add_subdirectory(editor_test_testing)
## Performance ##
add_subdirectory(Performance)

@ -0,0 +1,39 @@
#
# 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
#
#
if(NOT PAL_TRAIT_BUILD_TESTS_SUPPORTED OR NOT PAL_TRAIT_BUILD_HOST_TOOLS)
return()
endif()
ly_add_pytest(
NAME AutomatedTesting::EditorLevelLoadingPerfTests_DX12
TEST_SUITE periodic
TEST_REQUIRES gpu
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Periodic_DX12.py
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Performance
)
ly_add_pytest(
NAME AutomatedTesting::EditorLevelLoadingPerfTests_Vulkan
TEST_SUITE periodic
TEST_REQUIRES gpu
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Periodic_Vulkan.py
RUNTIME_DEPENDENCIES
Legacy::Editor
AZ::AssetProcessor
AutomatedTesting.Assets
COMPONENT
Performance
)

@ -0,0 +1,31 @@
"""
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
"""
# This suite consists of all test cases that are passing and have been verified.
import pytest
import os
import sys
from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSingleTest
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
class TestAutomation(EditorTestSuite):
class Time_EditorLevelLoading_10KEntityCpuPerfTest(EditorSingleTest):
extra_cmdline_args = ['-rhi=dx12']
use_null_renderer = False # needs renderer to validate test
from .tests import EditorLevelLoading_10KEntityCpuPerfTest as test_module
class Time_EditorLevelLoading_10kVegInstancesTest(EditorSingleTest):
extra_cmdline_args = ['-rhi=dx12']
use_null_renderer = False # needs renderer to validate test
from .tests import EditorLevelLoading_10kVegInstancesTest as test_module

@ -0,0 +1,34 @@
"""
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
"""
# This suite consists of all test cases that are passing and have been verified.
import pytest
import os
import sys
from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSingleTest
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
class TestAutomation(EditorTestSuite):
class Time_EditorLevelLoading_10KEntityCpuPerfTest(EditorSingleTest):
# there is currently a huge discrepancy loading this level with vulkan compared to dx12 which requires the 10 min timeout
# this should be removed once that issue has been sorted out
timeout = 600
extra_cmdline_args = ['-rhi=vulkan']
use_null_renderer = False # needs renderer to validate test
from .tests import EditorLevelLoading_10KEntityCpuPerfTest as test_module
class Time_EditorLevelLoading_10kVegInstancesTest(EditorSingleTest):
extra_cmdline_args = ['-rhi=vulkan']
use_null_renderer = False # needs renderer to validate test
from .tests import EditorLevelLoading_10kVegInstancesTest as test_module

@ -0,0 +1,6 @@
"""
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
"""

@ -0,0 +1,15 @@
"""
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
"""
from Performance.utils.perf_timer import time_editor_level_loading
def EditorLevelLoading_10KEntityCpuPerfTest():
time_editor_level_loading('Performance', '10KEntityCpuPerfTest')
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(EditorLevelLoading_10KEntityCpuPerfTest)

@ -0,0 +1,15 @@
"""
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
"""
from Performance.utils.perf_timer import time_editor_level_loading
def EditorLevelLoading_10kVegInstancesTest():
time_editor_level_loading('Performance', '10kVegInstancesTest')
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(EditorLevelLoading_10kVegInstancesTest)

@ -0,0 +1,6 @@
"""
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
"""

@ -0,0 +1,6 @@
"""
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
"""

@ -0,0 +1,72 @@
"""
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
"""
import time
ENTER_MSG = ("Entered game mode", "Failed to enter game mode")
EXIT_MSG = ("Exited game mode", "Couldn't exit game mode")
class Timer:
unit_divisor = 60
hour_divisor = unit_divisor * unit_divisor
def start(self):
self._start_time = time.perf_counter()
def log_time(self, message):
from editor_python_test_tools.utils import Report
elapsed_time = time.perf_counter() - self._start_time
hours = int(elapsed_time / Timer.hour_divisor)
minutes = int(elapsed_time % Timer.hour_divisor / Timer.unit_divisor)
seconds = elapsed_time % Timer.unit_divisor
Report.info(f'{message}: {hours:0>2d}:{minutes:0>2d}:{seconds:0>5.2f}\n')
def time_editor_level_loading(level_dir, level_name):
"""
Summary:
Time how long it takes to load an arbitrary level, entering game mode, and exiting game mode
Level Description:
Preferably a level with a large number of entities
Expected Behavior:
Level loads within a reasonable time frame e.i. doesn't trip the framework timeout
Benchmark Steps:
1) Time opening the level
2) Time entering game mode
3) Time exiting game mode
4) Close the editor
:return: None
"""
from editor_python_test_tools.utils import TestHelper as helper
timer = Timer()
helper.init_idle()
# 1) Open level
timer.start()
helper.open_level(level_dir, level_name)
timer.log_time('Level load time')
# 2) Time how long it takes to enter game mode
timer.start()
helper.enter_game_mode(ENTER_MSG)
timer.log_time('Enter game mode')
# 3) Exit game mode
timer.start()
helper.exit_game_mode(EXIT_MSG)
timer.log_time('Exit game mode')
# 4) Close the editor
helper.close_editor()

@ -0,0 +1,114 @@
"""
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
"""
class Tests:
image_gradient_entity_created = (
"Image Gradient entity created",
"Failed to create Image Gradient entity",
)
image_gradient_assigned = (
"Successfully assigned image gradient asset",
"Failed to assign image gradient asset"
)
instance_validation = (
"Found the expected number of instances",
"Found an unexpected number of instances"
)
def ImageGradient_ModifiesSurfaces():
"""
Summary:
This test verifies that an Image Gradient + Gradient Surface Tag Emitter properly modifies surfaces.
Expected Behavior:
Vegetation is used to verify expected surface modification.
Test Steps:
1) Open a level
2) Create an entity with Image Gradient, Gradient Transform Modifier, Shape Reference, and Gradient Surface Tag
Emitter components with an Image asset assigned.
3) Create a Vegetation Layer Spawner setup to plant on the generated surface.
4) Update all surface tag references
5) Validate expected instances planted on the modified surface.
:return: None
"""
import os
import azlmbr.bus as bus
import azlmbr.entity as EntityId
import azlmbr.editor as editor
import azlmbr.math as math
import azlmbr.surface_data as surface_data
import editor_python_test_tools.hydra_editor_utils as hydra
from editor_python_test_tools.asset_utils import Asset
from editor_python_test_tools.editor_entity_utils import EditorEntity
from largeworlds.large_worlds_utils import editor_dynveg_test_helper as dynveg
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
# 1) Open an existing simple level
hydra.open_base_level()
# 2) Create an entity with required Image Gradient + Surface Tag Emitter components and assign image asset
components_to_add = ["Image Gradient", "Gradient Transform Modifier", "Shape Reference",
"Gradient Surface Tag Emitter"]
entity_position = math.Vector3(0.0, 0.0, 0.0)
new_entity_id = editor.ToolsApplicationRequestBus(
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
)
Report.critical_result(Tests.image_gradient_entity_created, new_entity_id.IsValid())
image_gradient_entity = EditorEntity.create_editor_entity_at(entity_position, "Image Gradient")
image_gradient_entity.add_components(components_to_add)
test_img_gradient_path = os.path.join("Assets", "ImageGradients", "image_grad_test_gsi.png.streamingimage")
asset = Asset.find_asset_by_path(test_img_gradient_path)
image_gradient_entity.components[0].set_component_property_value("Configuration|Image Asset", asset.id)
success = image_gradient_entity.components[0].get_component_property_value("Configuration|Image Asset") == asset.id
Report.result(Tests.image_gradient_assigned, success)
# 3) Create vegetation and planting surface entities, and assign the Image Gradient entity's Shape Reference
# Create vegetation entity
purple_flower_prefab_path = os.path.join("assets", "prefabs", "PurpleFlower.spawnable")
spawner_entity = dynveg.create_prefab_vegetation_area("Instance Spawner", entity_position, 50.0, 50.0, 10.0,
purple_flower_prefab_path)
spawner_entity.add_component("Vegetation Surface Mask Filter")
# Create surface entity
dynveg.create_surface_entity("Box Shape", entity_position, 50.0, 50.0, 1.0)
# Assign Image Gradient entity's Shape Reference
image_gradient_entity.components[2].set_component_property_value("Configuration|Shape Entity Id", spawner_entity.id)
# 4) Assign surface tags to the required components
tag_list = [surface_data.SurfaceTag("terrain")]
# Set the Veg Spawner entity's Surface Tag Mask Filter component to include the "terrain" tag
hydra.get_set_test(spawner_entity, 3, "Configuration|Inclusion|Surface Tags", tag_list)
# Set the Image Gradient entity's Gradient Surface Tag Emitter component to modify the "terrain" tag
# NOTE: This requires a disable/re-enable of the component to force a refresh as assigning a tag via script does not
grad_surf_tag_emitter_component = image_gradient_entity.components[3]
grad_surf_tag_emitter_component.add_container_item("Configuration|Extended Tags", 0, tag_list[0])
grad_surf_tag_emitter_component.set_enabled(False)
grad_surf_tag_emitter_component.set_enabled(True)
# 5) Validate the expected number of vegetation instances. Instances should only spawn on the modified surface
num_expected_instances = 168
success = helper.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(
spawner_entity.id, num_expected_instances), 5.0)
Report.result(Tests.instance_validation, success)
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(ImageGradient_ModifiesSurfaces)

@ -48,6 +48,9 @@ class TestAutomation(EditorTestSuite):
class test_GradientTransform_RequiresShape(EditorSharedTest):
from .EditorScripts import GradientTransform_RequiresShape as test_module
class test_ImageGradient_ModifiesSurfaces(EditorSharedTest):
from .EditorScripts import ImageGradient_ModifiesSurfaces as test_module
class test_ImageGradient_ProcessedImageAssignedSuccessfully(EditorSharedTest):
from .EditorScripts import ImageGradient_ProcessedImageAssignedSuccessfully as test_module

@ -460,6 +460,33 @@
}
]
},
{
"Name": "DiffuseProbeGridVisualizationCompositePass",
"TemplateName": "DiffuseProbeGridVisualizationCompositePassTemplate",
"Connections": [
{
"LocalSlot": "VisualizationInput",
"AttachmentRef": {
"Pass": "OpaquePass",
"Attachment": "DiffuseProbeGridVisualization"
}
},
{
"LocalSlot": "Depth",
"AttachmentRef": {
"Pass": "DepthPrePass",
"Attachment": "Depth"
}
},
{
"LocalSlot": "ColorInputOutput",
"AttachmentRef": {
"Pass": "PostProcessPass",
"Attachment": "Output"
}
}
]
},
{
"Name": "AuxGeomPass",
"TemplateName": "AuxGeomPassTemplate",
@ -468,8 +495,8 @@
{
"LocalSlot": "ColorInputOutput",
"AttachmentRef": {
"Pass": "PostProcessPass",
"Attachment": "Output"
"Pass": "DiffuseProbeGridVisualizationCompositePass",
"Attachment": "ColorInputOutput"
}
},
{

@ -360,18 +360,6 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlo
textureVar->Set(textureName);
}
}
else if (!azstricmp(type, "color"))
{
CSmartVariable<Vec3> colorVar;
AddVariable(group, colorVar, child->getTag(), humanReadableName.toUtf8().data(), strDescription.toUtf8().data(), func, pUserData, IVariable::DT_COLOR);
ColorB color;
if (child->getAttr("value", color))
{
ColorF colorLinear = ColorGammaToLinear(QColor(color.r, color.g, color.b));
Vec3 colorVec3(colorLinear.r, colorLinear.g, colorLinear.b);
colorVar->Set(colorVec3);
}
}
}
}

@ -243,9 +243,6 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
case ePropertySelection:
m_reflectedVarAdapter = new ReflectedVarEnumAdapter;
break;
case ePropertyColor:
m_reflectedVarAdapter = new ReflectedVarColorAdapter;
break;
case ePropertyUser:
m_reflectedVarAdapter = new ReflectedVarUserAdapter;
break;

@ -312,50 +312,6 @@ void ReflectedVarVector4Adapter::SyncIVarToReflectedVar(IVariable *pVariable)
pVariable->Set(Vec4(m_reflectedVar->m_value.GetX(), m_reflectedVar->m_value.GetY(), m_reflectedVar->m_value.GetZ(), m_reflectedVar->m_value.GetW()));
}
void ReflectedVarColorAdapter::SetVariable(IVariable *pVariable)
{
m_reflectedVar.reset(new CReflectedVarColor(pVariable->GetHumanName().toUtf8().data()));
m_reflectedVar->m_description = pVariable->GetDescription().toUtf8().data();
}
void ReflectedVarColorAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
{
if (pVariable->GetType() == IVariable::VECTOR)
{
Vec3 v(0, 0, 0);
pVariable->Get(v);
const QColor col = ColorLinearToGamma(ColorF(v.x, v.y, v.z));
m_reflectedVar->m_color.Set(static_cast<float>(col.redF()), static_cast<float>(col.greenF()), static_cast<float>(col.blueF()));
}
else
{
int col(0);
pVariable->Get(col);
const QColor qcolor = ColorToQColor((uint32)col);
m_reflectedVar->m_color.Set(static_cast<float>(qcolor.redF()), static_cast<float>(qcolor.greenF()), static_cast<float>(qcolor.blueF()));
}
}
void ReflectedVarColorAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
{
if (pVariable->GetType() == IVariable::VECTOR)
{
ColorF colLin = ColorGammaToLinear(QColor::fromRgbF(m_reflectedVar->m_color.GetX(), m_reflectedVar->m_color.GetY(), m_reflectedVar->m_color.GetZ()));
pVariable->Set(Vec3(colLin.r, colLin.g, colLin.b));
}
else
{
int ir = static_cast<int>(m_reflectedVar->m_color.GetX() * 255.0f);
int ig = static_cast<int>(m_reflectedVar->m_color.GetY() * 255.0f);
int ib = static_cast<int>(m_reflectedVar->m_color.GetZ() * 255.0f);
pVariable->Set(static_cast<int>(RGB(ir, ig, ib)));
}
}
void ReflectedVarResourceAdapter::SetVariable(IVariable *pVariable)
{
m_reflectedVar.reset(new CReflectedVarResource(pVariable->GetHumanName().toUtf8().data()));

@ -186,21 +186,6 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
class EDITOR_CORE_API ReflectedVarColorAdapter
: public ReflectedVarAdapter
{
public:
void SetVariable(IVariable* pVariable) override;
void SyncReflectedVarToIVar(IVariable* pVariable) override;
void SyncIVarToReflectedVar(IVariable* pVariable) override;
CReflectedVar* GetReflectedVar() override { return m_reflectedVar.data(); }
private:
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
QScopedPointer<CReflectedVarColor > m_reflectedVar;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
class EDITOR_CORE_API ReflectedVarResourceAdapter
: public ReflectedVarAdapter
{

@ -32,15 +32,6 @@
#include "Settings.h"
#include "CryEdit.h"
enum
{
// in milliseconds
GameModeIdleFrequency = 0,
EditorModeIdleFrequency = 1,
InactiveModeFrequency = 10,
UninitializedFrequency = 9999,
};
Q_LOGGING_CATEGORY(InputDebugging, "o3de.editor.input")
// internal, private namespace:
@ -234,18 +225,12 @@ namespace Editor
EditorQtApplication::EditorQtApplication(int& argc, char** argv)
: AzQtApplication(argc, argv)
, m_stylesheet(new AzQtComponents::O3DEStylesheet(this))
, m_idleTimer(new QTimer(this))
{
m_idleTimer->setInterval(UninitializedFrequency);
setWindowIcon(QIcon(":/Application/res/o3de_editor.ico"));
// set the default key store for our preferences:
setApplicationName("O3DE Editor");
connect(m_idleTimer, &QTimer::timeout, this, &EditorQtApplication::maybeProcessIdle);
connect(this, &QGuiApplication::applicationStateChanged, this, [this] { ResetIdleTimerInterval(PollState); });
installEventFilter(this);
// Disable our debugging input helpers by default
@ -324,6 +309,10 @@ namespace Editor
winapp->OnIdle(0);
}
}
if (m_applicationActive)
{
QTimer::singleShot(1, this, &EditorQtApplication::maybeProcessIdle);
}
}
void EditorQtApplication::InstallQtLogHandler()
@ -376,14 +365,6 @@ namespace Editor
case eNotify_OnQuit:
GetIEditor()->UnregisterNotifyListener(this);
break;
case eNotify_OnBeginGameMode:
// GetIEditor()->IsInGameMode() Isn't reliable when called from within the notification handler
ResetIdleTimerInterval(GameMode);
break;
case eNotify_OnEndGameMode:
ResetIdleTimerInterval(EditorMode);
break;
}
}
@ -456,55 +437,16 @@ namespace Editor
void EditorQtApplication::EnableOnIdle(bool enable)
{
m_applicationActive = enable;
if (enable)
{
if (m_idleTimer->interval() == UninitializedFrequency)
{
ResetIdleTimerInterval();
}
m_idleTimer->start();
}
else
{
m_idleTimer->stop();
QTimer::singleShot(0, this, &EditorQtApplication::maybeProcessIdle);
}
}
bool EditorQtApplication::OnIdleEnabled() const
{
if (m_idleTimer->interval() == UninitializedFrequency)
{
return false;
}
return m_idleTimer->isActive();
}
void EditorQtApplication::ResetIdleTimerInterval(TimerResetFlag flag)
{
bool isInGameMode = flag == GameMode;
if (flag == PollState)
{
isInGameMode = GetIEditor() ? GetIEditor()->IsInGameMode() : false;
}
// Game mode takes precedence over anything else
if (isInGameMode)
{
m_idleTimer->setInterval(GameModeIdleFrequency);
}
else
{
if (applicationState() & Qt::ApplicationActive)
{
m_idleTimer->setInterval(EditorModeIdleFrequency);
}
else
{
m_idleTimer->setInterval(InactiveModeFrequency);
}
}
return m_applicationActive;
}
bool EditorQtApplication::eventFilter(QObject* object, QEvent* event)

@ -102,13 +102,6 @@ namespace Editor
bool m_isMovingOrResizing = false;
private:
enum TimerResetFlag
{
PollState,
GameMode,
EditorMode
};
void ResetIdleTimerInterval(TimerResetFlag = PollState);
static QColor InterpolateColors(QColor a, QColor b, float factor);
void RefreshStyleSheet();
void InstallFilters();
@ -125,7 +118,6 @@ namespace Editor
QTranslator* m_editorTranslator = nullptr;
QTranslator* m_assetBrowserTranslator = nullptr;
QTimer* const m_idleTimer = nullptr;
AZ::UserSettingsProvider m_localUserSettings;
@ -133,5 +125,6 @@ namespace Editor
QSet<int> m_pressedKeys;
bool m_activatedLocalUserSettings = false;
bool m_applicationActive = false;
};
} // namespace editor

@ -26,8 +26,13 @@ QString graphicsCardName()
// Create an iterator
io_iterator_t iterator;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_12_0
if (IOServiceGetMatchingServices(kIOMainPortDefault,matchDict,
&iterator) == kIOReturnSuccess)
#else
if (IOServiceGetMatchingServices(kIOMasterPortDefault,matchDict,
&iterator) == kIOReturnSuccess)
#endif
{
// Iterator for devices found
io_registry_entry_t regEntry;

@ -135,7 +135,7 @@ namespace Editor
}
widget = widget->parentWidget();
}
return false;
return nullptr;
};
if (object == toolBarAt(QCursor::pos()))
{

@ -44,6 +44,9 @@ class CXTPDockingPaneLayout; // Needed for settings.h
#include <SceneAPI/SceneUI/SceneWidgets/SceneGraphInspectWidget.h>
#include <SceneAPI/SceneCore/Events/AssetImportRequest.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/SceneData/Rules/ScriptProcessorRule.h>
#include <SceneAPI/SceneCore/DataTypes/Rules/IScriptProcessorRule.h>
#include <SceneAPI/SceneCore/Containers/Utilities/Filters.h>
const char* AssetImporterWindow::s_documentationWebAddress = "http://docs.aws.amazon.com/lumberyard/latest/userguide/char-fbx-importer.html";
const AZ::Uuid AssetImporterWindow::s_browseTag = AZ::Uuid::CreateString("{C240D2E1-BFD2-4FFA-BB5B-CC0FA389A5D3}");
@ -198,7 +201,7 @@ void AssetImporterWindow::Init()
// Filling the initial browse prompt text to be programmatically set from available extensions
AZStd::unordered_set<AZStd::string> extensions;
EBUS_EVENT(AZ::SceneAPI::Events::AssetImportRequestBus, GetSupportedFileExtensions, extensions);
AZ_Assert(!extensions.empty(), "No file extensions defined for assets.");
AZ_Error(AZ::SceneAPI::Utilities::ErrorWindow, !extensions.empty(), "No file extensions defined for assets.");
if (!extensions.empty())
{
for (AZStd::string& extension : extensions)
@ -252,6 +255,7 @@ void AssetImporterWindow::OpenFileInternal(const AZStd::string& filePath)
[this, filePath]()
{
m_assetImporterDocument->LoadScene(filePath);
UpdateSceneDisplay({});
},
[this]()
{
@ -290,6 +294,11 @@ void AssetImporterWindow::UpdateClicked()
AZ_Assert(!m_processingOverlay, "Attempted to update asset while processing is in progress.");
return;
}
else if (!m_scriptProcessorRuleFilename.empty())
{
AZ_TracePrintf(AZ::SceneAPI::Utilities::WarningWindow, "A script updates the manifest; will not save.");
return;
}
m_processingOverlay.reset(new ProcessingOverlayWidget(m_overlay.data(), ProcessingOverlayWidget::Layout::Exporting, s_browseTag));
connect(m_processingOverlay.data(), &ProcessingOverlayWidget::Closing, this, &AssetImporterWindow::ClearProcessingOverlay);
@ -383,6 +392,18 @@ void AssetImporterWindow::OnSceneResetRequested()
m_rootDisplay->HandleSceneWasReset(m_assetImporterDocument->GetScene());
}, this);
// reset the script rule from the .assetinfo file if it exists
if (!m_scriptProcessorRuleFilename.empty())
{
m_scriptProcessorRuleFilename.clear();
if (QFile::exists(m_assetImporterDocument->GetScene()->GetManifestFilename().c_str()))
{
QFile file(m_assetImporterDocument->GetScene()->GetManifestFilename().c_str());
file.remove();
}
}
UpdateSceneDisplay({});
m_processingOverlay.reset(new ProcessingOverlayWidget(m_overlay.data(), ProcessingOverlayWidget::Layout::Resetting, s_browseTag));
m_processingOverlay->SetAndStartProcessingHandler(asyncLoadHandler);
m_processingOverlay->SetAutoCloseOnSuccess(true);
@ -390,6 +411,51 @@ void AssetImporterWindow::OnSceneResetRequested()
m_processingOverlayIndex = m_processingOverlay->PushToOverlay();
}
void AssetImporterWindow::OnAssignScript()
{
using namespace AZ::SceneAPI;
using namespace AZ::SceneAPI::Events;
using namespace AZ::SceneAPI::SceneUI;
using namespace AZ::SceneAPI::Utilities;
// use QFileDialog to select a Python script to embed into a scene manifest file
QString pyFilename = QFileDialog::getOpenFileName(this,
tr("Select scene builder Python script"),
Path::GetEditingGameDataFolder().c_str(),
tr("Python (*.py)"));
if (pyFilename.isNull())
{
return;
}
// reset the script rule from the .assetinfo file if it exists
if (!m_scriptProcessorRuleFilename.empty())
{
m_scriptProcessorRuleFilename.clear();
if (QFile::exists(m_assetImporterDocument->GetScene()->GetManifestFilename().c_str()))
{
QFile file(m_assetImporterDocument->GetScene()->GetManifestFilename().c_str());
file.remove();
}
}
// find the path relative to the project folder
pyFilename = Path::GetRelativePath(pyFilename, true);
// create a script rule
auto scriptProcessorRule = AZStd::make_shared<SceneData::ScriptProcessorRule>();
scriptProcessorRule->SetScriptFilename(pyFilename.toUtf8().toStdString().c_str());
// add the script rule to the manifest & save off the scene manifest
Containers::SceneManifest sceneManifest;
sceneManifest.AddEntry(scriptProcessorRule);
if (sceneManifest.SaveToFile(m_assetImporterDocument->GetScene()->GetManifestFilename()))
{
OpenFile(m_assetImporterDocument->GetScene()->GetSourceFilename());
}
}
void AssetImporterWindow::ResetMenuAccess(WindowState state)
{
if (state == WindowState::FileLoaded)
@ -480,7 +546,7 @@ void AssetImporterWindow::SetTitle(const char* filePath)
}
AZStd::string fileName;
AzFramework::StringFunc::Path::GetFileName(filePath, fileName);
converted->setWindowTitle(QString("%1 Settings (PREVIEW) - %2").arg(extension.c_str(), fileName.c_str()));
converted->setWindowTitle(QString("%1 Settings - %2").arg(extension.c_str(), fileName.c_str()));
break;
}
else
@ -490,6 +556,28 @@ void AssetImporterWindow::SetTitle(const char* filePath)
}
}
void AssetImporterWindow::UpdateSceneDisplay(const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene> scene) const
{
AZ::IO::FixedMaxPath projectPath = AZ::Utils::GetProjectPath();
AZ::IO::FixedMaxPath relativeSourcePath = AZ::IO::PathView(m_fullSourcePath).LexicallyProximate(projectPath);
auto sceneHeaderText = QString::fromUtf8(relativeSourcePath.c_str(), static_cast<int>(relativeSourcePath.Native().size()));
if (!m_scriptProcessorRuleFilename.empty())
{
sceneHeaderText.append("\n Assigned Python builder script (")
.append(m_scriptProcessorRuleFilename.c_str())
.append(")");
}
if (scene)
{
m_rootDisplay->SetSceneDisplay(sceneHeaderText, scene);
}
else
{
m_rootDisplay->SetSceneHeaderText(sceneHeaderText);
}
}
void AssetImporterWindow::HandleAssetLoadingCompleted()
{
if (!m_assetImporterDocument->GetScene())
@ -501,10 +589,24 @@ void AssetImporterWindow::HandleAssetLoadingCompleted()
m_fullSourcePath = m_assetImporterDocument->GetScene()->GetSourceFilename();
SetTitle(m_fullSourcePath.c_str());
AZ::IO::FixedMaxPath projectPath = AZ::Utils::GetProjectPath();
AZ::IO::FixedMaxPath relativeSourcePath = AZ::IO::PathView(m_fullSourcePath).LexicallyProximate(projectPath);
auto userFriendlyFileName = QString::fromUtf8(relativeSourcePath.c_str(), static_cast<int>(relativeSourcePath.Native().size()));
m_rootDisplay->SetSceneDisplay(userFriendlyFileName, m_assetImporterDocument->GetScene());
using namespace AZ::SceneAPI;
m_scriptProcessorRuleFilename.clear();
// load up the source scene manifest file
Containers::SceneManifest sceneManifest;
if (sceneManifest.LoadFromFile(m_assetImporterDocument->GetScene()->GetManifestFilename()))
{
// check a Python script rule is in that source manifest
auto view = Containers::MakeDerivedFilterView<DataTypes::IScriptProcessorRule>(sceneManifest.GetValueStorage());
if (!view.empty())
{
// record the info about the rule in the class
const auto scriptProcessorRule = &*view.begin();
m_scriptProcessorRuleFilename = scriptProcessorRule->GetScriptFilename();
}
}
UpdateSceneDisplay(m_assetImporterDocument->GetScene());
// Once we've browsed to something successfully, we need to hide the initial browse button layer and
// show the main area where all the actual work takes place

@ -47,6 +47,10 @@ namespace AZ
{
class ProcessingOverlayWidget;
}
namespace DataTypes
{
class IScriptProcessorRule;
}
}
}
@ -80,6 +84,7 @@ public:
public slots:
void OnSceneResetRequested();
void OnAssignScript();
void OnOpenDocumentation();
void OnInspect();
@ -105,6 +110,7 @@ private slots:
void OverlayLayerAdded();
void OverlayLayerRemoved();
void UpdateSceneDisplay(const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene> scene = {}) const;
private:
static const AZ::Uuid s_browseTag;
@ -122,4 +128,6 @@ private:
int m_processingOverlayIndex;
QSharedPointer<AZ::SceneAPI::SceneUI::ProcessingOverlayWidget> m_processingOverlay;
AZStd::string m_scriptProcessorRuleFilename;
};

@ -25,7 +25,8 @@
<string>&amp;Edit</string>
</property>
<addaction name="m_actionResetSettings"/>
</widget>
<addaction name="m_actionAssignScript"/>
</widget>
<widget class="QMenu" name="helpMenu">
<property name="title">
<string>&amp;Help</string>
@ -49,7 +50,7 @@
<enum>QLayout::SetMaximumSize</enum>
</property>
<!-- When an fbx is loaded -->
<!-- When a source scene file (i.e. FBX) is loaded -->
<item>
<widget class="QWidget" name="m_mainArea">
<property name="sizePolicy">
@ -175,7 +176,16 @@
<string>Reset the settings for this file (note: you will have to update to commit)</string>
</property>
</action>
<action name="m_actionAssignScript">
<property name="text">
<string>Assign Build Script...</string>
</property>
<property name="toolTip">
<string>Assign a Python build script that will override the scene's build rules</string>
</property>
</action>
<action name="actionOpenDocumentation">
<property name="text">
<string>Documentation</string>
@ -204,6 +214,12 @@
<receiver>AssetImporterWindow</receiver>
<slot>OnSceneResetRequested()</slot>
</connection>
<connection>
<sender>m_actionAssignScript</sender>
<signal>triggered()</signal>
<receiver>AssetImporterWindow</receiver>
<slot>OnAssignScript()</slot>
</connection>
<connection>
<sender>m_actionInspect</sender>
<signal>triggered()</signal>

@ -44,6 +44,11 @@ AZ::SceneAPI::UI::ManifestWidget* ImporterRootDisplay::GetManifestWidget()
return m_manifestWidget.data();
}
void ImporterRootDisplay::SetSceneHeaderText(const QString& headerText)
{
ui->m_filePathText->setText(headerText);
}
void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene)
{
AZ_PROFILE_FUNCTION(Editor);
@ -53,7 +58,7 @@ void ImporterRootDisplay::SetSceneDisplay(const QString& headerText, const AZStd
return;
}
ui->m_filePathText->setText(headerText);
SetSceneHeaderText(headerText);
HandleSceneWasReset(scene);

@ -63,6 +63,7 @@ public:
AZ::SceneAPI::UI::ManifestWidget* GetManifestWidget();
void SetSceneDisplay(const QString& headerText, const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene);
void SetSceneHeaderText(const QString& headerText);
void HandleSceneWasReset(const AZStd::shared_ptr<AZ::SceneAPI::Containers::Scene>& scene);
void HandleSaveWasSuccessful();
bool HasUnsavedChanges() const;

@ -40,7 +40,7 @@
</size>
</property>
<property name="styleSheet">
<string notr="true">#m_filePathText { margin: 2px; color: grey; }</string>
<string notr="true">#m_filePathText { margin: 2px; color: white; }</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>

@ -116,9 +116,6 @@ bool C3DConnexionDriver::GetInputMessageData(LPARAM lParam, S3DConnexionMessage&
{
if (event->header.dwType == RIM_TYPEHID)
{
static bool bGotTranslation = false,
bGotRotation = false;
static int all6DOFs[6] = {0};
LPRAWHID pRawHid = &event->data.hid;
// Translation or Rotation packet? They come in two different packets.

@ -1,46 +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
*
*/
// Qt
#include <QColor>
#include <CryCommon/Cry_Color.h>
//////////////////////////////////////////////////////////////////////////
QColor ColorLinearToGamma(ColorF col)
{
float r = clamp_tpl(col.r, 0.0f, 1.0f);
float g = clamp_tpl(col.g, 0.0f, 1.0f);
float b = clamp_tpl(col.b, 0.0f, 1.0f);
float a = clamp_tpl(col.a, 0.0f, 1.0f);
r = (float)(r <= 0.0031308 ? (12.92 * r) : (1.055 * pow((double)r, 1.0 / 2.4) - 0.055));
g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f));
}
//////////////////////////////////////////////////////////////////////////
ColorF ColorGammaToLinear(const QColor& col)
{
float r = (float)col.red() / 255.0f;
float g = (float)col.green() / 255.0f;
float b = (float)col.blue() / 255.0f;
float a = (float)col.alpha() / 255.0f;
return ColorF((float)(r <= 0.04045 ? (r / 12.92) : pow(((double)r + 0.055) / 1.055, 2.4)),
(float)(g <= 0.04045 ? (g / 12.92) : pow(((double)g + 0.055) / 1.055, 2.4)),
(float)(b <= 0.04045 ? (b / 12.92) : pow(((double)b + 0.055) / 1.055, 2.4)), a);
}
QColor ColorToQColor(uint32 color)
{
return QColor::fromRgbF((float)GetRValue(color) / 255.0f,
(float)GetGValue(color) / 255.0f,
(float)GetBValue(color) / 255.0f);
}

@ -6,6 +6,7 @@
*
*/
#include <AzCore/Math/Color.h>
#include "EditorDefs.h"
@ -184,9 +185,9 @@ QColor ColorLinearToGamma(ColorF col)
float b = clamp_tpl(col.b, 0.0f, 1.0f);
float a = clamp_tpl(col.a, 0.0f, 1.0f);
r = (float)(r <= 0.0031308 ? (12.92 * r) : (1.055 * pow((double)r, 1.0 / 2.4) - 0.055));
g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055));
b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055));
r = AZ::Color::ConvertSrgbLinearToGamma(r);
g = AZ::Color::ConvertSrgbLinearToGamma(g);
b = AZ::Color::ConvertSrgbLinearToGamma(b);
return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f));
}
@ -199,9 +200,9 @@ ColorF ColorGammaToLinear(const QColor& col)
float b = (float)col.blue() / 255.0f;
float a = (float)col.alpha() / 255.0f;
return ColorF((float)(r <= 0.04045 ? (r / 12.92) : pow(((double)r + 0.055) / 1.055, 2.4)),
(float)(g <= 0.04045 ? (g / 12.92) : pow(((double)g + 0.055) / 1.055, 2.4)),
(float)(b <= 0.04045 ? (b / 12.92) : pow(((double)b + 0.055) / 1.055, 2.4)), a);
return ColorF(AZ::Color::ConvertSrgbGammaToLinear(r),
AZ::Color::ConvertSrgbGammaToLinear(g),
AZ::Color::ConvertSrgbGammaToLinear(b), a);
}
QColor ColorToQColor(uint32 color)

@ -48,7 +48,6 @@ set(FILES
Util/Image.cpp
Util/ImageHistogram.h
Util/Image.h
Util/ColorUtils.cpp
Undo/Undo.cpp
Undo/IUndoManagerListener.h
Undo/IUndoObject.h

@ -7,9 +7,9 @@
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Console/ConsoleTypeHelpers.h>
#include <AzCore/DOM/DomPath.h>
#include <AzCore/std/string/fixed_string.h>
#include <AzCore/Console/ConsoleTypeHelpers.h>
namespace AZ::Dom
{
@ -117,6 +117,36 @@ namespace AZ::Dom
return AZStd::get<size_t>(m_value);
}
size_t PathEntry::GetHash() const
{
return AZStd::visit(
[&](auto&& value) -> size_t
{
using CurrentType = AZStd::decay_t<decltype(value)>;
if constexpr (AZStd::is_same_v<CurrentType, size_t>)
{
AZStd::hash<size_t> hasher;
return hasher(value);
}
else if constexpr (AZStd::is_same_v<CurrentType, AZ::Name>)
{
return value.GetHash();
}
},
m_value);
}
} // namespace AZ::Dom
namespace AZStd
{
size_t AZStd::hash<AZ::Dom::PathEntry>::operator()(const AZ::Dom::PathEntry& entry) const
{
return entry.GetHash();
}
} // namespace AZStd
namespace AZ::Dom
{
const AZ::Name& PathEntry::GetKey() const
{
AZ_Assert(IsKey(), "Key called on PathEntry that is not a key");

@ -55,11 +55,24 @@ namespace AZ::Dom
size_t GetIndex() const;
const AZ::Name& GetKey() const;
size_t GetHash() const;
private:
AZStd::variant<size_t, AZ::Name> m_value;
};
} // namespace AZ::Dom
namespace AZStd
{
template<>
struct hash<AZ::Dom::PathEntry>
{
size_t operator()(const AZ::Dom::PathEntry& entry) const;
};
} // namespace AZStd
namespace AZ::Dom
{
//! Represents a path, represented as a series of PathEntry values, to a position in a Value.
class Path final
{
@ -135,7 +148,7 @@ namespace AZ::Dom
AZStd::string ToString() const;
void AppendToString(AZStd::string& output) const;
template <class T>
template<class T>
void AppendToString(T& output) const
{
const size_t startIndex = output.length();

@ -0,0 +1,100 @@
/*
* 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 <AzCore/DOM/DomPath.h>
#include <AzCore/std/containers/stack.h>
#include <AzCore/std/containers/unordered_map.h>
#include <AzCore/std/optional.h>
#include <AzCore/std/ranges/ranges.h>
#include <AzCore/std/tuple.h>
namespace AZ::Dom
{
//! Specifies how a path matches against a DomPrefixTree
enum class PrefixTreeMatch
{
//! Only an exact path will match.
//! For the path "/foo/bar" only "/foo/bar" will match while
//! "/foo" and "/foo/bar/baz" will not.
ExactPath,
//! The path, and any of its subpaths, will match.
//! For the path "/foo/bar" both "/foo/bar" and any subpaths like
//! "/foo/bar/0" will match, while "/foo" and orthogonal paths like
//! "/bar" will not
PathAndSubpaths,
//! Any of the path's subpaths will match, excepting the path itself.
//! For the path "/foo/bar", "/foo/bar" will not match but "/foo/bar/0"
//! will.
SubpathsOnly,
};
template<class Range, class T, class = void>
constexpr bool RangeConvertibleToPrefixTree = false;
template<class Range, class T>
constexpr bool RangeConvertibleToPrefixTree<
Range,
T,
AZStd::enable_if_t<
AZStd::ranges::input_range<Range> && AZStd::tuple_size<AZStd::ranges::range_value_t<Range>>::value == 2 &&
AZStd::convertible_to<AZStd::tuple_element_t<0, AZStd::ranges::range_value_t<Range>>, Path> &&
AZStd::convertible_to<AZStd::tuple_element_t<1, AZStd::ranges::range_value_t<Range>>, T>>> = true;
//! A prefix tree that maps DOM paths to some arbitrary value.
template<class T>
class DomPrefixTree
{
public:
DomPrefixTree() = default;
DomPrefixTree(const DomPrefixTree&) = default;
DomPrefixTree(DomPrefixTree&&) = default;
explicit DomPrefixTree(AZStd::initializer_list<AZStd::pair<Path, T>> init);
template<class Range, class = AZStd::enable_if_t<RangeConvertibleToPrefixTree<Range, T>>>
explicit DomPrefixTree(Range&& range);
DomPrefixTree& operator=(const DomPrefixTree&) = default;
DomPrefixTree& operator=(DomPrefixTree&&) = default;
using VisitorFunction = AZStd::function<void(const Path&, const T&)>;
//! Visits a path and calls a visitor for each matching path and value.
void VisitPath(const Path& path, PrefixTreeMatch match, const VisitorFunction& visitor) const;
//! Visits a path and returns the most specific matching value, or null if none was found.
T* ValueAtPath(const Path& path, PrefixTreeMatch match);
//! \see ValueAtPath
const T* ValueAtPath(const Path& path, PrefixTreeMatch match) const;
//! Visits a path and returns the most specific matching value or some default value.
template<class Deduced>
T ValueAtPathOrDefault(const Path& path, Deduced&& defaultValue, PrefixTreeMatch match) const;
//! Sets the value stored at path.
template<class Deduced>
void SetValue(const Path& path, Deduced&& value);
//! Removes the value stored at path. If removeChildren is true, also removes any values stored at subpaths.
void EraseValue(const Path& path, bool removedChildren = false);
//! Removes all entries from this tree.
void Clear();
private:
struct Node
{
AZStd::unordered_map<PathEntry, Node> m_values;
AZStd::optional<T> m_data;
};
Node* GetNodeForPath(const Path& path);
const Node* GetNodeForPath(const Path& path) const;
Node m_rootNode;
};
} // namespace AZ::Dom
#include <AzCore/DOM/DomPrefixTree.inl>

@ -0,0 +1,234 @@
/*
* 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
namespace AZ::Dom
{
template<class T>
DomPrefixTree<T>::DomPrefixTree(AZStd::initializer_list<AZStd::pair<Path, T>> init)
{
for (const auto& [path, value] : init)
{
SetValue(path, value);
}
}
template <class T>
template<class Range, class>
DomPrefixTree<T>::DomPrefixTree(Range&& range)
{
for (auto&& [path, value] : AZStd::forward<Range>(range))
{
SetValue(path, value);
}
}
template<class T>
auto DomPrefixTree<T>::GetNodeForPath(const Path& path) -> Node*
{
Node* node = &m_rootNode;
for (const auto& entry : path)
{
auto entryIt = node->m_values.find(entry);
if (entryIt == node->m_values.end())
{
return nullptr;
}
node = &entryIt->second;
}
return node;
}
template<class T>
auto DomPrefixTree<T>::GetNodeForPath(const Path& path) const -> const Node*
{
const Node* node = &m_rootNode;
for (const auto& entry : path)
{
auto entryIt = node->m_values.find(entry);
if (entryIt == node->m_values.end())
{
return nullptr;
}
node = &entryIt->second;
}
return node;
}
template<class T>
void DomPrefixTree<T>::VisitPath(const Path& path, PrefixTreeMatch match, const VisitorFunction& visitor) const
{
const Node* rootNode = GetNodeForPath(path);
if (rootNode == nullptr)
{
return;
}
if ((match == PrefixTreeMatch::ExactPath || match == PrefixTreeMatch::PathAndSubpaths) && rootNode->m_data.has_value())
{
visitor(path, rootNode->m_data.value());
}
if (match == PrefixTreeMatch::ExactPath)
{
return;
}
Path currentPath = path;
struct PopPathEntry
{
};
using StackEntry = AZStd::variant<const Node*, PathEntry, PopPathEntry>;
AZStd::stack<StackEntry> stack({ rootNode });
while (!stack.empty())
{
StackEntry entry = AZStd::move(stack.top());
stack.pop();
AZStd::visit(
[&](auto&& value)
{
using CurrentType = AZStd::decay_t<decltype(value)>;
if constexpr (AZStd::is_same_v<CurrentType, const Node*>)
{
if (value != rootNode && value->m_data.has_value())
{
visitor(currentPath, value->m_data.value());
}
for (const auto& entry : value->m_values)
{
// The stack runs this in reverse order, so we'll:
// 1) Push the current path entry to currentPath
// 2a) Process the value at the path (if any)
// 2b) Process the value's descendants at the path (if any)
// 3) Pop the path entry from the stack
stack.push(PopPathEntry{});
stack.push(&entry.second);
stack.push(entry.first);
}
}
else if constexpr (AZStd::is_same_v<CurrentType, PathEntry>)
{
currentPath.Push(value);
}
else if constexpr (AZStd::is_same_v<CurrentType, PopPathEntry>)
{
currentPath.Pop();
}
},
entry);
}
}
template<class T>
T* DomPrefixTree<T>::ValueAtPath(const Path& path, PrefixTreeMatch match)
{
// Just look up the node if we're looking for an exact path
if (match == PrefixTreeMatch::ExactPath)
{
if (Node* node = GetNodeForPath(path); node != nullptr && node->m_data.has_value())
{
return &node->m_data.value();
}
return {};
}
// Otherwise, walk to find the closest anscestor with a value
Node* node = &m_rootNode;
T* result = nullptr;
const size_t lengthToIterate = match == PrefixTreeMatch::SubpathsOnly ? path.Size() - 1 : path.Size();
for (size_t i = 0; i < lengthToIterate; ++i)
{
if (node->m_data.has_value())
{
result = &node->m_data.value();
}
const PathEntry& entry = path[i];
auto entryIt = node->m_values.find(entry);
if (entryIt == node->m_values.end())
{
break;
}
node = &entryIt->second;
}
if (node->m_data.has_value())
{
result = &node->m_data.value();
}
return result;
}
template<class T>
const T* DomPrefixTree<T>::ValueAtPath(const Path& path, PrefixTreeMatch match) const
{
// Const coerce the ValueAtPath result, which doesn't mutate but returns a mutable pointer
return const_cast<DomPrefixTree<T>*>(this)->ValueAtPath(path, match);
}
template<class T>
template<class Deduced>
T DomPrefixTree<T>::ValueAtPathOrDefault(const Path& path, Deduced&& defaultValue, PrefixTreeMatch match) const
{
const T* value = ValueAtPath(path, match);
return value == nullptr ? AZStd::forward<Deduced>(defaultValue) : *value;
}
template<class T>
template<class Deduced>
void DomPrefixTree<T>::SetValue(const Path& path, Deduced&& value)
{
Node* node = &m_rootNode;
for (const PathEntry& entry : path)
{
// Get or create an entry in this node
node = &node->m_values[entry];
}
node->m_data = AZStd::forward<Deduced>(value);
}
template<class T>
void DomPrefixTree<T>::EraseValue(const Path& path, bool removeChildren)
{
Node* node = &m_rootNode;
const size_t entriesToIterate = path.Size() - 1;
for (size_t i = 0; i < entriesToIterate; ++i)
{
const PathEntry& entry = path[i];
auto nodeIt = node->m_values.find(entry);
if (nodeIt == node->m_values.end())
{
return;
}
node = &nodeIt->second;
}
auto nodeIt = node->m_values.find(path[path.Size() - 1]);
if (nodeIt != node->m_values.end())
{
if (removeChildren)
{
node->m_values.erase(nodeIt);
}
else
{
nodeIt->second.m_data = {};
}
}
}
template<class T>
void DomPrefixTree<T>::Clear()
{
m_rootNode = Node();
}
} // namespace AZ::Dom

@ -151,6 +151,18 @@ namespace AZ::Dom
return Value(value);
}
Value Value::CreateNode(AZ::Name nodeName)
{
Value result(Type::Node);
result.SetNodeName(AZStd::move(nodeName));
return result;
}
Value Value::CreateNode(AZStd::string_view nodeName)
{
return CreateNode(AZ::Name(nodeName));
}
Value::Value(int8_t value)
: m_value(aznumeric_cast<int64_t>(value))
{

@ -222,6 +222,8 @@ namespace AZ::Dom
explicit Value(T*) = delete;
static Value FromOpaqueValue(const AZStd::any& value);
static Value CreateNode(AZ::Name nodeName);
static Value CreateNode(AZStd::string_view nodeName);
// Equality / comparison / swap...
Value& operator=(const Value&);

@ -134,6 +134,12 @@ namespace AZ
//! Color from u32 => 0xAABBGGRR, RGB convert from Gamma corrected to Linear values.
void FromU32GammaToLinear(u32 c);
//! Convert SRGB gamma space to linear space
static float ConvertSrgbGammaToLinear(float x);
//! Convert SRGB linear space to gamma space
static float ConvertSrgbLinearToGamma(float x);
//! Convert color from linear to gamma corrected space.
Color LinearToGamma() const;

@ -370,6 +370,15 @@ namespace AZ
*this = GammaToLinear();
}
AZ_MATH_INLINE float Color::ConvertSrgbGammaToLinear(float x)
{
return x <= 0.04045 ? (x / 12.92f) : static_cast<float>(pow((static_cast<double>(x) + 0.055) / 1.055, 2.4));
}
AZ_MATH_INLINE float Color::ConvertSrgbLinearToGamma(float x)
{
return x <= 0.0031308 ? 12.92f * x : static_cast<float>(1.055 * pow(static_cast<double>(x), 1.0 / 2.4) - 0.055);
}
AZ_MATH_INLINE Color Color::LinearToGamma() const
{
@ -377,9 +386,9 @@ namespace AZ
float g = GetG();
float b = GetB();
r = (r <= 0.0031308 ? 12.92f * r : static_cast<float>(1.055 * pow(static_cast<double>(r), 1.0 / 2.4) - 0.055));
g = (g <= 0.0031308 ? 12.92f * g : static_cast<float>(1.055 * pow(static_cast<double>(g), 1.0 / 2.4) - 0.055));
b = (b <= 0.0031308 ? 12.92f * b : static_cast<float>(1.055 * pow(static_cast<double>(b), 1.0 / 2.4) - 0.055));
r = ConvertSrgbLinearToGamma(r);
g = ConvertSrgbLinearToGamma(g);
b = ConvertSrgbLinearToGamma(b);
return Color(r,g,b,GetA());
}
@ -391,9 +400,9 @@ namespace AZ
float g = GetG();
float b = GetB();
return Color(r <= 0.04045 ? (r / 12.92f) : static_cast<float>(pow((static_cast<double>(r) + 0.055) / 1.055, 2.4)),
g <= 0.04045 ? (g / 12.92f) : static_cast<float>(pow((static_cast<double>(g) + 0.055) / 1.055, 2.4)),
b <= 0.04045 ? (b / 12.92f) : static_cast<float>(pow((static_cast<double>(b) + 0.055) / 1.055, 2.4)), GetA());
return Color(ConvertSrgbGammaToLinear(r),
ConvertSrgbGammaToLinear(g),
ConvertSrgbGammaToLinear(b), GetA());
}

@ -13,6 +13,7 @@
#include <AzCore/Memory/OSAllocator.h> // required by certain platforms
#include <AzCore/std/parallel/mutex.h>
#include <AzCore/std/parallel/lock.h>
#include <AzCore/std/containers/intrusive_list.h>
#include <AzCore/std/containers/intrusive_set.h>
#ifdef _DEBUG
@ -41,8 +42,8 @@
#define HPPA_ASSERT_PRINT_STACK(...) _EXPAND(_GET_MACRO23(__VA_ARGS__, _HPPA_ASSERT_PRINT_STACK3, _HPPA_ASSERT_PRINT_STACK2)(__VA_ARGS__))
namespace AZ {
namespace AZ
{
/// default windows virtual page size \todo Read this from the OS when we create the allocator)
#define OS_VIRTUAL_PAGE_SIZE AZ_PAGE_SIZE
//////////////////////////////////////////////////////////////////////////
@ -56,211 +57,78 @@ 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 T>
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<T*>(node_base::next()); }
T* prev() const {return static_cast<T*>(node_base::prev()); }
const T& data() const {return *static_cast<const T*>(this); }
T& data() {return *static_cast<T*>(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();
}
}
};
namespace HphaInternal
{
//! Rounds up a value to next power of 2.
//! For example to round 8388609((2^23) + 1) up to 16777216(2^24) the following occurs
//! Subtract one from the value in case it is already
//! equal to a power of 2
//! 8388609 - 1 = 8388608
//! Propagate the highest one bit in the value to all the lower bits
//! 8388608 = 0b100'0000'0000'0000'0000'0000 in binary
//!
//! 0b100'0000'0000'0000'0000'0000
//! |0b010'0000'0000'0000'0000'0000 (>> 1)
//! -------------------------------
//! 0b110'0000'0000'0000'0000'0000 (Now there are 2 consecutive 1-bits)
//! |0b001'1000'0000'0000'0000'0000 (>> 2)
//! -------------------------------
//! 0b111'1000'0000'0000'0000'0000 (Now there are 4 consecutive 1-bits)
//! |0b000'0111'1000'0000'0000'0000 (>> 4)
//! -------------------------------
//! 0b111'1111'1000'0000'0000'0000 (Now there are 8 consecutive 1-bits)
//! |0b000'0000'0111'1111'1000'0000 (>> 8)
//! -------------------------------
//! 0b111'1111'1111'1111'1000'0000 (Now there are 16 consecutive 1-bits)
//! |0b000'0000'0000'0000'0111'1111 (>> 16)
//! -------------------------------
//! 0b111'1111'1111'1111'1111'1111 (Now there are 23 consecutive 1-bits)
//! |0b000'0000'0000'0000'0000'0000 (>> 32)
//! -------------------------------
//! 0b111'1111'1111'1111'1111'1111
//! Finally since all the one bits are set in the value, adding one pushes it
//! to next power of 2
//! 0b1000'0000'0000'0000'0000'0000 = 16777216
static constexpr size_t AlignUpToPowerOfTwo(size_t value)
{
// If the value is <=2 it is already aligned
if (value <= 2)
{
return value;
}
// Subtract one to make any values already
// aligned to a power of 2 less than that power of 2
// so that algorithm doesn't push those values upwards
--value;
value |= value >> 0b1;
value |= value >> 0b10;
value |= value >> 0b100;
value |= value >> 0b1000;
value |= value >> 0b1'0000;
value |= value >> 0b10'0000;
++value;
return value;
}
static_assert(AlignUpToPowerOfTwo(0) == 0);
static_assert(AlignUpToPowerOfTwo(1) == 1);
static_assert(AlignUpToPowerOfTwo(2) == 2);
static_assert(AlignUpToPowerOfTwo(3) == 4);
static_assert(AlignUpToPowerOfTwo(4) == 4);
static_assert(AlignUpToPowerOfTwo(5) == 8);
static_assert(AlignUpToPowerOfTwo(8) == 8);
static_assert(AlignUpToPowerOfTwo(10) == 16);
static_assert(AlignUpToPowerOfTwo(16) == 16);
static_assert(AlignUpToPowerOfTwo(24) == 32);
static_assert(AlignUpToPowerOfTwo(32) == 32);
static_assert(AlignUpToPowerOfTwo(45) == 64);
static_assert(AlignUpToPowerOfTwo(64) == 64);
static_assert(AlignUpToPowerOfTwo(112) == 128);
static_assert(AlignUpToPowerOfTwo(128) == 128);
static_assert(AlignUpToPowerOfTwo(136) == 256);
static_assert(AlignUpToPowerOfTwo(256) == 256);
}
//////////////////////////////////////////////////////////////////////////
class HpAllocator
@ -376,7 +244,7 @@ namespace AZ {
};
struct page
: public block_header_proxy /* must be first */
, public intrusive_list<page>::node
, public AZStd::list_base_hook<page>::node_type
{
page(size_t elemSize, size_t pageSize, size_t marker)
: mBucketIndex((unsigned short)bucket_spacing_function_aligned(elemSize))
@ -415,25 +283,22 @@ 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<page>;
class bucket
using page_list = AZStd::intrusive_list<page, AZStd::list_base_hook<page>>;
#if defined(MULTITHREADED) && defined(USE_MUTEX_PER_BUCKET)
static constexpr size_t BucketAlignment = HphaInternal::AlignUpToPowerOfTwo(sizeof(page_list) + sizeof(AZStd::mutex) + sizeof(size_t));
#else
static constexpr size_t BucketAlignment = HphaInternal::AlignUpToPowerOfTwo(sizeof(page_list) + sizeof(size_t));
#endif
AZ_PUSH_DISABLE_WARNING_MSVC(4324)
class alignas(BucketAlignment) bucket
{
page_list mPageList;
#ifdef MULTITHREADED
#if defined (USE_MUTEX_PER_BUCKET)
#if defined(MULTITHREADED) && defined(USE_MUTEX_PER_BUCKET)
mutable AZStd::mutex mLock;
#endif
#endif
size_t mMarker;
#ifdef MULTITHREADED
#if defined (USE_MUTEX_PER_BUCKET)
unsigned char _padding[sizeof(void*) * 16 - sizeof(page_list) - sizeof(AZStd::mutex) - sizeof(size_t)];
#else
unsigned char _padding[sizeof(void*) * 16 - sizeof(page_list) - sizeof(size_t)];
#endif
#else
unsigned char _padding[sizeof(void*) * 4 - sizeof(page_list) - sizeof(size_t)];
#endif
public:
bucket();
#ifdef MULTITHREADED
@ -442,17 +307,19 @@ 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);
};
AZ_POP_DISABLE_WARNING_MSVC
void* bucket_system_alloc();
void bucket_system_free(void* ptr);
page* bucket_grow(size_t elemSize, size_t marker);
@ -1237,8 +1104,6 @@ namespace AZ {
// Thats why we use SimpleLcgRandom here
AZ::SimpleLcgRandom randGenerator = AZ::SimpleLcgRandom(reinterpret_cast<u64>(static_cast<void*>(this)));
mMarker = size_t(randGenerator.Getu64Random());
(void)_padding;
}
HpAllocator::page* HpAllocator::bucket::get_free_page()
@ -1278,8 +1143,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 +1160,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 +1392,8 @@ namespace AZ {
AZStd::lock_guard<AZStd::mutex> 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 +1407,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 +1424,21 @@ namespace AZ {
AZStd::lock_guard<AZStd::mutex> 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 +2109,17 @@ namespace AZ {
size_t HpAllocator::tree_get_max_allocation() const
{
#ifdef MULTITHREADED
AZStd::lock_guard<AZStd::recursive_mutex> lock(mTreeMutex);
#endif
return mFreeTree.maximum()->get_block()->size();
}
size_t HpAllocator::tree_get_unused_memory(bool isPrint) const
{
#ifdef MULTITHREADED
AZStd::lock_guard<AZStd::recursive_mutex> lock(mTreeMutex);
#endif
size_t unusedMemory = 0;
for (free_node_tree::const_iterator it = mFreeTree.begin(); it != mFreeTree.end(); ++it)
{
@ -2564,7 +2440,7 @@ namespace AZ {
m_capacity = desc.m_capacity;
}
AZ_Assert(sizeof(HpAllocator) <= sizeof(m_hpAllocatorBuffer), "Increase the m_hpAllocatorBuffer, we need %d bytes but we have %d bytes!", sizeof(HpAllocator), sizeof(m_hpAllocatorBuffer));
static_assert(sizeof(HpAllocator) <= sizeof(m_hpAllocatorBuffer), "Increase the m_hpAllocatorBuffer, it needs to be at least the sizeof(HpAllocator)");
m_allocator = new (&m_hpAllocatorBuffer) HpAllocator(m_desc);
}

@ -73,18 +73,20 @@ namespace AZ
void GarbageCollect() override;
private:
// [LY-84974][sconel@][2018-08-10] SliceStrike integration up to CL 671758
// this must be at least the max size of HpAllocator (defined in the cpp) + any platform compiler padding
static const int hpAllocatorStructureSize = 16584;
// [LY][sconel@] end
// A static assert inside of HphaSchema.cpp validates that this is the case
// as of commit https://github.com/o3de/o3de/commit/92cd457c256e1ec91eeabe04b56d1d4c61f8b1af
// When MULTITHREADED and USE_MUTEX_PER_BUCKET is defined
// the largest sizeof for HpAllocator is 16640 on MacOS
// On Windows the sizeof HpAllocator is 8384
// Up this value to 18 KiB to be safe
static constexpr size_t hpAllocatorStructureSize = 18 * 1024;
Descriptor m_desc;
int m_pad; // pad the Descriptor to avoid C4355
size_type m_capacity; ///< Capacity in bytes.
HpAllocator* m_allocator;
// [LY-84974][sconel@][2018-08-10] SliceStrike integration up to CL 671758
AZStd::aligned_storage<hpAllocatorStructureSize, 16>::type m_hpAllocatorBuffer; ///< Memory buffer for HpAllocator
// [LY][sconel@] end
AZStd::aligned_storage_t<hpAllocatorStructureSize, 16> m_hpAllocatorBuffer; ///< Memory buffer for HpAllocator
bool m_ownMemoryBlock;
};
} // namespace AZ

@ -22,6 +22,7 @@
#include <AzCore/Serialization/Json/UnorderedSetSerializer.h>
#include <AzCore/Serialization/Json/UnsupportedTypesSerializer.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Settings/ConfigurableStack.h>
#include <AzCore/std/any.h>
#include <AzCore/std/optional.h>
#include <AzCore/std/tuple.h>
@ -50,6 +51,8 @@ namespace AZ
void JsonSystemComponent::Reflect(ReflectContext* reflectContext)
{
JsonConfigurableStackSerializer::Reflect(reflectContext);
if (JsonRegistrationContext* jsonContext = azrtti_cast<JsonRegistrationContext*>(reflectContext))
{
jsonContext->Serializer<JsonBoolSerializer>()->HandlesType<bool>();

@ -8,11 +8,12 @@
#pragma once
#include <AzCore/Math/Uuid.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
#include <AzCore/std/containers/unordered_map.h>
#include <AzCore/Math/Uuid.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
namespace AZ
@ -22,6 +23,7 @@ namespace AZ
{
public:
AZ_RTTI(JsonRegistrationContext, "{5A763774-CA8B-4245-A897-A03C503DCD60}", ReflectContext);
AZ_CLASS_ALLOCATOR(JsonRegistrationContext, SystemAllocator, 0);
class SerializerBuilder;
using SerializerMap = AZStd::unordered_map<Uuid, AZStd::unique_ptr<BaseJsonSerializer>, AZStd::hash<Uuid>>;

@ -0,0 +1,172 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Settings/ConfigurableStack.h>
#include <AzCore/Serialization/Json/RegistrationContext.h>
#include <AzCore/std/containers/queue.h>
#include <AzCore/std/tuple.h>
namespace AZ
{
AZ_CLASS_ALLOCATOR_IMPL(JsonConfigurableStackSerializer, AZ::SystemAllocator, 0);
JsonSerializationResult::Result JsonConfigurableStackSerializer::Load(
void* outputValue,
[[maybe_unused]] const Uuid& outputValueTypeId,
const rapidjson::Value& inputValue,
JsonDeserializerContext& context)
{
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
switch (inputValue.GetType())
{
case rapidjson::kArrayType:
return LoadFromArray(outputValue, inputValue, context);
case rapidjson::kObjectType:
return LoadFromObject(outputValue, inputValue, context);
case rapidjson::kNullType:
[[fallthrough]];
case rapidjson::kFalseType:
[[fallthrough]];
case rapidjson::kTrueType:
[[fallthrough]];
case rapidjson::kStringType:
[[fallthrough]];
case rapidjson::kNumberType:
return context.Report(
JSR::Tasks::ReadField, JSR::Outcomes::Unsupported,
"Unsupported type. Configurable stack values can only be read from arrays or objects.");
default:
return context.Report(JSR::Tasks::ReadField, JSR::Outcomes::Unknown, "Unknown json type encountered for string value.");
}
}
JsonSerializationResult::Result JsonConfigurableStackSerializer::Store(
[[maybe_unused]] rapidjson::Value& outputValue,
[[maybe_unused]] const void* inputValue,
[[maybe_unused]] const void* defaultValue,
[[maybe_unused]] const Uuid& valueTypeId,
JsonSerializerContext& context)
{
return context.Report(
JsonSerializationResult::Tasks::WriteValue, JsonSerializationResult::Outcomes::Unsupported,
"Configuration stacks can not be written out.");
}
void JsonConfigurableStackSerializer::Reflect(ReflectContext* context)
{
if (JsonRegistrationContext* jsonContext = azrtti_cast<JsonRegistrationContext*>(context))
{
jsonContext->Serializer<JsonConfigurableStackSerializer>()->HandlesType<ConfigurableStack>();
}
}
JsonSerializationResult::Result JsonConfigurableStackSerializer::LoadFromArray(
void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
{
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
auto stack = reinterpret_cast<ConfigurableStackInterface*>(outputValue);
const Uuid& nodeValueType = stack->GetNodeType();
JSR::ResultCode result(JSR::Tasks::ReadField);
uint32_t counter = 0;
for (auto& it : inputValue.GetArray())
{
ScopedContextPath subPath(context, counter);
void* value = stack->AddNode(AZStd::to_string(counter));
result.Combine(ContinueLoading(value, nodeValueType, it, context));
counter++;
}
return context.Report(
result,
result.GetProcessing() != JSR::Processing::Halted ? "Loaded configurable stack from array."
: "Failed to load configurable stack from array.");
}
JsonSerializationResult::Result JsonConfigurableStackSerializer::LoadFromObject(
void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
{
namespace JSR = JsonSerializationResult; // Used remove name conflicts in AzCore in uber builds.
auto stack = reinterpret_cast<ConfigurableStackInterface*>(outputValue);
const Uuid& nodeValueType = stack->GetNodeType();
AZStd::queue<AZStd::tuple<ConfigurableStackInterface::InsertPosition, AZStd::string_view, rapidjson::Value::ConstMemberIterator>>
delayedEntries;
JSR::ResultCode result(JSR::Tasks::ReadField);
auto add = [&](ConfigurableStackInterface::InsertPosition position, rapidjson::Value::ConstMemberIterator target,
rapidjson::Value::ConstMemberIterator it)
{
if (target->value.IsString())
{
delayedEntries.emplace(position, AZStd::string_view(target->value.GetString(), target->value.GetStringLength()), it);
}
else
{
result.Combine(context.Report(
JSR::Tasks::ReadField, JSR::Outcomes::Skipped,
"Skipped value for the Configurable Stack because the target wasn't a string."));
}
};
// Load all the regular entries into the stack and store any with a before or after binding for
// later inserting.
for (auto it = inputValue.MemberBegin(); it != inputValue.MemberEnd(); ++it)
{
AZStd::string_view name(it->name.GetString(), it->name.GetStringLength());
ScopedContextPath subPath(context, name);
if (it->value.IsObject())
{
if (auto target = it->value.FindMember(StackBefore); target != it->value.MemberEnd())
{
add(ConfigurableStackInterface::InsertPosition::Before, target, it);
continue;
}
if (auto target = it->value.FindMember(StackAfter); target != it->value.MemberEnd())
{
add(ConfigurableStackInterface::InsertPosition::After, target, it);
continue;
}
}
void* value = stack->AddNode(name);
result.Combine(ContinueLoading(value, nodeValueType, it->value, context));
}
// Insert the entries that have been delayed.
while (!delayedEntries.empty())
{
auto&& [insertPosition, target, valueStore] = delayedEntries.front();
AZStd::string_view name(valueStore->name.GetString(), valueStore->name.GetStringLength());
ScopedContextPath subPath(context, name);
void* value = stack->AddNode(name, target, insertPosition);
if (value != nullptr)
{
result.Combine(ContinueLoading(value, nodeValueType, valueStore->value, context));
}
else
{
result.Combine(context.Report(
JSR::Tasks::ReadField, JSR::Outcomes::Skipped,
AZStd::string::format(
"Skipped value for the Configurable Stack because the target '%.*s' couldn't be found.", AZ_STRING_ARG(name))));
}
delayedEntries.pop();
}
return context.Report(
result,
result.GetProcessing() != JSR::Processing::Halted ? "Loaded configurable stack from array."
: "Failed to load configurable stack from array.");
}
} // namespace AZ

@ -0,0 +1,187 @@
/*
* 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 <AzCore/base.h>
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/utils.h>
namespace AZ
{
//! The ConfigurableStack makes configuring stacks and arrays through the Settings Registry easier than using direct serialization
//! to a container like AZStd::vector. It does this by using JSON Objects rather than JSON arrays, although arrays are supported
//! for backwards compatibility. Two key words were added:
//! - $stack_before : Insert the new entry before the referenced entry. Referencing is done by name.
//! - $stack_after : Insert the new entry after the referenced entry. Referencing is done by name.
//! to allow inserting new entries at specific locations. An example of a .setreg file at updates existing settings would be:
//! // Original settings
//! {
//! "Settings in a stack":
//! {
//! "AnOriginalEntry":
//! {
//! "MyValue": "hello",
//! "ExampleValue": 84
//! },
//! "TheSecondEntry":
//! {
//! "MyValue": "world"
//! }
//! }
//! }
//!
//! // Customized settings.
//! {
//! "Settings in a stack":
//! {
//! // Add a new entry before "AnOriginalEntry" in the original document.
//! "NewEntry":
//! {
//! "$stack_before": "AnOriginalEntry",
//! "MyValue": 42
//! },
//! // Add a second entry after "AnOriginalEntry" in the original document.
//! "SecondNewEntry":
//! {
//! "$stack_after": "AnOriginalEntry",
//! "MyValue": "FortyTwo".
//! },
//! // Update a value in "AnOriginalEntry".
//! "AnOriginalEntry":
//! {
//! "ExampleValue": 42
//! },
//! // Delete the "TheSecondEntry" from the settings.
//! "TheSecondEntry" : null,
//! }
//! }
//!
//! The ConfigurableStack uses an AZStd::shared_ptr to store the values. This supports settings up a base class and specifying
//! derived classes in the settings, but requires that the base and derived classes all have a memory allocator associated with
//! them (i.e. by using the "AZ_CLASS_ALLOCATOR" macro) and that the relation of the classes is reflected. Loading a
//! ConfigurableStack can be done using the GetObject call on the SettingsRegistryInterface.
class ReflectContext;
class ConfigurableStackInterface
{
public:
friend class JsonConfigurableStackSerializer;
virtual ~ConfigurableStackInterface() = default;
virtual const TypeId& GetNodeType() const = 0;
protected:
enum class InsertPosition
{
Before,
After
};
virtual void* AddNode(AZStd::string name) = 0;
virtual void* AddNode(AZStd::string name, AZStd::string_view target, InsertPosition position) = 0;
};
template<typename StackBaseType>
class ConfigurableStack final : public ConfigurableStackInterface
{
public:
using NodeValue = AZStd::shared_ptr<StackBaseType>;
using Node = AZStd::pair<AZStd::string, NodeValue>;
using NodeContainer = AZStd::vector<Node>;
using Iterator = typename NodeContainer::iterator;
using ConstIterator = typename NodeContainer::const_iterator;
~ConfigurableStack() override = default;
const TypeId& GetNodeType() const override;
Iterator begin();
Iterator end();
ConstIterator begin() const;
ConstIterator end() const;
size_t size() const;
protected:
void* AddNode(AZStd::string name) override;
void* AddNode(AZStd::string name, AZStd::string_view target, InsertPosition position) override;
private:
NodeContainer m_nodes;
};
AZ_TYPE_INFO_TEMPLATE(ConfigurableStack, "{0A3D2038-6E6A-4EFD-A1B4-F30D947E21B1}", AZ_TYPE_INFO_TYPENAME);
template<typename StackBaseType>
struct SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>
{
using ConfigurableStackType = ConfigurableStack<StackBaseType>;
class GenericConfigurableStackInfo : public GenericClassInfo
{
public:
AZ_TYPE_INFO(GenericConfigurableStackInfo, "{FC5A9353-D0DE-48F6-81B5-1CB2985C5F65}");
GenericConfigurableStackInfo();
SerializeContext::ClassData* GetClassData() override;
size_t GetNumTemplatedArguments() override;
const Uuid& GetTemplatedTypeId([[maybe_unused]] size_t element) override;
const Uuid& GetSpecializedTypeId() const override;
const Uuid& GetGenericTypeId() const override;
void Reflect(SerializeContext* serializeContext) override;
SerializeContext::ClassData m_classData;
};
using ClassInfoType = GenericConfigurableStackInfo;
static ClassInfoType* GetGenericInfo();
static const Uuid& GetClassTypeId();
};
class JsonConfigurableStackSerializer : public BaseJsonSerializer
{
public:
AZ_RTTI(JsonConfigurableStackSerializer, "{45A31805-9058-41A9-B1A3-71E2CB4D9237}", BaseJsonSerializer);
AZ_CLASS_ALLOCATOR_DECL;
JsonSerializationResult::Result Load(
void* outputValue,
const Uuid& outputValueTypeId,
const rapidjson::Value& inputValue,
JsonDeserializerContext& context) override;
JsonSerializationResult::Result Store(
rapidjson::Value& outputValue,
const void* inputValue,
const void* defaultValue,
const Uuid& valueTypeId,
JsonSerializerContext& context) override;
static void Reflect(ReflectContext* context);
private:
JsonSerializationResult::Result LoadFromArray(
void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context);
JsonSerializationResult::Result LoadFromObject(
void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context);
static constexpr const char* StackBefore = "$stack_before";
static constexpr const char* StackAfter = "$stack_after";
};
} // namespace AZ
#include <AzCore/Settings/ConfigurableStack.inl>

@ -0,0 +1,149 @@
/*
* 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
namespace AZ
{
//
// ConfigurableStack
//
template<typename StackBaseType>
const TypeId& ConfigurableStack<StackBaseType>::GetNodeType() const
{
return azrtti_typeid<NodeValue>();
}
template<typename StackBaseType>
auto ConfigurableStack<StackBaseType>::begin() -> Iterator
{
return m_nodes.begin();
}
template<typename StackBaseType>
auto ConfigurableStack<StackBaseType>::end() -> Iterator
{
return m_nodes.end();
}
template<typename StackBaseType>
auto ConfigurableStack<StackBaseType>::begin() const -> ConstIterator
{
return m_nodes.begin();
}
template<typename StackBaseType>
auto ConfigurableStack<StackBaseType>::end() const -> ConstIterator
{
return m_nodes.end();
}
template<typename StackBaseType>
size_t ConfigurableStack<StackBaseType>::size() const
{
return m_nodes.size();
}
template<typename StackBaseType>
void* ConfigurableStack<StackBaseType>::AddNode(AZStd::string name)
{
Node& result = m_nodes.emplace_back(AZStd::move(name));
return &result.second;
}
template<typename StackBaseType>
void* ConfigurableStack<StackBaseType>::AddNode(AZStd::string name, AZStd::string_view target, InsertPosition position)
{
auto end = m_nodes.end();
for (auto it = m_nodes.begin(); it != end; ++it)
{
if (it->first == target)
{
if (position == InsertPosition::After)
{
++it;
}
auto result = m_nodes.insert(it, Node(AZStd::move(name), {}));
return &result->second;
}
}
return nullptr;
}
//
// SerializeGenericTypeInfo
//
template<typename StackBaseType>
SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::GenericConfigurableStackInfo()
: m_classData{ SerializeContext::ClassData::Create<ConfigurableStackType>(
"AZ::ConfigurableStack", GetSpecializedTypeId(), Internal::NullFactory::GetInstance(), nullptr, nullptr) }
{
}
template<typename StackBaseType>
SerializeContext::ClassData* SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::GetClassData()
{
return &m_classData;
}
template<typename StackBaseType>
size_t SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::GetNumTemplatedArguments()
{
return 1;
}
template<typename StackBaseType>
const Uuid& SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::GetTemplatedTypeId(
[[maybe_unused]] size_t element)
{
return SerializeGenericTypeInfo<StackBaseType>::GetClassTypeId();
}
template<typename StackBaseType>
const Uuid& SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::GetSpecializedTypeId() const
{
return azrtti_typeid<ConfigurableStackType>();
}
template<typename StackBaseType>
const Uuid& SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::GetGenericTypeId() const
{
return TYPEINFO_Uuid();
}
template<typename StackBaseType>
void SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GenericConfigurableStackInfo::Reflect(SerializeContext* serializeContext)
{
if (serializeContext)
{
serializeContext->RegisterGenericClassInfo(GetSpecializedTypeId(), this, &AnyTypeInfoConcept<ConfigurableStackType>::CreateAny);
if (serializeContext->FindClassData(azrtti_typeid<AZStd::shared_ptr<StackBaseType>>()) == nullptr)
{
serializeContext->RegisterGenericType<AZStd::shared_ptr<StackBaseType>>();
}
}
}
template<typename StackBaseType>
auto SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GetGenericInfo() -> ClassInfoType*
{
return GetCurrentSerializeContextModule().CreateGenericClassInfo<ConfigurableStackType>();
}
template<typename StackBaseType>
const Uuid& SerializeGenericTypeInfo<ConfigurableStack<StackBaseType>>::GetClassTypeId()
{
return GetGenericInfo()->GetClassData()->m_typeId;
}
} // namespace AZ

@ -159,6 +159,36 @@ namespace UnitTest
TeardownAllocator();
}
};
/**
* RAII wrapper around a BenchmarkEnvironmentBase to encapsulate
* the creation and destuction of the SystemAllocator
* SetUpBenchmark and TearDownBenchmark can still be used for custom
* benchmark environment setup
*/
class ScopedAllocatorBenchmarkEnvironment
: public AZ::Test::BenchmarkEnvironmentBase
{
public:
ScopedAllocatorBenchmarkEnvironment()
{
// Only create the allocator if it doesn't exist
if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
{
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
m_ownsAllocator = true;
}
}
~ScopedAllocatorBenchmarkEnvironment() override
{
if (m_ownsAllocator)
{
AZ::AllocatorInstance<AZ::SystemAllocator>::Destroy();
}
}
private:
bool m_ownsAllocator{};
};
#endif
class DLLTestVirtualClass

@ -130,6 +130,8 @@ set(FILES
DOM/DomVisitor.h
DOM/DomComparison.cpp
DOM/DomComparison.h
DOM/DomPrefixTree.h
DOM/DomPrefixTree.inl
DOM/Backends/JSON/JsonBackend.h
DOM/Backends/JSON/JsonSerializationUtils.cpp
DOM/Backends/JSON/JsonSerializationUtils.h
@ -560,6 +562,9 @@ set(FILES
Serialization/std/VariantReflection.inl
Settings/CommandLine.cpp
Settings/CommandLine.h
Settings/ConfigurableStack.cpp
Settings/ConfigurableStack.inl
Settings/ConfigurableStack.h
Settings/SettingsRegistry.cpp
Settings/SettingsRegistry.h
Settings/SettingsRegistryConsoleUtils.cpp

@ -42,20 +42,13 @@ namespace AZStd
template<class U, class Hook, class Compare>
friend class intrusive_multiset;
#ifdef AZ_DEBUG_BUILD
intrusive_multiset_node()
{
m_children[0] = nullptr;
m_children[1] = nullptr;
m_neighbours[0] = nullptr;
m_neighbours[1] = nullptr;
m_parentColorSide = nullptr;
}
intrusive_multiset_node() = default;
~intrusive_multiset_node()
{
#if defined(AZ_DEBUG_BUILD)
AZSTD_CONTAINER_ASSERT(m_children[0] == nullptr && m_children[1] == nullptr && m_parentColorSide == nullptr, "AZStd::intrusive_multiset_node - intrusive list node is being destroyed while still in a container!");
}
#endif
}
// We use the lower 2 bits of the parent pointer to store
enum Bits
{
@ -95,9 +88,9 @@ namespace AZStd
AZ_FORCE_INLINE T* next() const { return m_neighbours[AZSTD_RBTREE_RIGHT]; }
protected:
T* m_children[2];
T* m_neighbours[2];
T* m_parentColorSide;
T* m_children[2]{};
T* m_neighbours[2]{};
T* m_parentColorSide{};
} AZ_MAY_ALIAS; // we access the object in such way that we potentially can break strict aliasing rules
/**
@ -659,12 +652,10 @@ namespace AZStd
--m_numElements;
#ifdef AZ_DEBUG_BUILD
nodeHook->m_children[0] = nodeHook->m_children[1] = nullptr;
nodeHook->m_parentColorSide = nullptr;
#ifdef DEBUG_INTRUSIVE_MULTISET
#if defined(AZ_DEBUG_BUILD) && defined(DEBUG_INTRUSIVE_MULTISET)
validate();
#endif
#endif
}
@ -955,8 +946,11 @@ namespace AZStd
hookNode->setParentSide(side);
}
//! pre-condition
//! @param node must be non-nullptr
inline static node_ptr_type MinOrMax(const_node_ptr_type node, SideType side)
{
AZSTD_CONTAINER_ASSERT(node != nullptr, "MinOrMax can only be called with a non-nullptr node")
const_node_ptr_type cur = node;
const_node_ptr_type minMax = cur;
while (!iterator_impl::isNil(cur))

@ -23,28 +23,28 @@ namespace AZStd::ranges::views::Internal
{}
template<class... Args>
constexpr decltype(auto) operator()(Args&&... args) &
noexcept(noexcept(AZStd::invoke(m_outer, AZStd::invoke(m_inner, AZStd::forward<Args>(args)...))))
noexcept(noexcept(AZStd::invoke(declval<Outer>(), AZStd::invoke(declval<Inner>(), AZStd::forward<Args>(args)...))))
{
return AZStd::invoke(m_outer, AZStd::invoke(m_inner, AZStd::forward<Args>(args)...));
}
template<class... Args>
constexpr decltype(auto) operator()(Args&&... args) const&
noexcept(noexcept(AZStd::invoke(m_outer, AZStd::invoke(m_inner, AZStd::forward<Args>(args)...))))
noexcept(noexcept(AZStd::invoke(declval<Outer>(), AZStd::invoke(declval<Inner>(), AZStd::forward<Args>(args)...))))
{
return AZStd::invoke(m_outer, AZStd::invoke(m_inner, AZStd::forward<Args>(args)...));
}
//
template<class... Args>
constexpr decltype(auto) operator()(Args&&... args) &&
noexcept(noexcept(AZStd::invoke(AZStd::move(m_outer),
AZStd::invoke(AZStd::move(m_inner), AZStd::forward<Args>(args)...))))
noexcept(noexcept(AZStd::invoke(declval<Outer>(),
AZStd::invoke(declval<Inner>(), AZStd::forward<Args>(args)...))))
{
return AZStd::invoke(AZStd::move(m_outer), AZStd::invoke(AZStd::move(m_inner), AZStd::forward<Args>(args)...));
}
template<class... Args>
constexpr decltype(auto) operator()(Args&&... args) const&&
noexcept(noexcept(AZStd::invoke(AZStd::move(m_outer),
AZStd::invoke(AZStd::move(m_inner), AZStd::forward<Args>(args)...))))
noexcept(noexcept(AZStd::invoke(declval<Outer>(),
AZStd::invoke(declval<Inner>(), AZStd::forward<Args>(args)...))))
{
return AZStd::invoke(AZStd::move(m_outer), AZStd::invoke(AZStd::move(m_inner), AZStd::forward<Args>(args)...));
}

@ -595,31 +595,44 @@ namespace AZStd
static constexpr int_type not_eof(int_type c) noexcept { return c != eof() ? c : !eof(); }
};
// string_view forward declaation
template <class Element, class Traits = AZStd::char_traits<Element>>
class basic_string_view;
}
namespace AZStd::Internal
{
template <class Element, class Traits, class R, class = void>
struct has_operator_basic_string_view
: false_type
{};
template <class Element, class Traits, class R>
struct has_operator_basic_string_view<Element, Traits, R, enable_if_t<
bool(&decay_t<R>::operator basic_string_view<Element, Traits>)>>
: true_type
{};
// If the range has a traits_type element, it must match
template <class Element, class Traits, class R, class = void>
static constexpr bool range_trait_type_matches = true;
template <class Element, class Traits, class R>
inline constexpr bool range_trait_type_matches<Element, Traits, R,
enable_if_t<conjunction_v<
Internal::sfinae_trigger<typename remove_reference_t<R>::traits_type>,
bool_constant<!same_as<typename remove_reference_t<R>::traits_type, Traits>>
>>> = false;
}
namespace AZStd
{
/**
* Immutable string wrapper based on boost::const_string and std::string_view. When we operate on
* Immutable string wrapper based on std::string_view. When we operate on
* const char* we don't know if this points to NULL terminated string or just a char array.
* to have a clear distinction between them we provide this wrapper.
*/
template <class Element, class Traits = AZStd::char_traits<Element>>
template <class Element, class Traits>
class basic_string_view
{
template <class R, class = void>
static constexpr bool has_operator_basic_string_view = false;
template <class R>
static constexpr bool has_operator_basic_string_view<R, void_t<
decltype(declval<remove_cvref_t<R>>().operator basic_string_view<Element, Traits>())
>> = true;
// If the range has a traits_type element, it must match
template <class R, class = void>
static constexpr bool range_trait_type_matches = true;
template <class R>
static constexpr bool range_trait_type_matches<R,
enable_if_t<conjunction_v<
Internal::sfinae_trigger<typename remove_reference_t<R>::traits_type>,
bool_constant<!same_as<typename remove_reference_t<R>::traits_type, Traits>>
>>> = false;
public:
using traits_type = Traits;
using value_type = Element;
@ -674,8 +687,8 @@ namespace AZStd
bool_constant<ranges::contiguous_range<R>>,
bool_constant<ranges::sized_range<R>>,
bool_constant<same_as<ranges::range_value_t<R>, value_type>>,
bool_constant<!has_operator_basic_string_view<R>>,
bool_constant<range_trait_type_matches<R>>
negation<Internal::has_operator_basic_string_view<Element, Traits, R>>,
bool_constant<Internal::range_trait_type_matches<Element, Traits, R>>
>>>
constexpr basic_string_view(R&& r)
: m_begin(ranges::data(r))

@ -140,7 +140,7 @@ namespace AZ {
SymRegisterCallback64_t g_SymRegisterCallback64;
HMODULE g_dbgHelpDll;
#define LOAD_FUNCTION(A) { g_##A = (A##_t)GetProcAddress(g_dbgHelpDll, #A); AZ_Assert(g_##A != 0, ("Can not load %s function!",#A)); }
#define LOAD_FUNCTION(A) { g_##A = (A##_t)GetProcAddress(g_dbgHelpDll, #A); AZ_Assert(g_##A != 0, "Can not load %s function!",#A); }
using namespace AZ::Debug;
@ -596,7 +596,7 @@ namespace AZ {
result = GetLastError();
}
ULONGLONG fileVersion = 0;
if (szImg != NULL)
if (szImg[0]) // !szImg.empty()
{
// try to retrieve the file-version:
VS_FIXEDFILEINFO* fInfo = NULL;
@ -624,43 +624,6 @@ namespace AZ {
}
}
// Retrive some additional-infos about the module
IMAGEHLP_MODULE64 Module;
const char* szSymType = "-unknown-";
if (GetModuleInfo(hProcess, baseAddr, &Module) != FALSE)
{
switch (Module.SymType)
{
case SymNone:
szSymType = "-nosymbols-";
break;
case SymCoff:
szSymType = "COFF";
break;
case SymCv:
szSymType = "CV";
break;
case SymPdb:
szSymType = "PDB";
break;
case SymExport:
szSymType = "-exported-";
break;
case SymDeferred:
szSymType = "-deferred-";
break;
case SymSym:
szSymType = "SYM";
break;
case 8: //SymVirtual:
szSymType = "Virtual";
break;
case 9: // SymDia:
szSymType = "DIA";
break;
}
}
// find insert position
if (g_moduleInfo.size() < g_moduleInfo.capacity())
{
@ -1073,7 +1036,7 @@ cleanup:
}
HANDLE hThread = nativeThread;
CONTEXT alignas(8) context; // Without this alignment the function randomly crashes in release.
alignas(alignof(CONTEXT)) CONTEXT context; // Without this alignment the function randomly crashes in release.
context.ContextFlags = CONTEXT_ALL;
GetThreadContext(hThread, &context);

@ -443,7 +443,7 @@ namespace UnitTest
: m_data(data) { /* expensive operations */ }
private:
int m_data;
[[maybe_unused]] int m_data;
};
//////////////////////////////////////////////////////////////////////////

@ -2537,7 +2537,7 @@ namespace Benchmark
{
AZStd::string test1{ "foo bar"};
AZStd::string test2{ "bar foo" };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
SwapStringViaPointerSizedSwaps(test1, test2);
}
@ -2547,7 +2547,7 @@ namespace Benchmark
{
AZStd::string test1{ "The brown quick wolf jumped over the hyperactive cat" };
AZStd::string test2{ "The quick brown fox jumped over the lazy dog" };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
SwapStringViaPointerSizedSwaps(test1, test2);
}
@ -2557,7 +2557,7 @@ namespace Benchmark
{
AZStd::string test1{ "foo bar" };
AZStd::string test2{ "bar foo" };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
SwapStringViaMemcpy(test1, test2);
}
@ -2567,7 +2567,7 @@ namespace Benchmark
{
AZStd::string test1{ "The brown quick wolf jumped over the hyperactive cat" };
AZStd::string test2{ "The quick brown fox jumped over the lazy dog" };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
SwapStringViaMemcpy(test1, test2);
}
@ -2584,7 +2584,7 @@ namespace Benchmark
AZStd::string sourceString(state.range(0), 'a');
const char* sourceAddress = sourceString.c_str();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(sourceAddress);
@ -2600,7 +2600,7 @@ namespace Benchmark
const char* sourceAddress = sourceString.c_str();
const size_t sourceSize = sourceString.size();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(sourceAddress, sourceSize);
@ -2616,7 +2616,7 @@ namespace Benchmark
auto sourceBegin = sourceString.begin();
auto sourceEnd = sourceString.end();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(sourceBegin, sourceEnd);
@ -2631,7 +2631,7 @@ namespace Benchmark
AZStd::string sourceString(state.range(0), 'a');
AZStd::string_view sourceView(sourceString);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(sourceView);
@ -2645,7 +2645,7 @@ namespace Benchmark
{
AZStd::string sourceString(state.range(0), 'a');
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(sourceString);
@ -2659,7 +2659,7 @@ namespace Benchmark
{
AZStd::string sourceString(state.range(0), 'a');
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(AZStd::move(sourceString));
@ -2671,7 +2671,7 @@ namespace Benchmark
BENCHMARK_TEMPLATE_DEFINE_F(StringTemplateBenchmarkFixture, BM_StringAssignFromSingleCharacter, AZStd::string)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::string assignString;
assignString.assign(state.range(0), 'a');
@ -2689,7 +2689,7 @@ namespace Benchmark
AZStd::fixed_string<1024> sourceString(state.range(0), 'a');
const char* sourceAddress = sourceString.c_str();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(sourceAddress);
@ -2705,7 +2705,7 @@ namespace Benchmark
const char* sourceAddress = sourceString.c_str();
const size_t sourceSize = sourceString.size();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(sourceAddress, sourceSize);
@ -2721,7 +2721,7 @@ namespace Benchmark
auto sourceBegin = sourceString.begin();
auto sourceEnd = sourceString.end();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(sourceBegin, sourceEnd);
@ -2736,7 +2736,7 @@ namespace Benchmark
AZStd::fixed_string<1024> sourceString(state.range(0), 'a');
AZStd::string_view sourceView(sourceString);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(sourceView);
@ -2750,7 +2750,7 @@ namespace Benchmark
{
AZStd::fixed_string<1024> sourceString(state.range(0), 'a');
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(sourceString);
@ -2764,7 +2764,7 @@ namespace Benchmark
{
AZStd::fixed_string<1024> sourceString(state.range(0), 'a');
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(AZStd::move(sourceString));
@ -2776,7 +2776,7 @@ namespace Benchmark
BENCHMARK_TEMPLATE_DEFINE_F(StringTemplateBenchmarkFixture, BM_FixedStringAssignFromSingleCharacter, AZStd::fixed_string<1024>)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::fixed_string<1024> assignString;
assignString.assign(state.range(0), 'a');

@ -29,7 +29,7 @@ namespace AZ::Dom::Benchmark
AZ::Dom::JsonBackend backend;
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
state.PauseTiming();
AZStd::string payloadCopy = serializedPayload;
@ -53,7 +53,7 @@ namespace AZ::Dom::Benchmark
AZ::Dom::JsonBackend backend;
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
state.PauseTiming();
AZStd::string payloadCopy = serializedPayload;
@ -77,7 +77,7 @@ namespace AZ::Dom::Benchmark
AZ::Dom::JsonBackend backend;
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
auto result = AZ::Dom::Json::WriteToRapidJsonDocument(
[&](AZ::Dom::Visitor& visitor)
@ -97,7 +97,7 @@ namespace AZ::Dom::Benchmark
AZ::Dom::JsonBackend backend;
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
auto result = AZ::Dom::Utils::WriteToValue(
[&](AZ::Dom::Visitor& visitor)
@ -117,7 +117,7 @@ namespace AZ::Dom::Benchmark
AZ::Dom::JsonBackend backend;
AZStd::string serializedPayload = GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
auto result = AZ::JsonSerializationUtils::ReadJsonString(serializedPayload);
@ -130,7 +130,7 @@ namespace AZ::Dom::Benchmark
BENCHMARK_DEFINE_F(DomJsonBenchmark, RapidjsonMakeComplexObject)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
TakeAndDiscardWithoutTimingDtor(GenerateDomJsonBenchmarkPayload(state.range(0), state.range(1)), state);
}
@ -152,7 +152,7 @@ namespace AZ::Dom::Benchmark
document.GetAllocator());
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const AZStd::string& key : keys)
{
@ -168,7 +168,7 @@ namespace AZ::Dom::Benchmark
{
rapidjson::Document original = GenerateDomJsonBenchmarkDocument(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
rapidjson::Document copy;
copy.CopyFrom(original, copy.GetAllocator(), true);
@ -184,7 +184,7 @@ namespace AZ::Dom::Benchmark
{
rapidjson::Document original = GenerateDomJsonBenchmarkDocument(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
rapidjson::Document copy;
copy.CopyFrom(original, copy.GetAllocator(), true);

@ -78,7 +78,7 @@ namespace AZ::Dom::Benchmark
if (apply)
{
auto patchInfo = GenerateHierarchicalDeltaPatch(m_before, m_after);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
auto patchResult = patchInfo.m_forwardPatches.Apply(m_before);
benchmark::DoNotOptimize(patchResult);
@ -86,7 +86,7 @@ namespace AZ::Dom::Benchmark
}
else
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
auto patchInfo = GenerateHierarchicalDeltaPatch(m_before, m_after);
benchmark::DoNotOptimize(patchInfo);

@ -20,7 +20,7 @@ namespace AZ::Dom::Benchmark
PathEntry end;
end.SetEndOfArray();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
Path p;
p /= entry1;
@ -40,7 +40,7 @@ namespace AZ::Dom::Benchmark
PathEntry end;
end.SetEndOfArray();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
Path p = Path() / entry1 / entry2 / 0 / end;
}
@ -55,7 +55,7 @@ namespace AZ::Dom::Benchmark
AZStd::string s;
s.resize_no_construct(p.GetStringLength());
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
p.GetStringLength();
p.FormatString(s.data(), s.size());
@ -69,7 +69,7 @@ namespace AZ::Dom::Benchmark
{
AZStd::string pathString = "/path/with/multiple/0/different/components/including-long-strings-like-this/65536/999/-";
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
Path p(pathString);
benchmark::DoNotOptimize(p);
@ -86,7 +86,7 @@ namespace AZ::Dom::Benchmark
PathEntry endOfArray;
endOfArray.SetEndOfArray();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
name.IsEndOfArray();
index.IsEndOfArray();
@ -104,7 +104,7 @@ namespace AZ::Dom::Benchmark
PathEntry endOfArray;
endOfArray.SetEndOfArray();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
benchmark::DoNotOptimize(name == name);
benchmark::DoNotOptimize(name == index);

@ -0,0 +1,104 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <Tests/DOM/DomFixtures.h>
#include <AzCore/DOM/DomPrefixTree.h>
#define REGISTER_TREE_BENCHMARK(BaseClass, Method) \
BENCHMARK_REGISTER_F(BaseClass, Method)->Args({10, 1})->Args({1000, 1})->Args({10, 5})->Args({1000, 5})
namespace AZ::Dom::Benchmark
{
class DomPrefixTreeBenchmark : public Tests::DomBenchmarkFixture
{
public:
void SetUpHarness() override
{
Tests::DomBenchmarkFixture::SetUpHarness();
m_registeredPaths = AZStd::make_unique<AZStd::vector<Path>>();
}
void TearDownHarness() override
{
m_registeredPaths.reset();
m_tree.Clear();
Tests::DomBenchmarkFixture::TearDownHarness();
}
void SetupTree(benchmark::State& state)
{
const size_t numPaths = aznumeric_cast<size_t>(state.range(0));
const size_t depth = aznumeric_cast<size_t>(state.range(1));
Path path("/root");
for (size_t i = 0; i < numPaths; ++i)
{
for (size_t c = 0; c < depth; ++c)
{
path.Push(i % 4);
m_tree.SetValue(path, AZStd::string::format("entry%zu", i));
m_registeredPaths->push_back(path);
}
for (size_t c = 0; c < depth; ++c)
{
path.Pop();
}
}
}
DomPrefixTree<AZStd::string> m_tree;
AZStd::unique_ptr<AZStd::vector<Path>> m_registeredPaths;
};
BENCHMARK_DEFINE_F(DomPrefixTreeBenchmark, FindValue_ExactPath)(benchmark::State& state)
{
SetupTree(state);
for (auto _ : state)
{
for (const auto& pathToCheck : *m_registeredPaths)
{
benchmark::DoNotOptimize(m_tree.ValueAtPath(pathToCheck, PrefixTreeMatch::ExactPath));
}
}
state.SetItemsProcessed(m_registeredPaths->size() * state.iterations());
}
REGISTER_TREE_BENCHMARK(DomPrefixTreeBenchmark, FindValue_ExactPath);
BENCHMARK_DEFINE_F(DomPrefixTreeBenchmark, FindValue_InexactPath)(benchmark::State& state)
{
SetupTree(state);
for (auto _ : state)
{
for (const auto& pathToCheck : *m_registeredPaths)
{
benchmark::DoNotOptimize(m_tree.ValueAtPath(pathToCheck, PrefixTreeMatch::PathAndSubpaths));
}
}
state.SetItemsProcessed(m_registeredPaths->size() * state.iterations());
}
REGISTER_TREE_BENCHMARK(DomPrefixTreeBenchmark, FindValue_InexactPath);
BENCHMARK_DEFINE_F(DomPrefixTreeBenchmark, FindValue_VisitEntries)(benchmark::State& state)
{
SetupTree(state);
for (auto _ : state)
{
m_tree.VisitPath(Path(), PrefixTreeMatch::PathAndSubpaths, [](const Path& path, const AZStd::string& value)
{
benchmark::DoNotOptimize(path);
benchmark::DoNotOptimize(value);
});
}
state.SetItemsProcessed(m_registeredPaths->size() * state.iterations());
}
REGISTER_TREE_BENCHMARK(DomPrefixTreeBenchmark, FindValue_VisitEntries);
}
#undef REGISTER_TREE_BENCHMARK

@ -0,0 +1,204 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/DOM/DomPrefixTree.h>
#include <Tests/DOM/DomFixtures.h>
namespace AZ::Dom::Tests
{
using DomPrefixTreeTests = DomTestFixture;
static_assert(!RangeConvertibleToPrefixTree<AZStd::vector<int>, int>, "Non-pair range should not convert to tree");
static_assert(
!RangeConvertibleToPrefixTree<AZStd::vector<AZStd::pair<Path, AZStd::string>>, int>,
"Mismatched value type should not convert to tree");
static_assert(
!RangeConvertibleToPrefixTree<AZStd::vector<AZStd::pair<AZStd::string, int>>, int>,
"Mismatched value type should not convert to tree");
static_assert(
RangeConvertibleToPrefixTree<AZStd::vector<AZStd::pair<Path, int>>, int>,
"Vector with path / key type pairs should convert to tree");
TEST_F(DomPrefixTreeTests, InitializeFromInitializerList)
{
DomPrefixTree<int> tree({
{ Path(), 0 },
{ Path("/foo/bar"), 1 },
});
EXPECT_EQ(0, *tree.ValueAtPath(Path(), PrefixTreeMatch::ExactPath));
EXPECT_EQ(1, *tree.ValueAtPath(Path("/foo/bar"), PrefixTreeMatch::ExactPath));
}
TEST_F(DomPrefixTreeTests, InitializeFromRange)
{
AZStd::vector<AZStd::pair<Path, int>> container({
{ Path(), 21 },
{ Path("/foo/bar"), 42 },
});
DomPrefixTree<int> tree(container);
EXPECT_EQ(21, *tree.ValueAtPath(Path(), PrefixTreeMatch::ExactPath));
EXPECT_EQ(42, *tree.ValueAtPath(Path("/foo/bar"), PrefixTreeMatch::ExactPath));
}
TEST_F(DomPrefixTreeTests, GetAndSetRoot)
{
DomPrefixTree<AZStd::string> tree;
tree.SetValue(Path(), "root");
EXPECT_EQ("root", *tree.ValueAtPath(Path(), PrefixTreeMatch::ExactPath));
}
TEST_F(DomPrefixTreeTests, GetExactPath)
{
DomPrefixTree<int> tree;
tree.SetValue(Path("/foo/0"), 0);
tree.SetValue(Path("/foo/1"), 42);
tree.SetValue(Path("/foo/foo"), 1);
tree.SetValue(Path("/foo/bar"), 2);
EXPECT_EQ(0, *tree.ValueAtPath(Path("/foo/0"), PrefixTreeMatch::ExactPath));
EXPECT_EQ(42, *tree.ValueAtPath(Path("/foo/1"), PrefixTreeMatch::ExactPath));
EXPECT_EQ(1, *tree.ValueAtPath(Path("/foo/foo"), PrefixTreeMatch::ExactPath));
EXPECT_EQ(2, *tree.ValueAtPath(Path("/foo/bar"), PrefixTreeMatch::ExactPath));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path(), PrefixTreeMatch::ExactPath));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path("/foo"), PrefixTreeMatch::ExactPath));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path("/foo/0/subpath"), PrefixTreeMatch::ExactPath));
}
TEST_F(DomPrefixTreeTests, GetSubpath)
{
DomPrefixTree<int> tree;
tree.SetValue(Path("/foo/0"), 0);
tree.SetValue(Path("/foo/1"), 42);
EXPECT_EQ(0, *tree.ValueAtPath(Path("/foo/0/bar"), PrefixTreeMatch::SubpathsOnly));
EXPECT_EQ(0, *tree.ValueAtPath(Path("/foo/0/bar/baz"), PrefixTreeMatch::SubpathsOnly));
EXPECT_EQ(42, *tree.ValueAtPath(Path("/foo/1/0"), PrefixTreeMatch::SubpathsOnly));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path("/foo/0"), PrefixTreeMatch::SubpathsOnly));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path("/foo/1"), PrefixTreeMatch::SubpathsOnly));
}
TEST_F(DomPrefixTreeTests, GetPathOrSubpath)
{
DomPrefixTree<int> tree;
tree.SetValue(Path("/foo/0"), 0);
tree.SetValue(Path("/foo/1"), 42);
EXPECT_EQ(0, *tree.ValueAtPath(Path("/foo/0"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(0, *tree.ValueAtPath(Path("/foo/0/bar"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(0, *tree.ValueAtPath(Path("/foo/0/bar/baz"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(42, *tree.ValueAtPath(Path("/foo/1"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(42, *tree.ValueAtPath(Path("/foo/1/0"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path(), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path("/foo"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(nullptr, tree.ValueAtPath(Path("/path/0"), PrefixTreeMatch::PathAndSubpaths));
}
TEST_F(DomPrefixTreeTests, RemovePath)
{
DomPrefixTree<int> tree;
tree.SetValue(Path(), 20);
tree.SetValue(Path("/foo"), 40);
tree.SetValue(Path("/foo/0"), 80);
tree.EraseValue(Path("/foo"));
EXPECT_EQ(20, *tree.ValueAtPath(Path("/foo"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(80, *tree.ValueAtPath(Path("/foo/0"), PrefixTreeMatch::PathAndSubpaths));
}
TEST_F(DomPrefixTreeTests, RemovePathAndChildren)
{
DomPrefixTree<int> tree;
tree.SetValue(Path(), 20);
tree.SetValue(Path("/foo"), 40);
tree.SetValue(Path("/foo/0"), 80);
tree.EraseValue(Path("/foo"), true);
EXPECT_EQ(20, *tree.ValueAtPath(Path("/foo"), PrefixTreeMatch::PathAndSubpaths));
EXPECT_EQ(20, *tree.ValueAtPath(Path("/foo/0"), PrefixTreeMatch::PathAndSubpaths));
}
TEST_F(DomPrefixTreeTests, ClearTree)
{
DomPrefixTree<int> tree;
tree.SetValue(Path(), 20);
tree.SetValue(Path("/foo"), 40);
tree.Clear();
EXPECT_EQ(-10, tree.ValueAtPathOrDefault(Path("/foo"), -10, PrefixTreeMatch::PathAndSubpaths));
}
TEST_F(DomPrefixTreeTests, Visit)
{
DomPrefixTree<int> tree;
AZStd::vector<AZStd::pair<Path, int>> results;
auto visitorFn = [&results](const Path& path, int n)
{
results.emplace_back(path, n);
};
auto validateResult = [&results](const Path& path, int n)
{
for (const auto& pair : results)
{
if (pair.first == path)
{
return pair.second == n;
}
}
return false;
};
tree.SetValue(Path("/foo"), 99);
tree.SetValue(Path("/foo/0"), 0);
tree.SetValue(Path("/foo/1"), 42);
tree.SetValue(Path("/bar/bat"), 1);
tree.SetValue(Path("/bar/baz"), 2);
tree.VisitPath(Path("/bar"), PrefixTreeMatch::ExactPath, visitorFn);
EXPECT_EQ(0, results.size());
results.clear();
tree.VisitPath(Path("/foo/0"), PrefixTreeMatch::ExactPath, visitorFn);
EXPECT_EQ(1, results.size());
EXPECT_TRUE(validateResult(Path("/foo/0"), 0));
results.clear();
tree.VisitPath(Path("/foo/1"), PrefixTreeMatch::ExactPath, visitorFn);
EXPECT_EQ(1, results.size());
EXPECT_TRUE(validateResult(Path("/foo/1"), 42));
results.clear();
tree.VisitPath(Path("/foo"), PrefixTreeMatch::SubpathsOnly, visitorFn);
EXPECT_EQ(2, results.size());
EXPECT_TRUE(validateResult(Path("/foo/0"), 0));
EXPECT_TRUE(validateResult(Path("/foo/1"), 42));
results.clear();
tree.VisitPath(Path("/foo"), PrefixTreeMatch::PathAndSubpaths, visitorFn);
EXPECT_EQ(3, results.size());
EXPECT_TRUE(validateResult(Path("/foo"), 99));
EXPECT_TRUE(validateResult(Path("/foo/0"), 0));
EXPECT_TRUE(validateResult(Path("/foo/1"), 42));
results.clear();
}
} // namespace AZ::Dom::Tests

@ -29,7 +29,7 @@ namespace AZ::Dom::Benchmark
Value doubleValue(4.0);
Value stringValue("foo", true);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
(intValue.GetType());
(boolValue.GetType());
@ -118,7 +118,7 @@ namespace AZ::Dom::Benchmark
value.GetInternalValue());
};
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
(getTypeViaVisit(intValue));
(getTypeViaVisit(boolValue));
@ -136,7 +136,7 @@ namespace AZ::Dom::Benchmark
BENCHMARK_DEFINE_F(DomValueBenchmark, AzDomValueMakeComplexObject)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
TakeAndDiscardWithoutTimingDtor(GenerateDomBenchmarkPayload(state.range(0), state.range(1)), state);
}
@ -149,7 +149,7 @@ namespace AZ::Dom::Benchmark
{
Value original = GenerateDomBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
Value copy = original;
benchmark::DoNotOptimize(copy);
@ -163,7 +163,7 @@ namespace AZ::Dom::Benchmark
{
Value original = GenerateDomBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
Value copy = original;
copy["entries"]["Key0"].ArrayPushBack(Value(42));
@ -178,7 +178,7 @@ namespace AZ::Dom::Benchmark
{
Value original = GenerateDomBenchmarkPayload(state.range(0), state.range(1));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
Value copy = Utils::DeepCopy(original);
TakeAndDiscardWithoutTimingDtor(AZStd::move(copy), state);
@ -199,7 +199,7 @@ namespace AZ::Dom::Benchmark
value[key] = i;
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const AZ::Name& key : keys)
{
@ -222,7 +222,7 @@ namespace AZ::Dom::Benchmark
value[key] = i;
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const AZStd::string& key : keys)
{
@ -245,7 +245,7 @@ namespace AZ::Dom::Benchmark
value[key] = i;
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const AZStd::string& key : keys)
{

@ -966,7 +966,7 @@ namespace Benchmark
BENCHMARK_F(PathBenchmarkFixture, BM_PathAppendFixedPath)(benchmark::State& state)
{
AZ::IO::FixedMaxPath m_testPath{ "." };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const auto& appendPath : m_appendPaths)
{
@ -977,7 +977,7 @@ namespace Benchmark
BENCHMARK_F(PathBenchmarkFixture, BM_PathAppendAllocatingPath)(benchmark::State& state)
{
AZ::IO::Path m_testPath{ "." };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const auto& appendPath : m_appendPaths)
{
@ -989,7 +989,7 @@ namespace Benchmark
BENCHMARK_F(PathBenchmarkFixture, BM_StringFuncPathJoinFixedString)(benchmark::State& state)
{
AZStd::string m_testPath{ "." };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const auto& appendPath : m_appendPaths)
{
@ -1000,7 +1000,7 @@ namespace Benchmark
BENCHMARK_F(PathBenchmarkFixture, BM_StringFuncPathJoinAZStdString)(benchmark::State& state)
{
AZStd::string m_testPath{ "." };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (const auto& appendPath : m_appendPaths)
{

@ -1741,7 +1741,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfLightWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(SMALL_NUMBER_OF_JOBS, LIGHT_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1749,7 +1749,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfLightWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(MEDIUM_NUMBER_OF_JOBS, LIGHT_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1757,7 +1757,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfLightWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(LARGE_NUMBER_OF_JOBS, LIGHT_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1765,7 +1765,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfMediumWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(SMALL_NUMBER_OF_JOBS, MEDIUM_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1773,7 +1773,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfMediumWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(MEDIUM_NUMBER_OF_JOBS, MEDIUM_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1781,7 +1781,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfMediumWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(LARGE_NUMBER_OF_JOBS, MEDIUM_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1789,7 +1789,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfHeavyWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(SMALL_NUMBER_OF_JOBS, HEAVY_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1797,7 +1797,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfHeavyWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(MEDIUM_NUMBER_OF_JOBS, HEAVY_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1805,7 +1805,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfHeavyWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithDefaultPriority(LARGE_NUMBER_OF_JOBS, HEAVY_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1813,7 +1813,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfRandomWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomDepthAndDefaultPriority(SMALL_NUMBER_OF_JOBS);
}
@ -1821,7 +1821,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfRandomWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomDepthAndDefaultPriority(MEDIUM_NUMBER_OF_JOBS);
}
@ -1829,7 +1829,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfRandomWeightJobsWithDefaultPriority)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomDepthAndDefaultPriority(LARGE_NUMBER_OF_JOBS);
}
@ -1837,7 +1837,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfLightWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(SMALL_NUMBER_OF_JOBS, LIGHT_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1845,7 +1845,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfLightWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(MEDIUM_NUMBER_OF_JOBS, LIGHT_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1853,7 +1853,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfLightWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(LARGE_NUMBER_OF_JOBS, LIGHT_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1861,7 +1861,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfMediumWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(SMALL_NUMBER_OF_JOBS, MEDIUM_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1869,7 +1869,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfMediumWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(MEDIUM_NUMBER_OF_JOBS, MEDIUM_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1877,7 +1877,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfMediumWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(LARGE_NUMBER_OF_JOBS, MEDIUM_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1885,7 +1885,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfHeavyWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(SMALL_NUMBER_OF_JOBS, HEAVY_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1893,7 +1893,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfHeavyWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(MEDIUM_NUMBER_OF_JOBS, HEAVY_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1901,7 +1901,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfHeavyWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomPriority(LARGE_NUMBER_OF_JOBS, HEAVY_WEIGHT_JOB_CALCULATE_PI_DEPTH);
}
@ -1909,7 +1909,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunSmallNumberOfRandomWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomDepthAndRandomPriority(SMALL_NUMBER_OF_JOBS);
}
@ -1917,7 +1917,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunMediumNumberOfRandomWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomDepthAndRandomPriority(MEDIUM_NUMBER_OF_JOBS);
}
@ -1925,7 +1925,7 @@ namespace Benchmark
BENCHMARK_F(JobBenchmarkFixture, RunLargeNumberOfRandomWeightJobsWithRandomPriorities)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
RunMultipleCalculatePiJobsWithRandomDepthAndRandomPriority(LARGE_NUMBER_OF_JOBS);
}

@ -7,29 +7,13 @@
*/
#include <AzCore/UnitTest/UnitTest.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AzTest/AzTest.h>
#include <AzCore/Memory/SystemAllocator.h>
#if defined(HAVE_BENCHMARK)
namespace AzCore
{
class AzCoreBenchmarkEnvironment
: public AZ::Test::BenchmarkEnvironmentBase
{
void SetUpBenchmark() override
{
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
}
void TearDownBenchmark() override
{
AZ::AllocatorInstance<AZ::SystemAllocator>::Destroy();
}
};
}
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV, AzCore::AzCoreBenchmarkEnvironment)
AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV, UnitTest::ScopedAllocatorBenchmarkEnvironment)
#else

@ -54,7 +54,7 @@ namespace Benchmark
{
// Runtime performance is not actually being measured by this test.
// This function only exist to calculate AZ::Crc32 values at compile time
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
[[maybe_unused]] constexpr auto resultArray = Crc32Internal::GenerateTestCrc32Values();
}

@ -63,7 +63,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathFrustum, SphereIntersect)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& data : m_dataArray)
{
@ -75,7 +75,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathFrustum, AabbIntersect)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& data : m_dataArray)
{

@ -68,7 +68,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateIdentity)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -80,7 +80,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateZero)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -92,7 +92,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetRowX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -108,7 +108,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetColumnX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -124,7 +124,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateFromValue)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -136,7 +136,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateFromRowMajorFloat9)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -148,7 +148,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateFromColumnMajorFloat9)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -162,7 +162,7 @@ namespace Benchmark
{
float storeValues[9];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -176,7 +176,7 @@ namespace Benchmark
{
float storeValues[9];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -188,7 +188,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateRotationX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -200,7 +200,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateRotationY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -212,7 +212,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateRotationZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -224,7 +224,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateFromTransform)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -236,7 +236,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateFromMatrix4x4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -248,7 +248,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateFromQuaternion)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -260,7 +260,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -272,7 +272,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateDiagonal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -284,7 +284,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, CreateCrossProduct)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -296,7 +296,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -308,7 +308,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, SetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -321,7 +321,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, SetRowX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -336,7 +336,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, SetColumnX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -351,7 +351,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetBasisX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -363,7 +363,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetBasisY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -375,7 +375,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetBasisZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -387,7 +387,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, OperatorAssign)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -399,7 +399,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, OperatorMultiply)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -411,7 +411,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, TransposedMultiply)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -423,7 +423,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, MultiplyVector)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -435,7 +435,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, OperatorSum)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -447,7 +447,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, OperatorDifference)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -459,7 +459,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, OperatorMultiplyScalar)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -471,7 +471,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, OperatorDivideScalar)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -483,7 +483,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, Transpose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -494,7 +494,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetTranspose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -506,7 +506,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, RetrieveScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -518,7 +518,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, ExtractScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -530,7 +530,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, MultiplyByScaleX2)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -542,7 +542,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetPolarDecomposition)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -557,7 +557,7 @@ namespace Benchmark
AZ::Matrix3x3 orthogonalOut;
AZ::Matrix3x3 symmetricOut;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -568,7 +568,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetInverseFast)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -580,7 +580,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetInverseFull)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -592,7 +592,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, Orthogonalize)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -603,7 +603,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetOrthogonalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -615,7 +615,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, IsOrthogonal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -627,7 +627,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetDiagonal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -639,7 +639,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetDeterminant)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -651,7 +651,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x3, GetAdjugate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{

@ -86,7 +86,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateIdentity)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -98,7 +98,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateZero)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -110,7 +110,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromValue)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -122,7 +122,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromRowMajorFloat12)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -134,7 +134,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromRows)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -146,7 +146,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromColumnMajorFloat12)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -158,7 +158,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromColumns)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -170,7 +170,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromColumnMajorFloat16)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -182,7 +182,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateRotationX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -194,7 +194,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateRotationY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -206,7 +206,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateRotationZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -218,7 +218,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromQuaternion)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -230,7 +230,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromQuaternionAndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -242,7 +242,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromMatrix3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -254,7 +254,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromMatrix3x3AndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -266,7 +266,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromTransform)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -278,7 +278,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -290,7 +290,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateFromTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -302,7 +302,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, CreateLookAt)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -316,7 +316,7 @@ namespace Benchmark
{
float testFloats[12];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -330,7 +330,7 @@ namespace Benchmark
{
float testFloats[12];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -344,7 +344,7 @@ namespace Benchmark
{
float testFloats[16];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -356,7 +356,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -368,7 +368,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -381,7 +381,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetRow)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -393,7 +393,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetRowAsVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -405,7 +405,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetRowWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -418,7 +418,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetRowWithVector3AndFloat)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -431,7 +431,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetRowWithVector4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -444,7 +444,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetRows)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -459,7 +459,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetRows)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -472,7 +472,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetColumn)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -484,7 +484,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetColumnWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -497,7 +497,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetColumnWithVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -510,7 +510,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetColumns)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -526,7 +526,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetColumns)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -539,7 +539,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetBasisX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -551,7 +551,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisXWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -564,7 +564,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisXWithVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -577,7 +577,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetBasisY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -589,7 +589,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisYWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -602,7 +602,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisYWithVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -615,7 +615,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetBasisZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -627,7 +627,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisZWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -640,7 +640,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisZWithVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -653,7 +653,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -665,7 +665,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetTranslationWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -678,7 +678,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetTranslationWithVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -691,7 +691,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetBasisAndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -707,7 +707,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetBasisAndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -720,7 +720,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, OperatorMultiplyMatrix3x4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -732,7 +732,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, OperatorMultiplyEqualsMatrix3x4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -745,7 +745,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, TransformPointVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -757,7 +757,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, TransformVectorVector4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -769,7 +769,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, Multiply3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -781,7 +781,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetTranspose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -793,7 +793,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, Transpose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -806,7 +806,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetTranspose3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -818,7 +818,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, Transpose3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -831,7 +831,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetInverseFull)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -843,7 +843,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, InvertFull)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -856,7 +856,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetInverseFast)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -868,7 +868,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, InvertFast)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -881,7 +881,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, RetrieveScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -893,7 +893,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, ExtractScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -906,7 +906,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, MultiplyByScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -919,7 +919,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, IsOrthogonal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -931,7 +931,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetOrthogonalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -943,7 +943,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, Orthogonalize)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -956,7 +956,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, IsCloseExactAndDifferent)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -971,7 +971,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, OperatorEqualEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -983,7 +983,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, OperatorNotEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -995,7 +995,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetEulerDegrees)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -1007,7 +1007,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetEulerRadians)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -1019,7 +1019,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetFromEulerDegrees)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -1032,7 +1032,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetFromEulerRadians)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -1045,7 +1045,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, SetRotationPartFromQuaternion)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -1058,7 +1058,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, GetDeterminant3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -1070,7 +1070,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix3x4, IsFinite)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{

@ -64,7 +64,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateIdentity)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -76,7 +76,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateZero)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -88,7 +88,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetRowX4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -106,7 +106,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetColumnX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -124,7 +124,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateFromValue)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -136,7 +136,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateFromRowMajorFloat16)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -148,7 +148,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateFromColumnMajorFloat9)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -160,7 +160,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateProjection)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -172,7 +172,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateProjectionFov)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -184,7 +184,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateInterpolated)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -198,7 +198,7 @@ namespace Benchmark
{
float storeValues[16];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -212,7 +212,7 @@ namespace Benchmark
{
float storeValues[16];
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -224,7 +224,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateRotationX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -236,7 +236,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateRotationY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -248,7 +248,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateRotationZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -260,7 +260,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateFromQuaternion)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -272,7 +272,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -284,7 +284,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateDiagonal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -296,7 +296,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -308,7 +308,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, SetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -321,7 +321,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, SetRowX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -337,7 +337,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, SetColumnX3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -353,7 +353,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetBasisX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -365,7 +365,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetBasisY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -377,7 +377,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetBasisZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -389,7 +389,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, CreateTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -401,7 +401,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, SetTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -414,7 +414,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -426,7 +426,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, OperatorAssign)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -438,7 +438,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, OperatorMultiply)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -450,7 +450,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, OperatorMultiplyAssign)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -463,7 +463,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, OperatorMultiplyVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -475,7 +475,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, OperatorMultiplyVector4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -487,7 +487,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, TransposedMultiply3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -499,7 +499,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, Multiply3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -511,7 +511,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, Transpose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -524,7 +524,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetTranspose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -536,7 +536,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetInverseFast)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -552,7 +552,7 @@ namespace Benchmark
AZ::Matrix4x4 mat = AZ::Matrix4x4::CreateRotationX(1.0f);
mat.SetElement(0, 1, 23.1234f);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -564,7 +564,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, GetInverseFull)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -576,7 +576,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathMatrix4x4, SetRotationPartFromQuaternion)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{

@ -47,7 +47,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, CreateFromPositionRotationAndHalfLengths)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -60,7 +60,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, SetPosition)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -72,7 +72,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetPosition)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -84,7 +84,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetAxisX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -96,7 +96,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetAxisY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -108,7 +108,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetAxisZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -120,7 +120,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetAxisIndex3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -136,7 +136,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, SetHalfLengthX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -148,7 +148,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetHalfLengthX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -160,7 +160,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, SetHalfLengthY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -172,7 +172,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetHalfLengthY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -184,7 +184,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, SetHalfLengthZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -196,7 +196,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetHalfLengthZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -208,7 +208,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, SetHalfLengthIndex3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -222,7 +222,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, GetHalfLengthIndex3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -242,7 +242,7 @@ namespace Benchmark
AZ::Vector3 max(120.0f, 300.0f, 50.0f);
AZ::Aabb aabb = AZ::Aabb::CreateFromMinMax(min, max);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -256,7 +256,7 @@ namespace Benchmark
{
AZ::Transform transform = AZ::Transform::CreateRotationY(AZ::DegToRad(90.0f));
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -268,7 +268,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, Equal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{
@ -280,7 +280,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathObb, IsFinite)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < numIters; ++i)
{

@ -73,7 +73,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, CreateFromNormalAndDistance)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -85,7 +85,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, GetDistance)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -97,7 +97,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, GetNormal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -109,7 +109,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, CreateFromNormalAndPoint)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -128,7 +128,7 @@ namespace Benchmark
coeff.push_back(unif(rng));
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -148,7 +148,7 @@ namespace Benchmark
coeff.push_back(unif(rng));
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -160,7 +160,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, SetVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -179,7 +179,7 @@ namespace Benchmark
vecs.push_back(AZ::Vector4(unif(rng), unif(rng), unif(rng), unif(rng)));
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -192,7 +192,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, SetNormal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -205,7 +205,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, SetDistance)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -218,7 +218,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, GetPlaneEquationCoefficients)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -236,7 +236,7 @@ namespace Benchmark
trans.push_back(AZ::Transform::CreateRotationY(AZ::DegToRad(unif(rng))));
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -254,7 +254,7 @@ namespace Benchmark
trans.push_back(AZ::Transform::CreateRotationY(AZ::DegToRad(unif(rng))));
}
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -265,7 +265,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, GetPointDist)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -277,7 +277,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, GetProjected)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -291,7 +291,7 @@ namespace Benchmark
{
AZ::Vector3 rayResult;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -305,7 +305,7 @@ namespace Benchmark
{
float rayResult;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{
@ -319,7 +319,7 @@ namespace Benchmark
{
AZ::Vector3 rayResult;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters - 1; ++i)
{
@ -333,7 +333,7 @@ namespace Benchmark
{
float rayResult;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters - 1; ++i)
{
@ -345,7 +345,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathPlane, IsFinite)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (int i = 0; i < m_numIters; ++i)
{

@ -68,7 +68,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SplatFloatConstruction)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -80,7 +80,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, NonNormalized4FloatsConstruction)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -92,7 +92,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, CreateFromIdentity)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
@ -104,7 +104,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, CreateZero)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
@ -116,7 +116,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, CreateRotationX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -128,7 +128,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, CreateRotationY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -140,7 +140,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, CreateRotationZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -155,7 +155,7 @@ namespace Benchmark
const AZ::Vector3 vec1 = AZ::Vector3(1.0f, 2.0f, 3.0f).GetNormalized();
const AZ::Vector3 vec2 = AZ::Vector3(-2.0f, 7.0f, -1.0f).GetNormalized();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
@ -170,7 +170,7 @@ namespace Benchmark
const AZ::Vector3 vec1 = AZ::Vector3(1.0f, 2.0f, 3.0f).GetNormalized();
const AZ::Vector3 vec2 = AZ::Vector3(-1.0f, -2.0f, -3.0f).GetNormalized();
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
@ -182,7 +182,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -194,7 +194,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -206,7 +206,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -218,7 +218,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetW)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -230,7 +230,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -243,7 +243,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -256,7 +256,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -269,7 +269,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetW)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -282,7 +282,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetSplat)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -295,7 +295,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetAll)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -310,7 +310,7 @@ namespace Benchmark
{
AZ::Vector3 vec(5.0f, 6.0f, 7.0f);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
@ -324,7 +324,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetArray)(benchmark::State& state)
{
const float quatArray[4] = { 5.0f, 6.0f, 7.0f, 8.0f };
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& quatData : m_quatDataArray)
{
@ -337,7 +337,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetElements)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -353,7 +353,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetElement)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -374,7 +374,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetConjugate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -386,7 +386,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetInverseFast)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -398,7 +398,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetInverseFull)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -410,7 +410,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, Dot)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -422,7 +422,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetLength)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -434,7 +434,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetLengthEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -446,7 +446,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetLengthReciprocal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -458,7 +458,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetLengthReciprocalEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -470,7 +470,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetNormalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -482,7 +482,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetNormalizedEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -494,7 +494,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, NormalizeWithLength)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -506,7 +506,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, NormalizeWithLengthEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -518,7 +518,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, Lerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -530,7 +530,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, NLerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -542,7 +542,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, Slerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -554,7 +554,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorEquality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -566,7 +566,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorInequality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -578,7 +578,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorNegate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -590,7 +590,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorSum)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -602,7 +602,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorSub)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -614,7 +614,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorMultiply)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -626,7 +626,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, OperatorMultiplyScalar)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -638,7 +638,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, TransformVector)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -653,7 +653,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, IsClose)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -665,7 +665,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, IsIdentity)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -677,7 +677,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetEulerDegrees)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -689,7 +689,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, GetEulerRadians)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -701,7 +701,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetFromEulerRadians)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -715,7 +715,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, SetFromEulerDegrees)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -729,7 +729,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, ConvertToAxisAngle)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& quatData : m_quatDataArray)
{
@ -744,7 +744,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathQuaternion, AggregateMultiply)(::benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector3 position = AZ::Vector3::CreateZero();
for (auto& quatData : m_quatDataArray)

@ -80,7 +80,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathShapeIntersection, ContainsFrustumPoint)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -103,7 +103,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathShapeIntersection, OverlapsFrustumSphere)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -120,7 +120,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathShapeIntersection, ContainsFrustumSphere)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -137,7 +137,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathShapeIntersection, OverlapsFrustumAabb)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -154,7 +154,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathShapeIntersection, ContainsFrustumAabb)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{

@ -78,7 +78,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateIdentity)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for ([[maybe_unused]] auto& testData : m_testDataArray)
{
@ -90,7 +90,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateRotationX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -102,7 +102,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateRotationY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -114,7 +114,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateRotationZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -126,7 +126,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateFromQuaternion)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -138,7 +138,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateFromQuaternionAndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -150,7 +150,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateFromMatrix3x3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -162,7 +162,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateFromMatrix3x3AndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -174,7 +174,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateFromMatrix3x4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -186,7 +186,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateUniformScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -198,7 +198,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateFromTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -210,7 +210,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, CreateLookAt)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -223,7 +223,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetBasis)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -235,7 +235,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetBasisX)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -247,7 +247,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetBasisY)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -259,7 +259,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetBasisZ)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -271,7 +271,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetBasisAndTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -287,7 +287,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetTranslation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -299,7 +299,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, SetTranslationWithFloats)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -312,7 +312,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, SetTranslationWithVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -325,7 +325,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetRotation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -337,7 +337,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, SetRotation)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -350,7 +350,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetUniformScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -362,7 +362,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, SetUniformScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -375,7 +375,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, ExtractUniformScale)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -388,7 +388,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, OperatorMultiplyTransform)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -400,7 +400,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, OperatorMultiplyEqualsTransform)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -413,7 +413,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, TransformPointVector3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -425,7 +425,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, TransformPointVector4)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -437,7 +437,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, TransformVector)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -449,7 +449,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetInverse)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -461,7 +461,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, Invert)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -474,7 +474,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, IsOrthogonal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -486,7 +486,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetOrthogonalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -498,7 +498,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, Orthogonalize)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -511,7 +511,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, IsCloseExactAndDifferent)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -526,7 +526,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, OperatorEqualEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -538,7 +538,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, OperatorNotEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -550,7 +550,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetEulerDegrees)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -562,7 +562,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, GetEulerRadians)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -574,7 +574,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, SetFromEulerDegrees)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -587,7 +587,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, SetFromEulerRadians)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{
@ -600,7 +600,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathTransform, IsFinite)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& testData : m_testDataArray)
{

@ -58,7 +58,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetSet)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector2 v1, v2;
float x = 0.0f, y = 0.0f;
@ -84,7 +84,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, ElementAccess)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector2 v1, v2;
float x = 0.0f, y = 0.0f;
@ -111,7 +111,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, CreateSelectCmpEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -123,7 +123,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, CreateSelectCmpGreaterEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -135,7 +135,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, CreateSelectCmpGreater)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -147,7 +147,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetNormalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -159,7 +159,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetNormalizedEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -171,7 +171,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, NormalizeWithLength)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -183,7 +183,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, NormalizeWithLengthEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -195,7 +195,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetNormalizedSafe)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -207,7 +207,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetNormalizedSafeEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -219,7 +219,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetDistance)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -231,7 +231,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetDistanceEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -243,7 +243,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Lerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -267,7 +267,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Slerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -291,7 +291,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Nlerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -315,7 +315,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Dot)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -327,7 +327,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Equality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -339,7 +339,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Inequality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -351,7 +351,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, IsLessThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -363,7 +363,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, IsLessEqualThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -375,7 +375,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, IsGreaterThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -387,7 +387,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, IsGreaterEqualThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -399,7 +399,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetMin)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -411,7 +411,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetMax)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -423,7 +423,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetClamp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -435,7 +435,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Sub)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -447,7 +447,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Sum)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -459,7 +459,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Mul)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -471,7 +471,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Div)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -483,7 +483,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetSin)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -495,7 +495,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetCos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -507,7 +507,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetSinCos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -521,7 +521,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetAcos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -533,7 +533,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetAtan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -545,7 +545,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetAtan2)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -557,7 +557,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetAngleMod)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -569,7 +569,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, Angle)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -581,7 +581,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, AngleDeg)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -593,7 +593,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetAbs)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -605,7 +605,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetReciprocal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -617,7 +617,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetReciprocalEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -629,7 +629,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector2, GetProjected)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{

@ -58,7 +58,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetSet)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector3 v1, v2, v3;
float x = 0.0f, y = 0.0f, z = 0.0f;
@ -98,7 +98,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, ElementAccess)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector3 v1, v2, v3;
float x = 0.0f, y = 0.0f, z = 0.0f;
@ -138,7 +138,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, CreateSelectCmpEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -150,7 +150,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, CreateSelectCmpGreaterEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -162,7 +162,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, CreateSelectCmpGreater)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -174,7 +174,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetNormalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -186,7 +186,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetNormalizedEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -198,7 +198,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, NormalizeWithLength)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -210,7 +210,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, NormalizeWithLengthEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -222,7 +222,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetNormalizedSafe)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -234,7 +234,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetNormalizedSafeEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -246,7 +246,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetDistance)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -258,7 +258,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetDistanceEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -270,7 +270,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Lerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -294,7 +294,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Slerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -318,7 +318,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Nlerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -342,7 +342,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Dot)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -354,7 +354,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Cross)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -366,7 +366,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Equality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -378,7 +378,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Inequality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -390,7 +390,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, IsLessThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -402,7 +402,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, IsLessEqualThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -414,7 +414,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, IsGreaterThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -426,7 +426,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, IsGreaterEqualThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -438,7 +438,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetMin)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -450,7 +450,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetMax)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -462,7 +462,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetClamp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -474,7 +474,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Sub)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -486,7 +486,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Sum)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -498,7 +498,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Mul)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -510,7 +510,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Div)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -522,7 +522,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetSin)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -534,7 +534,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetCos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -546,7 +546,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetSinCos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -560,7 +560,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetAcos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -572,7 +572,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetAtan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -584,7 +584,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetAngleMod)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -596,7 +596,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, Angle)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -608,7 +608,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, AngleDeg)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -620,7 +620,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetAbs)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -632,7 +632,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetReciprocal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -644,7 +644,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetReciprocalEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -656,7 +656,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, IsPerpendicular)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -668,7 +668,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetOrthogonalVector)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -680,7 +680,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector3, GetProjected)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{

@ -60,7 +60,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetSet)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector4 v1, v2, v3, v4;
float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
@ -117,7 +117,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, ElementAccess)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZ::Vector4 v1, v2, v3, v4;
float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
@ -174,7 +174,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, CreateSelectCmpEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -186,7 +186,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, CreateSelectCmpGreaterEqual)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -198,7 +198,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, CreateSelectCmpGreater)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -210,7 +210,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetNormalized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -222,7 +222,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetNormalizedEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -234,7 +234,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, NormalizeWithLength)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -246,7 +246,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, NormalizeWithLengthEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -258,7 +258,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetNormalizedSafe)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -270,7 +270,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetNormalizedSafeEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -282,7 +282,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetDistance)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -294,7 +294,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetDistanceEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -306,7 +306,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Lerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -330,7 +330,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Slerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -354,7 +354,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Nlerp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -378,7 +378,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Dot)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -390,7 +390,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Dot3)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -402,7 +402,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetHomogenized)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -414,7 +414,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Equality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -426,7 +426,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Inequality)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -438,7 +438,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, IsLessThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -450,7 +450,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, IsLessEqualThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -462,7 +462,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, IsGreaterThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -474,7 +474,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, IsGreaterEqualThan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -486,7 +486,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetMin)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -498,7 +498,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetMax)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -510,7 +510,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetClamp)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -522,7 +522,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Sub)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -534,7 +534,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Sum)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -546,7 +546,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Mul)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -558,7 +558,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Div)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -570,7 +570,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetSin)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -582,7 +582,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetCos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -594,7 +594,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetSinCos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -608,7 +608,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetAcos)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -620,7 +620,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetAtan)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -632,7 +632,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetAngleMod)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -644,7 +644,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, Angle)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -656,7 +656,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, AngleDeg)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -668,7 +668,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetAbs)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -680,7 +680,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetReciprocal)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{
@ -692,7 +692,7 @@ namespace Benchmark
BENCHMARK_F(BM_MathVector4, GetReciprocalEstimate)(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& vecData : m_vecDataArray)
{

@ -141,7 +141,6 @@ namespace UnitTest
////////////////////////////////////////////////////////////////////////
// Create some threads and simulate concurrent allocation and deallocation
AZStd::chrono::system_clock::time_point startTime = AZStd::chrono::system_clock::now();
{
AZStd::thread m_threads[m_maxNumThreads];
for (unsigned int i = 0; i < m_maxNumThreads; ++i)
@ -156,8 +155,6 @@ namespace UnitTest
m_threads[i].join();
}
}
//AZStd::chrono::microseconds exTime = AZStd::chrono::system_clock::now() - startTime;
//AZ_Printf("UnitTest::SystemAllocatorTest::deafult","Time: %d Ms\n",exTime.count());
//////////////////////////////////////////////////////////////////////////
AllocatorInstance<SystemAllocator>::Destroy();

@ -288,10 +288,10 @@ namespace Benchmark
public:
void Benchmark(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
state.PauseTiming();
AZStd::vector<void*>& perThreadAllocations = base::GetPerThreadAllocations(state.thread_index);
const size_t numberOfAllocations = perThreadAllocations.size();
size_t totalAllocationSize = 0;
@ -300,7 +300,7 @@ namespace Benchmark
const AllocationSizeArray& allocationArray = s_allocationSizes[TAllocationSize];
const size_t allocationSize = allocationArray[allocationIndex % allocationArray.size()];
totalAllocationSize += allocationSize;
state.ResumeTiming();
perThreadAllocations[allocationIndex] = TestAllocatorType::Allocate(allocationSize, 0);
state.PauseTiming();
@ -319,6 +319,8 @@ namespace Benchmark
TestAllocatorType::GarbageCollect();
state.SetItemsProcessed(numberOfAllocations);
state.ResumeTiming();
}
}
};
@ -333,7 +335,7 @@ namespace Benchmark
public:
void Benchmark(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
state.PauseTiming();
AZStd::vector<void*>& perThreadAllocations = base::GetPerThreadAllocations(state.thread_index);
@ -364,6 +366,8 @@ namespace Benchmark
state.SetItemsProcessed(numberOfAllocations);
TestAllocatorType::GarbageCollect();
state.ResumeTiming();
}
}
};
@ -420,7 +424,7 @@ namespace Benchmark
void Benchmark(benchmark::State& state)
{
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
state.PauseTiming();
@ -519,6 +523,8 @@ namespace Benchmark
state.SetItemsProcessed(itemsProcessed);
TestAllocatorType::GarbageCollect();
state.ResumeTiming();
}
}
};

@ -981,7 +981,7 @@ namespace AZ::IO
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [numChunks, &numCallbacks, &waitForReads](FileRequestHandle request)
auto callback = [&numCallbacks, &waitForReads](FileRequestHandle request)
AZ_POP_DISABLE_WARNING
{
IStreamer* streamer = Interface<IStreamer>::Get();
@ -1052,7 +1052,7 @@ namespace AZ::IO
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [numChunks, &waitForReads, &waitForSingleRead, &numReadCallbacks]([[maybe_unused]] FileRequestHandle request)
auto callback = [&waitForReads, &waitForSingleRead, &numReadCallbacks]([[maybe_unused]] FileRequestHandle request)
AZ_POP_DISABLE_WARNING
{
numReadCallbacks++;
@ -1076,7 +1076,7 @@ namespace AZ::IO
cancels.push_back(m_streamer->Cancel(requests[numChunks - i - 1]));
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [&numCancelCallbacks, &waitForCancels, numChunks](FileRequestHandle request)
auto callback = [&numCancelCallbacks, &waitForCancels](FileRequestHandle request)
AZ_POP_DISABLE_WARNING
{
auto result = Interface<IStreamer>::Get()->GetRequestStatus(request);
@ -1248,7 +1248,7 @@ namespace Benchmark
AZStd::unique_ptr<char[]> buffer(new char[FileSize]);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
AZStd::binary_semaphore waitForReads;
AZStd::atomic<system_clock::time_point> end;

@ -0,0 +1,281 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzCore/JSON/document.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Settings/ConfigurableStack.h>
#include <AzCore/Serialization/Json/JsonSerialization.h>
#include <AzCore/Serialization/Json/RegistrationContext.h>
#include <AzCore/Serialization/Json/JsonSystemComponent.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/UnitTest/TestTypes.h>
namespace UnitTest
{
struct ConfigInt
{
AZ_TYPE_INFO(UnitTest::ConfigInt, "{1FAF6E55-7FA4-4FFA-8C41-34F422B8E8AB}");
AZ_CLASS_ALLOCATOR(ConfigInt, AZ::SystemAllocator, 0);
int m_value;
static void Reflect(AZ::ReflectContext* context)
{
if (auto sc = azrtti_cast<AZ::SerializeContext*>(context))
{
sc->Class<ConfigInt>()->Field("Value", &ConfigInt::m_value);
}
}
};
struct ConfigurableStackTests : public ScopedAllocatorSetupFixture
{
void Reflect(AZ::ReflectContext* context)
{
if (auto sc = azrtti_cast<AZ::SerializeContext*>(context))
{
AZ::JsonSystemComponent::Reflect(sc);
ConfigInt::Reflect(sc);
sc->RegisterGenericType<AZ::ConfigurableStack<ConfigInt>>();
}
else if (auto jrc = azrtti_cast<AZ::JsonRegistrationContext*>(context))
{
AZ::JsonSystemComponent::Reflect(jrc);
}
}
void SetUp() override
{
ScopedAllocatorSetupFixture::SetUp();
m_serializeContext = AZStd::make_unique<AZ::SerializeContext>();
m_jsonRegistrationContext = AZStd::make_unique<AZ::JsonRegistrationContext>();
Reflect(m_serializeContext.get());
Reflect(m_jsonRegistrationContext.get());
m_deserializationSettings.m_registrationContext = m_jsonRegistrationContext.get();
m_deserializationSettings.m_serializeContext = m_serializeContext.get();
}
void TearDown()
{
m_jsonRegistrationContext->EnableRemoveReflection();
Reflect(m_jsonRegistrationContext.get());
m_jsonRegistrationContext->DisableRemoveReflection();
m_serializeContext->EnableRemoveReflection();
Reflect(m_serializeContext.get());
m_serializeContext->DisableRemoveReflection();
ScopedAllocatorSetupFixture::TearDown();
}
void ObjectTest(AZStd::string_view jsonText)
{
AZ::ConfigurableStack<ConfigInt> stack;
rapidjson::Document document;
document.Parse(jsonText.data(), jsonText.length());
ASSERT_FALSE(document.HasParseError());
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Load(stack, document, m_deserializationSettings);
ASSERT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing());
ASSERT_EQ(4, stack.size());
int numberCounter = 0;
int valueCounter = 42;
for (auto& [name, value] : stack)
{
EXPECT_STREQ(AZStd::string::format("Value%i", numberCounter).c_str(), name.c_str());
EXPECT_EQ(valueCounter, value->m_value);
numberCounter++;
valueCounter++;
}
}
AZStd::unique_ptr<AZ::SerializeContext> m_serializeContext;
AZStd::unique_ptr<AZ::JsonRegistrationContext> m_jsonRegistrationContext;
AZ::JsonDeserializerSettings m_deserializationSettings;
};
TEST_F(ConfigurableStackTests, DeserializeArray)
{
AZ::ConfigurableStack<ConfigInt> stack;
rapidjson::Document document;
document.Parse(
R"([
{ "Value": 42 },
{ "Value": 43 },
{ "Value": 44 },
{ "Value": 45 }
])");
ASSERT_FALSE(document.HasParseError());
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Load(stack, document, m_deserializationSettings);
ASSERT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing());
ASSERT_EQ(4, stack.size());
int numberCounter = 0;
int valueCounter = 42;
for (auto& [name, value] : stack)
{
EXPECT_STREQ(AZStd::to_string(numberCounter).c_str(), name.c_str());
EXPECT_EQ(valueCounter, value->m_value);
numberCounter++;
valueCounter++;
}
}
TEST_F(ConfigurableStackTests, DeserializeObject)
{
ObjectTest(
R"({
"Value0": { "Value": 42 },
"Value1": { "Value": 43 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 }
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithLateBefore)
{
ObjectTest(
R"({
"Value0": { "Value": 42 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 },
"Value1":
{
"$stack_before": "Value2",
"Value": 43
}
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithEarlyBefore)
{
ObjectTest(
R"({
"Value1":
{
"$stack_before": "Value2",
"Value": 43
},
"Value0": { "Value": 42 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 }
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithLateAfter)
{
ObjectTest(
R"({
"Value0": { "Value": 42 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 },
"Value1":
{
"$stack_after": "Value0",
"Value": 43
}
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithEarlyAfter)
{
ObjectTest(
R"({
"Value1":
{
"$stack_after": "Value0",
"Value": 43
},
"Value0": { "Value": 42 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 }
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithBeforeFirst)
{
ObjectTest(
R"({
"Value1": { "Value": 43 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 },
"Value0":
{
"$stack_before": "Value1",
"Value": 42
}
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithInsertAfterLast)
{
ObjectTest(
R"({
"Value3":
{
"$stack_after": "Value2",
"Value": 45
},
"Value0": { "Value": 42 },
"Value1": { "Value": 43 },
"Value2": { "Value": 44 }
})");
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithInvalidTarget)
{
AZ::ConfigurableStack<ConfigInt> stack;
rapidjson::Document document;
document.Parse(
R"({
"Value1":
{
"$stack_after": "airplane",
"Value": 43
},
"Value0": { "Value": 42 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 }
})");
ASSERT_FALSE(document.HasParseError());
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Load(stack, document, m_deserializationSettings);
EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing());
EXPECT_EQ(AZ::JsonSerializationResult::Outcomes::PartialSkip, result.GetOutcome());
EXPECT_EQ(3, stack.size());
}
TEST_F(ConfigurableStackTests, DeserializeObjectWithInvalidTargetType)
{
AZ::ConfigurableStack<ConfigInt> stack;
rapidjson::Document document;
document.Parse(
R"({
"Value1":
{
"$stack_after": 42,
"Value": 43
},
"Value0": { "Value": 42 },
"Value2": { "Value": 44 },
"Value3": { "Value": 45 }
})");
ASSERT_FALSE(document.HasParseError());
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Load(stack, document, m_deserializationSettings);
EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing());
EXPECT_EQ(AZ::JsonSerializationResult::Outcomes::PartialSkip, result.GetOutcome());
EXPECT_EQ(3, stack.size());
}
} // namespace UnitTest

@ -677,7 +677,7 @@ namespace Benchmark
[]
{
});
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
TaskGraphEvent ev;
graph->SubmitOnExecutor(*executor, &ev);
@ -699,7 +699,7 @@ namespace Benchmark
});
a.Precedes(b);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
TaskGraphEvent ev;
graph->SubmitOnExecutor(*executor, &ev);
@ -729,7 +729,7 @@ namespace Benchmark
e.Follows(a, b, c, d);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
TaskGraphEvent ev;
graph->SubmitOnExecutor(*executor, &ev);

@ -76,6 +76,7 @@ set(FILES
Name/NameTests.cpp
RTTI/TypeSafeIntegralTests.cpp
Settings/CommandLineTests.cpp
Settings/ConfigurableStackTests.cpp
Settings/SettingsRegistryTests.cpp
Settings/SettingsRegistryConsoleUtilsTests.cpp
Settings/SettingsRegistryMergeUtilsTests.cpp
@ -230,6 +231,8 @@ set(FILES
DOM/DomPatchBenchmarks.cpp
DOM/DomValueTests.cpp
DOM/DomValueBenchmarks.cpp
DOM/DomPrefixTreeTests.cpp
DOM/DomPrefixTreeBenchmarks.cpp
)
# Prevent the following files from being grouped in UNITY builds

@ -8,10 +8,12 @@
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/Jobs/JobContext.h>
#include <AzCore/Math/Vector2.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Aabb.h>
#include <AzCore/std/containers/span.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Entity/EntityContextBus.h>
#include <AzFramework/Render/GeometryIntersectionStructures.h>
#include <AzFramework/SurfaceData/SurfaceData.h>
@ -138,28 +140,28 @@ namespace AzFramework
//! Given a list of XY coordinates, call the provided callback function with surface data corresponding to each
//! XY coordinate in the list.
virtual void ProcessHeightsFromList(const AZStd::span<AZ::Vector3>& inPositions,
virtual void ProcessHeightsFromList(const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessNormalsFromList(const AZStd::span<AZ::Vector3>& inPositions,
virtual void ProcessNormalsFromList(const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessSurfaceWeightsFromList(const AZStd::span<AZ::Vector3>& inPositions,
virtual void ProcessSurfaceWeightsFromList(const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessSurfacePointsFromList(const AZStd::span<AZ::Vector3>& inPositions,
virtual void ProcessSurfacePointsFromList(const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessHeightsFromListOfVector2(const AZStd::span<AZ::Vector2>& inPositions,
virtual void ProcessHeightsFromListOfVector2(const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessNormalsFromListOfVector2(const AZStd::span<AZ::Vector2>& inPositions,
virtual void ProcessNormalsFromListOfVector2(const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessSurfaceWeightsFromListOfVector2(const AZStd::span<AZ::Vector2>& inPositions,
virtual void ProcessSurfaceWeightsFromListOfVector2(const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
virtual void ProcessSurfacePointsFromListOfVector2(const AZStd::span<AZ::Vector2>& inPositions,
virtual void ProcessSurfacePointsFromListOfVector2(const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT) const = 0;
@ -193,6 +195,147 @@ namespace AzFramework
//! Given a ray, return the closest intersection with terrain.
virtual RenderGeometry::RayResult GetClosestIntersection(const RenderGeometry::RayRequest& ray) const = 0;
//! A JobContext used to run jobs spawned by calls to the various Process*Async functions.
class TerrainJobContext : public AZ::JobContext
{
public:
TerrainJobContext(AZ::JobManager& jobManager,
int numJobsToComplete)
: JobContext(jobManager)
, m_numJobsToComplete(numJobsToComplete)
{
}
// When a terrain job context is cancelled, all associated
// jobs are still guaranteed to at least begin processing,
// and if any ProcessAsyncParams::m_completionCallback was
// set it's guaranteed to be called even in the event of a
// cancellation. If a job only begins processing after its
// associated job context has been cancelled, no processing
// will occur and the callback will be invoked immediately,
// otherwise the job may either run to completion or cease
// processing early; the callback is invoked in all cases,
// provided one was specified with the original request.
void Cancel() { m_isCancelled = true; }
// Was this TerrainJobContext cancelled?
bool IsCancelled() const { return m_isCancelled; }
// Called by the TerrainSystem when a job associated with
// this TerrainJobContext completes. Returns true if this
// was the final job to be completed, or false otherwise.
bool OnJobCompleted() { return (--m_numJobsToComplete == 0); }
private:
AZStd::atomic_int m_numJobsToComplete = 0;
AZStd::atomic_bool m_isCancelled = false;
};
//! Alias for an optional callback function to invoke when the various Process*Async functions complete.
//! The TerrainJobContext, returned from the original Process*Async function call, is passed as a param
//! to the callback function so it can be queried to see if the job was cancelled or completed normally.
typedef AZStd::function<void(AZStd::shared_ptr<TerrainJobContext>)> ProcessAsyncCompleteCallback;
//! A parameter group struct that can optionally be passed to the various Process*Async API functions.
struct ProcessAsyncParams
{
//! The default minimum number ofpositions per async terrain request job.
static constexpr int32_t MinPositionsPerJobDefault = 8;
//! The default number of jobs which async terrain requests will be split into.
static constexpr int32_t NumJobsDefault = 1;
//! The maximum number of jobs which async terrain requests will be split into.
//! This is not the value itself, rather a constant that can be used to request
//! the work be split into the maximum number of job manager threads available.
static constexpr int32_t NumJobsMax = -1;
//! The desired number of jobs to split async terrain requests into.
//! The actual value used will be clamped to the number of available job manager threads.
//!
//! Note: Currently, splitting the work over multiple threads causes contention when
//! locking various mutexes, resulting in slower overall wall time for async
//! requests split over multiple threads vs one where all the work is done on
//! a single thread. The latter is still preferable over a regular synchronous
//! call because it is just as quick and prevents the main thread from blocking.
//! This note should be removed once the mutex contention issues have been addressed.
int32_t m_desiredNumberOfJobs = NumJobsDefault;
//! The minimum number of positions per async terrain request job.
int32_t m_minPositionsPerJob = MinPositionsPerJobDefault;
//! The callback function that will be invoked when a call to a Process*Async function completes.
//! If the job is cancelled, the completion callback will not be invoked.
ProcessAsyncCompleteCallback m_completionCallback = nullptr;
};
//! Asynchronous versions of the various 'Process*' API functions declared above.
//! It's the responsibility of the caller to ensure all callbacks are threadsafe.
virtual AZStd::shared_ptr<TerrainJobContext> ProcessHeightsFromListAsync(
const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessNormalsFromListAsync(
const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessSurfaceWeightsFromListAsync(
const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessSurfacePointsFromListAsync(
const AZStd::span<const AZ::Vector3>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessHeightsFromListOfVector2Async(
const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessNormalsFromListOfVector2Async(
const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessSurfaceWeightsFromListOfVector2Async(
const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessSurfacePointsFromListOfVector2Async(
const AZStd::span<const AZ::Vector2>& inPositions,
SurfacePointListFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessHeightsFromRegionAsync(
const AZ::Aabb& inRegion,
const AZ::Vector2& stepSize,
SurfacePointRegionFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessNormalsFromRegionAsync(
const AZ::Aabb& inRegion,
const AZ::Vector2& stepSize,
SurfacePointRegionFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessSurfaceWeightsFromRegionAsync(
const AZ::Aabb& inRegion,
const AZ::Vector2& stepSize,
SurfacePointRegionFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
virtual AZStd::shared_ptr<TerrainJobContext> ProcessSurfacePointsFromRegionAsync(
const AZ::Aabb& inRegion,
const AZ::Vector2& stepSize,
SurfacePointRegionFillCallback perPositionCallback,
Sampler sampleFilter = Sampler::DEFAULT,
AZStd::shared_ptr<ProcessAsyncParams> params = nullptr) const = 0;
private:
// Private variations of the GetSurfacePoint API exposed to BehaviorContext that returns a value instead of
// using an "out" parameter. The "out" parameter is useful for reusing memory allocated in SurfacePoint when

@ -374,8 +374,6 @@ namespace AzFramework
// is double-quoted, then the double-quotes must be escaped properly otherwise
// it will be absorbed by the native argument parser and possibly evaluated as
// multiple values for arguments
AZStd::string_view escapedDoubleQuote = R"("\")";
AZStd::vector<AZStd::string> preprocessedCommandArray;
for (const auto& commandArg : commandLineArray)

@ -77,21 +77,21 @@ namespace UnitTest
MOCK_CONST_METHOD5(
GetSurfacePointFromFloats, void(float, float, AzFramework::SurfaceData::SurfacePoint&, Sampler, bool*));
MOCK_CONST_METHOD3(
ProcessHeightsFromList, void(const AZStd::span<AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessHeightsFromList, void(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessNormalsFromList, void(const AZStd::span<AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessNormalsFromList, void(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessSurfaceWeightsFromList, void(const AZStd::span<AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessSurfaceWeightsFromList, void(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessSurfacePointsFromList, void(const AZStd::span<AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessSurfacePointsFromList, void(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessHeightsFromListOfVector2, void(const AZStd::span<AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessHeightsFromListOfVector2, void(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessNormalsFromListOfVector2, void(const AZStd::span<AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessNormalsFromListOfVector2, void(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessSurfaceWeightsFromListOfVector2, void(const AZStd::span<AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessSurfaceWeightsFromListOfVector2, void(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD3(
ProcessSurfacePointsFromListOfVector2, void(const AZStd::span<AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
ProcessSurfacePointsFromListOfVector2, void(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler));
MOCK_CONST_METHOD2(
GetNumSamplesFromRegion, AZStd::pair<size_t, size_t>(const AZ::Aabb&, const AZ::Vector2&));
MOCK_CONST_METHOD4(
@ -106,5 +106,30 @@ namespace UnitTest
GetTerrainRaycastEntityContextId, AzFramework::EntityContextId());
MOCK_CONST_METHOD1(
GetClosestIntersection, AzFramework::RenderGeometry::RayResult(const AzFramework::RenderGeometry::RayRequest&));
MOCK_CONST_METHOD4(
ProcessHeightsFromListAsync, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessNormalsFromListAsync, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessSurfaceWeightsFromListAsync, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessSurfacePointsFromListAsync, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector3>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessHeightsFromListOfVector2Async, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessNormalsFromListOfVector2Async, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessSurfaceWeightsFromListOfVector2Async, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD4(
ProcessSurfacePointsFromListOfVector2Async, AZStd::shared_ptr<TerrainJobContext>(const AZStd::span<const AZ::Vector2>&, AzFramework::Terrain::SurfacePointListFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD5(
ProcessHeightsFromRegionAsync, AZStd::shared_ptr<TerrainJobContext>(const AZ::Aabb&, const AZ::Vector2&, AzFramework::Terrain::SurfacePointRegionFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD5(
ProcessNormalsFromRegionAsync, AZStd::shared_ptr<TerrainJobContext>(const AZ::Aabb&, const AZ::Vector2&, AzFramework::Terrain::SurfacePointRegionFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD5(
ProcessSurfaceWeightsFromRegionAsync, AZStd::shared_ptr<TerrainJobContext>(const AZ::Aabb&, const AZ::Vector2&, AzFramework::Terrain::SurfacePointRegionFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
MOCK_CONST_METHOD5(
ProcessSurfacePointsFromRegionAsync, AZStd::shared_ptr<TerrainJobContext>(const AZ::Aabb&, const AZ::Vector2&, AzFramework::Terrain::SurfacePointRegionFillCallback, Sampler, AZStd::shared_ptr<ProcessAsyncParams>));
};
} // namespace UnitTest

@ -142,7 +142,7 @@ namespace Benchmark
BENCHMARK_F(BM_Octree, InsertDelete1000)(benchmark::State& state)
{
constexpr uint32_t EntryCount = 1000;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
InsertEntries(EntryCount);
RemoveEntries(EntryCount);
@ -152,7 +152,7 @@ namespace Benchmark
BENCHMARK_F(BM_Octree, InsertDelete10000)(benchmark::State& state)
{
constexpr uint32_t EntryCount = 10000;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
InsertEntries(EntryCount);
RemoveEntries(EntryCount);
@ -162,7 +162,7 @@ namespace Benchmark
BENCHMARK_F(BM_Octree, InsertDelete100000)(benchmark::State& state)
{
constexpr uint32_t EntryCount = 100000;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
InsertEntries(EntryCount);
RemoveEntries(EntryCount);
@ -172,7 +172,7 @@ namespace Benchmark
BENCHMARK_F(BM_Octree, InsertDelete1000000)(benchmark::State& state)
{
constexpr uint32_t EntryCount = 1000000;
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
InsertEntries(EntryCount);
RemoveEntries(EntryCount);
@ -183,7 +183,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 1000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -197,7 +197,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 10000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -211,7 +211,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 100000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -225,7 +225,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 1000000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -239,7 +239,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 1000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -253,7 +253,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 10000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -267,7 +267,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 100000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -281,7 +281,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 1000000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -295,7 +295,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 1000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -309,7 +309,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 10000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -323,7 +323,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 100000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{
@ -337,7 +337,7 @@ namespace Benchmark
{
constexpr uint32_t EntryCount = 1000000;
InsertEntries(EntryCount);
for (auto _ : state)
for ([[maybe_unused]] auto _ : state)
{
for (auto& queryData : m_queryDataArray)
{

@ -46,9 +46,9 @@ namespace AzManipulatorTestFramework
//! Send a double click event.
DerivedDispatcherT* MouseLButtonDoubleClick();
//! Set the keyboard modifier button down.
DerivedDispatcherT* KeyboardModifierDown(const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier);
DerivedDispatcherT* KeyboardModifierDown(AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier);
//! Set the keyboard modifier button up.
DerivedDispatcherT* KeyboardModifierUp(const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier);
DerivedDispatcherT* KeyboardModifierUp(AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier);
//! Set the mouse position to the specified screen space position.
DerivedDispatcherT* MousePosition(const AzFramework::ScreenPoint& position);
//! Expect the selected manipulator to be interacting.
@ -81,8 +81,8 @@ namespace AzManipulatorTestFramework
virtual void MouseMButtonUpImpl() = 0;
virtual void MouseLButtonDoubleClickImpl() = 0;
virtual void MousePositionImpl(const AzFramework::ScreenPoint& position) = 0;
virtual void KeyboardModifierDownImpl(const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier) = 0;
virtual void KeyboardModifierUpImpl(const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier) = 0;
virtual void KeyboardModifierDownImpl(AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier) = 0;
virtual void KeyboardModifierUpImpl(AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier) = 0;
virtual void ExpectManipulatorBeingInteractedImpl() = 0;
virtual void ExpectManipulatorNotBeingInteractedImpl() = 0;
virtual void SetEntityWorldTransformImpl(AZ::EntityId entityId, const AZ::Transform& transform) = 0;
@ -94,7 +94,7 @@ namespace AzManipulatorTestFramework
bool m_logging = false;
private:
const char* KeyboardModifierString(const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier);
const char* KeyboardModifierString(AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier);
static void DebugPrint(const char* format, ...);
};
@ -215,7 +215,7 @@ namespace AzManipulatorTestFramework
template<typename DerivedDispatcherT>
const char* ActionDispatcher<DerivedDispatcherT>::KeyboardModifierString(
const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier)
const AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier)
{
using namespace AzToolsFramework::ViewportInteraction;
switch (keyModifier)
@ -235,7 +235,7 @@ namespace AzManipulatorTestFramework
template<typename DerivedDispatcherT>
DerivedDispatcherT* ActionDispatcher<DerivedDispatcherT>::KeyboardModifierDown(
const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier)
const AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier)
{
Log("Keyboard modifier down: %s", KeyboardModifierString(keyModifier));
KeyboardModifierDownImpl(keyModifier);
@ -244,7 +244,7 @@ namespace AzManipulatorTestFramework
template<typename DerivedDispatcherT>
DerivedDispatcherT* ActionDispatcher<DerivedDispatcherT>::KeyboardModifierUp(
const AzToolsFramework::ViewportInteraction::KeyboardModifier& keyModifier)
const AzToolsFramework::ViewportInteraction::KeyboardModifier keyModifier)
{
Log("Keyboard modifier up: %s", KeyboardModifierString(keyModifier));
KeyboardModifierUpImpl(keyModifier);

@ -66,8 +66,8 @@ namespace AzManipulatorTestFramework
void MouseMButtonUpImpl() override;
void MouseLButtonDoubleClickImpl() override;
void MousePositionImpl(const AzFramework::ScreenPoint& position) override;
void KeyboardModifierDownImpl(const KeyboardModifier& keyModifier) override;
void KeyboardModifierUpImpl(const KeyboardModifier& keyModifier) override;
void KeyboardModifierDownImpl(KeyboardModifier keyModifier) override;
void KeyboardModifierUpImpl(KeyboardModifier keyModifier) override;
void ExpectManipulatorBeingInteractedImpl() override;
void ExpectManipulatorNotBeingInteractedImpl() override;
void SetEntityWorldTransformImpl(AZ::EntityId entityId, const AZ::Transform& transform) override;

@ -126,12 +126,12 @@ namespace AzManipulatorTestFramework
m_manipulatorViewportInteraction.GetManipulatorManager().ConsumeMouseInteractionEvent(*m_event);
}
void ImmediateModeActionDispatcher::KeyboardModifierDownImpl(const KeyboardModifier& keyModifier)
void ImmediateModeActionDispatcher::KeyboardModifierDownImpl(const KeyboardModifier keyModifier)
{
ToggleOn(GetMouseInteractionEvent()->m_mouseInteraction.m_keyboardModifiers.m_keyModifiers, keyModifier);
}
void ImmediateModeActionDispatcher::KeyboardModifierUpImpl(const KeyboardModifier& keyModifier)
void ImmediateModeActionDispatcher::KeyboardModifierUpImpl(const KeyboardModifier keyModifier)
{
ToggleOff(GetMouseInteractionEvent()->m_mouseInteraction.m_keyboardModifiers.m_keyModifiers, keyModifier);
}

@ -276,7 +276,6 @@ namespace AzQtComponents
*/
void FancyDocking::updateDockingGeometry()
{
QRect totalScreenRect;
int numScreens = QApplication::screens().count();
#ifdef AZ_PLATFORM_WINDOWS
@ -286,6 +285,9 @@ namespace AzQtComponents
m_perScreenFullScreenWidgets.clear();
#endif
#if !defined(AZ_PLATFORM_WINDOWS)
QRect totalScreenRect;
#endif
for (int i = 0; i < numScreens; ++i)
{
#ifdef AZ_PLATFORM_WINDOWS

@ -164,6 +164,16 @@ namespace AZ
m_envs.push_back(std::move(env));
}
// Remove a registered benchmark from the registry
void RemoveBenchmarkEnvironment(BenchmarkEnvironmentBase* env)
{
auto RemoveBenchmarkFunc = [env](const std::unique_ptr<BenchmarkEnvironmentBase>& envElement)
{
return envElement.get() == env;
};
m_envs.erase(std::remove_if(m_envs.begin(), m_envs.end(), std::move(RemoveBenchmarkFunc)));
}
std::vector<std::unique_ptr<BenchmarkEnvironmentBase>>& GetBenchmarkEnvironments()
{
return m_envs;
@ -194,21 +204,26 @@ namespace AZ
return *benchmarkEnv;
}
template<typename... Ts>
std::array<BenchmarkEnvironmentBase*, sizeof...(Ts)> RegisterBenchmarkEnvironments()
/*
* An RAII wrapper about registering a BenchmarkEnvironment with the BenchmarkRegistry
* It will unregister the BenchmarkEnvironment with the BenchmarkRegistry on destruction
*/
struct ScopedRegisterBenchmarkEnvironment
{
constexpr size_t EnvironmentCount{ sizeof...(Ts) };
if constexpr (EnvironmentCount)
{
std::array<BenchmarkEnvironmentBase*, EnvironmentCount> benchmarkEnvs{ { &RegisterBenchmarkEnvironment<Ts>()... } };
return benchmarkEnvs;
}
else
template<typename T>
ScopedRegisterBenchmarkEnvironment(T& benchmarkEnv)
: m_benchmarkEnv(benchmarkEnv)
{}
~ScopedRegisterBenchmarkEnvironment()
{
std::array<BenchmarkEnvironmentBase*, EnvironmentCount> benchmarkEnvs{};
return benchmarkEnvs;
if (auto benchmarkRegistry = AZ::Environment::FindVariable<BenchmarkEnvironmentRegistry>(s_benchmarkEnvironmentName);
benchmarkRegistry != nullptr)
{
benchmarkRegistry->RemoveBenchmarkEnvironment(&m_benchmarkEnv);
}
}
}
BenchmarkEnvironmentBase& m_benchmarkEnv;
};
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! listener class to capture and print test output for embedded platforms
@ -276,7 +291,7 @@ namespace AZ
#define AZ_BENCHMARK_HOOK_ENV(TEST_ENV) \
AZTEST_EXPORT int AzRunBenchmarks(int argc, char** argv) \
{ \
AZ::Test::RegisterBenchmarkEnvironments<TEST_ENV>(); \
AZ::Test::ScopedRegisterBenchmarkEnvironment scopedBenchmarkEnv(AZ::Test::RegisterBenchmarkEnvironment<TEST_ENV>()); \
auto benchmarkEnvRegistry = AZ::Environment::FindVariable<AZ::Test::BenchmarkEnvironmentRegistry>(AZ::Test::s_benchmarkEnvironmentName); \
std::vector<std::unique_ptr<AZ::Test::BenchmarkEnvironmentBase>>* benchmarkEnvs = benchmarkEnvRegistry ? &(benchmarkEnvRegistry->GetBenchmarkEnvironments()) : nullptr; \
if (benchmarkEnvs != nullptr) \
@ -307,7 +322,6 @@ AZTEST_EXPORT int AzRunBenchmarks(int argc, char** argv) \
#define AZ_BENCHMARK_HOOK() \
AZTEST_EXPORT int AzRunBenchmarks(int argc, char** argv) \
{ \
AZ::Test::RegisterBenchmarkEnvironments<>(); \
auto benchmarkEnvRegistry = AZ::Environment::FindVariable<AZ::Test::BenchmarkEnvironmentRegistry>(AZ::Test::s_benchmarkEnvironmentName); \
std::vector<std::unique_ptr<AZ::Test::BenchmarkEnvironmentBase>>* benchmarkEnvs = benchmarkEnvRegistry ? &(benchmarkEnvRegistry->GetBenchmarkEnvironments()) : nullptr; \
if (benchmarkEnvs != nullptr) \

@ -52,7 +52,6 @@ namespace AZ
GemTestEnvironment::GemTestEnvironment()
{
m_parameters = new Parameters;
}
void GemTestEnvironment::AddDynamicModulePaths(const AZStd::vector<AZStd::string>& dynamicModulePaths)
@ -84,6 +83,8 @@ namespace AZ
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
m_parameters = new Parameters;
AddGemsAndComponents();
PreCreateApplication();

@ -8,14 +8,13 @@
#pragma once
#include <AzCore/Component/EntityId.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzToolsFramework/Entity/EntityTypes.h>
namespace AzToolsFramework
{
using EntityIdList = AZStd::vector<AZ::EntityId>;
/*!
* EditorEntityAPI
* Handles basic Entity operations

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save