<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSTemporaryImage/init(commandBuffer:textureDescriptor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSTemporaryImage(cm)temporaryImageWithCommandBuffer:textureDescriptor:"
  },
  "title" : "init(commandBuffer:textureDescriptor:)"
}
-->

# init(commandBuffer:textureDescriptor:)

Low-level interface for creating a temporary image using a texture descriptor.

```
convenience init(commandBuffer: any MTLCommandBuffer, textureDescriptor: MTLTextureDescriptor)
```

## Parameters

`commandBuffer`

The command buffer on which the temporary image will be exclusively used.

`textureDescriptor`

A texture descriptor that describes the temporary image texture to create.

## Return Value

A valid [`MPSTemporaryImage`](/documentation/MetalPerformanceShaders/MPSTemporaryImage) object.

## Discussion

The temporary image will be released when the command buffer is committed. The underlying texture will become invalid before this time due to the action of the [`readCount`](/documentation/MetalPerformanceShaders/MPSTemporaryImage/readCount) property.

This function provides access to pixel formats not typically covered by the [`init(commandBuffer:imageDescriptor:)`](/documentation/MetalPerformanceShaders/MPSTemporaryImage/init(commandBuffer:imageDescriptor:)) method. The feature channels will be inferred from the pixel format without changing the width. The following restrictions apply:

- The texture type must be <doc://com.apple.documentation/documentation/Metal/MTLTextureType/type2D> or <doc://com.apple.documentation/documentation/Metal/MTLTextureType/type2DArray>.
- The texture usage must contain at least one of <doc://com.apple.documentation/documentation/Metal/MTLTextureUsage/shaderRead> or <doc://com.apple.documentation/documentation/Metal/MTLTextureUsage/shaderWrite>.
- The storage mode must be <doc://com.apple.documentation/documentation/Metal/MTLStorageMode/private>.
- The depth must be 1.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)