Repository navigation
Decoder-free raster import surface + official ARMv6k portable guard - #1
Open
mattsp1290 wants to merge 1 commit into
Open
mattsp1290 wants to merge 1 commit into
mattsp1290 wants to merge 1 commit into
Conversation
`import pixie` unconditionally compiles the file-format decoders (PNG, JPEG, BMP, GIF, QOI, PPM, SVG) and zippy, which is dead weight on size-constrained, newlib-hosted targets like the Nintendo 3DS (ARMv6k) that only do CPU pixel math and never call readImage/writeFile. This adds a narrower, decoder-free entry point without changing `import pixie` for existing users. - images.nim: re-export chroma so `import pixie/images` is a self-contained, decoder-free raster surface (rgbx/ColorRGBX available without a separate `import chroma`). Additive and idempotent — `import pixie` already re-exports chroma, so its API is unchanged. - raster.nim: new convenience umbrella re-exporting images/paints/paths (plus chroma/vmath/bumpy). Decoder-free and font-free (omits contexts/fonts, which pull the font parsers). - simd.nim: explicit `else` branch documenting that non-amd64/arm64 targets (32-bit ARM/ARMv6k devkitARM, PSP/Vita newlib) fall through to portable C on purpose, and warning future contributors not to add a bare `elif defined(arm):` that would silently capture ARMv6k. - tests/test_portable_raster.nim: standalone regression test for the scalar path, run with -d:pixieNoSimd (kept out of tests/tests.nim, which is SIMD-on). - CI + README: run the portable test under -d:pixieNoSimd (C and C++); document the decoder-free imports and portable-target support. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
✅ On-device confirmed. Ran the minimal All raster ops verified on-device: newImage / dimensions, indexing |
mattsp1290
added a commit
to birbparty/shady
that referenced
this pull request
Jun 9, 2026
Switch the CPU-sim runtime from 'import pixie' to 'import pixie/images' + an explicit 'import chroma'. pixie/images is the decoder-free raster/Image surface (pixie PR birbparty/pixie#1) — it omits the PNG/JPEG/BMP/GIF/QOI/SVG decoders and zippy. cpusim only uses Image/indexing/getRgbaSmooth/rgbx/ColorRGBX/.data/.width/ .height, all covered by pixie/images + chroma. Result: 'import shady' is now decoder-free on desktop too (0 png/jpeg C files, verified against local src), not just under -d:shadyNoPixie. The chroma import is explicit so this works on the installed pixie 6.1.0 today (where pixie/images does not yet re-export chroma); once #1 lands, 'import pixie/images' alone would suffice. export narrowed pixie -> images, chroma (shady's own examples/tests and boxy import pixie directly, not via shady's re-export). -d:shadyNoPixie still drops pixie entirely. Full suite green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a decoder-free way to import pixie's raster/
ImageAPI, plus an explicit ARMv6k portable-C guard. All changes are additive —import pixieand its full API are unchanged.src/pixie/images.nim— re-exportchroma, soimport pixie/imagesis a self-contained, decoder-free raster surface (rgbx/ColorRGBXavailable without a separateimport chroma).pixiealready re-exports chroma, so this is idempotent forimport pixie.src/pixie/raster.nim(new) — convenience umbrella re-exportingimages/paints/paths(+ chroma/vmath/bumpy). Decoder-free and font-free (omitscontexts/fonts, which pull the font parsers).src/pixie/simd.nim— explicitelsebranch documenting that non-amd64/arm64 targets (32-bit ARM/ARMv6k devkitARM e.g. 3DS, PSP/Vita newlib) fall through to portable C on purpose, and warning future contributors not to add a bareelif defined(arm):that would silently capture ARMv6k. This documents existing behavior — the compiler emitted the same code before; no behavior change.tests/test_portable_raster.nim(new) — standalone regression test for the scalar path, run with-d:pixieNoSimd. Kept out oftests/tests.nim(which builds SIMD-on, so a per-file flag can't apply there)..github/workflows/build.yml— runs the portable test under-d:pixieNoSimd(C and C++).README.md— documents the decoder-free imports and portable-target support.Why
import pixieunconditionally compiles the file-format decoders (PNG, JPEG, BMP, GIF, QOI, PPM, SVG) and zippy. On size-constrained, newlib-hosted targets like the Nintendo 3DS (ARMv6k) that only do CPU pixel math and never callreadImage/writeFile, that's dead weight. Two consumers (shady's CPU shader-sim runtime and boxy/clckr) want the raster/Imagesurface without the decoders. This gives a narrow entry point without touchingimport pixiefor existing users.Verification
Host (arm64 macOS, Nim 2.2.10):
import pixie/imagesandimport pixie/rasternimcache is decoder-free (no png/jpeg/bmp/gif/qoi/svg/zippy/imagebase64); raster is also font-free.nim r tests/tests.nim— full existing suite green (import pixieunchanged).nim r -d:pixieNoSimd tests/test_portable_raster.nim— portable path passes (also undernim cpp, debug + release).nim cpp -r tests/tests.nimfails on this host with a pre-existing clang++ strictness issue in zippy (adler32_simd) + NEON SIMD (void*→typed pointer) — reproduced identically on cleanmasterwith these changes stashed, so it is not caused by this PR (Linux/gcc CI is unaffected).On-device (ARMv6k / Nintendo 3DS, devkitARM):
pixie/rastercross-compiles with--define:ds3 --cpu:arm(the natural ARMv6k portable fall-through — not-d:pixieNoSimd, so it exercises this PR's newelsebranch for real) and links into a.3dsx.-d:ds3nimcache is decoder-free — the request's headline acceptance criterion — containing onlychroma/blendsandpixie/{blends,common,images,internal}. No png/jpeg/zippy/fileformats.rgbx/ColorRGBX,.data,getRgbaSmooth,fill,drawto the top screen; the claim demonstrated is that the decoder-free raster surface executes correctly on ARMv6k (the guard itself is a no-op codification).Companion chroma change
shady also depends on chroma for
ColorRGBX+rgbx(uint8×4), both already in the zero-dependencychroma/colortypes. That is covered by birbparty/chroma#1 (comment/docs/CI-guard only — no code change), so no chroma pin is required for this PR. SHA07a39f8c1cb9317ef70030894e5e4a59787fff7dis available to pin if ever wanted.Scope notes
requires "zippy"stays inpixie.nimble— fullimport pixiestill needs it; the win is nimcache contents on a narrow import, not the dependency list.-d:pixieNoFileFormatscompile flag (to keep the literalimport pixiespelling decoder-free) was considered but deferred —import pixie/images/pixie/rasteralready satisfy the consumers, and the flag is the more invasive change.🤖 Generated with Claude Code