Files
kryon/include/kry_backend_rec.h
T
waozi 6a0591086a krb: kry_sw software rasterizer engine + headless conformance harness
Plan 11 phases 1-2 core:

- src/backend/kry_sw.c: portable software rasterizer behind the
  KryBackend vtable. RGBA8 target with RGB565 conversion, clip stack,
  input injection, theme slots, public-domain font8x8 text (glyph-atlas
  pipeline replaces it later without interface changes).
- src/backend/kry_backend_rec.c: recording backend that logs the
  cartridge draw-call stream while delegating to an inner engine.
- cmd/krb-run: headless cartridge runner; renders one frame to PNG
  (dependency-free writer, stored deflate) and/or dumps the call stream.
- tests: kry_sw unit test plus tests/krb_engine_test.sh golden
  conformance over examples/02_buttons.kry (sha256 goldens, refresh
  with KRB_ENGINE_REGOLDEN=1), wired into make test / make tools.
2026-08-16 20:05:20 -03:00

34 lines
1014 B
C

#ifndef KRY_BACKEND_REC_H
#define KRY_BACKEND_REC_H
/*
* Recording backend: logs the KryBackend call stream a cartridge makes
* (clear/rect/text/clip/texture) to a FILE while delegating every call to
* an inner backend. Recording over kry_sw gives one pass that yields both
* pixels and a deterministic call log — the two things engine conformance
* is compared on (plan 11, phase 1).
*
* Query calls (mouse/width/time/theme) are answered by the inner backend
* and not logged. Input injection goes through the inner backend.
*/
#include "kry_backend.h"
#include <stdio.h>
typedef struct KryBackendRec {
FILE *log;
const KryBackend *inner;
long calls;
KryBackend backend;
} KryBackendRec;
/* inner == NULL uses the null backend. log == NULL records nothing but
* still counts calls. */
const KryBackend *KryBackendRecBackend(KryBackendRec *rec, FILE *log,
const KryBackend *inner);
long KryBackendRecCalls(const KryBackendRec *rec);
#endif