You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.6 KiB
40 lines
1.6 KiB
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); |
|
} |
|
} |
|
}
|
|
|