inflate in a caller-owned context, and a PNG decoded in three steps (parked: the boot's PNGs move to build time)

runtime/native/inflate.ludic: ZInflate holds the bit reader, the RFC tables and every table and scratch
list a block builds, made once (z_inflate_new) and rebuilt in place - an inflate allocates nothing, and a
thread that inflates holds a context of its own. RtInflateState keeps one, so z_inflate / z_uncompress /
z_gunzip and their callers are unchanged; z_*_in take the context.
render3d png_jobs.ludic: png_parse (reads, walks the chunks, makes every buffer), png_work (inflates,
unfilters, packs; makes nothing, touches no state), png_take (frees, sets tex_*); tex_prefetch runs
png_work over a list on every core through Job.parallel_for and png_decode takes a waiting result, so
what uploads and in what order is unchanged. Nothing calls tex_prefetch yet. Compiles with the game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 17:17:20 +03:00
parent a9b7d216c8
commit 7d8882d28d
5 changed files with 337 additions and 196 deletions

View file

@ -880,6 +880,8 @@ export state Render3dState {
tex_channels: int = 0
tex_depth: int = 0 # bits per sample (8 or 16)
tex_file_len: int = 0
tex_pf: []PngJob = null # what tex_prefetch decoded, for png_decode to take (png_jobs.ludic)
tex_zs: []ZInflate = null # an inflate context per concurrent decode, made on this thread
tex_anisotropy: fixed = 16.0
tex_size_ws: []int = new []int
tex_size_hs: []int = new []int