Skip to content

test(compositor): measure the Glass Lens refraction as an edge shift - #1093

Merged
EtienneLescot merged 1 commit into
mainfrom
test/glass-lens-refraction-oracle
Oct 10, 2026
Merged

EtienneLescot merged 1 commit into
mainfrom
test/glass-lens-refraction-oracle

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

the_flat_glass_lens_refracts_the_picture now measures the refraction itself. The old moved check counted pixels whose brightness changed under the glass, which the lens lighting alone satisfies: it stayed green with the refraction off (IOR 1.0).

  • Renders vertical stripes and their inverse under the lens. The sign of the difference tells which stripe each pixel sees, whatever light the glass adds.
  • Edges seen through the lens must sit at least 3 px from every edge of the same row without it, on at least 10 edges.
  • Same oracle in the Linux (lavapipe) twin in compositor_linux.rs.
arrow pointer
IOR 1.5 (shipped) 23 edges shifted, up to 5.5 px 67 edges shifted, up to 5.5 px
IOR 1.0 (mutant) 0, at most 0.5 px 0, at most 1.0 px

Related issue

Refs #1019 (follow-up to the review nitpick confirmed by @My-Denia).

Type of change

  • Bug fix
  • Feature
  • Enhancement
  • Documentation
  • Refactor / maintenance
  • Performance
  • Security

Release impact

  • Patch
  • Minor
  • Major / breaking change
  • No release note needed

Desktop impact

  • Windows
  • macOS
  • Linux
  • Installer / packaging
  • Not platform-specific

Testing

  • Windows D3D11, local: cargo test -p openscreen-compositor --test cursor_model_render, 10/10 green. With GLASS_IOR = 1.0 in shaders.hlsl, the new test fails and the old one passes.
  • Linux lavapipe (WSL, nix develop .#compositor-view): same numbers as D3D11, and the same red with GLASS_IOR = 1.0 in layer.wgsl.
  • CI does not run the Windows render tests (cargo check only); the Linux twin runs in rust-linux-compositor-check.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated Glass Lens rendering checks to measure how far visible stripe edges shift through the lens, replacing the previous brightness-change pixel count.
    • Added coverage for light-and-dark stripe patterns to improve verification of lens refraction across rendered images.

The flat lens test counted pixels whose brightness changed under the
glass, which the lens lighting alone satisfies: it stayed green with the
refraction off (IOR 1.0). Render vertical stripes and their inverse under
the lens instead; the sign of the difference tells which stripe each
pixel sees, whatever light the glass adds. Edges seen through the lens
must sit at least 3 px from every edge of the same row without it.

Measured on D3D11: 23 and 67 shifted edges (up to 5.5 px) at IOR 1.5,
none (1 px at most) at IOR 1.0. Same oracle in the lavapipe twin.
@EtienneLescot
EtienneLescot requested a review from Beetix as a code owner October 10, 2026 11:25
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0633093-1173-4e3a-90a7-bb5f54ae5d39

📥 Commits

Reviewing files that changed from the base of the PR and between ad51125 and 8743d0f.


📒 Files selected for processing (2)
  • crates/compositor/src/compositor_linux.rs
  • crates/compositor/tests/cursor_model_render.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The Glass Lens render tests now use normal and inverted stripe patterns to measure edge displacement. Both tests require at least 10 stripe edges to shift by 3 pixels or more through the lens.

Changes

Glass Lens render tests

Layer / File(s) Summary
Stripe-edge detection helpers
crates/compositor/src/compositor_linux.rs, crates/compositor/tests/cursor_model_render.rs
The test helpers generate normal and inverted stripe patterns and detect luminance transitions in retained pixels.
Lens displacement measurement
crates/compositor/src/compositor_linux.rs, crates/compositor/tests/cursor_model_render.rs
Both Glass Lens tests compare in-lens stripe edges with bare-screen edges. They replace the displaced-pixel count with a requirement that at least 10 edges shift by 3 pixels or more.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other


Merge Risk: ⚪ Minimal · up to 8743d

The changed tests target stripe-edge displacement, and no concrete issue is established that would prevent merging after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: measuring Glass Lens refraction through edge shifts.
Description check Passed The description is complete and relevant. It explains the change, related issue, change type, release impact, platform impact, and testing results. The optional Screenshots / video section is not fill…
Docstring Coverage Passed Docstring coverage is 90.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.98.1)

Clippy execution failed



Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@EtienneLescot
EtienneLescot merged commit c83352f into main Oct 10, 2026
20 checks passed
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