Skip to content

fix: revert TAA shader#2375

Closed
doodlum wants to merge 3 commits into
devfrom
revert-taa-refactor
Closed

fix: revert TAA shader#2375
doodlum wants to merge 3 commits into
devfrom
revert-taa-refactor

Conversation

@doodlum
Copy link
Copy Markdown
Collaborator

@doodlum doodlum commented May 18, 2026

Fixes #2371

Summary by CodeRabbit

  • Bug Fixes

    • Temporal anti-aliasing is now disabled in VR, preventing VR-specific visual artifacts and improving stability/performance.
  • Refactor

    • Core temporal-AA shader implementation rewritten; improves HDR conversion/tonemapping and feedback outputs, which may change blending, luminance handling, and final image stability across HDR and SDR displays.

Review Change Stack

@github-actions
Copy link
Copy Markdown

No actionable suggestions for changed features.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

📝 Walkthrough

Walkthrough

Replaces ISTemporalAA.hlsl PS with a decompiled, register-heavy implementation (fixed registers, new cb12, HDR convert helpers, and a void entry writing SV_Target0/1) and adds an early-return in ShaderCache to disable this imagespace shader in VR.

Changes

Temporal AA Shader Update and VR Control

Layer / File(s) Summary
TAA Shader Declarations and HDR Helpers
package/Shaders/ISTemporalAA.hlsl
Declares fixed texture/sampler registers and cbuffers, adds cb12 : register(b12), defines cmp macro, and adds inline HDR conversion helpers used by the PS.
TAA Core Computation and Sampling
package/Shaders/ISTemporalAA.hlsl
Rewrites the PS body as a register-driven implementation performing neighborhood depth/velocity sampling, HDR-aware sampling/conversion, luminance comparisons, temporal blending, masking, and intermediate math (r0r19).
TAA Output Packaging and Fallback
package/Shaders/ISTemporalAA.hlsl
Packs final color to o0 and feedback to o1, applies HDR clamping/tonemapping and feedback saturation, and retains a minimal non-PSHADER fallback include.
VR Shader Exclusion in Cache
src/ShaderCache.cpp
Adds an early return in GetImagespaceShaderDescriptor to disable BSImagespaceShaderISTemporalAA when globals::game::isVR is true, preventing caching/loading in VR.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • soda3000

Poem

🐰 In registers deep the pixels play,
HDR hops through night and day.
A VR gate keeps the stage quite small,
While feedback channels tag them all.
Rabbity code, refined and bright—blend on!

🚥 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.
Title check ✅ Passed The title 'fix: revert TAA shader' directly summarizes the main change: reverting the TAA shader implementation to fix broken behavior.
Linked Issues check ✅ Passed The PR reverts the TAA shader to fix banding artifacts and sharpening issues when Imagespace is toggled, directly addressing the requirements in issue #2371.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the TAA implementation: shader reversion and VR disable logic are both in scope for resolving the reported TAA issues.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-taa-refactor

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
package/Shaders/ISTemporalAA.hlsl (1)

19-27: ⚡ Quick win

Name the load-bearing cbuffer slots.

cb2[3], cb2[4], cb2[5], cb12[43], and cb12[44] now drive most of the UV clamping and blend logic, but the raw indices make the binding contract very hard to audit in the next edit. A few declaration-site comments or aliases would make this much safer to maintain.

Suggested minimal cleanup
 cbuffer cb2 : register(b2)
 {
-	float4 cb2[6];
+	float4 cb2[6];   // [3]=taa offsets, [4]=blend/sharpen params, [5].w=history threshold
 }
 
 cbuffer cb12 : register(b12)
 {
-	float4 cb12[45];
+	float4 cb12[45]; // [43]=UV scale/bounds, [44].zw=screen clamp bounds
 }
🤖 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 `@package/Shaders/ISTemporalAA.hlsl` around lines 19 - 27, The anonymous
constant buffer entries cb2 and cb12 are used by magic indices (cb2[3], cb2[4],
cb2[5], cb12[43], cb12[44]) which makes bindings hard to audit; update the
declaration of cb2 and cb12 in ISTemporalAA.hlsl by adding clear
declaration-site comments or named aliases describing what those specific slots
represent (e.g., uvClampMin, uvClampMax, blendParams, historyWeightX,
historyWeightY) and/or introduce simple const aliases or struct wrappers that
map cb2[3]/[4]/[5] and cb12[43]/[44] to meaningful names so future editors can
see the binding contract at the buffer definition.
🤖 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 `@package/Shaders/ISTemporalAA.hlsl`:
- Around line 19-27: The anonymous constant buffer entries cb2 and cb12 are used
by magic indices (cb2[3], cb2[4], cb2[5], cb12[43], cb12[44]) which makes
bindings hard to audit; update the declaration of cb2 and cb12 in
ISTemporalAA.hlsl by adding clear declaration-site comments or named aliases
describing what those specific slots represent (e.g., uvClampMin, uvClampMax,
blendParams, historyWeightX, historyWeightY) and/or introduce simple const
aliases or struct wrappers that map cb2[3]/[4]/[5] and cb12[43]/[44] to
meaningful names so future editors can see the binding contract at the buffer
definition.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 90564010-d006-4637-af31-e0a07d48a4f0

📥 Commits

Reviewing files that changed from the base of the PR and between fd20066 and 923e4fd.

📒 Files selected for processing (2)
  • package/Shaders/ISTemporalAA.hlsl
  • src/ShaderCache.cpp

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@package/Shaders/ISTemporalAA.hlsl`:
- Around line 29-32: The cbuffer declaration "cbuffer cb12 { float4 cb12[45]; }"
is missing the required trailing semicolon; update the cbuffer block for cb12 by
appending a semicolon after the closing brace (i.e., after "}" in the cbuffer
cb12 declaration) so the HLSL shader compiles correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d7ed0512-2594-45ab-8be7-3914932f2a94

📥 Commits

Reviewing files that changed from the base of the PR and between 923e4fd and f07df4c.

📒 Files selected for processing (1)
  • package/Shaders/ISTemporalAA.hlsl

Comment thread package/Shaders/ISTemporalAA.hlsl
@github-actions
Copy link
Copy Markdown

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

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.

Broken TAA

2 participants