AddComputeVariants
Adds to the collection the compute shader variants that the visual effect assets dispatch.
Read time 2 minutesLast updated 13 days ago
Definition
- Type: Method
- Namespace: UnityEngine.VFX
- Assembly: UnityEngine.VFXModule
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
The GraphicsStateCollection in which to add the compute shader variants.
An array of VisualEffectAsset files to scan for compute shaders.
Returns
Type | Description |
|---|---|
| bool | True 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 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.
VFX_COMPUTE_AABBSAdditional Resources: GraphicsStateCollection.AddComputeVariant
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
The GraphicsStateCollection in which to add the compute shader variants.
An array of VisualEffectAsset files to scan for compute shaders.
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 |
|---|---|
| bool | True 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.
Additional Resources: GraphicsStateCollection.AddComputeVariant