Skip to content

feat(gpu): add bounded high-precision export rendering - #1395

Open
VailElla wants to merge 4 commits into
CyberTimon:mainfrom
VailElla:codex/jxl-pr-01-high-precision-export
Open

feat(gpu): add bounded high-precision export rendering#1395
VailElla wants to merge 4 commits into
CyberTimon:mainfrom
VailElla:codex/jxl-pr-01-high-precision-export

Conversation

@VailElla

@VailElla VailElla commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Description

Add a bounded, crate-private high-precision GPU render path for the follow-up JPEG XL export work. The normal preview and export path keeps its existing 8-bit contract, while the new path renders tile output as rgba16float and returns RGB/RGBA 32-bit float image data without an 8-bit intermediate.

This draft also bounds reusable compute textures to one overlapped processing tile instead of allocating six full-image textures for large inputs.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

  • Added a high-precision compute pipeline variant with an rgba16float storage target while deferring integer dithering to the follow-up encoder.
  • Generalized tiled GPU readback for both 4-byte RGBA8 and 8-byte RGBA16F pixels.
  • Converted RGBA16F readback into RGB32F or RGBA32F while preserving the source alpha contract.
  • Kept the high-precision entry crate-private until the follow-up JXL backend wires it into export.
  • Bounded reusable ping-pong, blur, and tile-output textures to a 2304 × 2304 overlapped tile; full-size display textures remain unchanged.
  • Avoided a full RGBA32F intermediate when the input is already RGB32F or RGBA32F.
  • Added three unit tests for high-precision shader behavior, RGB32F upload conversion, and the bounded tile extent.

Screenshots/Videos

N/A — this is a backend-only foundation and does not change the current UI or exported output by itself.

Testing

  • I have tested these changes locally and confirmed that they work as expected without issues

Test Configuration:

  • OS: macOS 26.5.2
  • Hardware: Apple M4 Pro, 14 logical cores, 48 GiB RAM

Automated:

  • cargo +1.96.1 fmt --manifest-path src-tauri/Cargo.toml --check — passed
  • cargo +1.96.1 check --manifest-path src-tauri/Cargo.toml — passed; warning set matches current main with no new warnings
  • cargo +1.96.1 test --manifest-path src-tauri/Cargo.toml -- --nocapture — 3 passed, 0 failed
  • cargo +1.96.1 test --manifest-path src-tauri/Cargo.toml gpu_processing:: -- --nocapture — 3 passed, 0 failed after final cleanup
  • cargo +1.96.1 clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features — passed; only current macOS baseline warnings remain
  • npm ci — completed with 0 vulnerabilities
  • npm run build — passed
  • git diff --check — passed

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

  • Based directly on main at 41d92c8f and kept to two focused commits touching only src-tauri/src/gpu_processing.rs.
  • This is an internal prerequisite for the smaller JXL export series related to FEATURE: Export JPEG XL & WepB with EXIF metadata #1322 and BUG: Exporting JPEG XL causes massive memory consumption #1342; it does not close either issue by itself.
  • The crate-private high-precision entry is intentionally not wired into export in this draft. JXL encoding, metadata, export controls, and end-to-end real-image validation remain in follow-up PRs.
  • The existing 8-bit preview/display path remains the default and retains its current output format.

AI Disclaimer:

Please state the involvement of AI in this PR:

  • This PR is entirely AI-generated
  • This PR is AI-generated but guided by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

@VailElla
VailElla marked this pull request as ready for review July 18, 2026 14:11
@VailElla
VailElla requested a review from CyberTimon as a code owner July 18, 2026 14:11
@VailElla
VailElla force-pushed the codex/jxl-pr-01-high-precision-export branch from 8970db0 to 1db32c9 Compare July 20, 2026 04:11
@VailElla
VailElla force-pushed the codex/jxl-pr-01-high-precision-export branch from 1db32c9 to 1de7b16 Compare July 25, 2026 11:53
@VailElla

Copy link
Copy Markdown
Contributor Author

Refresh validation (2026-07-25): rebased onto current upstream main and force-with-lease updated. Added an adapter capability gate for the RGBA16Float high-precision path.

Compatibility behavior:

  • adapters whose RGBA16Float format supports texture binding, storage binding, and copy-source create the high-precision pipeline;
  • other adapters keep the existing RGBA8 preview/export pipeline, while a request for the internal high-precision path returns a specific unsupported-GPU error instead of preventing normal GPU initialization.

Memory regression coverage now models a 100 MP (11,600 x 8,600) input: five reusable RGBA16F intermediates remain capped at 2,304 x 2,304 (<220 MiB combined), versus >3 GiB if those intermediates were full-image allocations. Full-size RGBA8 display textures are intentionally unchanged.

cargo test gpu_processing:: --lib passed: 4 passed, 0 failed.

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.

1 participant