Skip to content

UniversalRendererData GUID fix #5410

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

Merged
merged 20 commits into from
Aug 30, 2021
Merged

UniversalRendererData GUID fix #5410

merged 20 commits into from
Aug 30, 2021

Conversation

Verasl
Copy link
Contributor

@Verasl Verasl commented Aug 19, 2021

Purpose of this PR

When we changed the ForwardRendererData to be a UniversalRendererData we did not preserve the original GUID, at the time an upgrader was made to convert older ForwardRendererData assets into the new UniversalRendererData scriptable objects.
Recently it has been discovered that this upgrader has some issues and is not 100% reliable due to various reasons, in this PR we are reverting the GUID back to the original GUID that the file had in 21.1 and earlier.

What this means is that anyone coming from 21.1 or earlier will not notice any difference, and the asset will not need to go through any upgrade path.
What this does mean is any projects that has been opened in the Unity 2021.2 Alpha/Beta and have gone through the existing upgrade path for ForwardRendererData files, will have an incorrect GUID.

In this PR there is also an upgrader for these 21.2 Alpha/Beta projects, this means that users coming from LTS and public release versions of Unity have the safe path and the potentially less safe path is now only affecting Alpha/Beta projects.


Testing status

Describe what manual/automated tests were performed for this PR


Comments to reviewers

Notes for the reviewers you have assigned.

@github-actions
Copy link

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

URP
/.yamato%252Fall-urp.yml%2523PR_URP_2021.2

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

Copy link
Contributor

@ellioman ellioman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
We have to remember to create another PR right after this one to update all the renderers in the URP Test projects.

Comment on lines +44 to +56
// Core blitter shaders, adapted from HDRP
// TODO: move to core and share with HDRP
[Reload("Shaders/Utils/CoreBlit.shader"), SerializeField]
internal Shader coreBlitPS;
[Reload("Shaders/Utils/CoreBlitColorAndDepth.shader"), SerializeField]
internal Shader coreBlitColorAndDepthPS;


[Reload("Shaders/CameraMotionVectors.shader")]
public Shader cameraMotionVector;

[Reload("Shaders/ObjectMotionVectors.shader")]
public Shader objectMotionVector;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these added
And do you have a JIRA for that TODO:?

Copy link
Contributor Author

@Verasl Verasl Aug 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are copied as is from the UniversalRendererData.cs to make sure we don’t loose any user data as the existing UniversalRenderDatas will briefly become ForwardRendererDatas.

Comment on lines +68 to +76
[SerializeField] LayerMask m_OpaqueLayerMask;
[SerializeField] LayerMask m_TransparentLayerMask;
[SerializeField] StencilStateData m_DefaultStencilState; // This default state is compatible with deferred renderer.
[SerializeField] bool m_ShadowTransparentReceive;
[SerializeField] RenderingMode m_RenderingMode;
[SerializeField] DepthPrimingMode m_DepthPrimingMode; // Default disabled because there are some outstanding issues with Text Mesh rendering.
[SerializeField] bool m_AccurateGbufferNormals;
[SerializeField] bool m_ClusteredRendering;
[SerializeField] TileSize m_TileSize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you adding these properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the reason above, these have to be there to be copied over to the new serialized object, this was partially why before the conversion process didn’t retain any data set on the ForwardRenderer, now this list also needs to contain properties that are new to the UniversalRendererData.
This file should only be needed for a brief time, since it is only needed for those taking Alpha/Beta 21.2 projects forward, I imagine we will be able to remove this upgrader in Unity 2022 lifecycle.

@erikabar erikabar self-requested a review August 23, 2021 08:14
Copy link
Contributor

@erikabar erikabar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with https://github.com/Unity-Technologies/URP-validation-project:

  • if the renderers have been upgraded so the m_Script GUID is: de640fe3d0db1804a85f9fc8f5cadab6
  • Has any data been lost, like m_RenderingMode, LayerMasks - I went through all URP assets and renderers, checked settings and confirmed no data was lost; also all scenes were rendering as expected
  • Tested with/without Library folder
  • Tested if reopening and reimporting project doesn’t break anything
  • Tested 2021.2.0a19 > 2022.1.0a5.673
  • Tested if upgrading from older version still works (2019.4 > 2022.1.0a5.673)

…es and added an additional warning after all upgrades to recommend user to save project
Copy link
Contributor

@cinight cinight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good now.
Tested with a project which is already upgraded with the old upgrader, also checked a bit with UniversalRenderingExamples which is upgraded with the new upgrader. The upgrade works fine and is having a better warning message in console now.

@Verasl Verasl marked this pull request as ready for review August 24, 2021 07:41
@Verasl Verasl requested review from a team as code owners August 24, 2021 07:41
@Verasl Verasl merged commit 09d5620 into master Aug 30, 2021
@Verasl Verasl deleted the universal/renderer-guid-fix branch August 30, 2021 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants