---
title: cp_drawable_get_depth_texture
framework: compositorservices
role: symbol
role_heading: Function
path: compositorservices/cp_drawable_get_depth_texture
---

# cp_drawable_get_depth_texture

Returns the depth texture at the specified index in the drawable.

## Declaration

```occ
id<MTLTexture>cp_drawable_get_depth_texture(cp_drawable_t drawable, size_t index);
```

## Parameters

- `drawable`: The drawable for a frame.
- `index`: The index of the depth texture you want. The index must be greater than or equal to 0 and less than the value that doc://com.apple.compositorservices/documentation/CompositorServices/cp_drawable_get_texture_count returns.

## Return Value

Return Value The Metal depth texture at the specified index.

## Discussion

Discussion Use the returned texture in your render pipeline as the depth texture for your content. The layer’s texture topology determines the layout and content for each texture. The drawable’s views contain information about how those views map to the textures.

## See Also

### Getting the render textures

- [cp_drawable_get_texture_count](compositorservices/cp_drawable_get_texture_count.md)
- [cp_drawable_get_color_texture](compositorservices/cp_drawable_get_color_texture.md)
