Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x.x] Pure URP XRSDK #22

Merged
merged 125 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
39946af
* PureXRSDK V2: Added basic XR System and XR System Assets.
thomas-zeng Mar 17, 2020
27ee0dc
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
thomas-zeng Mar 18, 2020
491586d
* Set isStereoEnabled after xrPass is configured.
thomas-zeng Mar 18, 2020
330590c
* Added target dimension support to render pass.
thomas-zeng Mar 19, 2020
c4b5830
* Add shader macro to blit.shader to support procedure draw blit.
thomas-zeng Mar 19, 2020
032e79e
* Applied shader changes to postFX v3
thomas-zeng Mar 23, 2020
5bbda81
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
thomas-zeng Mar 23, 2020
52eb3b2
Fixed typo.
thomas-zeng Mar 24, 2020
f19a8bd
* Added support to mirror view to target texture.
thomas-zeng Mar 24, 2020
c1619ac
* Small fixes for multipass shadow and hdr.
thomas-zeng Mar 24, 2020
e1bac74
* Fixed postFX XR sRGB logic. m_EnableSRGBConversionIfNeeded logic is…
thomas-zeng Mar 26, 2020
1a1cb58
add XR automated tests
fabien-unity Mar 27, 2020
bab2984
fix DepthOnlyPass with XR single-pass
fabien-unity Mar 27, 2020
b6127b5
remove public from XRSystem, fix load/store for texarray, remove xrPa…
fabien-unity Mar 27, 2020
65105ef
fix null access
fabien-unity Mar 27, 2020
a069ad1
* Fixed sRGB logic.
thomas-zeng Mar 27, 2020
85c1872
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
thomas-zeng Mar 27, 2020
1545dd3
Merge branch 'master' of https://github.com/Unity-Technologies/Script…
thomas-zeng Mar 27, 2020
d76c138
remove GC allocations from XR code
fabien-unity Mar 30, 2020
e60aeed
fix vignette in XR single-pass
fabien-unity Mar 30, 2020
bf9c528
rename xrPass in CameraData to xr for consistency with HDRP
fabien-unity Mar 30, 2020
991c105
remove legacy VR code from XRSystem and XRPass
fabien-unity Mar 30, 2020
86bf968
fix autotests logic with render texture
fabien-unity Mar 30, 2020
66f6437
fix first frame settings with XR SDK
fabien-unity Apr 1, 2020
43c8fe6
* Added todo comment for asset pipeline controlled stereo mode.
thomas-zeng Apr 1, 2020
6ed87ad
* Fixed 069_2D_Forward_Shader_Compatibility_Forward
thomas-zeng Apr 1, 2020
bf8c066
* Fixed custom particle data shader not compatible with XR.
thomas-zeng Apr 2, 2020
3c57721
* Fixed formatting.
thomas-zeng Apr 2, 2020
64955e4
move XRSystemData to internal instead of public
fabien-unity Apr 2, 2020
c655c2d
remove unused GlobalXRSettings
fabien-unity Apr 2, 2020
54cf1f2
add missing meta folders
fabien-unity Apr 2, 2020
1cbccfd
tag deprecated code and remove redundant isStereoEnabled
fabien-unity Apr 2, 2020
a5178d6
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
thomas-zeng Apr 2, 2020
89ef74b
restore public field isStereoEnabled and tag it as obsolete
fabien-unity Apr 2, 2020
bf5e3bf
remove usage of UNITY_SINGLE_PASS_STEREO
fabien-unity Apr 2, 2020
c63bfb1
fix multipass and remove renderPass.eyeIndex
fabien-unity Apr 2, 2020
783ff92
removed extra [Obsolete] failing build
fabien-unity Apr 2, 2020
351f065
* Added XR support to copy color pass.
thomas-zeng Apr 2, 2020
0695b5c
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
thomas-zeng Apr 2, 2020
ff9c6a8
* Fixed 046_Camera_OpaqueTexture not working in XR.
thomas-zeng Apr 2, 2020
2f7aef9
fix blit shader with standalone build
fabien-unity Apr 2, 2020
4bf4a07
fix mirror view in standalone
fabien-unity Apr 2, 2020
2bcb186
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
fabien-unity Apr 2, 2020
846a593
fix xr system data
fabien-unity Apr 2, 2020
7a42909
fix shader from test 046 for XR
fabien-unity Apr 2, 2020
99eb58e
fix material from test 127 for XR
fabien-unity Apr 2, 2020
71eae01
* Fixed case in forward renderer where extra final blit is used.
thomas-zeng Apr 2, 2020
0f01139
fix multiview, remove extra dimension parameters, move xr autotest bl…
fabien-unity Apr 6, 2020
a36ed0a
remove BLIT_SINGLE_SLICE from blit.shader
fabien-unity Apr 6, 2020
5647b74
use DeclareOpaqueTexture.hlsl
fabien-unity Apr 6, 2020
97c01a3
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
thomas-zeng Apr 6, 2020
67d4d0d
Merge branch 'urp/xr/fix-unit-tests' of https://github.com/Unity-Tech…
thomas-zeng Apr 6, 2020
c314433
* Added Occlusion Mesh support to pure URP XRSDK.
thomas-zeng Apr 7, 2020
7feff00
remove dead code
fabien-unity Apr 8, 2020
8717083
fix transparents and skybox with multipass
fabien-unity Apr 8, 2020
3466274
remove redundant obsolete keyword
fabien-unity Apr 8, 2020
4ddce3b
add support to debug XR tests directly in editor
fabien-unity Apr 8, 2020
2599dbc
* Fixed XR occlusion pass not working in SPI mode.
thomas-zeng Apr 8, 2020
ef90a38
* ConfigureTarget in forward renderer need to match occlusion pass's …
thomas-zeng Apr 8, 2020
c4dfe18
move XRPass loop one level up to make it compatible with camera stacking
fabien-unity Apr 8, 2020
beee0bb
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
thomas-zeng Apr 8, 2020
22281e4
* Fixed y-flip when opaque texture is not being used.
thomas-zeng Apr 9, 2020
c74efbf
disable incompatible XR tests
fabien-unity Apr 9, 2020
0e99ecb
* Removed mount/unmount functions.
thomas-zeng Apr 9, 2020
d4c8ad9
cleanup postfx changes
fabien-unity Apr 9, 2020
04b69b0
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 9, 2020
df1dfa6
Merge branch 'urp/xr/pure-xrsdk-disable-tests' into urp/xr/pure-xrsdk
fabien-unity Apr 9, 2020
2a2dc8b
rename xrCompatible
fabien-unity Apr 9, 2020
8bb5518
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
thomas-zeng Apr 9, 2020
0644fdd
fix compile issue with motion blur shader
fabien-unity Apr 9, 2020
2105f09
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
fabien-unity Apr 9, 2020
9487313
fix tests in non-VR
fabien-unity Apr 10, 2020
8bc654b
wrap XR code within #ifdef and fix sRGB issues
fabien-unity Apr 13, 2020
52da112
fix camera stack in XR
fabien-unity Apr 13, 2020
a70c184
refactor code with GetCameraTarget()
fabien-unity Apr 13, 2020
4f304c5
fix subsystem compile error
fabien-unity Apr 13, 2020
295c77f
* Fixed sRGB rendering case: render directly to non-sRGB eye texture …
thomas-zeng Apr 13, 2020
437999b
revert previous change until trunk is fixed
fabien-unity Apr 13, 2020
c09e9db
* Fixed oculus quest msaa auto resolve
thomas-zeng Apr 13, 2020
fd32b19
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
thomas-zeng Apr 13, 2020
1aa2685
* Renamed _BlitTex to _InputTex for PostProcessPass.
thomas-zeng Apr 13, 2020
3429bab
* Fixed final blit shader after postFX renaming.
thomas-zeng Apr 13, 2020
de5a88f
fix post fx
fabien-unity Apr 14, 2020
29d84c0
fix mirror view shader warnings
fabien-unity Apr 14, 2020
fc0657b
fix black screen when RP is not set
fabien-unity Apr 15, 2020
2f3e0ec
* Fixed MSAA.
thomas-zeng Apr 16, 2020
cbd86b4
* Fixed depth only pass for SPI/MV
thomas-zeng Apr 18, 2020
3e055ac
check for valid occlusion mesh before queueing the pass
fabien-unity Apr 20, 2020
ec4e6a1
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 21, 2020
84890a0
workaround for invalid blit params on the Quest with Vulkan
fabien-unity Apr 21, 2020
3862cc0
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 22, 2020
056ef63
use Assume() to skip incompatible XR tests
fabien-unity Apr 22, 2020
712d2dc
use Assert.Ignore instead of Assume.That to not fail test but still s…
fabien-unity Apr 23, 2020
1f410e2
add comment
fabien-unity Apr 23, 2020
75c021e
restore code (will be removed in another PR to limit the scope of thi…
fabien-unity Apr 23, 2020
e617656
remove one comment (task tracked externally)
fabien-unity Apr 23, 2020
78a64eb
* Added workaround code to fix UWPPlayer debug build issue.
thomas-zeng Apr 24, 2020
f6243fd
* Fixed extra space.
thomas-zeng Apr 24, 2020
9b0b990
disable stereo tests until they are compatible with XR SDK
fabien-unity Apr 24, 2020
df946e0
disable vsync on the main display when rendering to a XR device
fabien-unity Apr 24, 2020
a9976f9
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 27, 2020
c412d44
update comments
fabien-unity Apr 27, 2020
8419c22
fix BoxDownsample for XR and refactor fullscreen effects shader code …
fabien-unity Apr 27, 2020
fba03c2
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 27, 2020
5fd1cab
* Reverted UWP debug build workaround as discussed with Mario and Jason
thomas-zeng Apr 27, 2020
68479fa
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
thomas-zeng Apr 29, 2020
63f213e
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 30, 2020
83dcc59
reenable stereo tests
fabien-unity Apr 30, 2020
d2f5a3e
disable new tests incompatible with XR testing solution
fabien-unity Apr 30, 2020
3567fb1
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity Apr 30, 2020
a96ed42
disable XR stereo playmode tests, keep only standalone
fabien-unity May 1, 2020
f5a5e5d
* Added workaround for Quest vsync bug.
thomas-zeng May 1, 2020
4ae6415
update obsolete messages
fabien-unity May 5, 2020
4f141c4
* Address change feedback.
thomas-zeng May 5, 2020
611c59e
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
thomas-zeng May 5, 2020
207255b
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity May 5, 2020
6881f1f
* Address change feedback.
thomas-zeng May 6, 2020
7bc1b63
Merge branch 'urp/xr/pure-xrsdk' of https://github.com/Unity-Technolo…
thomas-zeng May 6, 2020
42a3fbe
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity May 6, 2020
c704092
disable test 118 for XR (due to legacy skybox code)
fabien-unity May 6, 2020
6210ae4
Merge branch 'master' into urp/xr/pure-xrsdk
fabien-unity May 8, 2020
522ff83
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
thomas-zeng May 8, 2020
9838887
* Fixed shim XR being used in deferred.
thomas-zeng May 8, 2020
56ada9b
* Fixed shim XR usage in deferred renderer.
thomas-zeng May 8, 2020
f2a6810
* Disable 019 test for XR as discussed with Dennis.
thomas-zeng May 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .yamato/upm-ci-shadergraph_stereo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ platforms:
testplatforms:
- name: Standalone
args: --suite=playmode --platform=Standalone
- name: playmode
args: --suite=playmode
# - name: playmode
# args: --suite=playmode
- name: editmode
args: --suite=editor --platform=editmode
projects:
Expand Down
2 changes: 2 additions & 0 deletions .yamato/upm-ci-universal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ testplatforms:
args: --suite=playmode --platform=Standalone
- name: playmode
args: --suite=playmode
- name: playmode XR
args: --suite=playmode --extra-editor-arg="-xr-tests"
- name: editmode
args: --suite=editor --platform=editmode
projects:
Expand Down
4 changes: 2 additions & 2 deletions .yamato/upm-ci-universal_stereo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ platforms:
testplatforms:
- name: Standalone
args: --suite=playmode --platform=Standalone
- name: playmode
args: --suite=playmode
# - name: playmode
# args: --suite=playmode
- name: editmode
fabien-unity marked this conversation as resolved.
Show resolved Hide resolved
args: --suite=editor --platform=editmode
projects:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",
"com.unity.test-framework": "1.1.14",
"com.unity.test-framework.build": "0.0.1-preview.12",
"com.unity.test-framework.utp-reporter": "1.0.0-preview",
"com.unity.testframework.graphics": "7.1.13-preview",
"com.unity.test-framework.utp-reporter": "1.0.2-preview",
"com.unity.testframework.graphics": "7.2.0-preview",
"com.unity.ugui": "1.0.0",
"com.unity.xr.mock-hmd": "1.0.1-preview.6",
"com.unity.xr.mock-hmd": "1.0.1-preview.7",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
7 changes: 3 additions & 4 deletions TestProjects/UniversalGfxTestStereo/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",
"com.unity.test-framework": "1.1.14",
"com.unity.test-framework.build": "0.0.1-preview.12",
"com.unity.test-framework.utp-reporter": "1.0.0-preview",
"com.unity.testframework.graphics": "7.1.13-preview",
"com.unity.test-framework.utp-reporter": "1.0.2-preview",
"com.unity.testframework.graphics": "7.2.0-preview",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.1.2",
"com.unity.xr.mock-hmd": "1.0.1-preview.6",
"com.unity.xr.mock-hmd": "1.0.1-preview.7",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/018_xr_Particles_Multiply.unity
guid: dae78502f2e214f498d8e5e4b4adf79d
- enabled: 1
path: Assets/Scenes/019_xr_Particles_AlphaBlend.unity
guid: f5b47e7b559724329bbd9f437a652f52
- enabled: 1
path: Assets/Scenes/020_xr_Lighting_ReflectionProbe.unity
guid: 0feef353efdf045989e9c2b501774338
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ MonoBehaviour:
m_Name: ForwardRenderer
m_EditorClassIdentifier:
m_RendererFeatures: []
m_RendererFeatureMap:
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2}
shaders:
blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3}
copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ MonoBehaviour:
AverageCorrectnessThreshold: 0.001
UseHDR: 0
WaitFrames: 0
XRCompatible: 0
--- !u!81 &971756571
AudioListener:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ MonoBehaviour:
UseBackBuffer: 1
ImageResolution: 4
WaitFrames: 2
XRCompatible: 0
--- !u!114 &763890391
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ MonoBehaviour:
UseBackBuffer: 1
ImageResolution: 4
WaitFrames: 2
XRCompatible: 0
--- !u!20 &1203454921
Camera:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Unlit
m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
m_CustomRenderQueue: 2050
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Texture: {fileID: 8400000, guid: b5fedf867466f754eaa6898d3fea1f05, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
Expand Down Expand Up @@ -75,6 +76,7 @@ Material:
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SampleGI: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
Expand All @@ -83,7 +85,7 @@ Material:
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public class UniversalGraphicsTests

public IEnumerator Run(GraphicsTestCase testCase)
{
// XRTODO: Fix XR tests on macOS or disable them from Yamato directly
if (XRSystem.testModeEnabled && (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer))
Assert.Ignore("Universal XR tests do not run on macOS.");

SceneManager.LoadScene(testCase.ScenePath);

// Always wait one frame for scene load
Expand All @@ -33,6 +37,18 @@ public IEnumerator Run(GraphicsTestCase testCase)
var settings = Object.FindObjectOfType<UniversalGraphicsTestSettings>();
Assert.IsNotNull(settings, "Invalid test scene, couldn't find UniversalGraphicsTestSettings");

if (XRSystem.testModeEnabled)
{
if (settings.XRCompatible)
{
XRSystem.automatedTestRunning = true;
}
else
{
Assert.Ignore("Test scene is not compatible with XR and will be skipped.");
}
}

Scene scene = SceneManager.GetActiveScene();

yield return null;
Expand Down Expand Up @@ -90,5 +106,11 @@ public void DumpImagesInEditor()
{
UnityEditor.TestTools.Graphics.ResultsUtility.ExtractImagesFromTestProperties(TestContext.CurrentContext.Test);
}

[TearDown]
public void ResetSystemState()
{
XRSystem.automatedTestRunning = false;
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class Styles
// Quality
public static GUIContent hdrText = EditorGUIUtility.TrTextContent("HDR", "Controls the global HDR settings.");
public static GUIContent msaaText = EditorGUIUtility.TrTextContent("Anti Aliasing (MSAA)", "Controls the global anti aliasing settings.");
public static GUIContent renderScaleText = EditorGUIUtility.TrTextContent("Render Scale", "Scales the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution. When VR is enabled, this is overridden by XRSettings.");
public static GUIContent renderScaleText = EditorGUIUtility.TrTextContent("Render Scale", "Scales the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution.");

// Main light
public static GUIContent mainLightRenderingModeText = EditorGUIUtility.TrTextContent("Main Light", "Main light is the brightest directional light.");
Expand Down Expand Up @@ -244,9 +244,7 @@ void DrawQualitySettings()
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_HDR, Styles.hdrText);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaText);
EditorGUI.BeginDisabledGroup(XRGraphics.enabled);
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleText, m_RenderScale.floatValue, UniversalRenderPipeline.minRenderScale, UniversalRenderPipeline.maxRenderScale);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.Space();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void UpdateAnimationValues(bool initialize)
{
SetAnimationTarget(m_ShowBGColorAnim, initialize, isSameClearFlags && (camera.clearFlags == CameraClearFlags.SolidColor || camera.clearFlags == CameraClearFlags.Skybox));
SetAnimationTarget(m_ShowOrthoAnim, initialize, isSameOrthographic && camera.orthographic);
SetAnimationTarget(m_ShowTargetEyeAnim, initialize, settings.targetEye.intValue != (int)StereoTargetEyeMask.Both || XRGraphics.tryEnable);
SetAnimationTarget(m_ShowTargetEyeAnim, initialize, settings.targetEye.intValue != (int)StereoTargetEyeMask.Both);
}

