-
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
Changes from 82 commits
f3b8ce6
39aaaad
2326e65
dfb0c68
dc9c43f
36cd0d1
78aa012
ef791ee
bee37cc
7561217
03cb8aa
2bf178d
abe0bfb
7b6aaf3
20915b4
6f170c0
6e53c52
1ed5d03
19bf12f
0b24504
78ddd02
34839dd
0d628a5
30a7775
7cc83d7
8fffce0
88535e5
6f90801
855abf4
00885db
be5bec4
6a2f163
ae600f7
2ac6795
c080511
5559743
4ec0446
8589a4c
bb9c43f
180a754
6f857b9
2726435
65dfc45
b9df3c6
09f10ad
4901d6b
1ab69fa
a436159
67efea8
2e6c47a
ffec644
3246c64
a8b9375
dd3a81d
37694bb
451ae1d
0654bc1
ec17a62
4c2aa5f
216f416
ea59b26
380c000
aec1b59
55aa16b
91d69e2
4aa0bbf
d0b8f7a
9271789
1bab4f4
f37f9ef
2863c7e
938ec32
1af4d89
685d55a
c70d38e
3611339
3e2f945
9cb631e
7c2f4fd
1ad3fb0
ee852a5
39be2b1
1460457
b82de55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| using System.Collections.Generic; | ||
| using System.ComponentModel; | ||
| using UnityEngine.Scripting.APIUpdating; | ||
| using UnityEngine.Experimental.Rendering; | ||
|
|
||
| namespace UnityEngine.Rendering.Universal | ||
| { | ||
|
|
@@ -173,6 +174,18 @@ public Color clearColor | |
| internal bool overrideCameraTarget { get; set; } | ||
| internal bool isBlitRenderPass { get; set; } | ||
|
|
||
| internal bool useNativeRenderPass { get; set; } | ||
|
|
||
| internal int renderTargetWidth { get; set; } | ||
| internal int renderTargetHeight { get; set; } | ||
| internal int renderTargetSampleCount { get; set; } | ||
|
|
||
| internal bool depthOnly { get; set; } | ||
| // this flag is updated each frame to keep track of which pass is the last for the current camera | ||
| internal bool isLastPass { get; set; } | ||
|
|
||
|
|
||
| internal GraphicsFormat[] renderTargetFormat { get; set; } | ||
| RenderTargetIdentifier[] m_ColorAttachments = new RenderTargetIdentifier[] {BuiltinRenderTextureType.CameraTarget}; | ||
| RenderTargetIdentifier m_DepthAttachment = BuiltinRenderTextureType.CameraTarget; | ||
| ScriptableRenderPassInput m_Input = ScriptableRenderPassInput.None; | ||
|
|
@@ -189,6 +202,16 @@ public ScriptableRenderPass() | |
| overrideCameraTarget = false; | ||
| isBlitRenderPass = false; | ||
| profilingSampler = new ProfilingSampler(nameof(ScriptableRenderPass)); | ||
| useNativeRenderPass = true; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: add a comment
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| renderTargetWidth = -1; | ||
| renderTargetHeight = -1; | ||
| renderTargetSampleCount = -1; | ||
| renderTargetFormat = new GraphicsFormat[] | ||
| { | ||
| GraphicsFormat.None, GraphicsFormat.None, GraphicsFormat.None, | ||
| GraphicsFormat.None, GraphicsFormat.None, GraphicsFormat.None, GraphicsFormat.None, GraphicsFormat.None | ||
| }; | ||
| depthOnly = false; | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -215,6 +238,12 @@ public void ConfigureTarget(RenderTargetIdentifier colorAttachment, RenderTarget | |
| ConfigureTarget(colorAttachment); | ||
| } | ||
|
|
||
| internal void ConfigureTarget(RenderTargetIdentifier colorAttachment, RenderTargetIdentifier depthAttachment, GraphicsFormat format) | ||
| { | ||
| m_DepthAttachment = depthAttachment; | ||
| ConfigureTarget(colorAttachment, format); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. | ||
| /// This method should be called inside Configure. | ||
|
|
@@ -234,6 +263,13 @@ public void ConfigureTarget(RenderTargetIdentifier[] colorAttachments, RenderTar | |
| m_DepthAttachment = depthAttachment; | ||
| } | ||
|
|
||
| internal void ConfigureTarget(RenderTargetIdentifier[] colorAttachments, RenderTargetIdentifier depthAttachment, GraphicsFormat[] formats) | ||
| { | ||
| ConfigureTarget(colorAttachments, depthAttachment); | ||
| for (int i = 0; i < formats.Length; ++i) | ||
| renderTargetFormat[i] = formats[i]; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. | ||
| /// This method should be called inside Configure. | ||
|
|
@@ -249,6 +285,19 @@ public void ConfigureTarget(RenderTargetIdentifier colorAttachment) | |
| m_ColorAttachments[i] = 0; | ||
| } | ||
|
|
||
| internal void ConfigureTarget(RenderTargetIdentifier colorAttachment, GraphicsFormat format, int width = -1, int height = -1, int sampleCount = -1, bool depth = false) | ||
| { | ||
| ConfigureTarget(colorAttachment); | ||
| for (int i = 1; i < m_ColorAttachments.Length; ++i) | ||
| renderTargetFormat[i] = GraphicsFormat.None; | ||
|
|
||
| renderTargetWidth = width; | ||
| renderTargetHeight = height; | ||
| renderTargetSampleCount = sampleCount; | ||
| depthOnly = depth; | ||
| renderTargetFormat[0] = format; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. | ||
| /// This method should be called inside Configure. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.