macOS native parity + GPU tone curve shader fix#8
Merged
Conversation
## macOS parity
Convert the macOS raw processor to the wrapper pattern (same as Linux),
which was the last standalone drift point after the Linux cleanup branch.
Before: `macos/raw_processor/raw_processor.c` was a 250-line standalone
copy ~60 lines out of sync with canonical. Most importantly it lacked
`raw_processor_set_highlight_mode`, so any macOS build after the Linux
refactor would crash at image load when the Dart FFI looked up the
missing symbol.
- Add `macos/raw_processor/raw_processor_wrapper.c` (one-liner that
`#include`s `../../lib/ffi/raw/raw_processor_common.c`).
- Delete `macos/raw_processor/raw_processor.{c,h}`.
- Update `macos/build.sh` and `macos/Makefile` to compile the wrapper
and pass `-I../lib/ffi/raw` for the canonical header.
- Update Xcode project input-paths so the "Build Native Libraries" phase
re-runs on wrapper/canonical changes.
- Update `CLAUDE.md` — macOS no longer needs special mirroring.
## GPU tone curve fixes
Audit of ROADMAP's "GPU tone curve pending" claim: the shader code is
all there, but there were two real bugs that a CPU↔GPU comparison test
would have caught:
1. **Operation order was reversed** from CPU. The shader applied
master RGB curve first then per-channel curves; CPU does per-channel
first. Non-commutative for non-identity curves — outputs differed
by several LSBs.
2. **Float→int truncation** when indexing the byte LUT: sRGB 0.50196
(byte 128) got truncated to index 127 instead of rounded to 128. Off
by one at every quantisation boundary.
Both fixed in `linux/vulkan_processor/shaders/image_process.comp`.
Added a CPU↔GPU comparison test with an S-curve + distinct per-channel
curves; CPU and GPU now agree to within 1 LSB (measured: maxDiff 0,
avgDiff 0.00 on the full test fixture).
## Tests
31 native tests pass (was 30), 66 unit tests pass, `dart analyze` clean.
Co-Authored-By: Claude Opus 4.6 (1M context) <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.
macOS parity
Convert the macOS raw processor to the wrapper pattern (same as Linux), which was the last standalone drift point after the Linux cleanup branch. Before:
macos/raw_processor/raw_processor.cwas a 250-line standalone copy ~60 lines out of sync with canonical. Most importantly it lackedraw_processor_set_highlight_mode, so any macOS build after the Linux refactor would crash at image load when the Dart FFI looked up the missing symbol.macos/raw_processor/raw_processor_wrapper.c(one-liner that#includes../../lib/ffi/raw/raw_processor_common.c).macos/raw_processor/raw_processor.{c,h}.macos/build.shandmacos/Makefileto compile the wrapper and pass-I../lib/ffi/rawfor the canonical header.CLAUDE.md— macOS no longer needs special mirroring.GPU tone curve fixes
Audit of ROADMAP's "GPU tone curve pending" claim: the shader code is all there, but there were two real bugs that a CPU↔GPU comparison test would have caught:
Both fixed in
linux/vulkan_processor/shaders/image_process.comp. Added a CPU↔GPU comparison test with an S-curve + distinct per-channel curves; CPU and GPU now agree to within 1 LSB (measured: maxDiff 0, avgDiff 0.00 on the full test fixture).Tests
31 native tests pass (was 30), 66 unit tests pass,
dart analyzeclean.