fix(VR): broken desktop window when HDR enabled#2098
Conversation
Move hook to account for VR rendering. HDR is still not fully functional as HMDs do not support HDR. Preview window does not allow HDR slider adjustments.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds VR-aware HDR framebuffer handling: copies tonemapped scene into the runtime Changes
Sequence Diagram(s)sequenceDiagram
participant Renderer as Game Renderer
participant HDR as HDR Module
participant VR as VR Runtime (kFRAMEBUFFER)
participant GPU as GPU/Resources
participant ISC as Imagespace/ISCopy
Renderer->>HDR: render scene -> hdrTexture
HDR->>GPU: RestoreFramebuffer()
HDR->>GPU: CopyResource(hdrTexture.resource -> kFRAMEBUFFER)
GPU->>VR: present framebuffer content
ISC->>GPU: read kFRAMEBUFFER.SRV for IS processing
HDR->>Renderer: ApplyHDR(using kFRAMEBUFFER.SRV in VR)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Features/HDRDisplay.cpp (1)
888-900:⚠️ Potential issue | 🟠 MajorDon't bind a second UI layer in the VR path.
Line 889 switches VR to
kFRAMEBUFFER, which already contains vanilla UI + ImGui. But Lines 897-900 still binduiTexture->srv, even thoughSetUIBuffer()now exits early in VR. That leaves the VR companion pass sampling an uninitialized/stale UI texture on top of a scene that already has UI baked in.Proposed fix
- ID3D11ShaderResourceView* uiSRV = nullptr; - if (upscaling.d3d12SwapChainActive && upscaling.dx12SwapChain.uiBufferWrapped) { - uiSRV = upscaling.dx12SwapChain.uiBufferWrapped->srv; - } else if (uiTexture && uiTexture->srv) { - uiSRV = uiTexture->srv.get(); - } + ID3D11ShaderResourceView* uiSRV = nullptr; + if (!globals::game::isVR) { + if (upscaling.d3d12SwapChainActive && upscaling.dx12SwapChain.uiBufferWrapped) { + uiSRV = upscaling.dx12SwapChain.uiBufferWrapped->srv; + } else if (uiTexture && uiTexture->srv) { + uiSRV = uiTexture->srv.get(); + } + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Features/HDRDisplay.cpp` around lines 888 - 900, The VR path sets sceneSRV to the framebuffer (which already contains vanilla UI/ImGui), but uiSRV is still bound from uiTexture leading to a stale/duplicated UI layer; update the uiSRV selection (the block that sets uiSRV using upscaling.d3d12SwapChainActive, upscaling.dx12SwapChain.uiBufferWrapped and uiTexture) to skip binding any uiTexture when globals::game::isVR is true (or when SetUIBuffer early-returns for VR), i.e., only assign uiSRV from uiBufferWrapped or uiTexture if not in VR, otherwise leave uiSRV null so the VR companion pass does not sample a second UI layer.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/Features/HDRDisplay.cpp`:
- Around line 888-900: The VR path sets sceneSRV to the framebuffer (which
already contains vanilla UI/ImGui), but uiSRV is still bound from uiTexture
leading to a stale/duplicated UI layer; update the uiSRV selection (the block
that sets uiSRV using upscaling.d3d12SwapChainActive,
upscaling.dx12SwapChain.uiBufferWrapped and uiTexture) to skip binding any
uiTexture when globals::game::isVR is true (or when SetUIBuffer early-returns
for VR), i.e., only assign uiSRV from uiBufferWrapped or uiTexture if not in VR,
otherwise leave uiSRV null so the VR companion pass does not sample a second UI
layer.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7da143b1-365a-4310-bcb5-65ae7e5cac7b
📒 Files selected for processing (3)
src/Features/HDRDisplay.cppsrc/Hooks.cppsrc/ShaderCache.cpp
|
✅ A pre-release build is available for this PR: |
Move hook to account for VR rendering. HDR is still not fully functional as HMDs do not support HDR. Preview window does not allow HDR slider adjustments.
Summary by CodeRabbit
Bug Fixes
Improvements