KhronosGroup / KhronosGroup/WebGL
Does spec need to be clear about \0 in strings
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 703
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
Example:
```
const gl = document.querySelector('canvas').getContext('webgl');
const prg = createProgram(
gl,
`// \0\nvoid main() { gl_Position = vec4(0, 0, 0, 1); gl_PointSize = 128.0; }`,
`void main() { gl_FragColor = vec4(0, 1, 1, 1); }`);
gl.useProgram(prg);
gl.drawArrays(gl.POINTS, 0, 1);
function createShader(gl, type, src) {
const shader = gl.createShader(type);
gl.shaderSource(shader, src);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
throw new Error(gl.getShaderInfoLog(shader));
}
return shader;
}
function createProgram(gl, vs, fs, tf) {
const program = gl.createProgram();
gl.attachShader(program, createShader(gl, gl.VERTEX_SHADER, vs));
gl.attachShader(program, createShader(gl, gl.FRAGMENT_SHADER, fs));
if (tf) {
gl.transformFeedbackVaryings(program, tf, gl.INTERLEAVED_ATTRIBS); // gl.SEPARATE_ATTRIBS);
}
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
throw new Error(gl.getProgramInfoLog(program));
}
return program;
}
```
Runs in Firefox, fails in Safari and Chrome
https://jsgist.org/?src=c20a4b92a9116ac894553ade4b57c4a8
Contributor guide
Research direction
Start with the gl.shaderSource call and the provided WebGL example, then compare how Firefox, Safari, and Chrome handle the embedded \0 in the shader source. Review the WebGL specification's treatment of null characters; done when the expected behavior is clarified and the browser discrepancy is resolved or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100