using System; namespace UnityEngine.Rendering.HighDefinition { /// /// Context used when executing custom passes /// public struct CustomPassContext { /// /// Scriptable Render Context, used for any SRP related operations. /// public readonly ScriptableRenderContext renderContext; /// /// Command Buffer, used to enqueue graphic commands to the GPU. /// public readonly CommandBuffer cmd; /// /// HdCamera, HDRP data related to the rendering camera. Use the camera property to access the Camera class. /// public readonly HDCamera hdCamera; /// /// Result of the culling either of the camera or the custom pass if AggregateCullingParameters is used. /// public CullingResults cullingResults; /// /// Camera culling results, not modified by the custom pass culling. /// public readonly CullingResults cameraCullingResults; /// /// Camera color buffer. /// public readonly RTHandle cameraColorBuffer; /// /// Camera depth buffer. /// public readonly RTHandle cameraDepthBuffer; /// /// Camera normal buffer. /// public readonly RTHandle cameraNormalBuffer; /// /// Camera motion vectors buffer. /// public readonly RTHandle cameraMotionVectorsBuffer; /// /// Lazy handle to the custom color buffer, not allocated if not used. /// public readonly Lazy customColorBuffer; /// /// Lazy handle to the custom depth buffer, not allocated if not used. /// public readonly Lazy customDepthBuffer; /// /// Material Property Block, unique for each custom pass instance. /// public readonly MaterialPropertyBlock propertyBlock; /// /// Shading rate image buffer for variable shading rate. /// public readonly RTHandle shadingRateBuffer; internal readonly RTHandle sssBuffer; internal readonly RTHandle diffuseLightingBuffer; internal readonly CustomPassInjectionPoint injectionPoint; // This represent the state of HDRP globals at the point of recording the custom passes. // Using GetShaderVariablesGlobals() from HDRP inside the execute of the custom pass would give invalid result // because the execute of custom passes is called during the render graph execution, after the recording of all passes. internal readonly ShaderVariablesGlobal currentGlobalState; internal CustomPassContext( ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResults, CullingResults cameraCullingResults, RTHandle cameraColorBuffer, RTHandle cameraDepthBuffer, RTHandle cameraNormalBuffer, RTHandle cameraMotionVectorsBuffer, RTHandle sssBuffer, RTHandle diffuseLightingBuffer, Lazy customColorBuffer, Lazy customDepthBuffer, MaterialPropertyBlock propertyBlock, RTHandle shadingRateBuffer, CustomPassInjectionPoint injectionPoint, ShaderVariablesGlobal currentGlobalState) { this.renderContext = renderContext; this.cmd = cmd; this.hdCamera = hdCamera; this.cullingResults = cullingResults; this.cameraCullingResults = cameraCullingResults; this.cameraColorBuffer = cameraColorBuffer; this.cameraDepthBuffer = cameraDepthBuffer; this.customColorBuffer = customColorBuffer; this.cameraNormalBuffer = cameraNormalBuffer; this.cameraMotionVectorsBuffer = cameraMotionVectorsBuffer; this.customDepthBuffer = customDepthBuffer; this.propertyBlock = propertyBlock; this.shadingRateBuffer = shadingRateBuffer; this.sssBuffer = sssBuffer; this.diffuseLightingBuffer = diffuseLightingBuffer; this.injectionPoint = injectionPoint; this.currentGlobalState = currentGlobalState; } } }