fix(lighting): guard EMAT parallax shadow against undefined TBN#80
Conversation
The EMAT parallax-shadow block reads tbn via mul(refractedLightDirection, tbn), but tbn is only defined under defined(SKINNED) || !defined(MODELSPACENORMALS). For the MODELSPACENORMALS && !SKINNED permutations the block read an undefined TBN, producing garbage parallax soft-shadow results. Gate the block on the same condition that defines tbn, matching the idiom already used elsewhere in this file. Ported from ParticleTroned/skyrim-community-shaders. Co-Authored-By: ParticleTroned <248299730+ParticleTroned@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 54 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
There was a problem hiding this comment.
Pull request overview
Tightens the #if defined(EMAT) guard around the parallax-shadow block in Lighting.hlsl so it only compiles when tbn is defined (SKINNED || !MODELSPACENORMALS), fixing an undefined read in the MODELSPACENORMALS && !SKINNED permutation.
Changes:
- Narrow EMAT parallax-shadow preprocessor guard to match
tbn's definition condition. - Annotate matching
#endifwith the guard condition for readability.
|
No actionable suggestions for changed features. |
Summary
The EMAT parallax-shadow block in
Lighting.hlslreads the tangent-space basistbnviamul(refractedLightDirection, tbn), buttbnis only defined underdefined(SKINNED) || !defined(MODELSPACENORMALS). ForMODELSPACENORMALS && !SKINNEDpermutations, the block read an undefinedtbn, producing garbage parallax soft-shadow results.This gates the block on the same condition that defines
tbn, matching the idiom already used elsewhere in the file (e.g. the EMAT normal-mapping block and thetbndefinition itself).Change
package/Shaders/Lighting.hlsl— two lines: tighten#if defined(EMAT)→#if defined(EMAT) && (defined(SKINNED) || !defined(MODELSPACENORMALS))around the parallax-shadow block (and annotate the matching#endif).The guard only removes the block from permutations where
tbnwas undefined, so it cannot introduce a compile error — only fix the latent undefined read. CI shader validation covers the affected permutations.Attribution
Ported from ParticleTroned/skyrim-community-shaders (
fix(lighting): guard EMAT parallax shadow TBN use).🤖 Generated with Claude Code