# OpenGLPipelineState::SetComputeShader() ```cpp void SetComputeShader(RHIShader* shader) override; ``` ## 作用 把一个 shader 作为当前 compute pipeline 的程序来源。 ## 当前实现行为 - 把 `shader` 缓存到 `m_computeShader` - 若 `shader != nullptr`: - 直接 `static_cast(shader)` - 把其 `GetID()` 结果写入 `m_computeProgram` - 若 `shader == nullptr`,则把 `m_computeProgram` 置为 `0` ## 需要特别注意 - 没有运行时类型检查 - 也不验证这个 `OpenGLShader` 是否真的是 compute program ## 相关文档 - [HasComputeShader](HasComputeShader.md) - [GetComputeShader](GetComputeShader.md) - [Bind](Bind.md)