Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit b44a621

Browse files
committed
Get context width/height from XR eye texture (when XR is active)
This handles the double-wide issue for temporary RTs in stereo. We still need to accomodate: * Stereo render target arraus * Shaders that need to know the per-eye texture size
1 parent bb6a5d3 commit b44a621

1 file changed

Lines changed: 36 additions & 4 deletions

File tree

PostProcessing/Runtime/PostProcessRenderContext.cs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,34 @@ public sealed class PostProcessRenderContext
77
// The following should be filled by the render pipeline
88

99
// Camera currently rendering
10-
public Camera camera { get; set; }
10+
private Camera m_camera;
11+
public Camera camera
12+
{
13+
get
14+
{
15+
return this.m_camera;
16+
}
17+
18+
set
19+
{
20+
this.m_camera = value;
21+
22+
if (XR.XRSettings.isDeviceActive)
23+
{
24+
RenderTextureDescriptor xrDesc = XR.XRSettings.eyeTextureDesc;
25+
m_width = xrDesc.width;
26+
m_height = xrDesc.height;
27+
// we should create eye-specific params
28+
// in order to support knowing the size of each eye
29+
}
30+
else
31+
{
32+
m_width = m_camera.pixelWidth;
33+
m_height = m_camera.pixelHeight;
34+
}
35+
}
36+
}
37+
1138

1239
// The command buffer to fill in
1340
public CommandBuffer command { get; set; }
@@ -41,15 +68,17 @@ public sealed class PostProcessRenderContext
4168
public object userData { get; set; }
4269

4370
// Current camera width in pixels
71+
private int m_width;
4472
public int width
4573
{
46-
get { return camera.pixelWidth; }
74+
get { return m_width; }
4775
}
4876

4977
// Current camera height in pixels
78+
private int m_height;
5079
public int height
5180
{
52-
get { return camera.pixelHeight; }
81+
get { return m_height; }
5382
}
5483

5584
// Are we currently rendering in the scene view?
@@ -64,7 +93,10 @@ public int height
6493

6594
public void Reset()
6695
{
67-
camera = null;
96+
m_camera = null;
97+
m_width = 0;
98+
m_height = 0;
99+
68100
command = null;
69101
source = 0;
70102
destination = 0;

0 commit comments

Comments
 (0)