Instance Method

use(_:usage:stages:)

Adds an untracked resource to the render pass, specifying which render stages need it.

Required.

Declaration

func use(_ resource: MTLResource, usage: MTLResourceUsage, stages: MTLRenderStages)

Parameters

resource

A resource within an argument buffer.

usage

Options for describing how a graphics function uses the resource.

stages

The render stages where the resource must be resident.

Discussion

This method makes the resource resident for the selected stages of the render pass and ensures that it's in a format compatible with the graphics function.

Call this method before issuing any draw calls that may access the resource. Calling this method again, or calling use(_:stages:), overwrites any previously specified usage options for future draw calls within the same render command encoder.

When working with color render targets, call this method as late as possible to improve performance.

See Also

Specifying Resource Usage for Argument Buffers

func use(UnsafePointer<MTLResource>, count: Int, usage: MTLResourceUsage, stages: MTLRenderStages)

Adds an array of untracked resources to the render pass, specifying which stages need them.

Required.

func use(MTLHeap, stages: MTLRenderStages)

Adds the resources in a heap to the render pass, specifying which render stages need them.

Required.

func use(UnsafePointer<MTLHeap>, count: Int, stages: MTLRenderStages)

Adds the resources in an array of heaps to the render pass, specifying which render stages need them.

Required.

func useResource(MTLResource, usage: MTLResourceUsage)

Adds an untracked resource to the render pass.

Required.

func useHeap(MTLHeap)

Adds the resources in a heap to the render pass.

Required.

func useHeaps([MTLHeap])

Adds the resources in an array of heaps to the render pass.

func useResources([MTLResource], usage: MTLResourceUsage)

Adds an array of untracked resources to the render pass.

struct MTLResourceUsage

The options that describe how a resource within an argument buffer will be used in a graphics or compute function.