using System;
using System.Collections.Generic;
namespace UnityEngine.Rendering.HighDefinition
{
/// Utility to build frame passes.
public class AOVRequestBuilder : IDisposable
{
// Owned
private List m_AOVRequestDataData;
/// Add a AOV request.
/// Settings to use for this frame pass.
/// An allocator for each buffer.
/// If non null, only these lights will be rendered, if none, all lights will be rendered.
/// A list of buffers to use.
/// A callback that can use the requested buffers once the rendering has completed.
///
public AOVRequestBuilder Add(
AOVRequest settings,
AOVRequestBufferAllocator bufferAllocator,
List includedLightList,
AOVBuffers[] aovBuffers,
FramePassCallback callback
)
{
(m_AOVRequestDataData ?? (m_AOVRequestDataData = ListPool.Get())).Add(
new AOVRequestData(settings, bufferAllocator, includedLightList, aovBuffers, callback));
return this;
}
/// Add a AOV request.
/// Settings to use for this frame pass.
/// An allocator for each buffer.
/// If non null, only these lights will be rendered, if none, all lights will be rendered.
/// A list of buffers to use.
/// A list of custom passes to captured.
/// An allocator for each custom pass buffer.
/// A callback that can use the requested buffers once the rendering has completed.
///
public AOVRequestBuilder Add(
AOVRequest settings,
AOVRequestBufferAllocator bufferAllocator,
List includedLightList,
AOVBuffers[] aovBuffers,
CustomPassAOVBuffers[] customPassAovBuffers,
AOVRequestCustomPassBufferAllocator customPassbufferAllocator,
FramePassCallbackEx callback
)
{
(m_AOVRequestDataData ?? (m_AOVRequestDataData = ListPool.Get())).Add(
new AOVRequestData(settings, bufferAllocator, includedLightList, aovBuffers, customPassAovBuffers, customPassbufferAllocator, callback));
return this;
}
/// Build the frame passes. Allocated resources will be transferred to the returned value.
/// The built collection.
public AOVRequestDataCollection Build()
{
var result = new AOVRequestDataCollection(m_AOVRequestDataData);
m_AOVRequestDataData = null;
return result;
}
///
/// Dispose the builder.
///
/// This is required when you don't call .
///
public void Dispose()
{
if (m_AOVRequestDataData == null) return;
ListPool.Release(m_AOVRequestDataData);
m_AOVRequestDataData = null;
}
}
}