31 lines
600 B
Markdown
31 lines
600 B
Markdown
|
|
# OpenGLShader::CompileCompute
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
bool CompileCompute(const char* computeSource);
|
||
|
|
```
|
||
|
|
|
||
|
|
从源代码编译计算着色器。
|
||
|
|
|
||
|
|
**参数:**
|
||
|
|
- `computeSource` - 计算着色器源代码
|
||
|
|
|
||
|
|
**返回:** 成功返回 `true`,失败返回 `false`
|
||
|
|
|
||
|
|
**线程安全:** ❌
|
||
|
|
|
||
|
|
**示例:**
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
const char* cs = R"(
|
||
|
|
#version 430 core
|
||
|
|
layout(local_size_x = 16, local_size_y = 16) in;
|
||
|
|
void main() { /* compute logic */ }
|
||
|
|
)";
|
||
|
|
shader->CompileCompute(cs);
|
||
|
|
```
|
||
|
|
|
||
|
|
## 相关文档
|
||
|
|
|
||
|
|
- [OpenGLShader 总览](shader.md) - 返回类总览
|
||
|
|
- [Compile (VS+FS)](compile-vs-fs.md) - 图形着色器版本
|