GetComputeVariants(List<ComputeShaderVariant>)
Populates the given list with the compute shader variants in the collection.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
public void GetComputeVariants(List<GraphicsStateCollection.ComputeShaderVariant> results)
Parameters
The GraphicsStateCollection.ComputeShaderVariant list to populate.
Remarks
If Unity can't find the compute shader of a variant, it logs a warning and the returned GraphicsStateCollection.ComputeShaderVariant has a , a of 0, and no . The returned of the other variants omit any keywords that GraphicsStateCollection.AddComputeVariant ignores, so they can differ from the keywords you passed to it.
nullshaderkernelIndexkeywordskeywordsAdditional Resources: GraphicsStateCollection.computeVariantCount, GraphicsStateCollection.AddComputeVariant.
Examples
using System.Collections.Generic;using UnityEngine;using UnityEngine.Rendering;// Attach this script to a GameObject, then assign a graphics state collection in the Inspector.public class GetComputeVariantsExample : MonoBehaviour{ public GraphicsStateCollection graphicsStateCollection; void Start() { List<GraphicsStateCollection.ComputeShaderVariant> variants = new List<GraphicsStateCollection.ComputeShaderVariant>(); graphicsStateCollection.GetComputeVariants(variants); Debug.Log("Collection contains " + variants.Count + " compute shader variants."); }}