Skip to content

Conversation

RSlysz
Copy link
Contributor

@RSlysz RSlysz commented Sep 2, 2021

Purpose of this PR

MenuItem are not dynamically hideable normally. Here we added this possibility.
For LookDev and RenderGraph, we can find which RP can use them from CoreRP. So there is dedicated rules to them. This is a change from first attempt ([MenuItemForRenderPipeline]). As the attribute is no use right now, it is not in the final version of the PR. (It can still be added later though)

This is a requirement for Quality Audit in order to not have so many state (currently it can be "not here", "here but disabled", "here and enabled")


Testing status

Tested Manually:

  • Persistent through DomainReload (meanings the recomputation give same result)
  • Tested LookDev and RenderGraph both show up in HDRP and not in Universal nor Built-in

Comments to reviewers

  • Also adding missing namespace on the RenderGraphViewer

@RSlysz RSlysz requested a review from alex-vazquez September 2, 2021 17:34
@github-actions
Copy link

github-actions bot commented Sep 2, 2021

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)

SRP Core
You could run ABV on your branch before merging your PR, but it will start A LOT of jobs. Please be responsible about it and run it only when you feel the PR is ready:
/.yamato%252F_abv.yml%2523all_project_ci_trunk
Be aware that any modifications to the Core package impacts everyone in the Graphics repo so please discuss the PR with your lead.

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

@alex-vazquez alex-vazquez left a comment

Choose a reason for hiding this comment

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

Minor comments, I think we should use the Pipeline instead of the Asset though.

Comment on lines 152 to 153
this.renderPipelineAssetTypes = renderPipelineAssetTypes
.Select(rpat => rpat != null ? rpat : typeof(RenderPipelineAsset)).ToArray();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should throw an exception if the typeof is null or if the typeof is RenderPipelineAsset. This will mean invalid data. I think attribute must only be used to specify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only to support case where we want something only in builtin. Builtin is null (render pipeline asset used) but null cannot be used as a key

public readonly int priority;
public readonly bool validate;

public MenuItemForRenderPipeline(string path, bool validate = false, int priority = 0, params Type[] renderPipelineAssetTypes)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure we want the asset and not the pipeline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Jenny seamed to say that the only thing we are certain at editor start is GraphicsSettings.currentRenderPipeline which is the Asset. Did I miss something @jenniferd-unity ? I would also prefer checking the RenderPipeline and not the asset if possible

@@ -1,690 +1,691 @@
using UnityEngine;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file from this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes sorry I added missing name space here.
Only modification is that I remove the menu item for the RenderGraphWindow

RSlysz and others added 5 commits September 2, 2021 22:15
Co-authored-by: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com>
Co-authored-by: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com>
Co-authored-by: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com>
@RSlysz
Copy link
Contributor Author

RSlysz commented Sep 2, 2021

@alex-vazquez Did you do any test for other attributes somewhere? I think I perhaps need to add some for this one. (I dunno exactly how)

@RSlysz RSlysz marked this pull request as ready for review September 3, 2021 13:30
Copy link
Contributor

@jenniferd-unity jenniferd-unity left a comment

Choose a reason for hiding this comment

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

See my comments about InitializeOnLoad and not being able to know which SRP is going to be used for rendering.


// Note: GraphicsSettings.currentRenderPipeline == null possible and should mean built-in
// though we cannot use null as key so it was early replaced by typeof(RenderPipelineAsset)
Type currentSRPType = GraphicsSettings.currentRenderPipeline?.GetType() ?? typeof(RenderPipelineAsset);
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use RenderPipelineManager.currentPipeline if you want the RenderPipeline type (our APIs are very confusing I know).
The problem I can see here is that this can be called from a InitializeOnLoad where we cannot guarantee that the ADB is ready - which means we cannot guarantee accessibility to the SRP asset of the current Quality level.
So I guess your solution works in some circumstances but not all. We definitely need to push for a callback to guarantee those scenarios. (OnAssetDatabaseReady?)

We know from CoreRP if they can or cannot be used.
Also cleaning code
@RSlysz RSlysz changed the title [Quality Audit] Make MenuItem dynamically hiddeable for LookDev and RenderGraphWindow [Quality Audit] Make MenuItem dynamically hiddeable for LookDev and RenderGraphWindow [OnHold] Sep 7, 2021
Copy link
Contributor

@alex-vazquez alex-vazquez left a comment

Choose a reason for hiding this comment

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

Use the MenuManager :)

@jenniferd-unity jenniferd-unity removed their request for review September 15, 2021 09:01
@RSlysz RSlysz removed the request for review from JulienIgnace-Unity February 25, 2022 11:00
@RSlysz
Copy link
Contributor Author

RSlysz commented Feb 25, 2022

Update: This PR is OnHold and will remain as we still don't have a good lifecycle for render pipeline nd this is required to land it. Removing remaining reviewer.

@RSlysz
Copy link
Contributor Author

RSlysz commented Apr 22, 2022

Closing the PR for now

@RSlysz RSlysz closed this Apr 22, 2022
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.

3 participants