-
Notifications
You must be signed in to change notification settings - Fork 860
[Universal] RenderPass conversion #3380
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
Conversation
…ts out because of incompatible blit operations
…r RP-related reasons
…g up deferred MRT formats for that
…nity-Technologies/Graphics into universal/render-pass-conversion
…nity-Technologies/Graphics into universal/render-pass-conversion
|
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. |
|
@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. |
phi-lira
left a comment
There was a problem hiding this 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.
com.unity.render-pipelines.universal/Editor/UniversalRendererDataEditor.cs
Show resolved
Hide resolved
| srpDescriptor.ConfigureDescriptor(GraphicsFormat.DepthAuto, descriptor.width, descriptor.height, 1, true); | ||
| ConfigureTarget(new RenderTargetIdentifier(depthAttachmentHandle.Identifier(), 0, CubemapFace.Unknown, -1)); |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
| internal int width; | ||
| internal int height; | ||
| internal int sampleCount; | ||
| internal GraphicsFormat[] formats; | ||
| internal bool isLastPass; | ||
| internal bool isDepthOnly; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: add a comment
There was a problem hiding this comment.
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
| 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs
Outdated
Show resolved
Hide resolved
… attachment issue
…echnologies/Graphics into universal/render-pass-conversion # Conflicts: # com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs
|
@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 |
ernestasKupciunas
left a comment
There was a problem hiding this 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
…use the same logic
|
Failures on Yamato are known and not caused by this PR. |
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.