Documentation

Unity Engine

Download Unity

Unity Engine

AddComputeVariants

Adds to the collection the compute shader variants that the visual effect assets dispatch.
Read time 2 minutesLast updated 13 days ago

Definition

AddComputeVariants(GraphicsStateCollection, VisualEffectAsset[])

Adds to the collection the compute shader variants that the visual effect assets dispatch.
public static bool AddComputeVariants(this GraphicsStateCollection graphicsStateCollection, VisualEffectAsset[] visualEffectAssets)

Parameters

graphicsStateCollection

The GraphicsStateCollection in which to add the compute shader variants.

visualEffectAssets

An array of VisualEffectAsset files to scan for compute shaders.

Returns

Type

Description

boolTrue if at least one new compute shader variant was successfully added, false otherwise.

Remarks

For each compute shader task in each VisualEffectAsset, this method adds the variant for kernel 0 with the compute shader's enabled local keywords and the global shader keywords that are currently enabled in the active context. For update tasks that can compute ray tracing bounding boxes, it adds the variants both with and without the
VFX_COMPUTE_AABBS
keyword. The method doesn't add compute shaders that the Visual Effect Graph runtime shares between all effects, such as sorting and indirect argument shaders. To record them, trace the collection at runtime. The method doesn't add a variant that the collection already contains.

AddComputeVariants(GraphicsStateCollection, VisualEffectAsset[], GlobalKeyword[])

Adds to the collection the compute shader variants that the visual effect assets dispatch.
public static bool AddComputeVariants(this GraphicsStateCollection graphicsStateCollection, VisualEffectAsset[] visualEffectAssets, GlobalKeyword[] globalKeywords)

Parameters

graphicsStateCollection

The GraphicsStateCollection in which to add the compute shader variants.

visualEffectAssets

An array of VisualEffectAsset files to scan for compute shaders.

globalKeywords

An array of GlobalKeyword objects to use with each compute shader's enabled local keywords when the method generates compute shader variants.

Returns

Type

Description

boolTrue if at least one new compute shader variant was successfully added, false otherwise.

Remarks

This method operates like VFXGraphicsStateCollectionBindings.AddComputeVariants, but uses the provided global keywords instead of the global shader keywords that are currently enabled.