using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering
{
///
/// This struct contains some static helper functions that can be used when you want to convert between Commandbuffer and RasterCommandBuffer/ComputeCommandBuffer/LowLevelCommandBuffer
///
public struct CommandBufferHelpers
{
static internal RasterCommandBuffer rasterCmd = new RasterCommandBuffer(null, null, false);
static internal ComputeCommandBuffer computeCmd = new ComputeCommandBuffer(null, null, false);
static internal LowLevelCommandBuffer lowlevelCmd = new LowLevelCommandBuffer(null, null, false);
///
/// Get a RasterCommandBuffer given an standard CommandBuffer.
///
/// The CommandBuffer the RasterCommandBuffer should record it's commands to.
/// A RasterCommandBuffer that will record its commands to the given buffer.
public static RasterCommandBuffer GetRasterCommandBuffer(CommandBuffer baseBuffer)
{
rasterCmd.m_WrappedCommandBuffer = baseBuffer;
return rasterCmd;
}
///
/// Get a ComputeCommandBuffer given an standard CommandBuffer.
///
/// The CommandBuffer the RasterCommandBuffer should record it's commands to.
/// A ComputeCommandBuffer that will record its commands to the given buffer.
public static ComputeCommandBuffer GetComputeCommandBuffer(CommandBuffer baseBuffer)
{
computeCmd.m_WrappedCommandBuffer = baseBuffer;
return computeCmd;
}
///
/// Get a LowLevelCommandBuffer given an standard CommandBuffer.
///
/// The CommandBuffer the LowLevelCommandBuffer should record it's commands to.
/// A LowLevelCommandBuffer that will record its commands to the given buffer.
public static LowLevelCommandBuffer GetLowLevelCommandBuffer(CommandBuffer baseBuffer)
{
lowlevelCmd.m_WrappedCommandBuffer = baseBuffer;
return lowlevelCmd;
}
}
}