Skip to content

Render Graph Async Compute #552

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

Merged
merged 21 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2403c55
Handle deallocation/reallocation of resources when switching rendergr…
JulienIgnace-Unity Apr 22, 2020
c775689
AO and Post Processes.
JulienIgnace-Unity Apr 24, 2020
a147330
Prefixed all history buffers with camera name for readability in the …
JulienIgnace-Unity Apr 24, 2020
8bb3fe6
LIght volume debug and Volumetric (WIP)
JulienIgnace-Unity Apr 27, 2020
4baa326
Fixed volumetric
JulienIgnace-Unity Apr 29, 2020
c7cca48
Fixed deallocation of SSS buffers
JulienIgnace-Unity Apr 29, 2020
960c0a5
Review feedback fixes.
JulienIgnace-Unity Apr 29, 2020
4c67bfd
Init order fix for post process
JulienIgnace-Unity Apr 29, 2020
6c38c3f
WIP: refactoring of render graph compilation and resource allocation …
JulienIgnace-Unity May 5, 2020
1898564
Implementation of async resource synchronization.
JulienIgnace-Unity May 7, 2020
ac2166a
Fixed synchronization (only partial fix)
JulienIgnace-Unity May 7, 2020
d62e8a7
Added default profiling sampler for render graph passes not providing…
JulienIgnace-Unity May 7, 2020
9d7c910
Async WIP
JulienIgnace-Unity May 12, 2020
3a579d0
Fixed async synchronization by extending lifetime of resources freed …
JulienIgnace-Unity May 18, 2020
41178ed
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity May 19, 2020
96f5563
Post merge fix
JulienIgnace-Unity May 19, 2020
fdec415
Cleanup
JulienIgnace-Unity May 19, 2020
e5f8993
Removed comment.
JulienIgnace-Unity May 19, 2020
6728b7e
Disabled async contact shadows again.
JulienIgnace-Unity May 19, 2020
052aa74
Merge branch 'HDRP/staging' of https://github.com/Unity-Technologies/…
JulienIgnace-Unity May 20, 2020
6c7e6dd
Small cleanup
JulienIgnace-Unity May 20, 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
80 changes: 42 additions & 38 deletions com.unity.render-pipelines.core/Runtime/Debugging/ProfilingScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,42 @@ public ProfilingSampler(string name)
#endif
}

/// <summary>
/// Begin the profiling block.
/// </summary>
/// <param name="cmd">Command buffer used by the profiling block.</param>
public void Begin(CommandBuffer cmd)
{
if (cmd != null)
#if UNITY_USE_RECORDER
if (sampler != null)
cmd.BeginSample(sampler);
else
cmd.BeginSample(name);
#else
cmd.BeginSample(name);
#endif
inlineSampler?.Begin();
}

/// <summary>
/// End the profiling block.
/// </summary>
/// <param name="cmd">Command buffer used by the profiling block.</param>
public void End(CommandBuffer cmd)
{
if (cmd != null)
#if UNITY_USE_RECORDER
if (sampler != null)
cmd.EndSample(sampler);
else
cmd.EndSample(name);
#else
m_Cmd.EndSample(name);
#endif
inlineSampler?.End();
}

internal bool IsValid() { return (sampler != null && inlineSampler != null); }

internal CustomSampler sampler { get; private set; }
Expand Down Expand Up @@ -187,11 +223,9 @@ public bool enableRecording
/// </summary>
public struct ProfilingScope : IDisposable
{
string m_Name;
CommandBuffer m_Cmd;
bool m_Disposed;
CustomSampler m_Sampler;
CustomSampler m_InlineSampler;
CommandBuffer m_Cmd;
bool m_Disposed;
ProfilingSampler m_Sampler;

/// <summary>
/// Profiling Scope constructor
Expand All @@ -202,29 +236,8 @@ public ProfilingScope(CommandBuffer cmd, ProfilingSampler sampler)
{
m_Cmd = cmd;
m_Disposed = false;
if (sampler != null)
{
m_Name = sampler.name; // Don't use CustomSampler.name because it causes garbage
m_Sampler = sampler.sampler;
m_InlineSampler = sampler.inlineSampler;
}
else
{
m_Name = "NullProfilingSampler"; // Don't use CustomSampler.name because it causes garbage
m_Sampler = null;
m_InlineSampler = null;
}

if (cmd != null)
#if UNITY_USE_RECORDER
if (m_Sampler != null)
cmd.BeginSample(m_Sampler);
else
cmd.BeginSample(m_Name);
#else
cmd.BeginSample(m_Name);
#endif
m_InlineSampler?.Begin();
m_Sampler = sampler;
m_Sampler?.Begin(m_Cmd);
}

/// <summary>
Expand All @@ -246,16 +259,7 @@ void Dispose(bool disposing)
// this but will generate garbage on every frame (and this struct is used quite a lot).
if (disposing)
{
if (m_Cmd != null)
#if UNITY_USE_RECORDER
if (m_Sampler != null)
m_Cmd.EndSample(m_Sampler);
else
m_Cmd.EndSample(m_Name);
#else
m_Cmd.EndSample(m_Name);
#endif
m_InlineSampler?.End();
m_Sampler?.End(m_Cmd);
}

m_Disposed = true;
Expand Down
Loading