User configurable power level
This commit is contained in:
@@ -175,6 +175,9 @@ configuration::configuration(xr::system & system)
|
||||
|
||||
if (auto val = root["environment_model"]; val.is_string())
|
||||
environment_model = (std::string_view)val.get_string();
|
||||
|
||||
if (auto val = root["high_power_mode"]; val.is_bool())
|
||||
high_power_mode = val.get_bool();
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -263,5 +266,6 @@ void configuration::save()
|
||||
json << ",\"first_run\":" << std::boolalpha << first_run;
|
||||
json << ",\"locale\":" << json_string(locale);
|
||||
json << ",\"environment_model\":" << json_string(environment_model);
|
||||
json << ",\"high_power_mode\":" << std::boolalpha << high_power_mode;
|
||||
json << "}";
|
||||
}
|
||||
|
||||
@@ -74,6 +74,8 @@ public:
|
||||
float override_foveation_pitch = 10 * M_PI / 180;
|
||||
float override_foveation_distance = 3;
|
||||
|
||||
bool high_power_mode = false;
|
||||
|
||||
bool first_run = true;
|
||||
|
||||
std::string locale;
|
||||
|
||||
@@ -667,6 +667,15 @@ void scenes::lobby::gui_settings()
|
||||
}
|
||||
}
|
||||
|
||||
if (instance.has_extension(XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME))
|
||||
{
|
||||
if (ImGui::Checkbox(_S("High power mode"), &config.high_power_mode))
|
||||
config.save();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Increase power usage to allow higher resolution and refresh rate"));
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
{
|
||||
bool enabled = config.check_feature(feature::microphone);
|
||||
if (ImGui::Checkbox(_S("Enable microphone"), &enabled))
|
||||
|
||||
@@ -493,8 +493,16 @@ void scenes::stream::on_focused()
|
||||
video_stream_description->defoveated_width / view_count,
|
||||
video_stream_description->defoveated_height);
|
||||
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT);
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT);
|
||||
if (application::get_config().high_power_mode)
|
||||
{
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_CPU_EXT, XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT);
|
||||
session.set_performance_level(XR_PERF_SETTINGS_DOMAIN_GPU_EXT, XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT);
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::on_unfocused()
|
||||
|
||||
Reference in New Issue
Block a user