toggle DisableFrameThrottling setting by clicking on FPS display

s/jSurface/vkSurface
This commit is contained in:
Matesic Darko 2022-12-02 09:03:56 +01:00 committed by Billy Laws
parent 3168e8efc0
commit f850271e2d
3 changed files with 18 additions and 0 deletions

View File

@ -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};

View File

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

View File

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