From 1ee5463418b4a70ef4f6b737f57d8a5683c7014e Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 Jul 2026 09:53:24 +0000 Subject: [PATCH 12/71] debug(macos): log uploadTile locations and source ink (rev 6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The atlas is 1024x2048 with only 1434 non-zero pixels — far fewer than expected if every glyph were uploaded, so blank glyphs likely have no atlas pixels where their renderTile samples. Log each uploadTile's destination location, size, and source non-zero byte count, to compare upload locations against the norm->pixel locations the tiles sample and confirm whether uploads land where tiles read. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/SoftwareRenderTarget.cpp | 18 ++++++++++++++++++ src/contour_macos/render_probe.cpp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/contour_macos/SoftwareRenderTarget.cpp b/src/contour_macos/SoftwareRenderTarget.cpp index 43f3a0cd..0705d550 100644 --- a/src/contour_macos/SoftwareRenderTarget.cpp +++ b/src/contour_macos/SoftwareRenderTarget.cpp @@ -127,6 +127,24 @@ void SoftwareRenderTarget::uploadTile(UploadTile tile) auto const dstX = tile.location.x.value; auto const dstY = tile.location.y.value; + if (_debugTiles) + { + // Count source non-zero bytes so we can tell an empty upload from a real glyph. + size_t srcNonZero = 0; + for (auto b: tile.bitmap) + if (b) + ++srcNonZero; + std::fprintf(stderr, + "uploadTile loc=(%u,%u) bmp=%ux%u fmt=%d srcBytes=%zu srcNonZero=%zu\n", + (unsigned) dstX, + (unsigned) dstY, + tw, + th, + static_cast(tile.bitmapFormat), + tile.bitmap.size(), + srcNonZero); + } + // Source rows are tightly packed. Convert to RGBA8 into the atlas at (dstX, dstY), // matching the Qt backend: Red -> (c,0,0,255); RGB -> (r,g,b,255); RGBA -> verbatim. auto const channels = static_cast(tile.bitmapFormat); diff --git a/src/contour_macos/render_probe.cpp b/src/contour_macos/render_probe.cpp index e8ab4cdf..14c44d1d 100644 --- a/src/contour_macos/render_probe.cpp +++ b/src/contour_macos/render_probe.cpp @@ -59,7 +59,7 @@ void writePpm(std::string const& path, contour_macos::PixelBuffer const& buf) // produced it. __DATE__/__TIME__ update whenever THIS translation unit is recompiled, so the // printed line is a reliable "is the running binary built from the current source?" signal // without needing a full rebuild. -#define RENDER_PROBE_REVISION 5 +#define RENDER_PROBE_REVISION 6 int main(int argc, char** argv) {