Skip to content

Commit df6ac0f

Browse files
author
Evergreen
committed
[Port] [6000.0] [XR] Fix missing unity_StereoEyeIndex constant in URP Multi-pass, needed for stereoscopic panoramic skyboxes
1 parent 0835190 commit df6ac0f

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

Packages/com.unity.render-pipelines.core/Runtime/XR/XRBuiltinShaderConstants.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public static class XRBuiltinShaderConstants
5252
/// </summary>
5353
static public readonly int unity_StereoWorldSpaceCameraPos = Shader.PropertyToID("unity_StereoWorldSpaceCameraPos");
5454

55+
/// <summary>
56+
/// Cached unique id for unity_StereoEyeIndex
57+
/// </summary>
58+
static public readonly int unity_StereoEyeIndex = Shader.PropertyToID("unity_StereoEyeIndex");
59+
5560
// Pre-allocate arrays to avoid GC
5661
static Matrix4x4[] s_cameraProjMatrix = new Matrix4x4[2];
5762
static Matrix4x4[] s_invCameraProjMatrix = new Matrix4x4[2];

Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ void SetPerCameraShaderVariables(RasterCommandBuffer cmd, UniversalCameraData ca
292292
cameraHeight = (float)cameraTargetSizeCopy.y;
293293

294294
useRenderPassEnabled = false;
295+
296+
// Multi-pass needs to set unity_StereoEyeIndex builtin param for skybox-panoramic.shader to work correctly (UUM-120719)
297+
if (!cameraData.xr.singlePassEnabled)
298+
cmd.SetGlobalVector(XRBuiltinShaderConstants.unity_StereoEyeIndex, new Vector4(cameraData.xr.multipassId, 0, 0, 0));
295299
}
296300

297301
if (camera.allowDynamicResolution)

0 commit comments

Comments
 (0)