Contents

read(commandBuffer:)

Returns a Metal texture containing the current contents of the texture resource for GPU read operations.

Declaration

final func read(commandBuffer: (any MTLCommandBuffer)?) -> any MTLTexture

Parameters

  • commandBuffer:

    The command buffer that reads from this texture, or nil to skip synchronization.

Return Value

A MTLTexture ready for GPU read operations.

Discussion

The renderer waits for the provided command buffer to complete before discarding the texture.

See Also

Reading and writing texture data