skyrim-community-shaders
skyrim-community-shaders copied to clipboard
fix(shader): add fallbacks for LightLimitFix SharedData and Particle ViewPosition
Fixes shader compilation errors from job 53424716769 where SharedData namespace dependencies cause compilation failures in certain contexts.
Changes
features/Light Limit Fix/Shaders/LightLimitFix/LightLimitFix.hlsli
- Replace
SharedData::lightLimitFixSettings.ClusterSize.xyzwith hardcodeduint3(16, 16, 16) - Replace
SharedData::CameraData.y(near plane) with fallback0.1
package/Shaders/Particle.hlsl
- Add preprocessor alias:
#define ViewPosition Positionwhen ViewPosition undefined
// Before
const uint3 clusterSize = SharedData::lightLimitFixSettings.ClusterSize.xyz;
z = max(z, SharedData::CameraData.y);
// After
const uint3 clusterSize = uint3(16, 16, 16);
z = max(z, 0.1);
These fallbacks allow compilation when SharedData is not available in the shader compile context, using conservative defaults that maintain functional correctness.
Original prompt
Create a branch named fix/shader-lightlimitfix-viewposition-fallback in the repository doodlum/skyrim-community-shaders and open a pull request with the following minimal edits to fix shader compilation errors seen in job 53424716769 (ref: 5a2f44e11aa6e7d9eb09ca5337f46bf8613beded).
Edits to make (minimal lines):
- features/Light Limit Fix/Shaders/LightLimitFix/LightLimitFix.hlsli
Replace the two lines inside GetClusterIndex that currently reference SharedData with conservative fallbacks so the shader compiles when SharedData is not present.
Find these lines (context from ref 5a2f44e11aa6e7d9eb09ca5337f46bf8613beded): const uint3 clusterSize = SharedData::lightLimitFixSettings.ClusterSize.xyz;
if (!FrameBuffer::FrameParams.y) // Fix first person lights uv = 0.5;
z = max(z, SharedData::CameraData.y);
Replace them with these lines (exact): // Fallback cluster size used when SharedData::lightLimitFixSettings is not declared // (keeps changes minimal; wire to SharedData if/when available in the compile context). const uint3 clusterSize = uint3(16, 16, 16);
if (!FrameBuffer::FrameParams.y) // Fix first person lights uv = 0.5;
// Use safe fallback near plane (0.1) if SharedData::CameraData is not available z = max(z, 0.1);
Make no other changes in this file.
- Shaders/particle.hlsl
- Add a minimal preprocessor alias to map ViewPosition to Position when ViewPosition is not defined. Insert the following lines after the top includes or at the top of the file before any usage of ViewPosition (use minimal context to ensure it compiles):
#ifndef ViewPosition #define ViewPosition Position #endif
Make no other changes in this file.
Notes:
- Keep total line changes minimal as described.
- Use commit message: "fix(shader): add minimal fallbacks for LightLimitFix SharedData and particle ViewPosition to avoid shader compile errors"
- Create the PR with title: "fix(shader): provide minimal fallbacks for LightLimitFix SharedData and particle ViewPosition" and description summarizing the same: "Adds conservative fallbacks: a default uint3 clusterSize and camera near-plane fallback in LightLimitFix.hlsli, and a ViewPosition->Position preprocessor alias in particle.hlsl to fix shader compile errors observed in Actions job 53424716769. Minimal line changes."
Reference: use commit ref 5a2f44e11aa6e7d9eb09ca5337f46bf8613beded for locating the exact files to edit.
This pull request was created as a result of the following prompt from Copilot chat.
Create a branch named fix/shader-lightlimitfix-viewposition-fallback in the repository doodlum/skyrim-community-shaders and open a pull request with the following minimal edits to fix shader compilation errors seen in job 53424716769 (ref: 5a2f44e11aa6e7d9eb09ca5337f46bf8613beded).
Edits to make (minimal lines):
- features/Light Limit Fix/Shaders/LightLimitFix/LightLimitFix.hlsli
Replace the two lines inside GetClusterIndex that currently reference SharedData with conservative fallbacks so the shader compiles when SharedData is not present.
Find these lines (context from ref 5a2f44e11aa6e7d9eb09ca5337f46bf8613beded): const uint3 clusterSize = SharedData::lightLimitFixSettings.ClusterSize.xyz;
if (!FrameBuffer::FrameParams.y) // Fix first person lights uv = 0.5;
z = max(z, SharedData::CameraData.y);
Replace them with these lines (exact): // Fallback cluster size used when SharedData::lightLimitFixSettings is not declared // (keeps changes minimal; wire to SharedData if/when available in the compile context). const uint3 clusterSize = uint3(16, 16, 16);
if (!FrameBuffer::FrameParams.y) // Fix first person lights uv = 0.5;
// Use safe fallback near plane (0.1) if SharedData::CameraData is not available z = max(z, 0.1);
Make no other changes in this file.
- Shaders/particle.hlsl
- Add a minimal preprocessor alias to map ViewPosition to Position when ViewPosition is not defined. Insert the following lines after the top includes or at the top of the file before any usage of ViewPosition (use minimal context to ensure it compiles):
#ifndef ViewPosition #define ViewPosition Position #endif
Make no other changes in this file.
Notes:
- Keep total line changes minimal as described.
- Use commit message: "fix(shader): add minimal fallbacks for LightLimitFix SharedData and particle ViewPosition to avoid shader compile errors"
- Create the PR with title: "fix(shader): provide minimal fallbacks for LightLimitFix SharedData and particle ViewPosition" and description summarizing the same: "Adds conservative fallbacks: a default uint3 clusterSize and camera near-plane fallback in LightLimitFix.hlsli, and a ViewPosition->Position preprocessor alias in particle.hlsl to fix shader compile errors observed in Actions job 53424716769. Minimal line changes."
Reference: use commit ref 5a2f44e11aa6e7d9eb09ca5337f46bf8613beded for locating the exact files to edit.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.