Skip to content

Commit d0b5952

Browse files
committed
Storing the current eye id in the context so that we can use it in autoexposure.
1 parent ff89028 commit d0b5952

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

com.unity.postprocessing/PostProcessing/Runtime/Effects/AutoExposure.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void CheckTexture(int eye, int id)
122122
public override void Render(PostProcessRenderContext context)
123123
{
124124
// multi pass and singlepass only has a single eye
125-
int eye = (context.numberOfEyes>1) ? context.xrActiveEye : 0;
125+
int eye = context.currentEye;
126126
var cmd = context.command;
127127
cmd.BeginSample("AutoExposureLookup");
128128

com.unity.postprocessing/PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,7 @@ int RenderBuiltins(PostProcessRenderContext context, bool isFinalPass, int relea
11821182
context.uberSheet = uberSheet;
11831183
context.autoExposureTexture = RuntimeUtilities.whiteTexture;
11841184
context.bloomBufferNameID = -1;
1185+
context.currentEye = eye;
11851186

11861187
if (isFinalPass && context.stereoActive && context.stereoRenderingMode == PostProcessRenderContext.StereoRenderingMode.SinglePassInstanced)
11871188
uberSheet.EnableKeyword("STEREO_INSTANCING_ENABLED");

com.unity.postprocessing/PostProcessing/Runtime/PostProcessRenderContext.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ public Camera camera
144144
/// </summary>
145145
public int xrActiveEye { get; private set; }
146146

147+
/// <summary>
148+
/// The xrActiveEye is not necessarily the right eye id depending which mode we're running on.
149+
/// The renderbuiltin function receives an eye id. This eye id gets stored here during the current
150+
/// eye.
151+
/// </summary>
152+
internal int currentEye = 0;
153+
147154
/// <summary>
148155
/// The number of eyes for XR outputs.
149156
/// </summary>

0 commit comments

Comments
 (0)