<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/LayerRenderer/Drawable/View/TextureMap-swift.struct/textureIndex",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Compositor Services",
      "CompositorServices"
    ],
    "preciseIdentifier" : "c:@F@cp_view_texture_map_get_texture_index"
  },
  "title" : "textureIndex"
}
-->

# textureIndex

The index of the view’s textures in the drawable.

```
var textureIndex: Int { get }
```

## Discussion

Compositor Services places the color and depth textures for this view at same index number in the drawable.
Use the returned index to the [`colorTextures`](/documentation/CompositorServices/LayerRenderer/Drawable/colorTextures)
or [`depthTextures`](/documentation/CompositorServices/LayerRenderer/Drawable/depthTextures) properties to retrieve the appropriate texture.

Compositor Services places the color and depth textures for this view at same index number in the drawable.
In Swift, the index applies to the [`colorTextures`](/documentation/CompositorServices/LayerRenderer/Drawable/colorTextures)and
[`depthTextures`](/documentation/CompositorServices/LayerRenderer/Drawable/depthTextures) properties.
In ObjectiveC, the index applies to the [`cp_drawable_get_color_texture`](/documentation/CompositorServices/cp_drawable_get_color_texture) and
[`cp_drawable_get_depth_texture`](/documentation/CompositorServices/cp_drawable_get_depth_texture) functions.

> Note:
> If you draw with array-based textures, retrieve and apply the index from
> ``doc://com.apple.compositorservices/documentation/CompositorServices/LayerRenderer/Drawable/View/TextureMap-swift.struct/sliceIndex`` instead.

---

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)