Makefile: add Debug build diagnostics

This commit is contained in:
wyj committed 2026-08-29 19:23:50 -04:00
1 parent 9e22d59213
commit 6f8ec50c64
3 files changed
+65 -26

No files matched your search

+20 -3
View File
@@ -6,6 +6,7 @@
#include <math.h>
#include <omp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -780,6 +781,7 @@ static int owns_source_boundary(const LensTriangle *triangle,
typedef struct {
const LensVertex *vertex[3];
const LensTriangle *triangle;
size_t triangle_index;
double *hdr;
int width, height;
double exposure, magnification;
@@ -820,10 +822,24 @@ static int splat_catalog_tile(const Star *stars, size_t count,
weights[1] * context->vertex[1]->log_frequency_ratio +
weights[2] * context->vertex[2]->log_frequency_ratio;
const LinearRgb color = blackbody_to_linear_rgb(star->temperature_K * exp(log_g));
context->direct_fallbacks += splat_moffat_cached(
const double flux = context->exposure * star->amplitude * context->magnification;
const int direct_fallback = splat_moffat_cached(
context->hdr, context->width, context->height, image_x, image_y, color,
context->exposure * star->amplitude * context->magnification,
flux,
context->psf, context->psf_cache);
context->direct_fallbacks += direct_fallback;
#ifdef GR_DEBUG
if (direct_fallback)
/* This is deliberately emitted by the active splat worker: a direct
* fallback can be the long-running work a Debug render is waiting on.
* Do not add a critical section here; interleaved Debug lines are more
* useful than stalling the other workers. */
fprintf(stderr,
"Debug: %.3f s splat worker %d triangle %zu star %zu uses direct "
"PSF fallback (image %.3f, %.3f; flux %.6g).\n",
omp_get_wtime(), omp_get_thread_num(), context->triangle_index,
s, image_x, image_y, flux);
#endif
++context->images;
}
return 0;
@@ -853,7 +869,8 @@ static size_t splat_catalog_triangles(const FrameLensMesh *mesh,
{vertex[1]->n_infinity[0], vertex[1]->n_infinity[1], vertex[1]->n_infinity[2]},
{vertex[2]->n_infinity[0], vertex[2]->n_infinity[1], vertex[2]->n_infinity[2]}};
TriangleSplatContext context = {.vertex = {vertex[0], vertex[1], vertex[2]},
.triangle = &mesh->triangles[t], .hdr = hdr,
.triangle = &mesh->triangles[t],
.triangle_index = t, .hdr = hdr,
.width = width, .height = height,
.exposure = exposure, .magnification = magnification,
.psf = psf, .psf_cache = psf_cache};
+10
View File
@@ -137,6 +137,12 @@ static int parse_args(int argc, char **argv, Settings *s,
*s = (Settings){.width = 1280,
.height = 720,
.coarse_cell_pixels = 16,
#ifdef GR_DEBUG
/* Debug builds make existing low-frequency render progress
* visible by default. Their worker heartbeats are local
* 8/16/32... milestones, not shared progress counters. */
.verbose = 1,
#endif
.horizontal_fov_deg = 30.0,
.look_ra_deg = 270.0,
.look_dec_deg = 0.0,
@@ -651,6 +657,10 @@ int main(int argc, char **argv) {
argv[0]);
return 2;
}
#ifdef GR_DEBUG
fputs("Debug build: low-frequency render progress is enabled; direct PSF "
"fallbacks log immediately from their splat worker.\n", stderr);
#endif
if (write_path != NULL)
return catalog_write_octant_grid(write_path) == 0 ? 0
: (perror(write_path), 1);