Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1df359c
WIP for enabling valid graphics tests with Render Graph.
JulienIgnace-Unity May 27, 2020
64ef0ca
Fixed more GCAlloc and added an option for a test to not be run if re…
JulienIgnace-Unity May 28, 2020
505924b
First batch of disabled tests.
JulienIgnace-Unity May 28, 2020
a6c1f8e
Fixed decal rendering
JulienIgnace-Unity May 28, 2020
04d0d20
Implemented ColorGrading and Uber Post (fixes a lot of small diff due…
JulienIgnace-Unity May 28, 2020
4934ab9
Revert "First batch of disabled tests."
JulienIgnace-Unity May 28, 2020
0dd42d8
Temp "texture not bound" error fix until bloom is implemented.
JulienIgnace-Unity May 28, 2020
027a5c5
Fixed an error when using a stale invalid renderer list handle.
JulienIgnace-Unity Jun 2, 2020
349a273
Add some debug info to compiled passes and removed wrong refCount++ o…
JulienIgnace-Unity Jun 2, 2020
a98f454
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity Jun 2, 2020
3eb0eb6
Added possibility to disallow pass pruning
JulienIgnace-Unity Jun 3, 2020
e1f9e08
Small fixes
JulienIgnace-Unity Jun 3, 2020
1213511
temporarily removed pruning of passes without product
JulienIgnace-Unity Jun 3, 2020
95952b0
Fixed HDRP asset for test 5009
JulienIgnace-Unity Jun 3, 2020
1d97a44
Implement alpha copy for post processes
JulienIgnace-Unity Jun 3, 2020
0c62ef7
Small render graph error fix for motion vector pass.
JulienIgnace-Unity Jun 3, 2020
84467f6
Disabled for render graph tests that are currently broken.
JulienIgnace-Unity Jun 4, 2020
7b8acc0
Updated yamato with new render graph configurations
JulienIgnace-Unity Jun 4, 2020
46a64a3
Fixed lens distortion
JulienIgnace-Unity Jun 4, 2020
76a7c00
Reenabled 4021
JulienIgnace-Unity Jun 4, 2020
9c4c38e
Added an option to ignore tests when render graph is enabled.
JulienIgnace-Unity Jun 4, 2020
e5d8dd0
Disabled for render graph tests that are currently broken.
JulienIgnace-Unity Jun 4, 2020
ec2a4af
Reenabled 4021
JulienIgnace-Unity Jun 4, 2020
399512c
Updated yamato script to add the RenderGraph pipeline.
JulienIgnace-Unity Jun 4, 2020
68fb303
Revert "Reenabled 4021"
JulienIgnace-Unity Jun 4, 2020
fb085d0
Revert "Updated yamato with new render graph configurations"
JulienIgnace-Unity Jun 4, 2020
b3ac299
Revert "Disabled for render graph tests that are currently broken."
JulienIgnace-Unity Jun 4, 2020
d0bb7fa
Reverted HDRP test framework files (will go to another PR)
JulienIgnace-Unity Jun 4, 2020
4ac6aa2
Revert "Fixed HDRP asset for test 5009"
JulienIgnace-Unity Jun 4, 2020
0e1d250
Fixed HDRP asset for test 5009
JulienIgnace-Unity Jun 3, 2020
ddd259e
Merge branch 'HDRP/staging' into HDRP/rendergraph-graphicstests
sebastienlagarde Jun 4, 2020
4d1cc10
Adding purge of unused resources in render graph.
JulienIgnace-Unity Jun 5, 2020
463fe5b
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity Jun 8, 2020
fc9f739
Revert unrelated yml files changes due to old configuration (#714)
theopnv Jun 8, 2020
01de7e6
Fixed an issue with not unregistering render graph debug.
JulienIgnace-Unity Jun 8, 2020
1fa7451
Disabled 9800 for render graph
JulienIgnace-Unity Jun 8, 2020
e05eb9a
Revert hdrp asset for 5009
JulienIgnace-Unity Jun 8, 2020
a09947a
Merge branch 'HDRP/rendergraph-enable-graphicstests' of https://githu…
JulienIgnace-Unity Jun 8, 2020
5fe9c4a
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity Jun 12, 2020
14a0cad
WIP Creation of compute buffers through render graph.
JulienIgnace-Unity Jun 8, 2020
4347974
Refactoring internal resource management to share more code (WIP)
JulienIgnace-Unity Jun 8, 2020
d126be4
Share most of the code between compute buffers and textures.
JulienIgnace-Unity Jun 15, 2020
10acf55
Restored internal API for tests and fixed unit tests.
JulienIgnace-Unity Jun 15, 2020
a38c2a2
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity Jun 16, 2020
1f5e7e0
Post merge fix
JulienIgnace-Unity Jun 16, 2020
489d2c9
Added APIs to create compute buffers through render graph.
JulienIgnace-Unity Jun 16, 2020
e6931fc
Refactor Light List build to use render graph created compute buffers.
JulienIgnace-Unity Jun 17, 2020
e4636d8
Small rewrite to facilitate implementing Probe Volume Light lists.
JulienIgnace-Unity Jun 17, 2020
064a640
Refactored handle to include an intermediate ResourceHandle struct (n…
JulienIgnace-Unity Jun 17, 2020
3b0cb24
Fixed light list binding for forward passes.
JulienIgnace-Unity Jun 17, 2020
f8672b0
Removed usless SetGlobals
JulienIgnace-Unity Jun 17, 2020
0d75869
Correctly bind cluster buffers for transparent forward passes.
JulienIgnace-Unity Jun 17, 2020
2edc865
Fixed light list build (wrong light count)
JulienIgnace-Unity Jun 17, 2020
424855d
Fixed tile/cluster debug.
JulienIgnace-Unity Jun 18, 2020
b628507
Ported coarse stencil buffer to render graph.
JulienIgnace-Unity Jun 18, 2020
7d1681f
Moved decal property mask buffer to render graph created buffer.
JulienIgnace-Unity Jun 18, 2020
5a3d99f
Fixed reset size of width/height
JulienIgnace-Unity Jun 18, 2020
49a908c
Fixed size of dbuffer property mask buffer.
JulienIgnace-Unity Jun 18, 2020
0fd07af
Fixed unit tests
JulienIgnace-Unity Jun 19, 2020
f732507
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity Jun 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
447 changes: 234 additions & 213 deletions com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public struct RenderGraphBuilder : IDisposable
/// <param name="input">The Texture resource to use as a color render target.</param>
/// <param name="index">Index for multiple render target usage.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public TextureHandle UseColorBuffer(TextureHandle input, int index)
public TextureHandle UseColorBuffer(in TextureHandle input, int index)
{
CheckTransientTexture(input);

CheckTransientResource(input.handle);
m_RenderPass.SetColorBuffer(input, index);
return input;
}
Expand All @@ -34,10 +33,9 @@ public TextureHandle UseColorBuffer(TextureHandle input, int index)
/// <param name="input">The Texture resource to use as a depth buffer during the pass.</param>
/// <param name="flags">Specify the access level for the depth buffer. This allows you to say whether you will read from or write to the depth buffer, or do both.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public TextureHandle UseDepthBuffer(TextureHandle input, DepthAccess flags)
public TextureHandle UseDepthBuffer(in TextureHandle input, DepthAccess flags)
{
CheckTransientTexture(input);

CheckTransientResource(input.handle);
m_RenderPass.SetDepthBuffer(input, flags);
return input;
}
Expand All @@ -47,11 +45,10 @@ public TextureHandle UseDepthBuffer(TextureHandle input, DepthAccess flags)
/// </summary>
/// <param name="input">The Texture resource to read from during the pass.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public TextureHandle ReadTexture(TextureHandle input)
public TextureHandle ReadTexture(in TextureHandle input)
{
CheckTransientTexture(input);

m_RenderPass.AddTextureRead(input);
CheckTransientResource(input.handle);
m_RenderPass.AddResourceRead(input.handle);
return input;
}

Expand All @@ -60,12 +57,11 @@ public TextureHandle ReadTexture(TextureHandle input)
/// </summary>
/// <param name="input">The Texture resource to write to during the pass.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public TextureHandle WriteTexture(TextureHandle input)
public TextureHandle WriteTexture(in TextureHandle input)
{
CheckTransientTexture(input);

// TODO: Manage resource "version" for debugging purpose
m_RenderPass.AddTextureWrite(input);
CheckTransientResource(input.handle);
// TODO RENDERGRAPH: Manage resource "version" for debugging purpose
m_RenderPass.AddResourceWrite(input.handle);
return input;
}

Expand All @@ -78,20 +74,21 @@ public TextureHandle WriteTexture(TextureHandle input)
public TextureHandle CreateTransientTexture(in TextureDesc desc)
{
var result = m_Resources.CreateTexture(desc, 0, m_RenderPass.index);
m_RenderPass.AddTransientTexture(result);
m_RenderPass.AddTransientResource(result.handle);
return result;
}

/// <summary>
/// Create a new Render Graph Texture resource using the descriptor from another texture.
/// This texture will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
/// </summary>
/// <param name="texture">Texture from which the descriptor should be used.</param>
/// <returns>A new transient TextureHandle.</returns>
public TextureHandle CreateTransientTexture(TextureHandle texture)
public TextureHandle CreateTransientTexture(in TextureHandle texture)
{
var desc = m_Resources.GetTextureResourceDesc(texture);
var desc = m_Resources.GetTextureResourceDesc(texture.handle);
var result = m_Resources.CreateTexture(desc, 0, m_RenderPass.index);
m_RenderPass.AddTransientTexture(result);
m_RenderPass.AddTransientResource(result.handle);
return result;
}

Expand All @@ -100,7 +97,7 @@ public TextureHandle CreateTransientTexture(TextureHandle texture)
/// </summary>
/// <param name="input">The Renderer List resource to use during the pass.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public RendererListHandle UseRendererList(RendererListHandle input)
public RendererListHandle UseRendererList(in RendererListHandle input)
{
m_RenderPass.UseRendererList(input);
return input;
Expand All @@ -111,9 +108,10 @@ public RendererListHandle UseRendererList(RendererListHandle input)
/// </summary>
/// <param name="input">The Compute Buffer resource to read from during the pass.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public ComputeBufferHandle ReadComputeBuffer(ComputeBufferHandle input)
public ComputeBufferHandle ReadComputeBuffer(in ComputeBufferHandle input)
{
m_RenderPass.AddBufferRead(input);
CheckTransientResource(input.handle);
m_RenderPass.AddResourceRead(input.handle);
return input;
}

Expand All @@ -122,12 +120,40 @@ public ComputeBufferHandle ReadComputeBuffer(ComputeBufferHandle input)
/// </summary>
/// <param name="input">The Compute Buffer resource to write to during the pass.</param>
/// <returns>An updated resource handle to the input resource.</returns>
public ComputeBufferHandle WriteComputeBuffer(ComputeBufferHandle input)
public ComputeBufferHandle WriteComputeBuffer(in ComputeBufferHandle input)
{
m_RenderPass.AddBufferWrite(input);
CheckTransientResource(input.handle);
m_RenderPass.AddResourceWrite(input.handle);
return input;
}

/// <summary>
/// Create a new Render Graph Compute Buffer resource.
/// This Compute Buffer will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
/// </summary>
/// <param name="desc">Compute Buffer descriptor.</param>
/// <returns>A new transient ComputeBufferHandle.</returns>
public ComputeBufferHandle CreateTransientComputeBuffer(in ComputeBufferDesc desc)
{
var result = m_Resources.CreateComputeBuffer(desc, m_RenderPass.index);
m_RenderPass.AddTransientResource(result.handle);
return result;
}

/// <summary>
/// Create a new Render Graph Compute Buffer resource using the descriptor from another Compute Buffer.
/// This Compute Buffer will only be available for the current pass and will be assumed to be both written and read so users don't need to add explicit read/write declarations.
/// </summary>
/// <param name="computebuffer">Compute Buffer from which the descriptor should be used.</param>
/// <returns>A new transient ComputeBufferHandle.</returns>
public ComputeBufferHandle CreateTransientComputeBuffer(in ComputeBufferHandle computebuffer)
{
var desc = m_Resources.GetComputeBufferResourceDesc(computebuffer.handle);
var result = m_Resources.CreateComputeBuffer(desc, m_RenderPass.index);
m_RenderPass.AddTransientResource(result.handle);
return result;
}

/// <summary>
/// Specify the render function to use for this pass.
/// A call to this is mandatory for the pass to be valid.
Expand Down Expand Up @@ -185,12 +211,18 @@ void Dispose(bool disposing)
m_Disposed = true;
}

void CheckTransientTexture(TextureHandle input)
void CheckTransientResource(in ResourceHandle res)
{
if (input.IsValid() && input.transientPassIndex != -1 && input.transientPassIndex != m_RenderPass.index)
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (res.IsValid())
{
throw new ArgumentException($"Trying to use a transient texture (pass index {input.transientPassIndex}) in a different pass (pass index {m_RenderPass.index}.");
int transientIndex = m_Resources.GetResourceTransientIndex(res);
if (transientIndex != -1 && transientIndex != m_RenderPass.index)
{
throw new ArgumentException($"Trying to use a transient texture (pass index {transientIndex}) in a different pass (pass index {m_RenderPass.index}.");
}
}
#endif
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,34 @@ public RenderFunc<PassData> GetExecuteDelegate<PassData>()
public int colorBufferMaxIndex { get; protected set; } = -1;
public int refCount { get; protected set; }

public List<TextureHandle> textureReadList = new List<TextureHandle>();
public List<TextureHandle> textureWriteList = new List<TextureHandle>();
public List<TextureHandle> transientTextureList = new List<TextureHandle>();
public List<ComputeBufferHandle> bufferReadList = new List<ComputeBufferHandle>();
public List<ComputeBufferHandle> bufferWriteList = new List<ComputeBufferHandle>();
public List<ResourceHandle>[] resourceReadLists = new List<ResourceHandle>[(int)RenderGraphResourceType.Count];
public List<ResourceHandle>[] resourceWriteLists = new List<ResourceHandle>[(int)RenderGraphResourceType.Count];
public List<ResourceHandle>[] transientResourceList = new List<ResourceHandle>[(int)RenderGraphResourceType.Count];

public List<RendererListHandle> usedRendererListList = new List<RendererListHandle>();

public RenderGraphPass()
{
for (int i = 0; i < (int)RenderGraphResourceType.Count; ++i)
{
resourceReadLists[i] = new List<ResourceHandle>();
resourceWriteLists[i] = new List<ResourceHandle>();
transientResourceList[i] = new List<ResourceHandle>();
}
}

public void Clear()
{
name = "";
index = -1;
customSampler = null;
textureReadList.Clear();
textureWriteList.Clear();
bufferReadList.Clear();
bufferWriteList.Clear();
transientTextureList.Clear();
for (int i = 0; i < (int)RenderGraphResourceType.Count; ++i)
{
resourceReadLists[i].Clear();
resourceWriteLists[i].Clear();
transientResourceList[i].Clear();
}

usedRendererListList.Clear();
enableAsyncCompute = false;
allowPassPruning = true;
Expand All @@ -57,31 +68,19 @@ public void Clear()
}
}

public void AddTextureWrite(TextureHandle texture)
{
textureWriteList.Add(texture);
refCount++;
}

public void AddTextureRead(TextureHandle texture)
{
textureReadList.Add(texture);
}

public void AddBufferWrite(ComputeBufferHandle buffer)
public void AddResourceWrite(in ResourceHandle res)
{
bufferWriteList.Add(buffer);
refCount++;
resourceWriteLists[res.iType].Add(res);
}

public void AddTransientTexture(TextureHandle texture)
public void AddResourceRead(in ResourceHandle res)
{
transientTextureList.Add(texture);
resourceReadLists[res.iType].Add(res);
}

public void AddBufferRead(ComputeBufferHandle buffer)
public void AddTransientResource(in ResourceHandle res)
{
bufferReadList.Add(buffer);
transientResourceList[res.iType].Add(res);
}

public void UseRendererList(RendererListHandle rendererList)
Expand All @@ -104,16 +103,16 @@ public void SetColorBuffer(TextureHandle resource, int index)
Debug.Assert(index < RenderGraph.kMaxMRTCount && index >= 0);
colorBufferMaxIndex = Math.Max(colorBufferMaxIndex, index);
colorBuffers[index] = resource;
AddTextureWrite(resource);
AddResourceWrite(resource.handle);
}

public void SetDepthBuffer(TextureHandle resource, DepthAccess flags)
{
depthBuffer = resource;
if ((flags & DepthAccess.Read) != 0)
AddTextureRead(resource);
AddResourceRead(resource.handle);
if ((flags & DepthAccess.Write) != 0)
AddTextureWrite(resource);
AddResourceWrite(resource.handle);
}
}

Expand Down
Loading