Parameter | Description |
---|---|
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. |
vfxAssets | An array of VisualEffectAsset files to scan for each unique mesh and shader pairs. |
samples | The number of samples per pixel in this rendering configuration. |
attachments | The array of color attachments used in this rendering configuration. |
subPasses | 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 attachment used as shading rate image. |
bool True if at least one new graphics state was successfully added, `false` otherwise.
Generates and adds new graphics states to the collection from arrays of assets.
This method creates and attempts to add graphics states by processing arrays of assets. This is a convenient way to populate the collection without constructing each GraphicsState object manually. The shader variants generated by this function use both the keywords enabled on each `Material` and the global shader keywords that are **currently enabled** at the active context. When you provide `Mesh` and `Material` arrays, the function processes them as matched pairs. The number of elements in `meshes` must match the number of elements in `materials`. When you provide a `VisualEffectAsset` array, the function scans each asset to find pairs of shaders and geometry used in its render outputs. For each pair, the function generates graphics states for all combinations of the mesh's submeshes and the material's shader passes. The function populates each state with data from the mesh, render state, and render pass, and sets any remaining fields to their default values. Finally, the function will not add a graphics state if an identical one already exists for a given shader variant.