WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
197592
[WebGL] Safari doesn't handle common no attribute use case
https://bugs.webkit.org/show_bug.cgi?id=197592
Summary
[WebGL] Safari doesn't handle common no attribute use case
Gregg Tavares
Reported
2019-05-04 02:18:51 PDT
When debugging WebGL or when explaining to discussing a feature it's best to make a "MINIMAL, Complete, Verifiable, Example" For WebGL this often means using no attributes and just drawing a single POINT Example: ------- const gl = document.querySelector('canvas').getContext('webgl'); const vsrc = ` void main() { gl_PointSize = 128.0; gl_Position = vec4(0, 0, 0, 1); } `; const fsrc = ` precision highp float; void main() { gl_FragColor = vec4(1, 0, 0, 1); } `; function createShader(gl, type, src) { const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s); return s; } const prg = gl.createProgram(); gl.attachShader(prg, createShader(gl, gl.VERTEX_SHADER, vsrc)); gl.attachShader(prg, createShader(gl, gl.FRAGMENT_SHADER, fsrc)); gl.linkProgram(prg); gl.useProgram(prg); gl.clearColor(0, 0, 1, 1); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.POINTS, 0, 1); ----- No attributes needed. This is great as it keeps the sample minimal so is perfect as a starting point for fragment shader based examples. I've used it 100s of times on Stack Overflow and other places to demonstrate WebGL solutions. It incorrectly fails on Safari only Here's the relevant conformance test
https://www.khronos.org/registry/webgl/sdk/tests/conformance/rendering/point-no-attributes.html?webglVersion=1&quiet=0
Attachments
Add attachment
proposed patch, testcase, etc.
Gregg Tavares
Comment 1
2019-05-04 02:23:16 PDT
Note that changing the vertex shader to this attribute vec4 position void main() { gl_PointSize = 128.0; gl_Position = position; } also fails but is perfectly valid WebGL with no attributes. Attributes have a default value of 0,0,0,1 so this will produce the same result as the previous example. Similarly you can set the attribute's constant value with `gl.vertexAttrib4f(...)` and draw points around the canvas.
Radar WebKit Bug Importer
Comment 2
2019-05-04 23:59:15 PDT
<
rdar://problem/50477704
>
Noah Chase
Comment 3
2020-02-23 21:12:45 PST
I’d love to see this fixed. I wish I knew where to start with a patch, but WebGL implementation is an intimidating black box to me.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug