fix: dynamic cubemaps X4000 warning#2478
Conversation
|
Wondering what really moved? Review this PR in Change Stack to inspect semantic changes, definitions, and references. 📝 WalkthroughWalkthroughThis PR refactors static IBL control flow in the dynamic cubemaps shader by extracting the static IBL condition into a reusable boolean, optimizing early-exit paths, and ensuring proper initialization of specular variables in non-static IBL fallback code. ChangesStatic IBL Control Flow and Initialization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Pull request overview
This PR adjusts the Dynamic Cubemaps shader logic to eliminate an HLSL compiler warning (X4000) by ensuring variables are always initialized and by restructuring the static-IBL path to avoid relying on conditional early returns.
Changes:
- Introduces a
useStaticIBLflag and routes control flow through an explicitif/elseto handle static IBL vs dynamic evaluation. - Initializes
envSpecularandskySpecularto0.0in both affected functions to prevent “potentially uninitialized” warnings. - Simplifies the static-IBL return in
GetDynamicCubemap()to directly usespecularIrradiance(equivalent behavior given the previous initialization).
There was a problem hiding this comment.
🧹 Nitpick comments (1)
features/Dynamic Cubemaps/Shaders/DynamicCubemaps/DynamicCubemaps.hlsli (1)
1-1: Consider adding an issue reference if applicable.The PR title correctly follows conventional commits format. If this PR fixes a reported issue or implements a tracked feature request, please add an appropriate GitHub keyword to the PR description:
- "Fixes
#XXX" or "Closes#XXX" for bug fixes- "Implements
#XXX" for features- "Related to
#XXX" for partial implementationsAs per coding guidelines for this repository.
🤖 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 `@features/Dynamic` Cubemaps/Shaders/DynamicCubemaps/DynamicCubemaps.hlsli at line 1, The PR is missing a repository issue reference in its description; please update the PR body to include the appropriate GitHub keyword (e.g., "Fixes #<issue>", "Implements #<issue>", or "Related to #<issue>") that corresponds to the work in this change — this change touches the DynamicCubemaps shader header (symbol DYNAMICCUBEMAPS_HLSLI in file DynamicCubemaps.hlsli) so reference the relevant issue number and use the correct keyword in the PR description.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 `@features/Dynamic` Cubemaps/Shaders/DynamicCubemaps/DynamicCubemaps.hlsli:
- Line 1: The PR is missing a repository issue reference in its description;
please update the PR body to include the appropriate GitHub keyword (e.g.,
"Fixes #<issue>", "Implements #<issue>", or "Related to #<issue>") that
corresponds to the work in this change — this change touches the DynamicCubemaps
shader header (symbol DYNAMICCUBEMAPS_HLSLI in file DynamicCubemaps.hlsli) so
reference the relevant issue number and use the correct keyword in the PR
description.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: cd42b51b-54df-4f4c-8f06-61e55dd0f16e
📒 Files selected for processing (1)
features/Dynamic Cubemaps/Shaders/DynamicCubemaps/DynamicCubemaps.hlsli
GetSceneDepthForFog assigns volumeUV/projectedDepth on every path, but the [branch] early-return trips fxc's uninitialized-variable analysis (X4000), which fails the fork's shader validation (--max-warnings 0). Initialize the out-params at function entry and the two caller locals. Behavior-preserving (values were already assigned before use). Same class as upstream community-shaders#2478/community-shaders#2479.
finally fixes x4000 issues per #2465
Summary by CodeRabbit
Bug Fixes
Refactor