Singularity/Library/PackageCache/com.unity.render-pipelines..../Runtime/Decal/DecalPreviewPass.cs
2024-05-06 11:45:45 -07:00

41 lines
1.6 KiB
C#

using System.Collections.Generic;
namespace UnityEngine.Rendering.Universal
{
internal class DecalPreviewPass : ScriptableRenderPass
{
private FilteringSettings m_FilteringSettings;
private List<ShaderTagId> m_ShaderTagIdList;
private ProfilingSampler m_ProfilingSampler;
public DecalPreviewPass()
{
renderPassEvent = RenderPassEvent.AfterRenderingOpaques;
ConfigureInput(ScriptableRenderPassInput.Depth); // Require depth
m_ProfilingSampler = new ProfilingSampler("Decal Preview Render");
m_FilteringSettings = new FilteringSettings(RenderQueueRange.opaque, -1);
m_ShaderTagIdList = new List<ShaderTagId>();
m_ShaderTagIdList.Add(new ShaderTagId(DecalShaderPassNames.DecalScreenSpaceMesh));
}
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
SortingCriteria sortingCriteria = renderingData.cameraData.defaultOpaqueSortFlags;
DrawingSettings drawingSettings = CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria);
CommandBuffer cmd = CommandBufferPool.Get();
using (new ProfilingScope(cmd, m_ProfilingSampler))
{
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref m_FilteringSettings);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
}
}