Skip to content

fix(rendering): stop foveation enable call from overriding the selected level (#41) - #226

Merged
BGLuis merged 3 commits into
developfrom
fix/41-foveation-mode-override
Oct 28, 2026
Merged

BGLuis merged 3 commits into
developfrom
fix/41-foveation-mode-override

Conversation

@BGLuis

@BGLuis BGLuis commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Description

Found while running the #34 hardware-validation blocks on a Quest 3: the 5-level foveation matrix in #41 could not be validated because Low/Medium/High were always replaced by Auto.

  • VRActivity.onCreate and the Settings foveation selector called nativeSetFoveationEnabled(mode != 0) right after nativeSetFoveationMode(mode).
  • The bridge's set_foveation_enabled (rust/bridge/src/lib.rs:257-259) maps "enabled" to mode 4 (Auto), so any fixed level was overwritten and the render loop applied the QualityController level (1).
  • set_foveation_mode already updates FOVEATION_ENABLED, so the second call is dropped. The GLES path also exports nativeSetFoveationMode and only reads get_foveation_enabled(), so both back-ends are covered.

A second commit fixes the SET_SCREEN_MODE example in docs/HARDWARE-VALIDATION-CHECKLIST.md (Block 6, #46) and in a VRActivity comment: the receiver reads the screen_mode extra, not mode, so the documented command did nothing.

Refs #41, #46 (does not close them: the validation sessions are still pending).

Left as is: nativeSetFoveationEnabled / set_foveation_enabled now have no Kotlin caller. They are kept to avoid touching the frozen GLES path, but calling them again would reintroduce the bug.

Type of change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 📝 Documentation update

Affected layers

  • 🟣 Kotlin (app/) — app shell, UI panels, credentials, history, i18n
  • 📚 Docs only

How has this been tested?

  • Unit tests (JVM / cargo test): ./gradlew testDebugUnitTest and ./gradlew ktlintCheck pass.
  • Native/Vulkan build compiled without errors (./gradlew assembleDebug, Vulkan).
  • Physically tested on a device (Quest 3, firmware UP1A.231005.007.A1): the persisted foveated_rendering_mode was set through prefs, the app was restarted on a 4K clip in Cinema, and the native log was read.
Saved mode Before After
1 Low aplicado nivel=1 aplicado nivel=1
2 Medium aplicado nivel=1 aplicado nivel=2
3 High aplicado nivel=1 aplicado nivel=3
4 Auto aplicado nivel=1 aplicado nivel=1 (Auto start level)

Not tested: changing the level from the Settings UI during playback. It takes the same code path, but tapping the UI needs someone wearing the headset; that is part of the #41 manual session. The telemetry CSV foveation column is a boolean (foveationEnabled), so the level must be checked in logcat, not in the CSV.

Checklist:

  • My code follows the project's style guidelines (ktlint, rustfmt, clippy -D warnings).
  • I have performed a self-review of my own code.
  • I have added new tests that prove my fix is effective or that my feature works. (The bug is in the Kotlin→JNI call order; there is no host-testable seam for it.)
  • The CI checks are passing for this PR.

If applicable

  • Kotlin never calls Rust directly — the Kotlin → JNI → C++ → C ABI → Rust path is preserved (ADR-002).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DKhrqR6co7AR9tP6fh6G2n

BGLuis and others added 2 commits October 27, 2026 13:00
…ed level (#41)

VRActivity.onCreate and the Settings foveation selector called
nativeSetFoveationEnabled(mode != 0) right after nativeSetFoveationMode(mode).
The bridge's set_foveation_enabled maps "enabled" to mode 4 (Auto), so a
persisted or selected Low/Medium/High was always replaced by Auto, and the
render loop applied the QualityController level (1) instead.

set_foveation_mode already updates FOVEATION_ENABLED, so the second call is
dropped. Verified on Quest 3: saved modes 2 and 3 now log
"Foveated Rendering: aplicado nivel=2/3" (before: nivel=1).

Refs #41

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DKhrqR6co7AR9tP6fh6G2n
The receiver reads EXTRA_SCREEN_MODE ("screen_mode"); the checklist command
and the VRActivity comment passed "mode", which the broadcast ignores.

Refs #46

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DKhrqR6co7AR9tP6fh6G2n
@BGLuis BGLuis self-assigned this Oct 28, 2026

@BGLuis BGLuis left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean and precise fix for the foveation mode override bug observed during Quest 3 hardware validation (#41), along with the documentation fix for SET_SCREEN_MODE (#46).

Removing nativeSetFoveationEnabled from both startup (VRActivity.onCreate) and SettingsScreen stops set_foveation_enabled (rust/bridge/src/lib.rs:258) from overwriting granular modes (1=Low, 2=Medium, 3=High) to mode 4 (Auto). Since set_foveation_mode already updates FOVEATION_ENABLED via FOVEATION_ENABLED.store(mode != 0), the boolean toggle state and stats remain coherent.

Fixing --ei mode 6 to --ei screen_mode 6 aligns the checklist with VRActivity.EXTRA_SCREEN_MODE and docs/DEBUGGING.md, where the broadcast was previously a no-op.

Suggestion

  • Consider annotating the now-unused declaration external fun nativeSetFoveationEnabled in VRActivity.kt with @Deprecated to warn future callers that invoking it resets mode to Auto (inline on VRActivity.kt:488).

Dependencies: No package version or lockfile changed (dependency_diff.py). No new library APIs called. Dual-backend and JNI layering conventions (ADR-002) respected.

Checked: rust/bridge/src/lib.rs, native/src/vr_player_app_vulkan.cpp, VRActivity.kt, SettingsScreen.kt, HARDWARE-VALIDATION-CHECKLIST.md, DEBUGGING.md, issues #41 and #46, and git diff. Ran: ./gradlew ktlintCheck, ./gradlew testDebugUnitTest, npx --yes markdownlint-cli2@0.18.1, cargo test -p protocols -p media-logic (all passed). Not run: Physical Quest 3 headset validation in this CI session (author verified on Quest 3 firmware UP1A.231005.007.A1 and provided logs in the PR description).

@BGLuis
BGLuis merged commit af128b6 into develop Oct 28, 2026
8 checks passed
@BGLuis
BGLuis deleted the fix/41-foveation-mode-override branch October 28, 2026 19:29
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