summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Unverwerth <s.unverwerth@serenityos.org>2022-01-01 23:29:51 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-01-09 16:21:13 +0330
commitf510a3cd8f15129fa842b2e6e46daa7354734682 (patch)
treef9fdb6ee25e45d520f0e99af172dadeb70fcc7c2
parentb8e06ca7570faaa07b2019762a5bd99492a19c5a (diff)
downloadserenity-f510a3cd8f15129fa842b2e6e46daa7354734682.zip
LibSoftGPU: Add SIMD utilization counter to debug overlay
This adds a counter to the debug overlay that displays the average percentage of SIMD lane utilization. This number represents the number of pixels that were output for each quad. A utilization of 100% means that all 4 SIMD lanes were used and no pixels were masked out before being written to the color buffer.
-rw-r--r--Userland/Libraries/LibSoftGPU/Device.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp
index b9fe3f6078..b1bdd03599 100644
--- a/Userland/Libraries/LibSoftGPU/Device.cpp
+++ b/Userland/Libraries/LibSoftGPU/Device.cpp
@@ -24,6 +24,7 @@ static long long g_num_pixels;
static long long g_num_pixels_shaded;
static long long g_num_pixels_blended;
static long long g_num_sampler_calls;
+static long long g_num_quads;
using IntVector2 = Gfx::Vector2<int>;
using IntVector3 = Gfx::Vector3<int>;
@@ -271,6 +272,7 @@ static void rasterize_triangle(const RasterizerOptions& options, Gfx::Bitmap& re
if (none(quad.mask))
continue;
+ INCREASE_STATISTICS_COUNTER(g_num_quads, 1);
INCREASE_STATISTICS_COUNTER(g_num_pixels, maskcount(quad.mask));
// Calculate barycentric coordinates from previously calculated edge values
@@ -902,6 +904,7 @@ void Device::draw_statistics_overlay(Gfx::Bitmap& target)
static_cast<double>(milliseconds) / frame_counter,
(milliseconds > 0) ? 1000.0 * frame_counter / milliseconds : 9999.0));
builder.append(String::formatted("Triangles : {}\n", g_num_rasterized_triangles));
+ builder.append(String::formatted("SIMD usage : {}%\n", g_num_quads > 0 ? g_num_pixels_shaded * 25 / g_num_quads : 0));
builder.append(String::formatted("Pixels : {}, Shaded: {}%, Blended: {}%, Overdraw: {}%\n",
g_num_pixels,
g_num_pixels_shaded * 100 / g_num_pixels,
@@ -920,6 +923,7 @@ void Device::draw_statistics_overlay(Gfx::Bitmap& target)
g_num_pixels_shaded = 0;
g_num_pixels_blended = 0;
g_num_sampler_calls = 0;
+ g_num_quads = 0;
auto& font = Gfx::FontDatabase::default_fixed_width_font();