diff --git a/client/configuration.cpp b/client/configuration.cpp index 9709fd17..fffaeae0 100644 --- a/client/configuration.cpp +++ b/client/configuration.cpp @@ -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 << "}"; } diff --git a/client/configuration.h b/client/configuration.h index f5e6f3a6..c7d170e4 100644 --- a/client/configuration.h +++ b/client/configuration.h @@ -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; diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 507964f1..b12759b5 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -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)) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 66f59670..ba59308a 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -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()