---
title: "setStencilReferenceValue(front:back:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4rendercommandencoder/setstencilreferencevalue(front:back:)"
---

# setStencilReferenceValue(front:back:)

Configures the encoder with different stencil test reference values for front-facing and back-facing primitives.

## Declaration

```swift
func setStencilReferenceValue(front frontReferenceValue: UInt32, back backReferenceValue: UInt32)
```

## Parameters

- `frontReferenceValue`: A stencil test comparison value the render pipeline applies to front-facing primitives.
- `backReferenceValue`: A stencil test comparison value the render pipeline applies to back-facing primitives.

## Discussion

Discussion The render pipeline applies frontReferenceValue to front-facing primitives and backReferenceValue to back-facing primitives.

## See Also

### Configuring depth and stencil behavior

- [setDepthStencilState(_:)](metal/mtl4rendercommandencoder/setdepthstencilstate(_:).md)
- [setDepthBias(_:slopeScale:clamp:)](metal/mtl4rendercommandencoder/setdepthbias(_:slopescale:clamp:).md)
- [setDepthClipMode(_:)](metal/mtl4rendercommandencoder/setdepthclipmode(_:).md)
- [setDepthTestBounds(_:)](metal/mtl4rendercommandencoder/setdepthtestbounds(_:).md)
- [setStencilReferenceValue(_:)](metal/mtl4rendercommandencoder/setstencilreferencevalue(_:).md)
