Singularity/Library/PackageCache/com.unity.render-pipelines..../Runtime/Passes/DeferredPass.cs

52 lines
2.1 KiB
C#
Raw Permalink Normal View History

2024-05-06 14:45:45 -04:00
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.Profiling;
using Unity.Collections;
// cleanup code
// listMinDepth and maxDepth should be stored in a different uniform block?
// Point lights stored as vec4
// RelLightIndices should be stored in ushort instead of uint.
// TODO use Unity.Mathematics
// TODO Check if there is a bitarray structure (with dynamic size) available in Unity
namespace UnityEngine.Rendering.Universal.Internal
{
// Render all tiled-based deferred lights.
internal class DeferredPass : ScriptableRenderPass
{
DeferredLights m_DeferredLights;
public DeferredPass(RenderPassEvent evt, DeferredLights deferredLights)
{
base.profilingSampler = new ProfilingSampler(nameof(DeferredPass));
base.renderPassEvent = evt;
m_DeferredLights = deferredLights;
}
// ScriptableRenderPass
public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescripor)
{
RenderTargetIdentifier lightingAttachmentId = m_DeferredLights.GbufferAttachmentIdentifiers[m_DeferredLights.GBufferLightingIndex];
RenderTargetIdentifier depthAttachmentId = m_DeferredLights.DepthAttachmentIdentifier;
if (m_DeferredLights.UseRenderPass)
ConfigureInputAttachments(m_DeferredLights.DeferredInputAttachments, m_DeferredLights.DeferredInputIsTransient);
// TODO: change to m_DeferredLights.GetGBufferFormat(m_DeferredLights.GBufferLightingIndex) when it's not GraphicsFormat.None
// TODO: Cannot currently bind depth texture as read-only!
ConfigureTarget(lightingAttachmentId, depthAttachmentId, cameraTextureDescripor.graphicsFormat);
}
// ScriptableRenderPass
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
m_DeferredLights.ExecuteDeferredPass(context, ref renderingData);
}
// ScriptableRenderPass
public override void OnCameraCleanup(CommandBuffer cmd)
{
m_DeferredLights.OnCameraCleanup(cmd);
}
}
}