move hardware benchmarking settings to its own class

This commit is contained in:
Mamadou Babaei
2024-08-16 18:00:53 +02:00
parent f08c301710
commit 2f32ad1fe7
5 changed files with 132 additions and 25 deletions
@@ -168,7 +168,9 @@ void USGGameUserSettings::SetEngineScalabilitySettings(ESGEngineScalabilitySetti
return;
}
const FSGGameUserSettingSettings& Settings{USGSettings::GetInstance()->GetGameUserSettings()};
const FSGHardwareBenchmarkSettings& Settings{
USGSettings::GetInstance()->GetGameUserSettings().HardwareBenchmarkSettings
};
if (IsDirty())
{
@@ -199,9 +201,9 @@ void USGGameUserSettings::SetEngineScalabilitySettings(ESGEngineScalabilitySetti
else
{
RunHardwareBenchmark(
Settings.HardwareBenchmarkWorkScale,
Settings.HardwareBenchmarkCPUMultiplier,
Settings.HardwareBenchmarkGPUMultiplier);
Settings.WorkScale,
Settings.CPUMultiplier,
Settings.GPUMultiplier);
ApplyHardwareBenchmarkResults();
}
@@ -36,19 +36,12 @@
#include "SGSettings/SGGameUserSettingSettings.h"
FSGGameUserSettingSettings::FSGGameUserSettingSettings()
: FSGGameUserSettingSettings(
10.0f,
1.0f,
1.0f)
: HardwareBenchmarkSettings{}
{
}
FSGGameUserSettingSettings::FSGGameUserSettingSettings(
const float InHardwareBenchmarkWorkScale,
const float InHardwareBenchmarkCPUMultiplier,
const float InHardwareBenchmarkGPUMultiplier)
: HardwareBenchmarkWorkScale(InHardwareBenchmarkWorkScale),
HardwareBenchmarkCPUMultiplier(InHardwareBenchmarkCPUMultiplier),
HardwareBenchmarkGPUMultiplier(InHardwareBenchmarkGPUMultiplier)
const FSGHardwareBenchmarkSettings& InHardwareBenchmarkSettings)
: HardwareBenchmarkSettings(InHardwareBenchmarkSettings)
{
}
@@ -0,0 +1,54 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#include "SGSettings/SGHardwareBenchmarkSettings.h"
FSGHardwareBenchmarkSettings::FSGHardwareBenchmarkSettings()
: FSGHardwareBenchmarkSettings(
10.0f,
1.0f,
1.0f)
{
}
FSGHardwareBenchmarkSettings::FSGHardwareBenchmarkSettings(
const float InWorkScale,
const float InCPUMultiplier,
const float InGPUMultiplier)
: WorkScale(InWorkScale),
CPUMultiplier(InCPUMultiplier),
GPUMultiplier(InGPUMultiplier)
{
}
@@ -37,6 +37,8 @@
#include "UObject/ObjectMacros.h"
#include "SGSettings/SGHardwareBenchmarkSettings.h"
#include "SGGameUserSettingSettings.generated.h"
USTRUCT(BlueprintType)
@@ -45,20 +47,12 @@ struct SENSEGLOVESETTINGS_API FSGGameUserSettingSettings
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Settings")
float HardwareBenchmarkWorkScale;
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Settings")
float HardwareBenchmarkCPUMultiplier;
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Settings")
float HardwareBenchmarkGPUMultiplier;
UPROPERTY(Config, EditDefaultsOnly, Category = "Game User Setting")
FSGHardwareBenchmarkSettings HardwareBenchmarkSettings;
public:
FSGGameUserSettingSettings();
FSGGameUserSettingSettings(
float InHardwareBenchmarkWorkScale,
float InHardwareBenchmarkCPUMultiplier,
float InHardwareBenchmarkGPUMultiplier);
const FSGHardwareBenchmarkSettings& InHardwareBenchmarkSettings);
};
@@ -0,0 +1,64 @@
/**
* @file
*
* @author Mamadou Babaei <mamadou@senseglove.com>
*
* @section LICENSE
*
* (The MIT License)
*
* Copyright (c) 2020 - 2024 SenseGlove
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @section DESCRIPTION
*
*
*/
#pragma once
#include "UObject/ObjectMacros.h"
#include "SGHardwareBenchmarkSettings.generated.h"
USTRUCT(BlueprintType)
struct SENSEGLOVESETTINGS_API FSGHardwareBenchmarkSettings
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(Config, EditDefaultsOnly, Category = "Hardware Benchmark")
float WorkScale;
UPROPERTY(Config, EditDefaultsOnly, Category = "Hardware Benchmark")
float CPUMultiplier;
UPROPERTY(Config, EditDefaultsOnly, Category = "Hardware Benchmark")
float GPUMultiplier;
public:
FSGHardwareBenchmarkSettings();
FSGHardwareBenchmarkSettings(
float InWorkScale,
float InCPUMultiplier,
float InGPUMultiplier);
};