Skip to content

fix(upscaling): fix upscaling freezes#1513

Closed
doodlum wants to merge 1 commit into
devfrom
fix-upscaler-freezes
Closed

fix(upscaling): fix upscaling freezes#1513
doodlum wants to merge 1 commit into
devfrom
fix-upscaler-freezes

Conversation

@doodlum
Copy link
Copy Markdown
Collaborator

@doodlum doodlum commented Sep 23, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved stability when switching upscaling or frame generation modes by introducing a brief delay after resources are reinitialized. This reduces flicker, visual artifacts, and rare crashes during mode changes. Users may notice a very short pause when applying a new upscaling method.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 23, 2025

Walkthrough

Adds a 1000 ms delay in Upscaling::CheckResources after creating new upscaling resources when the upscale method changes, before updating previousUpscaleMode and previousFrameGenMode. No other logic, APIs, or control flow paths are modified.

Changes

Cohort / File(s) Summary
Upscaling resource check
src/Features/Upscaling.cpp
Inserted a 1000 ms sleep in CheckResources after creating upscaling resources (on mode change) and before updating previousUpscaleMode/previousFrameGenMode. No signature or external API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Game
  participant U as Upscaling::CheckResources
  participant R as Resource Creation

  Game->>U: CheckResources()
  alt Upscale/FrameGen mode changed
    U->>R: Create upscaling resources
    Note over U: Wait 1000 ms before state update
    U-->>U: Sleep(1000ms)
    U-->>U: Update previousUpscaleMode / previousFrameGenMode
  else No mode change
    U-->>U: No action
  end
  U-->>Game: return
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • jiayev
  • Pentalimbed

Poem

A hop, a pause—one second’s keep,
I chew my cud and gently sleep.
New scales bloom, then states align,
A measured beat in rendering time.
Thump-thump—resources set just right,
Now onward, frames! into the night. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately describes the primary intent of the changeset — fixing freezes in the upscaling code; it uses a conventional commit-style scope ("upscaling") and is concise without noisy details. The change in Upscaling::CheckResources (adding a 1s delay after resource creation) is directly related to the described fix, so the title reflects the main change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-upscaler-freezes

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3129e2 and 7e68184.

📒 Files selected for processing (1)
  • src/Features/Upscaling.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{cpp,cxx,cc,c,h,hpp,hxx,hlsl,hlsli,fx,fxh,py}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not include TODO/FIXME placeholders; provide complete, working solutions

Files:

  • src/Features/Upscaling.cpp
src/**/*.{cpp,cxx,cc,h,hpp,hxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.{cpp,cxx,cc,h,hpp,hxx}: Ensure SE/AE/VR runtime compatibility; use runtime detection patterns (e.g., REL::RelocateMember())
Include robust error handling and resource management with graceful degradation in the plugin code

Files:

  • src/Features/Upscaling.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (1)
src/Features/Upscaling.cpp (1)

569-576: Remove 1s sleep; drain GPU with fences instead to avoid hard stalls on the render thread

src/Features/Upscaling.cpp not found in this branch — cannot verify lines. Apply the original recommendation: replace the 1s std::this_thread::sleep_for(...) used in CheckResources()/ConfigureUpscaling (orig lines 569–576; also applies 605–609) with fence-based synchronization — for previousUpscaleMode == kFSR || kXESS signal sharedD3D12CommandQueue and wait on sharedD3D12Fence; otherwise QueryInterface ID3D11DeviceContext4 and Signal sharedD3D11Fence then wait. Remove the blocking sleep; if a sleep fallback remains, ensure and are included. Test by toggling DLSS ⇄ FSR/XeSS and enabling/disabling Frame Generation — expect no 1s freeze and no device removal/hangs.


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 and usage tips.

@github-actions
Copy link
Copy Markdown

Using provided base ref: b3129e2
Using base ref: b3129e2
Base commit date: 2025-09-22T21:30:57+01:00 (Monday, September 22, 2025 09:30 PM)
No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

@doodlum doodlum closed this Sep 23, 2025
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