wip(0.S3): the packages migrated by ludic migrate state packages - every package test green

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 14:02:21 +03:00
parent 1e8b5b0523
commit 07505e7ef2
294 changed files with 14996 additions and 14675 deletions

View file

@ -4,31 +4,31 @@
# at the boundary, so nothing raw crosses it.
# an accessor's float components (gltf_count elements of gltf_comps floats), as floats
function gltf_accessor_floats(idx: int) -> floats {
let p = gltf_accessor(idx)
let n = gltf_count * gltf_comps
function gltf_accessor_floats(render3d_st: mut Render3dState, idx: int) -> floats {
let p = gltf_accessor(render3d_st, idx)
let n = render3d_st.gltf_count * render3d_st.gltf_comps
let out = floats(n)
for i in 0 .. n { out[i] = float_from_bits(mem_get_f32_bits(p, i)) }
free(p)
return out
}
# how many elements an accessor holds, without reading them
function gltf_accessor_count(idx: int) -> int {
let acc = value_at(value_get(gltf_doc, "accessors"), idx)
function gltf_accessor_count(render3d_st: Render3dState, idx: int) -> int {
let acc = value_at(value_get(render3d_st.gltf_doc, "accessors"), idx)
return jint(acc, "count", 0)
}
# the presented frame as RGB8, bottom row first, into `out` (at least w * h * 3 bytes)
function gpu_read_screen_bytes(w: int, h: int, out: []byte) -> bool {
function gpu_read_screen_bytes(render3d_st: mut Render3dState, w: int, h: int, out: []byte) -> bool {
if out == null or len(out) < w * h * 3 { return false }
gpu_read_screen(w, h, data_of(out))
gpu_read_screen(render3d_st, w, h, data_of(out))
return true
}
# a PNG's samples (tex_w x tex_h x tex_channels, 8 or 16 bits): into `reuse` when it is large
# enough - a map swap decodes the same size again - else into a new buffer. null if unreadable.
function png_decode_bytes(path: string, reuse: []byte) -> []byte {
let p = png_decode(path)
function png_decode_bytes(render3d_st: mut Render3dState, path: string, reuse: []byte) -> []byte {
let p = png_decode(render3d_st, path)
if p == null { return null }
let n = tex_w * tex_h * tex_channels * (tex_depth / 8)
let n = render3d_st.tex_w * render3d_st.tex_h * render3d_st.tex_channels * (render3d_st.tex_depth / 8)
var out = reuse
if out == null or len(out) < n { out = buffer(n) }
for i in 0 .. n { out[i] = p[i] }
@ -36,6 +36,6 @@ function png_decode_bytes(path: string, reuse: []byte) -> []byte {
return out
}
# upload samples laid out as the last decode left them (tex_w, tex_h, tex_channels, tex_depth)
function tex_upload_bytes(px: []byte, srgb: bool, mips: bool) -> int {
return tex_upload(data_of(px), srgb, mips)
function tex_upload_bytes(render3d_st: mut Render3dState, px: []byte, srgb: bool, mips: bool) -> int {
return tex_upload(render3d_st, data_of(px), srgb, mips)
}