Feat: Add post-tone-map mesh diagnostics with RGBA overlays

Color antialiased half-edges by ray outcome with configurable Catppuccin colors and default opacity 0.5.

Rasterize premultiplied RGBA8 overlays on the producer and composite in place after writing the clean image. Keep single-frame, movie, and replay output consistent.

Add overlay, CLI, and queue ownership regressions and document the final output architecture.
This commit is contained in:
wyj committed 2026-10-10 01:46:32 -04:00
1 parent 4053d5d0c8
commit 80f9dcb3a3
17 files changed
+1873 -182

No files matched your search

+22 -4
View File
@@ -1,5 +1,6 @@
#include "frame.h"
#include "lens_map.h"
#include "mesh_overlay.h"
#include "optics.h"
#include <math.h>
@@ -1086,10 +1087,27 @@ int main(void) {
if (!fast_ok)
goto done;
}
frame_draw_mesh(&mesh, hdr, width, height, 0.5, 0.5);
if (hdr[3 * (10 * width + 20)] != 0.25) {
fputs("mesh diagnostic overlay regression failed\n", stderr);
goto done;
/* Diagnostic overlay draws the finalized mesh as an sRGB8 edge map: the
* vertical coarse edge crossing (20, 10) must be painted, while an interior
* pixel away from every edge must stay at the background value. */
{
MeshOverlayLines overlay_lines = {0};
const MeshOverlaySettings overlay_settings = mesh_overlay_default_settings();
unsigned char *overlay_rgb = calloc((size_t)width * height * 3, 1);
const int overlay_ok =
overlay_rgb != NULL &&
mesh_overlay_prepare(&mesh, &overlay_lines) == 0 &&
overlay_lines.count != 0 &&
mesh_overlay_draw_rgb8(&overlay_lines, overlay_rgb, width, height,
&overlay_settings) == 0 &&
overlay_rgb[3 * (10 * width + 20)] != 0 &&
overlay_rgb[3 * (12 * width + 5)] == 0;
mesh_overlay_lines_destroy(&overlay_lines);
free(overlay_rgb);
if (!overlay_ok) {
fputs("mesh diagnostic overlay regression failed\n", stderr);
goto done;
}
}
/* A fixed absolute edge tolerance used to make tiny source triangles claim
* sources far outside their field. */