Skip to content

fix: big-endian bundle contract and Cairo input mutation - #330

Merged
jaromil merged 1 commit into
masterfrom
fix/big-endian-contracts
Nov 12, 2026
Merged

jaromil merged 1 commit into
masterfrom
fix/big-endian-contracts

Conversation

@jaromil

@jaromil jaromil commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

RGBA8888 defines channel order in memory. bundle-api-contract encoded little-endian integer pixels, while invert0r used a mask that inverted alpha and left red unchanged on big-endian hosts. Check explicit RGBA bytes across the full frame and invert only the three color bytes.

cairogradient, cairoaffineblend, and cairoblend also premultiplied caller-owned input buffers. Convert into scratch buffers and pack/unpack native-endian Cairo pixels, preserving the existing red/blue convention used by the Cairo color helpers. Keep the tests enabled and add regressions for opaque, translucent, and transparent inputs, repeated rendering, and gradient colors.

Add a Debian s390x/QEMU CI job, a cross-compilation toolchain, and setup instructions in BUILD.md. Referencing the CTest runner as an executable target lets CMake apply the emulator to ordinary plugin tests.

Fixes #309.
Fixes #329.

Validation:

  • Original bundle-api-contract, cross-compiled for s390x and run with qemu-s390x -L /usr/s390x-linux-gnu, fails with exit 6. The byte-oriented regression also fails against the original invert0r; the fixed implementation passes.
  • s390x/QEMU CI: 8/8 passed, including the bundle contract, invert0r, all three affected Cairo plugins, and all three new input contracts.
  • Full native Clang CI: 202/202 passed. All executed PR checks are green, including Windows, i386, native bundles, WASI, Emscripten, lint, and website build.
  • Native affected tests: 8/8 passed with ctest --test-dir build-be-native --output-on-failure -R '^(bundle-api-contract|invert0r|cairo(gradient|affineblend|blend)(-input-contract)?)$'.
  • AddressSanitizer + UndefinedBehaviorSanitizer with leak detection: 4/4 focused contracts passed.
  • Local broader native suite: 195/197 passed with ctest --test-dir build-be-native --output-on-failure --parallel 4. The two profile tests require unavailable OpenCV development files and fail identically on unchanged origin/master; both pass in the full CI environment.

The Cairo fix uses one temporary frame buffer for cairogradient/cairoblend and two for cairoaffineblend; allocation failure copies the background through.

@jaromil jaromil changed the title Fix big-endian bundle contract and Cairo input mutation fix: big-endian bundle contract and Cairo input mutation Nov 12, 2026
@jaromil
jaromil marked this pull request as ready for review November 12, 2026 09:17
@umlaeute

Copy link
Copy Markdown
Contributor

thanks for the fixes.

since it christmas appears to be early this year can i wish for more? like: split the PR into multiple commits (separating changes to the filters, the test-suite and the CI changes)?

@jaromil
jaromil merged commit 6156f2e into master Nov 12, 2026
12 checks passed
@jaromil
jaromil deleted the fix/big-endian-contracts branch November 12, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bundle-api test fails on big endian test failures on BIGendian

2 participants