Skip to content

Conversation

@jonuuukas
Copy link
Contributor

Purpose of this PR

Initial PR for the URP RenderPass conversion. This adds the yet limited feature in a hidden manner as it still needs work. This converts current Forward+Deferred in a 1:1 manner - ScriptableRenderPass corresponds to RenderPass. This is not feasible performance-wise on TBDRs, but is a good starting point, as we will continue implementing RenderPass lazy merging. MSAA implementation is not here as well, though we are including some of the related methods (such as ConfigureResolveTarget and etc.)

All of the API and variables are internal, one can enable the checkbox to enable native RenderPass by adding "ENABLE_RENDER_PASS_UI" to the Scripting define symbols. This will create a new checkbox in the renderer assets which can be used to enable RenderPass during runtime or before.

This is work in progress, so documentation and QA passes will be done in the future when we will officially be exposing this API from internal to public

Testing status

This is still very experimental and didn't have a QA round as a lot of work still has to be done. However, on the editor, ~124 tests are green, with few known failures that require changes in the engine-side.

Comments to reviewers

Notes for the reviewers you have assigned.

jonuuukas and others added 30 commits January 13, 2021 14:28
…ts out because of incompatible blit operations
…nity-Technologies/Graphics into universal/render-pass-conversion
…nity-Technologies/Graphics into universal/render-pass-conversion
@kaychang-unity
Copy link
Contributor

Is ScriptableRenderPass.srpDescriptor a mechanism to get information on render-targets that are not available through RenderTargetIdentifier, such as graphicsFormats, width, height, ... ? It is a shame RenderTargetidentifier is so limited.

Anyway, I don't think I am the most qualified to comment on the design of of RenderPass and how it integrates into URP code.

@jonuuukas
Copy link
Contributor Author

@kaychang-unity - srpDescriptor currently serves that purpose, yeah. However, when the transition to RTHandles happens, we will be removing this class, as the RTHandles carry all the required information for the RenderPass execution.

Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

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

Made some comments, but have not finished review yet. Let's catch up tomorrow to go through comments? It might be easier to discuss and hear your thoughts over a call.

Comment on lines 59 to 60
srpDescriptor.ConfigureDescriptor(GraphicsFormat.DepthAuto, descriptor.width, descriptor.height, 1, true);
ConfigureTarget(new RenderTargetIdentifier(depthAttachmentHandle.Identifier(), 0, CubemapFace.Unknown, -1));
Copy link
Contributor

Choose a reason for hiding this comment

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

API wise I have some concerns with this. ScriptableRenderPassDescriptor has a mix of render pass data and attachment data (format).

We are configuring attachment data in two APIs (ConfigureDescriptor (format) and ConfigureTarget (surface handle))

Copy link
Contributor

Choose a reason for hiding this comment

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

So now you have overloads of ConfigureDescriptor and ConfigureTarget taking arrays of attachment data.
My suggestion is to let ConfigureTarget configure all the per-attachment information, maybe when we support RTHandle it can just take an array of that as that provides the GraphicsFormat you need, but meanwhile an internal overload to take GraphicsFormat and RenderTargetIdentifiers could work?

The other fields you have in ScriptableRenderPassDescriptor (width, height, samples) why do we need a descriptor for that instead of storing in the ScriptableRenderPass itself?

So if user wants to query width of a render pass API would be simpler myPass.width instead of myPass.srpDescriptor.width?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SrpDescriptor changes were reverted and now the API is using ConfigureTarget overloads to get this data

Comment on lines 8 to 13
internal int width;
internal int height;
internal int sampleCount;
internal GraphicsFormat[] formats;
internal bool isLastPass;
internal bool isDepthOnly;
Copy link
Contributor

Choose a reason for hiding this comment

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

Considering GraphicsFormat comes from RTHandle. Why not having the other settings in the ScriptableRenderPass itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SrpDescriptor changes were reverted and now the API is using ConfigureTarget overloads to get this data

overrideCameraTarget = false;
isBlitRenderPass = false;
profilingSampler = new ProfilingSampler(nameof(ScriptableRenderPass));
useNativeRenderPass = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This API is internal, what does it mean for custom passes that can't change this userNativeRenderPass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: add a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the end, we expect to have a preprocessing mechanism that would determine whether pass is eligible or not to be inside a RenderPass, so this is temporary. Also, Native RenderPass has to be enabled in the renderer asset and having this value as true won't really affect anything unless it's explicitly enabled

Comment on lines 781 to 788
var attachments =
new NativeArray<AttachmentDescriptor>(useDepth && !renderPass.srpDescriptor.isDepthOnly ? validColorBuffersCount + 1 : 1, Allocator.Temp);

for (int i = 0; i < validColorBuffersCount; ++i)
attachments[i] = m_ActiveColorAttachmentDescriptors[i];

if (useDepth && !renderPass.srpDescriptor.isDepthOnly)
attachments[validColorBuffersCount] = m_ActiveDepthAttachmentDescriptor;
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be encapsulated in the ScriptableRenderPass when configuring attachments we could already cache attachment descriptors?

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 temporary code as it will be changing in the future with lazy merging being introduced. We technically could cache something per-pass, but that will change as soon as we start grouping the render passes

@jonuuukas jonuuukas requested a review from a team February 12, 2021 13:03
@jonuuukas
Copy link
Contributor Author

@Unity-Technologies/mobile-qa - please do a sanity check on this PR. Checking BoatAttack and UniversalRenderingExamples should be enough. The feature itself shouldn't be tested now, we are only interested whether default behaviour has regressed or got broken with this PR. So basically opening and running these projects on few platforms should be enough

@jonuuukas jonuuukas marked this pull request as ready for review February 15, 2021 13:12
@jonuuukas jonuuukas requested a review from a team as a code owner February 15, 2021 13:12
@jonuuukas jonuuukas requested a review from phi-lira February 15, 2021 13:13
@ernestasKupciunas ernestasKupciunas requested review from ernestasKupciunas and removed request for a team February 17, 2021 10:10
Copy link

@ernestasKupciunas ernestasKupciunas 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 on the mobile side. There were no issues related to these changes, and the default behaviour seems to work as expected.

Testing doc: https://docs.google.com/document/d/1fM3mptWJuI4hvk78xSXi4nOwoswl1ZUWCriNsGOlMMk/edit?usp=sharing

Devices under testing:
VLNQA00217, Razer Phone 2, 9.0.0, Snapdragon 845 SDM845, Adreno 630
VLNQA00268, Samsung Galaxy S10+, 10.0.0, Exynos 9 9820, Mali-G76
OnePlus Nord, 10, Snapdragon 765G SM7250-AB, Adreno 620
VLNQA00108, LGE LG Leon 4G LTE, 5.0.1, Snapdragon 410 MSM8916, Adreno 306
Samsung Galaxy Z Fold2 5G, 10, Snapdragon 865 SM8250, Adreno 650
VLNQA00292, iPad Air3, SoC: A12, iOS: 13.2.3
iPad Air4, SoC: A14, iOS: 14.0
iPhone 12Pro, SoC: A14, iOS: 14.1

@ellioman
Copy link
Contributor

Failures on Yamato are known and not caused by this PR.

@ellioman ellioman merged commit 82e9320 into master Feb 26, 2021
@ellioman ellioman deleted the universal/render-pass-conversion branch February 26, 2021 09:04
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.

7 participants