---
title: "makeTexture(descriptor:offset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlheap/maketexture(descriptor:offset:)"
---

# makeTexture(descriptor:offset:)

Creates a texture at a specified offset on the heap.

## Declaration

```swift
func makeTexture(descriptor: MTLTextureDescriptor, offset: Int) -> (any MTLTexture)?
```

## Parameters

- `descriptor`: A descriptor object that describes the properties of the texture.
- `offset`: The distance, in bytes, to place the texture relative to the start of the heap.

## Return Value

Return Value A new texture, or nil if the heap is not a placement heap.

## Discussion

Discussion You can call the method with the following restrictions: The heap’s type needs to be MTLHeapType.placement The texture’s CPU cache mode option needs to match the heap’s cpuCacheMode property The texture’s storage mode option needs to be MTLStorageMode.memoryless, or match the heap’s storageMode property important: Avoid potentially erratic behavior by aligning the texture correctly so that it doesn’t extend past the end of the heap. Use the heapBufferSizeAndAlign(length:options:) to determine the correct size and alignment. note: The new texture can implicitly alias the underlying memory of other resources already in the heap within the overlapping half-open range of [offset, offset + requiredSize).

## See Also

### Creating textures from a heap

- [makeTexture(descriptor:)](metal/mtlheap/maketexture(descriptor:).md)
