Repository navigation
Terrain shader: avoid FXC loop-variable redefinition in fogAt - #196
Open
MyriadColors wants to merge 2 commits into
Open
MyriadColors wants to merge 2 commits into
MyriadColors wants to merge 2 commits into
Conversation
Commit 01f7cff added fogAt() to kTerrainHlsl with a for (int k = 0; ...) loop followed by float2 k = ... in the same function body. Under FXC (D3DCompile targeting vs_5_1/ps_5_1 on Windows' default DXBC backend), for-loop variables leak into the enclosing scope, causing terrain.hlsl to fail at runtime with error X3003: redefinition of 'k'. Rename float2 k to float2 v in fogAt() (matching Renderer.cpp's fogAt), clean up nested k shadowing in PSTerrain(), and add a Windows-only D3DCompile CTest (tests/shader_compile_test.cpp) covering all 10 embedded HLSL entry points so windows-x64 CI catches future FXC regressions.
Match <name>[] = R"hlsl( directly so comment mentions of shader constant names cannot mis-extract another literal, bail out immediately if any literal extraction fails, include <iterator> explicitly for std::size, and note that the entry table mirrors tools/shaders/gen_msl.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Issue
Commit 01f7cff added fogAt() to kTerrainHlsl with a for (int k = 0; ...) loop followed by float2 k = ... in the same function body. Under FXC (D3DCompile targeting vs_5_1/ps_5_1 on Windows' default DXBC backend), for-loop variables leak into the enclosing scope, causing terrain.hlsl to fail at runtime with error X3003: redefinition of 'k'.
What it changes
Rename float2 k to float2 v in fogAt() (matching Renderer.cpp's fogAt), clean up nested k shadowing in PSTerrain(), and add a Windows-only D3DCompile CTest (tests/shader_compile_test.cpp) covering all 10 embedded HLSL entry points so windows-x64 CI catches future FXC regressions.
How it was checked
ctest --test-dir build\ReleasepassesFair Warning
I've made this commit using Gemini Neon, I know this might be offputting, but this is a small bugfix Im sure this wont be a huge problem. But tell me if you need more assurances
autoplay_log.txt