Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddGraphicsStatesFromReference

Generates and adds new graphics states from arrays of assets, using a reference graphics state to initialize unspecified values.
Read time 5 minutesLast updated 5 days ago

Definition

AddGraphicsStatesFromReference(GraphicsState, Mesh[], Material[], int, NativeArray<AttachmentDescriptor>, NativeArray<SubPassDescriptor>, int, int, int)

Generates and adds new graphics states from arrays of assets, using a reference graphics state to initialize unspecified values.
public bool AddGraphicsStatesFromReference(GraphicsStateCollection.GraphicsState refState, Mesh[] meshes, Material[] materials, int samples, NativeArray<AttachmentDescriptor> attachments, NativeArray<SubPassDescriptor> subPasses, int subPassIndex = 0, int depthAttachmentIndex = -1, int shadingRateIndex = -1)

Parameters

The reference GraphicsStateCollection.GraphicsState to use as a template for initializing unspecified values.

meshes

An array of meshes to generate graphics states from. This array must be the same length as the
materials
array.

materials

An array of materials specifying the shader variant(s) for each generated graphics state. This array must be the same length as the
meshes
array.

samples

The number of samples per pixel in this rendering configuration.

The array of color attachments used in this rendering configuration.

The array containing information of each subpass.

subPassIndex

The index of the active subpass in this rendering configuration.

depthAttachmentIndex

The index of the attachment to be used as the depth/stencil buffer for this rendering configuration.

shadingRateIndex

The index of the attachment to be used as the shading rate image for this rendering configuration.

Returns

Type

Description

boolTrue if at least one new graphics state was successfully added, false otherwise.

Remarks

This function operates like GraphicsStateCollection.AddGraphicsStates, but instead of using default values for GraphicsStateCollection.GraphicsState fields, it copies values from the provided
refState
for any fields not determined by the input parameters.

AddGraphicsStatesFromReference(GraphicsState, Mesh[], Material[], GlobalKeyword[], int, NativeArray<AttachmentDescriptor>, NativeArray<SubPassDescriptor>, int, int, int)

Generates and adds new graphics states from arrays of assets, using a reference graphics state to initialize unspecified values.
public bool AddGraphicsStatesFromReference(GraphicsStateCollection.GraphicsState refState, Mesh[] meshes, Material[] materials, GlobalKeyword[] globalKeywords, int samples, NativeArray<AttachmentDescriptor> attachments, NativeArray<SubPassDescriptor> subPasses, int subPassIndex = 0, int depthAttachmentIndex = -1, int shadingRateIndex = -1)

Parameters

The reference GraphicsStateCollection.GraphicsState to use as a template for initializing unspecified values.

meshes

An array of meshes to generate graphics states from. This array must be the same length as the
materials
array.

materials

An array of materials specifying the shader variant(s) for each generated graphics state. This array must be the same length as the
meshes
array.

globalKeywords

An array of GlobalKeyword objects to use in conjunction with each material's enabled keywords when generating shader variants.

samples

The number of samples per pixel in this rendering configuration.

The array of color attachments used in this rendering configuration.

The array containing information of each subpass.

subPassIndex

The index of the active subpass in this rendering configuration.

depthAttachmentIndex

The index of the attachment to be used as the depth/stencil buffer for this rendering configuration.

shadingRateIndex

The index of the attachment to be used as the shading rate image for this rendering configuration.

Returns

Type

Description

boolTrue if at least one new graphics state was successfully added, false otherwise.

Remarks

This function operates like GraphicsStateCollection.AddGraphicsStates, but instead of using default values for GraphicsStateCollection.GraphicsState fields, it copies values from the provided
refState
for any fields not determined by the input parameters.

AddGraphicsStatesFromReference(GraphicsState, Mesh[], Material[])

Generates and adds new graphics states from arrays of assets, using a reference graphics state to initialize unspecified values.
public bool AddGraphicsStatesFromReference(GraphicsStateCollection.GraphicsState refState, Mesh[] meshes, Material[] materials)

Parameters

The reference GraphicsStateCollection.GraphicsState to use as a template for initializing unspecified values.

meshes

An array of meshes to generate graphics states from. This array must be the same length as the
materials
array.

materials

An array of materials specifying the shader variant(s) for each generated graphics state. This array must be the same length as the
meshes
array.

Returns

Type

Description

boolTrue if at least one new graphics state was successfully added, false otherwise.

Remarks

This function operates like GraphicsStateCollection.AddGraphicsStates, but instead of using default values for GraphicsStateCollection.GraphicsState fields, it copies values from the provided
refState
for any fields not determined by the input parameters.

AddGraphicsStatesFromReference(GraphicsState, Mesh[], Material[], GlobalKeyword[])

Generates and adds new graphics states from arrays of assets, using a reference graphics state to initialize unspecified values.
public bool AddGraphicsStatesFromReference(GraphicsStateCollection.GraphicsState refState, Mesh[] meshes, Material[] materials, GlobalKeyword[] globalKeywords)

Parameters

The reference GraphicsStateCollection.GraphicsState to use as a template for initializing unspecified values.

meshes

An array of meshes to generate graphics states from. This array must be the same length as the
materials
array.

materials

An array of materials specifying the shader variant(s) for each generated graphics state. This array must be the same length as the
meshes
array.

globalKeywords

An array of GlobalKeyword objects to use in conjunction with each material's enabled keywords when generating shader variants.

Returns

Type

Description

boolTrue if at least one new graphics state was successfully added, false otherwise.

Remarks

This function operates like GraphicsStateCollection.AddGraphicsStates, but instead of using default values for GraphicsStateCollection.GraphicsState fields, it copies values from the provided
refState
for any fields not determined by the input parameters.