Skip to content

Commit

Permalink
Fix flood warning when combining XR with cinemachine brain
Browse files Browse the repository at this point in the history
case 1074030 is having issues of flood wanrings complaining about cinemachine brain conflicting with xr camera.
This is due to ShouldUseVRFieldOfView() returning true in Camera::SetVerticalFieldOfView because we have a vr device.
URP 10.0.0 fixed this using #22 by setting disableLegacyRenderer to true
to force a VRDeviceToXRDisplaySetup::TeardownShimFuncs(*this);. This is so there's no function override left in
the shim table when calling UninstallVRDeviceShims from ProcessPendingTextureRequestsSynchronized which will finally
call ShimTeardownIfActive(); to finally reset completely the legacy render device s_LegacyDevice = NULL;.which allows
ShouldUseVRFieldOfView() to return false and therefore not throw a warning in Camera::SetVerticalFieldOfView.
  • Loading branch information
fcoulombe committed Oct 27, 2021
1 parent b7a6c67 commit b7b6ebb
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,16 @@ internal void SetupXRStates()
throw new NotImplementedException("Only 1 XR display is supported.");

XRDisplaySubsystem display = xrDisplayList[0];
if(display.GetRenderPassCount() == 0)
// case 1074030 is having issues of flood wanrings complaining about cinemachine brain conflicting with xr camera.
// This is due to ShouldUseVRFieldOfView() returning true in Camera::SetVerticalFieldOfView because we have a vr device.
// URP 10.0.0 fixed this using https://github.com/Unity-Technologies/Graphics/pull/22 by setting disableLegacyRenderer to true
// to force a VRDeviceToXRDisplaySetup::TeardownShimFuncs(*this);. This is so there's no function override left in
// the shim table when calling UninstallVRDeviceShims from ProcessPendingTextureRequestsSynchronized which will finally
// call ShimTeardownIfActive(); to finally reset completely the legacy render device s_LegacyDevice = NULL;.which allows
// ShouldUseVRFieldOfView() to return false and therefore not throw a warning in Camera::SetVerticalFieldOfView.
display.disableLegacyRenderer = true;

if (display.GetRenderPassCount() == 0)
{
// Disable XR rendering if display contains 0 renderpass
if(!xrSkipRender)
Expand Down

0 comments on commit b7b6ebb

Please sign in to comment.