void UpdateCameraTypeIntPopupData()
Expand Down Expand Up @@ -476,16 +476,6 @@ void DrawStackSettings()
return;
}

// TODO: Warn when MultiPass is active and enabled so we show in the UI camera stacking is not supported.
// Seems like the stereo rendering mode only changes in playmode. Check the reason so we can enable this check.
//#if ENABLE_VR
// if (UnityEngine.XR.XRSettings.stereoRenderingMode == UnityEngine.XR.XRSettings.StereoRenderingMode.MultiPass)
// {
// EditorGUILayout.HelpBox("Camera Stacking is not supported in Multi Pass stereo mode. Only Base camera will render.", MessageType.Warning);
// return;
// }
//#endif

if (m_StackSettingsFoldout.value)
{
m_LayerList.DoLayoutList();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 307a736764ebbce44b54d72f8467b6fd, type: 3}
m_Name: XRSystemData
m_EditorClassIdentifier:
shaders:
xrOcclusionMeshPS: {fileID: 4800000, guid: 4431b1f1f743fbf4eb310a967890cbea, type: 3}
xrMirrorViewPS: {fileID: 4800000, guid: d5a307c014552314b9f560906d708772, type: 3}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions com.unity.render-pipelines.universal/Runtime/Data/XRSystemData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.ProjectWindowCallback;
#endif
using System;

