Add font cache stats to "internals" screen

This commit is contained in:
Henrik Rydgård committed 2025-04-09 12:40:10 +02:00
1 parent 2ce186481e
commit 531842f577
49 files changed
+75 -12

No files matched your search

+4
View File
@@ -477,6 +477,10 @@ public:
int Height() const { return height_; }
int Depth() const { return depth_; }
DataFormat Format() const { return format_; }
int DataSize() const {
// Rough estimate, discounts padding etc.
return width_ * height_ * (int)DataFormatSizeInBytes(format_);
}
protected:
int width_ = -1, height_ = -1, depth_ = -1;
+9 -5
View File
@@ -38,11 +38,7 @@ void TextDrawer::SetFontScale(float xscale, float yscale) {
float TextDrawer::CalculateDPIScale() const {
if (ignoreGlobalDpi_)
return dpiScale_;
float scale = g_display.dpi_scale;
if (scale >= 1.0f) {
scale = 1.0f;
}
return scale;
return g_display.dpi_scale;
}
void TextDrawer::DrawString(DrawBuffer &target, std::string_view str, float x, float y, uint32_t color, int align) {
@@ -244,6 +240,14 @@ void TextDrawer::OncePerFrame() {
}
}
size_t TextDrawer::GetCacheDataSize() const {
size_t sz = 0;
for (const auto &iter : cache_) {
sz += iter.second->texture->DataSize();
}
return sz;
}
TextDrawer *TextDrawer::Create(Draw::DrawContext *draw) {
TextDrawer *drawer = nullptr;
#if defined(__LIBRETRO__)
+6
View File
@@ -59,6 +59,7 @@ public:
void OncePerFrame();
float CalculateDPIScale() const;
// This is used by PPGe, since we run at the PSP's DPI inside of there.
void SetForcedDPIScale(float dpi) {
dpiScale_ = dpi;
ignoreGlobalDpi_ = true;
@@ -67,6 +68,11 @@ public:
// Factory function that selects implementation.
static TextDrawer *Create(Draw::DrawContext *draw);
size_t GetStringCacheSize() const {
return cache_.size();
}
size_t GetCacheDataSize() const;
protected:
TextDrawer(Draw::DrawContext *draw);
+6 -6
View File
@@ -54,9 +54,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.32"
version = "4.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83"
checksum = "d8aa86934b44c19c50f87cc2790e19f54f7a67aedb64101c2e1a2e5ecfb73944"
dependencies = [
"clap_builder",
"clap_derive",
@@ -64,9 +64,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.32"
version = "4.5.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8"
checksum = "2414dbb2dd0695280da6ea9261e327479e9d37b0630f6b53ba2a11c60c679fd9"
dependencies = [
"anstream",
"anstyle",
@@ -119,9 +119,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.21.1"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "proc-macro2"
+6 -1
View File
@@ -44,7 +44,7 @@
#include "Common/UI/ViewGroup.h"
#include "Common/UI/UI.h"
#include "Common/UI/IconCache.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/Render/Text/draw_text.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Log/LogManager.h"
@@ -939,6 +939,11 @@ void SystemInfoScreen::CreateInternalsTab(UI::ViewGroup *internals) {
return UI::EVENT_DONE;
});
internals->Add(new ItemHeader(si->T("Font cache")));
const TextDrawer *text = screenManager()->getUIContext()->Text();
internals->Add(new InfoItem(si->T("Texture count"), StringFromFormat("%d", text->GetStringCacheSize())));
internals->Add(new InfoItem(si->T("Data size"), NiceSizeFormat(text->GetCacheDataSize())));
internals->Add(new ItemHeader(si->T("Notification tests")));
internals->Add(new Choice(si->T("Error")))->OnClick.Add([&](UI::EventParams &) {
std::string str = "Error " + CodepointToUTF8(0x1F41B) + CodepointToUTF8(0x1F41C) + CodepointToUTF8(0x1F914);
+1
View File
@@ -1260,6 +1260,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Treiberversion
EGL Extensions = EGL Erweiterungen
Font cache = Font cache
Frames per buffer = Bilder pro Zwischenspeicher
GPU Flags = GPU Flags
GPU Information = GPU Information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1267,6 +1267,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1253,6 +1253,7 @@ DPI = DPI
Driver bugs = Errores de controlador
Driver Version = Versión de controlador
EGL Extensions = Extensiones EGL
Font cache = Font cache
Frames per buffer = Fotogramas por búfer
GPU Flags = GPU Flags
GPU Information = Información de la GPU
+1
View File
@@ -1254,6 +1254,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Versión de driver
EGL Extensions = Extensiones EGL
Font cache = Font cache
Frames per buffer = Cuadros por búfer
GPU Flags = GPU Flags
GPU Information = Info de GPU
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1243,6 +1243,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Version du pilote
EGL Extensions = Extensions EGL
Font cache = Font cache
Frames per buffer = Images par mémoire tampon
GPU Flags = GPU Flags
GPU Information = Informations GPU
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Έκδοση Driver
EGL Extensions = Επεκτάσεις EGL
Font cache = Font cache
Frames per buffer = Καρέ ανά buffer
GPU Flags = GPU Flags
GPU Information = Πληροφορίες GPU
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Verzija drivera
EGL Extensions = EGL nastavci
Font cache = Font cache
Frames per buffer = Frame-ova po ublaživanju
GPU Flags = GPU Flags
GPU Information = Informacije o GPU
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver hibák
Driver Version = Driver verzió
EGL Extensions = EGL kiterjesztések
Font cache = Font cache
Frames per buffer = Pufferenkénti képkockák
GPU Flags = GPU állapotjelzők
GPU Information = GPU információ
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Versi driver
EGL Extensions = Ekstensi EGL
Font cache = Font cache
Frames per buffer = Bingkai penyangga
GPU Flags = GPU Flags
GPU Information = Informasi GPU
+1
View File
@@ -1253,6 +1253,7 @@ DPI = DPI
Driver bugs = Bug dei driver
Driver Version = Versione dei Driver
EGL Extensions = Estensioni EGL
Font cache = Font cache
Frames per buffer = Frame per buffer
GPU Flags = Flag GPU
GPU Information = Informazioni GPU
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = ドライバーバグ
Driver Version = ドライバのバージョン
EGL Extensions = EGL拡張
Font cache = Font cache
Frames per buffer = バッファあたりのフレーム数
GPU Flags = GPU Flags
GPU Information = GPU情報
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1243,6 +1243,7 @@ DPI = DPI
Driver bugs = 드라이버 버그
Driver Version = 드라이버 버전
EGL Extensions = EGL 확장
Font cache = Font cache
Frames per buffer = 버퍼당 프레임
GPU Flags = GPU 플래그
GPU Information = GPU 정보
+1
View File
@@ -1257,6 +1257,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU زانیاری
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driverversie
EGL Extensions = EGL-extensies
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU-informatie
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1257,6 +1257,7 @@ DPI = DPI
Driver bugs = Błędy sterownika
Driver Version = Wersja sterownika
EGL Extensions = Rozszerzenia EGL
Font cache = Font cache
Frames per buffer = Klatek na bufor
GPU Flags = Flagi GPU
GPU Information = Informacje o GPU
+1
View File
@@ -1267,6 +1267,7 @@ DPI = DPI
Driver bugs = Bugs do driver
Driver Version = Versão do driver
EGL Extensions = Extensões do EGL
Font cache = Font cache
Frames per buffer = Frames por buffer
GPU Flags = Bandeira da GPU
GPU Information = Informações da GPU
+1
View File
@@ -1269,6 +1269,7 @@ DPI = DPI
Driver bugs = Bugs do Driver
Driver Version = Versão do driver
EGL Extensions = Extensões do EGL
Font cache = Font cache
Frames per buffer = Frames por buffer
GPU Flags = Flags da GPU
GPU Information = Informações da GPU
+1
View File
@@ -1253,6 +1253,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU information
+1
View File
@@ -1252,6 +1252,7 @@ DPI = точек на дюйм
Driver bugs = Ошибки драйвера
Driver Version = Версия драйвера
EGL Extensions = Расширения EGL
Font cache = Font cache
Frames per buffer = Кадров на буфер
GPU Flags = Флаги ГП
GPU Information = Информация о ГП
+1
View File
@@ -1253,6 +1253,7 @@ DPI = DPI
Driver bugs = Drivrutinsbuggar
Driver Version = Drivrutinsversion
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Frames per buffer
GPU Flags = GPU Flags
GPU Information = GPU-information
+1
View File
@@ -1255,6 +1255,7 @@ DPI = Ilang DPI
Driver bugs = Mga bugs sa iyong Driver
Driver Version = Bersyon ng iyong Driver
EGL Extensions = Mga Ekstensyon ni EGL
Font cache = Font cache
Frames per buffer = Ilang Frames kada buffer
GPU Flags = Mga GPU Flag
GPU Information = Impormasyon ng iyong GPU
+1
View File
@@ -1276,6 +1276,7 @@ Driver Version = เวอร์ชั่นของไดรเวอร์
EGL Extensions = ส่วนขยายอีจีแอล
Error = เอ๋อ
Failure = ล้มเหลว
Font cache = Font cache
Frames per buffer = จำนวนเฟรมต่อบัฟเฟอร์
GPU Flags = แฟล็กของหน่วยประมวลผลกราฟิก
GPU Information = ข้อมูลของหน่วยประมวลผลกราฟิก
+1
View File
@@ -1253,6 +1253,7 @@ DPI = DPI
Driver bugs = Sürücü hataları
Driver Version = Sürücü sürümü
EGL Extensions = EGL eklentileri
Font cache = Font cache
Frames per buffer = Tampon başına çerçeveler
GPU Flags = GPU Flags
GPU Information = GPU bilgisi
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Версія драйвера
EGL Extensions = Розширення EGL
Font cache = Font cache
Frames per buffer = Кадрів на буфер
GPU Flags = GPU Flags
GPU Information = Інформація про GPU
+1
View File
@@ -1252,6 +1252,7 @@ DPI = DPI
Driver bugs = Driver bugs
Driver Version = Driver version
EGL Extensions = EGL extensions
Font cache = Font cache
Frames per buffer = Khung cho mỗi bộ đệm
GPU Flags = GPU Flags
GPU Information = Thông tin GPU
+1
View File
@@ -1244,6 +1244,7 @@ Display Information = 显示信息
DPI = 像素密度
Driver Version = 驱动版本
EGL Extensions = EGL扩展
Font cache = Font cache
Frames per buffer = 每缓冲区帧数
GPU Flags = GPU 特性
GPU Information = GPU 信息
+1
View File
@@ -1243,6 +1243,7 @@ DPI = DPI
Driver bugs = 驅動程式錯誤
Driver Version = 驅動程式版本
EGL Extensions = EGL 擴充
Font cache = Font cache
Frames per buffer = 每緩衝區影格數
GPU Flags = GPU 旗標
GPU Information = GPU 資訊