Documentation

Unity Engine

Download Unity

Unity Engine

ComputeShaderVariant

Creates a compute shader variant identifier with the provided compute shader, kernel index, and keywords.
Read time 1 minuteLast updated 5 days ago

Definition

ComputeShaderVariant(ComputeShader, int, LocalKeyword[])

Creates a compute shader variant identifier with the provided compute shader, kernel index, and keywords.
public ComputeShaderVariant(ComputeShader shader, int kernelIndex, LocalKeyword[] keywords)

Parameters

The ComputeShader of the variant.

kernelIndex

The index of the kernel in
shader
.

The LocalKeyword array of the variant.

Remarks

Use this constructor to describe a variant to pass to GraphicsStateCollection.AddComputeVariant, GraphicsStateCollection.ContainsComputeVariant, or GraphicsStateCollection.RemoveComputeVariant, or to compare with the variants that GraphicsStateCollection.GetComputeVariants returns. The constructor stores the arguments as they are and doesn't validate them.

ComputeShaderVariant(ComputeShader, int)

Creates a compute shader variant identifier with the provided compute shader, kernel index, and the keywords enabled on the compute shader.
public ComputeShaderVariant(ComputeShader shader, int kernelIndex)

Parameters

The ComputeShader of the variant.

kernelIndex

The index of the kernel in
shader
.

Remarks

The variant uses the keywords that are enabled on
shader
when you call the constructor, from ComputeShader.enabledKeywords. Later changes to the keywords of
shader
don't affect the variant. If
shader
is
null
, this constructor throws a
NullReferenceException
.