Skip to content

chore(sync): merge upstream/dev water + UI fixes (080afc0)#135

Merged
alandtse merged 4 commits into
devfrom
sync/upstream-1.7.0-fixes
Jun 9, 2026
Merged

chore(sync): merge upstream/dev water + UI fixes (080afc0)#135
alandtse merged 4 commits into
devfrom
sync/upstream-1.7.0-fixes

Conversation

@alandtse

@alandtse alandtse commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Cherry-picks the 3 upstream Community Shaders dev fixes landed since our v1.7.0-rc.1 sync (#121, b74dedf96). All are upstream fix: commits; history was clean/linear.

Commits

community-shaders#2490 — keep-VR conflict resolution (the only conflict)

It's a moved hook, resolved to preserve VR:

  • Upstream removes the CreateRenderTarget_Water1/Water2 creation-hooks (which force-set kR16G16B16A16_FLOAT at RT creation and leak a texture each time) and instead sets the format in Deferred::SetupResources via SetupRenderTarget(RE::RENDER_TARGETS::kWATER_1/kWATER_2, …R16G16B16A16_FLOAT…), which now releases the existing RTV/SRV/UAV/texture before recreating (the VRAM-leak fix).
  • The replacement addresses water RTs by RT enum through GetRuntimeData().renderTargets[] — CommonLib resolves the VR member offset internally — so SE/AE/VR are all covered with no raw addresses. The removed hooks' VR offsets (0x12C2/0x12D8) retire with the hooks (no orphaning).
  • Resolution: dropped the two Water registrations (adopting the leak fix), kept the fork's VR third-arg offsets on the surviving Precip/Reflections hooks (0x1917/0xCD2/0xD13) and the fork's perfMode.InstallCreateRTThunks(). No orphaned Water1/Water2 references remain.

Verification

  • BuildRelease ALL — green.
  • cpp_tests — 307/307.
  • extract-i18n --check — en.json in sync (no string changes).

Pre-merge note

community-shaders#2490 touches the VR water render targets. The addressing is now runtime-resolved (enum, not offsets), so it should be VR-correct by construction — but a quick VR water smoke is worth doing before merge given the fork is the VR maintainer.

Release impact

Titled fix: (patch) — these are user-facing bug fixes (alt-tab CTD, VRAM leak, water blending) that warrant a changelog entry. Retitle to chore(sync): if you'd rather they not bump.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Water effects now include temporal anti-aliasing support for smoother, more stable visuals across frames
  • Bug Fixes

    • Custom cursor display now properly respects menu theme and cursor load state
    • Improved graphics resource cleanup to prevent leaks and related rendering issues
  • Improvements

    • Refactored water caustics computation for better performance and visual consistency

Copilot AI review requested due to automatic review settings June 8, 2026 21:35
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Refactors caustics sampling control flow in the water shader, adds render-target cleanup and two TAA water-history targets, removes legacy Water1/Water2 hook thunks, and gates custom cursor drawing by theme and loaded-cursor count.

Changes

Water Effects Pipeline Modernization

Layer / File(s) Summary
Caustics shader control-flow optimization
features/Water Effects/Shaders/WaterEffects/WaterCaustics.hlsli
ComputeCaustics replaces ternary-based const initialization with mutable float3 variables assigned via if statements, conditionally sampling causticsHigh when causticsFade > 0.0 and causticsLow when causticsFade < 1.0, preserving the final lerp blend.
Render target resource cleanup and TAA water history buffers
src/Deferred.cpp
SetupRenderTarget releases existing COM resources (UAV, RTV, SRV, copy textures/views and textures) and nulls pointers before recreation; SetupResources adds two TAA water-history render targets (kWATER_1, kWATER_2) with DXGI_FORMAT_R16G16B16A16_FLOAT.
Legacy Water1/Water2 hook removal
src/Hooks.cpp
Removes Hooks::CreateRenderTarget_Water1 and Hooks::CreateRenderTarget_Water2 hook structs and their stl::write_thunk_call installations in Hooks::Install(), removing the previous Water1/Water2 thunk wiring.

Custom Cursor Rendering Safety

Layer / File(s) Summary
Custom cursor drawing condition safeguards
src/Menu/OverlayRenderer.cpp
FinalizeImGuiFrame now draws custom cursors only when the menu singleton exists, Theme.UseCustomCursor is enabled, and Util::CursorLoader::GetLoadedCount() > 0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • alandtse/open-shaders#62: Also modifies ComputeCaustics in WaterCaustics.hlsli; that PR reformats ternary expressions while this PR refactors sampling into conditional assignments.

Poem

🐰
A shader shimmers, pixels play,
Caustics wake at break of day.
Old hooks tucked in a tidy fold;
New targets hold the waters bold.
Cursors guard the frame so bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Title check ✅ Passed The title accurately summarizes the main objective of the PR: merging upstream water and UI fixes into the dev branch, with the specific commit hash referenced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/upstream-1.7.0-fixes

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

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

No actionable suggestions for changed features.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Syncs three upstream fix: commits onto the fork’s v1.7.0-rc.1 baseline, addressing (1) a custom-cursor alt-tab crash that can occur when this fork ships no cursor PNGs, (2) water render-target lifetime/format handling to fix blending and a VRAM leak, and (3) shader warning cleanup to keep shader-validation warning-free.

Changes:

  • Guard custom cursor rendering so it only runs when enabled and at least one cursor texture is loaded.
  • Move WATER_1/WATER_2 format enforcement to Deferred::SetupResources() and release existing RT resources before recreating to fix a VRAM leak.
  • Restructure caustics shader code to silence X4000 “potentially uninitialized” warnings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Menu/OverlayRenderer.cpp Adds a guard to avoid drawing the custom cursor when no cursor textures are loaded.
src/Hooks.cpp Removes Water1/Water2 RT creation thunks; updates hook installation block comments accordingly.
src/Deferred.cpp Releases existing RT COM resources before recreating; enforces RGBA16F for WATER_1/WATER_2 history RTs.
features/Water Effects/Shaders/WaterEffects/WaterCaustics.hlsli Refactors conditional assignments to avoid uninitialized-variable warnings.

Comment thread src/Hooks.cpp Outdated
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/Deferred.cpp (2)

142-144: 🏗️ Heavy lift

Add a user toggle for water history RT allocation.

These two RGBA16F history targets add persistent VRAM cost; expose an on/off or quality-tier toggle so users on lower-end GPUs can trade quality for stability/perf.

As per coding guidelines, "Flag potential performance impact issues for graphics features and suggest user toggles for performance-sensitive features".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Deferred.cpp` around lines 142 - 144, Add a user-configurable toggle to
control allocation of the two RGBA16F water history render targets (created by
calls to SetupRenderTarget for RE::RENDER_TARGETS::kWATER_1 and kWATER_2) so
users on low-end GPUs can disable them; implement a new setting (e.g., bool
UseWaterHistory or a quality enum) in the renderer/settings subsystem with a
sensible default enabled, read that setting where Deferred.cpp constructs
targets and only call SetupRenderTarget for kWATER_1 and kWATER_2 when the flag
is true, and ensure the setting is exposed to user config/GUI and documented in
defaults so VRAM-sensitive users can toggle it.

Source: Coding guidelines


1-1: ⚡ Quick win

Tighten commit title/body to conventional-commit + explicit issue keywords.

Suggested title: fix(sync): adopt upstream 1.7.0 water/ui fixes
Suggested PR body refs: Fixes community-shaders#2488, `Fixes `#2487, Fixes community-shaders#2490``.

As per coding guidelines, include conventional commit titles and explicit issue-reference keywords when applicable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Deferred.cpp` at line 1, Update the commit title and PR body to follow
conventional-commit format and include explicit issue keywords: change the
commit title to "fix(sync): adopt upstream 1.7.0 water/ui fixes" and update the
PR description to include the issue references "Fixes `#2488`", "Fixes `#2487`", and
"Fixes `#2490`"; ensure the repo/git commit message and the pull request
description are edited accordingly so CI/issue trackers pick up the conventional
commit type and the explicit "Fixes" references.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/Deferred.cpp`:
- Around line 142-144: Add a user-configurable toggle to control allocation of
the two RGBA16F water history render targets (created by calls to
SetupRenderTarget for RE::RENDER_TARGETS::kWATER_1 and kWATER_2) so users on
low-end GPUs can disable them; implement a new setting (e.g., bool
UseWaterHistory or a quality enum) in the renderer/settings subsystem with a
sensible default enabled, read that setting where Deferred.cpp constructs
targets and only call SetupRenderTarget for kWATER_1 and kWATER_2 when the flag
is true, and ensure the setting is exposed to user config/GUI and documented in
defaults so VRAM-sensitive users can toggle it.
- Line 1: Update the commit title and PR body to follow conventional-commit
format and include explicit issue keywords: change the commit title to
"fix(sync): adopt upstream 1.7.0 water/ui fixes" and update the PR description
to include the issue references "Fixes `#2488`", "Fixes `#2487`", and "Fixes `#2490`";
ensure the repo/git commit message and the pull request description are edited
accordingly so CI/issue trackers pick up the conventional commit type and the
explicit "Fixes" references.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 11c5e3bd-1c8a-470d-ad57-8ef4711fd7ba

📥 Commits

Reviewing files that changed from the base of the PR and between 36e8da0 and 63a5304.

📒 Files selected for processing (4)
  • features/Water Effects/Shaders/WaterEffects/WaterCaustics.hlsli
  • src/Deferred.cpp
  • src/Hooks.cpp
  • src/Menu/OverlayRenderer.cpp
💤 Files with no reviewable changes (1)
  • src/Hooks.cpp

Adopts the 3 upstream Community Shaders dev fixes landed since v1.7.0-rc.1:
- community-shaders#2488 water-caustics X4000 warnings
- community-shaders#2487 alt-tab CTD with no cursor png (fork ships none)
- community-shaders#2490 water blending + VRAM texture leak (Water RT format-forcing moved to
  Deferred::SetupResources; keep-VR: Water hooks' VR offsets retire with them,
  Precip/Reflections keep theirs)

Merged (not cherry-picked) to preserve upstream commit ancestry for clean
future syncs.

# Conflicts:
#	src/Hooks.cpp
@alandtse alandtse force-pushed the sync/upstream-1.7.0-fixes branch from 63a5304 to 1f35376 Compare June 9, 2026 01:47
@alandtse alandtse changed the title fix: adopt upstream 1.7.0 water + UI fixes (#2488, #2487, #2490) chore(sync): merge upstream/dev water + UI fixes (080afc0) Jun 9, 2026
@alandtse alandtse merged commit 526774d into dev Jun 9, 2026
25 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.

4 participants