<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputeCommandEncoder/setStageInRegionWithIndirectBuffer(_:indirectBufferOffset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLComputeCommandEncoder(im)setStageInRegionWithIndirectBuffer:indirectBufferOffset:"
  },
  "title" : "setStageInRegionWithIndirectBuffer(_:indirectBufferOffset:)"
}
-->

# setStageInRegionWithIndirectBuffer(_:indirectBufferOffset:)

Sets the region of the stage-in attributes to apply to a compute kernel using an indirect buffer.

```
func setStageInRegionWithIndirectBuffer(_ indirectBuffer: any MTLBuffer, indirectBufferOffset: Int)
```

## Parameters

`indirectBuffer`

The [`MTLRegion`](/documentation/Metal/MTLRegion) defining how to interpret a thread’s location as a coordinate for stage-in data.

`indirectBufferOffset`

Where the data begins, in bytes, from the start of the buffer.

## Discussion> Important:
> Lay out the data in the buffer as described in the ``doc://com.apple.metal/documentation/Metal/MTLStageInRegionIndirectArguments`` structure.

The region’s origin point, starting from `(0,0,0)` in the upper left of the bound data, determines the final index of `[[stage_in]]` data. Note that the total number of threads Metal launches may be larger than your stage-in data.

To determine the index used to fetch `[[stage_in]]` data for a given thread, the GPU adds the values specified by the region’s origin to the thread position in the grid. Threads in the grid outside of the maximum stage-in data size have undefined behavior when accessing the stage-in memory region.

---

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)