Documentation

Unity Engine

Download Unity

Unity Engine

GetComputeVariants(List<ComputeShaderVariant>)

Populates the given list with the compute shader variants in the collection.
Read time 1 minuteLast updated 5 days ago

Definition

public void GetComputeVariants(List<GraphicsStateCollection.ComputeShaderVariant> results)

Parameters

Remarks

If Unity can't find the compute shader of a variant, it logs a warning and the returned GraphicsStateCollection.ComputeShaderVariant has a
null
shader
, a
kernelIndex
of 0, and no
keywords
. The returned
keywords
of the other variants omit any keywords that GraphicsStateCollection.AddComputeVariant ignores, so they can differ from the keywords you passed to it.

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."); }}