namespace UnityEngine.Rendering.Universal
{
[Serializable]
public class XRSystemData : ScriptableObject
{
#if UNITY_EDITOR
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1812")]
internal class CreateXRSystemDataAsset : EndNameEditAction
{
public override void Action(int instanceId, string pathName, string resourceFile)
{
var instance = CreateInstance<XRSystemData>();
AssetDatabase.CreateAsset(instance, pathName);
ResourceReloader.ReloadAllNullIn(instance, UniversalRenderPipelineAsset.packagePath);
Selection.activeObject = instance;
}
}

[MenuItem("Assets/Create/Rendering/Universal Render Pipeline/XR System Data", priority = CoreUtils.assetCreateMenuPriority3)]
static void CreateXRSystemData()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateXRSystemDataAsset>(), "CustomXRSystemData.asset", null, null);
}
#endif

[Serializable, ReloadGroup]
public sealed class ShaderResources
{
[Reload("Shaders/XR/XROcclusionMesh.shader")]
public Shader xrOcclusionMeshPS;

[Reload("Shaders/XR/XRMirrorView.shader")]
public Shader xrMirrorViewPS;
}

public ShaderResources shaders;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions com.unity.render-pipelines.universal/Runtime/DeferredLights.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,8 @@ void SetupMatrixConstants(CommandBuffer cmd, ref RenderingData renderingData)
Matrix4x4 proj;
Matrix4x4 view;

