# RHICommandList::SetStencilRef ```cpp virtual void SetStencilRef(uint8_t ref) = 0; ``` 设置模板测试的参考值。模板测试将每个像素的模板值与此参考值进行比较,决定像素是否被写入。 **参数:** - `ref` - 模板参考值(范围 0-255) **返回:** `void` **异常:** 无 **线程安全:** ❌ **复杂度:** O(1) **示例:** ```cpp cmdList->SetStencilRef(0xFF); ``` ## 相关文档 - [RHICommandList 总览](command-list.md) - 返回类总览 - [SetDepthStencilState](set-depth-stencil-state.md) - 设置深度模板状态