diff --git a/app/src/main/cpp/skyline/gpu/presentation_engine.cpp b/app/src/main/cpp/skyline/gpu/presentation_engine.cpp index 5a913b70..8f610583 100644 --- a/app/src/main/cpp/skyline/gpu/presentation_engine.cpp +++ b/app/src/main/cpp/skyline/gpu/presentation_engine.cpp @@ -33,6 +33,7 @@ namespace skyline::gpu { auto desc{presentationTrack.Serialize()}; desc.set_name("Presentation"); perfetto::TrackEvent::SetTrackDescriptor(presentationTrack, desc); + state.settings->disableFrameThrottling.AddCallback(std::bind(&PresentationEngine::OnDisableFrameThrottlingChanged, this, std::placeholders::_1)); } PresentationEngine::~PresentationEngine() { @@ -341,6 +342,13 @@ namespace skyline::gpu { swapchainImageCount = vkImages.size(); } + void PresentationEngine::OnDisableFrameThrottlingChanged(const bool &value) { + std::scoped_lock guard{mutex}; + + if (vkSurface && swapchainExtent && swapchainFormat) + UpdateSwapchain(swapchainFormat, swapchainExtent); + } + void PresentationEngine::UpdateSurface(jobject newSurface) { std::scoped_lock guard{mutex}; diff --git a/app/src/main/cpp/skyline/gpu/presentation_engine.h b/app/src/main/cpp/skyline/gpu/presentation_engine.h index 7fbfaf27..19ac6bc2 100644 --- a/app/src/main/cpp/skyline/gpu/presentation_engine.h +++ b/app/src/main/cpp/skyline/gpu/presentation_engine.h @@ -105,6 +105,11 @@ namespace skyline::gpu { */ void UpdateSwapchain(texture::Format format, texture::Dimensions extent); + /** + * @brief Handles DisableFrameThrottling setting changed event + */ + void OnDisableFrameThrottlingChanged(const bool &value); + public: PresentationEngine(const DeviceState &state, GPU &gpu); diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt index 1fce15cb..810e986b 100644 --- a/app/src/main/java/emu/skyline/EmulationActivity.kt +++ b/app/src/main/java/emu/skyline/EmulationActivity.kt @@ -249,6 +249,11 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo postDelayed(this, 250) } }, 250) + setOnClickListener { + preferenceSettings.disableFrameThrottling = !preferenceSettings.disableFrameThrottling + var color = if (preferenceSettings.disableFrameThrottling) getColor(R.color.colorPerfStatsSecondary) else getColor(R.color.colorPerfStatsPrimary) + binding.perfStats.setTextColor(color) + } } }