Merge pull request 'perf(font): upload only the dirty sub-rect of the glyph atlas (#51)' (#83) from claude/issue-51 into master

This commit is contained in:
catbot 2026-06-16 17:43:23 +02:00
commit 991a39e094
5 changed files with 276 additions and 6 deletions

View file

@ -327,6 +327,33 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
bc.GetInterfacesAndImplementations(ifaces, blasImpls);
cfg.tests.push_back(std::move(blasTest));
// Issue #51: FontAtlas only re-uploads the dirty sub-rect now,
// tracked via FontAtlas::DirtyRect. The accumulation/clamp math is
// pure CPU, so this test drives it directly — no GPU device needed
// at runtime (the real copy params are covered by HelloUI rendering
// text on both backends).
Test atlasTest;
Configuration& ac = atlasTest.config;
ac.path = cfg.path;
ac.name = "FontAtlasDirtyRect";
ac.outputName = "FontAtlasDirtyRect";
ac.type = ConfigurationType::Executable;
ac.target = cfg.target;
ac.march = cfg.march;
ac.mtune = cfg.mtune;
ac.debug = cfg.debug;
ac.sysroot = cfg.sysroot;
ac.dependencies = cfg.dependencies;
ac.externalDependencies = cfg.externalDependencies;
ac.compileFlags = cfg.compileFlags;
ac.linkFlags = cfg.linkFlags;
ac.defines = cfg.defines;
ac.cFiles = cfg.cFiles;
std::vector<fs::path> atlasImpls(impls.begin(), impls.end());
atlasImpls.emplace_back("tests/FontAtlasDirtyRect/main");
ac.GetInterfacesAndImplementations(ifaces, atlasImpls);
cfg.tests.push_back(std::move(atlasTest));
// Issue #52: shaped-run cache for UIRenderer::ShapeText. Shapes a
// string against a real CPU-side FontAtlas and asserts that a cache
// hit is byte-equivalent to the uncached path, that hits don't touch