KhronosGroup / KhronosGroup/WebGL
Change spec and add conformance tests asserting variables are initialized to zero
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 703
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
Per discussion in the working group: it's been a longstanding problem that WebGL didn't mandate that variables (global, local) in shaders are initialized to zero. Many implementations enforce this but some don't, which has historically led to behavioral differences of some shaders which accumulate values.
After discussing the options, it's been resolved to initialize these variables to zero explicitly. (Alternatives included failing shader compilation if there was a possibility of using uninitialized values, but enforcing this consistently is problematic, since sophisticated compilers may be able to prove things simpler compilers can't.) Microsoft's WebGL implementation has been initializing variables to zero all along, and there doesn't seem to be a performance penalty from doing so.
The WebGL 1.0 specification needs to be updated and some conformance tests written for this. Mac OS X is one platform where in the past it was observed that GLSL variables weren't initialized to 0, so it's possible that implementations can be most easily verified on that platform.
Contributor guide
Research direction
Start by locating the WebGL 1.0 specification and the existing conformance-test suite. Read related shader initialization tests and use the issue's global and local variable cases as the scope; done means the specification requires zero initialization and conformance tests verify it, including on platforms such as Mac OS X.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation, testing, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100