Class GPUResidentDrawer
Static utility class for updating data post cull in begin camera rendering
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.GPUDriven.Runtime.dll
Syntax
public class GPUResidentDrawer
Methods
InstanceOcclusionTest(RenderGraph, in OcclusionCullingSettings, ReadOnlySpan<SubviewOcclusionTest>)
Utility function to run an occlusion test in compute to update indirect draws. This function will dispatch compute shaders to run the given occlusion test and update all indirect draws in the culling output for the given view. The next time a renderer list that uses this culling output is drawn, these indirect draw commands will contain only the instances that passed the given occlusion test.
Declaration
public static void InstanceOcclusionTest(RenderGraph renderGraph, in OcclusionCullingSettings settings, ReadOnlySpan<SubviewOcclusionTest> subviewOcclusionTests)
Parameters
Type | Name | Description |
---|---|---|
RenderGraph | renderGraph | Render graph that will have a compute pass added. |
OcclusionCullingSettings | settings | The view to update and occlusion test to use. |
ReadOnlySpan<SubviewOcclusionTest> | subviewOcclusionTests | Specifies the occluder subviews to use with each culling split index. |
IsInstanceOcclusionCullingEnabled()
Utility function to test if instance occlusion culling is enabled
Declaration
public static bool IsInstanceOcclusionCullingEnabled()
Returns
Type | Description |
---|---|
bool | True if instance occlusion culling is enabled |
OnSetupAmbientProbe()
Utility function for updating probe data after global ambient probe is set up
Declaration
public static void OnSetupAmbientProbe()
PostCullBeginCameraRendering(RenderRequestBatcherContext)
Utility function for updating data post cull in begin camera rendering
Declaration
public static void PostCullBeginCameraRendering(RenderRequestBatcherContext context)
Parameters
Type | Name | Description |
---|---|---|
RenderRequestBatcherContext | context | Context containing the data to be set |
ReinitializeIfNeeded()
Enable or disable GPUResidentDrawer based on the project settings. We call this every frame because GPUResidentDrawer can be enabled/disabled by the settings outside the render pipeline asset.
Declaration
public static void ReinitializeIfNeeded()
RenderDebugOccluderOverlay(RenderGraph, DebugDisplayGPUResidentDrawer, Vector2, float, TextureHandle)
Utility function visualise the occluder pyramid in a debug overlay.
Declaration
public static void RenderDebugOccluderOverlay(RenderGraph renderGraph, DebugDisplayGPUResidentDrawer debugSettings, Vector2 screenPos, float maxHeight, TextureHandle colorBuffer)
Parameters
Type | Name | Description |
---|---|---|
RenderGraph | renderGraph | Render graph that will have a compute pass added. |
DebugDisplayGPUResidentDrawer | debugSettings | The rendering debugger debug settings to read parameters from. |
Vector2 | screenPos | The screen position to render the overlay at. |
float | maxHeight | The maximum screen height of the overlay. |
TextureHandle | colorBuffer | The color buffer to render the overlay on. |
RenderDebugOcclusionTestOverlay(RenderGraph, DebugDisplayGPUResidentDrawer, int, TextureHandle)
Utility function to render an occlusion test heatmap debug overlay.
Declaration
public static void RenderDebugOcclusionTestOverlay(RenderGraph renderGraph, DebugDisplayGPUResidentDrawer debugSettings, int viewInstanceID, TextureHandle colorBuffer)
Parameters
Type | Name | Description |
---|---|---|
RenderGraph | renderGraph | Render graph that will have a compute pass added. |
DebugDisplayGPUResidentDrawer | debugSettings | The rendering debugger debug settings to read parameters from. |
int | viewInstanceID | The instance ID of the camera using a GPU occlusion test. |
TextureHandle | colorBuffer | The color buffer to render the overlay on. |
UpdateInstanceOccluders(RenderGraph, in OccluderParameters, ReadOnlySpan<OccluderSubviewUpdate>)
Utility function used to update occluders using a depth buffer. This function will dispatch compute shaders to read the given depth buffer and build a mip pyramid of closest depths for use during occlusion culling. The next time an occlusion test is issed for this view, instances will be tested against the updated occluders.
Declaration
public static void UpdateInstanceOccluders(RenderGraph renderGraph, in OccluderParameters occluderParameters, ReadOnlySpan<OccluderSubviewUpdate> occluderSubviewUpdates)
Parameters
Type | Name | Description |
---|---|---|
RenderGraph | renderGraph | Render graph that will have a compute pass added. |
OccluderParameters | occluderParameters | Parameter to specify the view and depth buffer to read. |
ReadOnlySpan<OccluderSubviewUpdate> | occluderSubviewUpdates | Specifies which occluder subviews to update from slices of the input depth buffer. |