KhronosGroup / KhronosGroup/WebGL
Functions that read from out parameters have undefined behavior
Open
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 703
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
```glsl
void foo(out float a) {
a += 2.0f;
}
void main() {
float x = 5.0f;
foo(x);
gl_FragColor = vec4(x);
}
```
This is not an error, and is undefined behavior, but it works fine on some GPUs because their drivers effectively treat out as inout. However, I've encountered issues with other GPU drivers that are more strict. While we probably can't make it an error due to backcompat, maybe a compiler warning should be emitted for this?
Contributor guide
Assessment
This issue has not been assessed yet.