fix(VR): interior water submersion masks#2075
Conversation
📝 WalkthroughWalkthroughAdds a VR fallback water-height source: shaders use Changes
Sequence DiagramsequenceDiagram
participant CPU as CPU (State.cpp)
participant GameUtil as Game Utils (TryGetWaterData)
participant ConstBuf as SharedData ConstBuffer
participant Shader as UnderwaterMaskUpscalePS
CPU->>GameUtil: TryGetWaterData(position)
alt GetWaterHeight succeeds
GameUtil-->>CPU: cell water height (camera/world)
else
GameUtil-->>CPU: no-tile sentinel (-FLT_MAX)
end
CPU->>CPU: If VR & player underwaterCount>0\ncompute worldWater = player->GetWaterHeight()
alt worldWater valid
CPU->>CPU: WaterSystemHeight = worldWater - eye0.z
else
CPU->>CPU: WaterSystemHeight = sentinel
end
CPU->>ConstBuf: write WaterSystemHeight
Shader->>ConstBuf: read tile water value (data.w)
alt tile != NO_TILE
Shader->>Shader: use tile-based per-eye waterHeight
else
Shader->>ConstBuf: read WaterSystemHeight
Shader->>Shader: apply per-eye CameraPosAdjust.z (eye0 reference)
Shader->>Shader: reconstruct per-eye underwater mask
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
No actionable suggestions for changed features. |
|
✅ A pre-release build is available for this PR: |
647e77f to
5f328c6
Compare
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
package/Shaders/Common/SharedData.hlsli (1)
27-27: Keep sentinel terminology consistent across CPU and shader comments.This comment uses
-FLT_MAX, while the C++ side documents-NI_INFINITY. Consider using one term consistently (or explicitly noting they map to the same sentinel) to reduce ambiguity during debugging.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package/Shaders/Common/SharedData.hlsli` at line 27, The shader comment for the WaterSystemHeight field uses the sentinel value "-FLT_MAX" while the C++/CPU side documents "-NI_INFINITY"; update the comment for WaterSystemHeight (and any nearby shader comments) to use the same sentinel term as the CPU side (use "-NI_INFINITY") or explicitly state they are equivalent (e.g., "-NI_INFINITY (-FLT_MAX on shaders)") so TES::GetWaterHeight mapping is unambiguous across CPU and shader code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@package/Shaders/Common/SharedData.hlsli`:
- Line 27: The shader comment for the WaterSystemHeight field uses the sentinel
value "-FLT_MAX" while the C++/CPU side documents "-NI_INFINITY"; update the
comment for WaterSystemHeight (and any nearby shader comments) to use the same
sentinel term as the CPU side (use "-NI_INFINITY") or explicitly state they are
equivalent (e.g., "-NI_INFINITY (-FLT_MAX on shaders)") so TES::GetWaterHeight
mapping is unambiguous across CPU and shader code.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0706e6b9-88e3-4d20-af7e-b01e7fe8debd
📒 Files selected for processing (3)
package/Shaders/Common/SharedData.hlslisrc/State.cppsrc/State.h
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit 6e4cd11)
Adds a VR diagnostics switch to bypass the community-shaders#2062/community-shaders#2075 underwater mask changes for in-game A/B testing. The toggle disables the analytical underwater mask shader path, the TESWaterSystem fallback height, and the shared VR water-height eye correction while preserving SRV unbind safety.
Summary by CodeRabbit