From 065525aba084b3ba7a7932615be72cd43b5c10da Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Sat, 8 Jan 2022 14:30:56 -0700 Subject: [PATCH] LibSoftGPU: Configure stats overlay period Problem: - The statistics overlay period is hardcoded to 500 ms. This time is very short and can result in the values being very "jumpy". Solution: - Increasing this value can result in more steady values which is useful when trying to evaluate the performance impact of a change. A new config value is offered in `Config.h` to let the developer change to any value desired. --- Userland/Libraries/LibSoftGPU/Config.h | 1 + Userland/Libraries/LibSoftGPU/Device.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibSoftGPU/Config.h b/Userland/Libraries/LibSoftGPU/Config.h index c75603427e..86f88a31d5 100644 --- a/Userland/Libraries/LibSoftGPU/Config.h +++ b/Userland/Libraries/LibSoftGPU/Config.h @@ -16,6 +16,7 @@ namespace SoftGPU { static constexpr bool ENABLE_STATISTICS_OVERLAY = false; static constexpr int NUM_SAMPLERS = 2; +static constexpr int MILLISECONDS_PER_STATISTICS_PERIOD = 500; static constexpr int SUBPIXEL_BITS = 5; static constexpr int NUM_LIGHTS = 8; diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index 7309a94969..25d44aeb86 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -1224,7 +1224,7 @@ void Device::draw_statistics_overlay(Gfx::Bitmap& target) Gfx::Painter painter { target }; - if (milliseconds > 500) { + if (milliseconds > MILLISECONDS_PER_STATISTICS_PERIOD) { int num_rendertarget_pixels = m_render_target->width() * m_render_target->height();