Repository navigation
GPU: match the CPU's rounding in box blur rows and affine warp sampling - #1494
Draft
MatejKozlovsky wants to merge 1 commit into
Draft
MatejKozlovsky wants to merge 1 commit into
MatejKozlovsky wants to merge 1 commit into
Conversation
MatejKozlovsky
marked this pull request as draft
October 18, 2026 12:08
This branch has not been deployed
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.
Depends on #1415 to show. Without #1415, 4K effect frames run out of GPU memory and fall back to the CPU, so the GPU kernels this PR changes never run in those tests. The diff itself doesn't depend on #1415.
Why
GPU and CPU renders of the same comp differ by one 8-bit level in a few pixels around blurred edges. Two sources of this are in the GPU kernels:
What
GPU output changes on purpose in this PR, to match the CPU's. CPU output does not change (verified pixel for pixel).
f64 - f32) as a second set of coefficients. For affine warps with nearest or bilinear sampling,warp_blendrebuilds the f64 mapping as double-f32 (hi + lo) arithmetic, so a pixel maps to the CPU's source position and weights. A host-set factor of 1.0 keeps the GPU compiler from simplifying away the rounding-error terms. Perspective warps and other sampling modes keep the f32 path.Results
GPU = RTX 3090, CPU = Ryzen 7 5800X. 4K, frame 0. Both builds are
main+ #1415, without and with this commit. The table counts pixels that differ between CPU and GPU renders.Testing
cargo fmt -p effectcraft-gpu -- --check: clean.cargo clippy -p effectcraft-gpu --all-targets -- -D warnings: clean.cargo test -p effectcraft-gpu: 212 passed, 1 ignored.