mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
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.
This commit is contained in:
parent
b8e06ca757
commit
f510a3cd8f
Notes:
sideshowbarker
2024-07-17 21:26:19 +09:00
Author: https://github.com/sunverwerth Commit: https://github.com/SerenityOS/serenity/commit/f510a3cd8f1 Pull-request: https://github.com/SerenityOS/serenity/pull/11568 Reviewed-by: https://github.com/Hendiadyoin1 ✅ Reviewed-by: https://github.com/Quaker762 ✅ Reviewed-by: https://github.com/gmta
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user