if (renderingData.cameraData.isXRMultipass)
{
//Camera.StereoscopicEye eyeIndex = (Camera.StereoscopicEye)renderingData.cameraData.camera.stereoActiveEye; // Always left eye
Camera.StereoscopicEye eyeIndex = (Camera.StereoscopicEye)m_EyeIndex;
proj = renderingData.cameraData.camera.GetStereoProjectionMatrix(eyeIndex);
view = renderingData.cameraData.camera.GetStereoViewMatrix(eyeIndex);
}
else
{
proj = renderingData.cameraData.camera.projectionMatrix;
view = renderingData.cameraData.camera.worldToCameraMatrix;
}
proj = renderingData.cameraData.camera.projectionMatrix;
view = renderingData.cameraData.camera.worldToCameraMatrix;

// When reading back from depth texture, we need to scale back from [0; 1] to [-1; 1] as Unity defaults to for GL clip-space depth convention.
// As well, non-GL platforms render upside-down, we don't need to y-reverse again on GL platforms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re
bool requiresDepthPrepass = cameraData.isSceneViewCamera || m_PreferDepthPrepass || m_DeferredLights.TiledDeferredShading;

// TODO: There's an issue in multiview and depth copy pass. Atm forcing a depth prepass on XR until we have a proper fix.
if (cameraData.isStereoEnabled && cameraData.requiresDepthTexture)
if (cameraData.xr.enabled && cameraData.requiresDepthTexture)
requiresDepthPrepass = true;

// Special path for depth only offscreen cameras. Only write opaques + transparents.
Expand Down Expand Up @@ -220,7 +220,7 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re

// We generate color LUT in the base camera only. This allows us to not break render pass execution for overlay cameras.
bool generateColorGradingLUT = anyPostProcessing && cameraData.renderType == CameraRenderType.Base;
bool isStereoEnabled = cameraData.isStereoEnabled;
bool isStereoEnabled = cameraData.xr.enabled;

bool mainLightShadows = m_MainLightShadowCasterPass.Setup(ref renderingData);
bool additionalLightShadows = m_AdditionalLightsShadowCasterPass.Setup(ref renderingData);
Expand Down