<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>197592</bug_id>
          
          <creation_ts>2019-05-04 02:18:51 -0700</creation_ts>
          <short_desc>[WebGL] Safari doesn&apos;t handle common no attribute use case</short_desc>
          <delta_ts>2020-02-23 21:12:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Gregg Tavares">gman</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dino</cc>
    
    <cc>justin_fan</cc>
    
    <cc>nchase</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1533198</commentid>
    <comment_count>0</comment_count>
    <who name="Gregg Tavares">gman</who>
    <bug_when>2019-05-04 02:18:51 -0700</bug_when>
    <thetext>When debugging WebGL or when explaining to discussing a feature it&apos;s best to make a &quot;MINIMAL, Complete, Verifiable, Example&quot;

For WebGL this often means using no attributes and just drawing a single POINT

Example:

-------
const gl = document.querySelector(&apos;canvas&apos;).getContext(&apos;webgl&apos;);

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&apos;ve used it 100s of times on Stack Overflow and other places to demonstrate WebGL solutions.

It incorrectly fails on Safari only

Here&apos;s the relevant conformance test

https://www.khronos.org/registry/webgl/sdk/tests/conformance/rendering/point-no-attributes.html?webglVersion=1&amp;quiet=0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1533199</commentid>
    <comment_count>1</comment_count>
    <who name="Gregg Tavares">gman</who>
    <bug_when>2019-05-04 02:23:16 -0700</bug_when>
    <thetext>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&apos;s constant value with `gl.vertexAttrib4f(...)` and draw points around the canvas.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1533270</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-05-04 23:59:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/50477704&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1622050</commentid>
    <comment_count>3</comment_count>
    <who name="Noah Chase">nchase</who>
    <bug_when>2020-02-23 21:12:45 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>