Skip to content

Commit c10d599

Browse files
JulienIgnace-UnityEvergreen
authored andcommitted
Fixed a warning in Lens flare shader for URP
Fixed a warning in Lens flare shader for URP
1 parent fcc6b5a commit c10d599

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/Shaders/LensFlareCommon.hlsl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,16 @@ float GetLinearDepthValue(float2 uv)
164164
depth = LOAD_TEXTURE2D_X_LOD(_CameraDepthTexture, uint2(uv * GetScaledScreenParams().xy), 0).x;
165165

166166
if (_ViewId >= 0)
167-
depth = LOAD_TEXTURE2D_ARRAY_LOD(_CameraDepthTexture, uint2(uv * GetScaledScreenParams().xy), _ViewId, 0).x;
167+
{
168+
#if defined(DISABLE_TEXTURE2D_X_ARRAY)
169+
// This should never happen in theory since _ViewId can only be >= 0 IF xr is enabled and so DISABLE_TEXTURE2D_X_ARRAY is disabled.
170+
// We just have to manage the DISABLE_TEXTURE2D_X_ARRAY variant here for avoiding warnings.
171+
// HDRP does not need this because it never uses DISABLE_TEXTURE2D_X_ARRAY.
172+
depth = LOAD_TEXTURE2D_LOD(_CameraDepthTexture, int2(uv * GetScaledScreenParams().xy), 0).x;
173+
#else
174+
depth = LOAD_TEXTURE2D_ARRAY_LOD(_CameraDepthTexture, int2(uv * GetScaledScreenParams().xy), _ViewId, 0).x;
175+
#endif
176+
}
168177
else
169178
depth = LOAD_TEXTURE2D_X_LOD(_CameraDepthTexture, uint2(uv * GetScaledScreenParams().xy), 0).x;
170179

0 commit comments

Comments
 (0)