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

Dynamic Resolution Tests #3579

Merged
merged 11 commits into from
Feb 25, 2021
Merged

Dynamic Resolution Tests #3579

merged 11 commits into from
Feb 25, 2021

Conversation

kecho
Copy link
Contributor

@kecho kecho commented Feb 19, 2021

Purpose of this PR

  • Adding new dynamic resolution tests, for software and hardware on all platforms.
  • DRS can now run on render to texture cameras.
  • Adding new callback for CustomPostProcess pass. This callback is required since we change the filter mid frame. Its the only possible way I found to set the filter on a per camera basis.

image

Comments to reviewers

This PR includes a new callback in the CustomPass. If we dont wan't to expose this, please provide feedback on other possible ways we could change the filter mid frame.
Another possibility as well is to create 8 separate tests, and keep the filter on a per frame basis (not per camera basis). This however would add 8 new tests.

@@ -0,0 +1,15 @@
using System;

namespace UnityEngine.Rendering.HighDefinition
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add proper docs here, if you guys agree on this callback arguements / naming

@kecho kecho marked this pull request as draft February 20, 2021 02:44
@Unity-Technologies Unity-Technologies deleted a comment from github-actions bot Feb 20, 2021
@sebastienlagarde sebastienlagarde requested a review from a team February 22, 2021 13:44
@@ -213,7 +213,7 @@ internal void ExecuteInternal(RenderGraph renderGraph, HDCamera hdCamera, Cullin
this.owner = owner;
this.currentRenderTarget = targets;
this.currentHDCamera = hdCamera;

OnRenderEvent(new CustomPassRenderEventContext() { hdCamera = hdCamera, eventType = CustomPassRenderEventContext.EventType.OnExecute });
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding @alelievr for review on adding callback in custom pass

Copy link
Member

Choose a reason for hiding this comment

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

@kecho I'm not sure to see why we need to add another user callback for such case, there is already the Execute() function of the custom pass that should be enough.

Additionally, your callback is outside of the render graph, so I'm really not sure when it would be executed.

Also, I don't understand the purpose of the enum CustomPassRenderEventContext.EventType. We already have the injection point available in the custom pass API: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@10.3/api/UnityEngine.Rendering.HighDefinition.CustomPass.html#UnityEngine_Rendering_HighDefinition_CustomPass_injectionPoint

Copy link
Contributor Author

@kecho kecho Feb 22, 2021

Choose a reason for hiding this comment

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

Hey @alelievr , the problem with Execute is that it happens too late. It happens in the execution of the render graph itself. I need a callback that happens during render graph construction, in fact something before we construct the render graph for the bound camera. I thought having some sort of 'event' hook would make it easy to add other injection points later if needed to, like a bookmark system.
I need a callback that ticks once per camera, before performing any rendering / render graphing. This tick must happen during render graph construction, prior to running the render graph.
I need to specify a new upsampling filter per camera, and this must happen before render graph execution, otherwise its too late.

Essentially I need the equivalent of a PreRender. Another thing I could do is add custom events to the hdCamera itself, and have a way of calling PreRender from the hdCamera. Let me know what you recommend. Maybe I shoudlnt be using the custom pass system? I couldnt find anything else that would allow me to run some function once per camera. Let me know your thoughts

Copy link
Member

@alelievr alelievr Feb 22, 2021

Choose a reason for hiding this comment

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

Okay, so indeed, in that case, we don't have yet an API that provides access during the construction of the render graph. We still have the plan to expose such API when we'll move the custom passes to render graph (with full API on the user side).

So right now, I'd say that it's better to not expose the API you added because we won't be able to remove it before the replacement lands (if it's public, it needs to be documented and kept alive for migration purposes during multiple major versions :/ )

Just to make sure, right now this callback is only used during our tests? If that's the case, we can either make it internal and then replace it with a proper API when it lands. Or you can use the This callback:
https://docs.unity3d.com/ScriptReference/Rendering.RenderPipelineManager-beginCameraRendering.html

It's called at the very beginning of the frame before the culling, would this work for you?

Copy link
Contributor

@sebastienlagarde sebastienlagarde Feb 22, 2021

Choose a reason for hiding this comment

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

I need a callback that ticks once per camera, before performing any rendering / render graphing.

We have BeginCameraRendering (https://docs.unity3d.com/2021.1/Documentation/ScriptReference/Rendering.RenderPipeline.BeginCameraRendering.html) but not sure if it fit all your need.

Copy link
Contributor Author

@kecho kecho Feb 22, 2021

Choose a reason for hiding this comment

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

@sebastienlagarde this delegate will work! However I will have to make some refactors on how the state of the DynamicResolutionManager gets propagated. Because the render requests run deferredly, and the DynamicResolutionHandler is a singleton. Will have to run it by @FrancescoC-unity but sounds like the way to go then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did the changes, worked like a charm. @alelievr won't need the custom pass callback. Thanks for checking in. Will wait on a review from Francesco now :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you push said changes? I see only formatting as recent push

Copy link
Contributor Author

Choose a reason for hiding this comment

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

woops! sorry just pushed again

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh the change looks trivial to me, I am good with it 🟢

Copy link
Contributor

@sebastienlagarde sebastienlagarde left a comment

Choose a reason for hiding this comment

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

I am ok with the change on my side, but prefer to let @alelievr judge about the added callback or if we want to do it another way

@sebastienlagarde
Copy link
Contributor

Note: you should trigger Yamato

@sebastienlagarde
Copy link
Contributor

Need to update screenshots now :)

@kecho
Copy link
Contributor Author

kecho commented Feb 25, 2021

Final screenshots have been updated. Triggering yamato one more time.

@sebastienlagarde sebastienlagarde marked this pull request as ready for review February 25, 2021 12:49
@sebastienlagarde
Copy link
Contributor

Test is green, I will move forward and merge it as it can prevent to break code. If QA have feedback, please raise them, thanks.

@sebastienlagarde sebastienlagarde merged commit c52f13f into master Feb 25, 2021
@sebastienlagarde sebastienlagarde deleted the hdrp/drs-tests branch February 25, 2021 18:37
@sebastienlagarde sebastienlagarde restored the hdrp/drs-tests branch February 25, 2021 18:38
@sebastienlagarde sebastienlagarde deleted the hdrp/drs-tests branch February 25, 2021 19:12
Copy link
Contributor

@JMargevics JMargevics left a comment

Choose a reason for hiding this comment

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

Checked already merged. Looks good 👍

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