Repository navigation
feat(gpui): rotate the camera for portrait-mounted cameras - #2778
YoavLevavi wants to merge 5 commits into
Conversation
|
@YoavLevavi is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for the GPUI port @YoavLevavi, this is nicely contained and rotation 0 stays an identity path in the shader. It now conflicts with main in |
Camera rotation in quarter turns (project config + renderer) with a Rotation control in the GPUI editor's camera tab. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bee44c5 to
1a21d1c
Compare
|
Thanks @richiemcilroy. I rebased onto main: |
|
@greptileai review |
| fn rotated_frame_uv(uv: vec2<f32>) -> vec2<f32> { | ||
| let quarter_turns = u32(round(uniforms.frame_rotation / 90.0)) % 4u; | ||
| if quarter_turns == 1u { | ||
| return vec2<f32>(uv.y, 1.0 - uv.x); |
There was a problem hiding this comment.
Camera rotation lacks rendering tests
The added test checks number normalization and legacy defaults, while camera_frame_geometry.rs leaves rotation at zero. Neither checks the pixels produced by these new mappings, so reversed rotation or incorrect cropping can pass the current tests.
Add a rendering test with an asymmetric camera image at all four angles, including a rectangular source and mirroring. This is a non-blocking coverage improvement.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/src/shaders/composite-video-frame.wgsl
Line: 422-425
Comment:
**Camera rotation lacks rendering tests**
The added test checks number normalization and legacy defaults, while `camera_frame_geometry.rs` leaves rotation at zero. Neither checks the pixels produced by these new mappings, so reversed rotation or incorrect cropping can pass the current tests.
Add a rendering test with an asymmetric camera image at all four angles, including a rectangular source and mirroring. This is a non-blocking coverage improvement.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Hey @YoavLevavi, thanks for this one, portrait-mounted cameras are a real pain point and the quarter-turn approach is nice and simple. Greptile's only finding this round ( One extra thing from our side that Greptile didn't flag here (it did on #2779): Once pushed, could you comment |
- camera_rotation_pixels renders a non-square camera with a different colour per quadrant, camera-only, at 0/90/180/270 with and without mirroring, and checks the quadrant in each output corner against the shader's mapping. It skips when no GPU adapter is available. - Regenerates apps/desktop/src/utils/tauri.ts for Camera.rotation. - Merges origin/main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks @richiemcilroy, both are in 94c294e (also merged main):
@greptileai review |
| else { | ||
| eprintln!("no GPU adapter available, skipping camera rotation pixels"); | ||
| return; |
There was a problem hiding this comment.
The new pixel test treats every error from RenderVideoConstants::new_with_options as a missing GPU adapter. That call can also fail when an adapter exists but request_device fails. The test then passes without checking any pixels and prints the wrong reason.
This is non-blocking, but it hides failed test setup. Skip only RenderingError::NoAdapter and fail on other errors.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/rendering/tests/camera_rotation_pixels.rs
Line: 63-65
Comment:
**Device failures pass the test**
The new pixel test treats every error from `RenderVideoConstants::new_with_options` as a missing GPU adapter. That call can also fail when an adapter exists but `request_device` fails. The test then passes without checking any pixels and prints the wrong reason.
This is non-blocking, but it hides failed test setup. Skip only `RenderingError::NoAdapter` and fail on other errors.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Fixed in 3f69fd2: the pixel test now skips only on @greptileai review |
# Conflicts: # apps/desktop-gpui/src/editor_tabs.rs
GPUI port of #2375.
Camera::rotation(quarter turns, normalized, defaults to 0) withrotation_degrees()/swaps_axes().Testing:
cargo test -p cap-project -p cap-rendering --lib(all pass),cargo checkinapps/desktop-gpui.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; both previous findings are addressed.Summary
Adds camera rotation at 0°, 90°, 180°, and 270°.
Both previous findings are addressed. No new issues were found.
Reviews (3) · Last reviewed commit: "Fail the rotation pixel test when the GP..." · Reviewed by Greptile