"texture bound to texture unit 0 is not renderable" error after resizing WebGL canvas

Number:rdar://35650822 Date Originated:November 20 2017
Status: Resolved:
Product:Safari Product Version:11.0.1 (12604.
Classification:Bug Reproducible:Always
If the WebGL canvas is resized, any subsequent draw calls that occur while a texture is bound produce the following error:

WebGL: drawArrays: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete', or it is a float/half-float type with linear filtering and without the relevant float/half-float linear extension enabled.

Steps to Reproduce:

Open the attached HTML file.

Expected Results:

No errors in console.

Actual Results:

Above error appears in console.

11.0.1 (12604.

macOS 10.12.6 (16G1036)
MacBook Pro (13-inch, 2017, Four Thunderbolt 3 Ports)
Intel Iris Plus Graphics 650 1536 MB


<!DOCTYPE html>
    <meta charset="utf-8"/>
<canvas id="webgl" width="640" height="480"></canvas>
<script type="text/javascript">
    var canvas = document.getElementById('webgl');
    var gl = canvas.getContext('webgl');

    gl.clearColor(0.8, 0.8, 0.8, 1);

    var prog = gl.createProgram();

    var vertex = gl.createShader(gl.VERTEX_SHADER);
    gl.shaderSource(vertex, `
        attribute vec3 pos;
        void main() {
            gl_Position = vec4(pos, 2.0);
    gl.attachShader(prog, vertex);

    var fragment = gl.createShader(gl.FRAGMENT_SHADER);
    gl.shaderSource(fragment, `
        void main() {
        	gl_FragColor = vec4(0.5, 0.5, 1.0, 1.0);
    gl.attachShader(prog, fragment);


    gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
        -1, 0, 0,
        0, 1, 0,
        0, -1, 0,
        1, 0, 0
    ]), gl.STATIC_DRAW);

    var attr = gl.getAttribLocation(prog, 'pos');
    gl.vertexAttribPointer(attr, 3, gl.FLOAT, false, 0, 0);

    const texture = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 64, 64, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(64 * 64 * 4));

    canvas.width = canvas.width + 1;

    gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);


Engineering requested a macOS sysdiagnose, and then closed the issue without comment.

As I provided a test case that demonstrates the bug, I don't see why a sysdiagnose should be necessary.

By john.firebaugh at Jan. 12, 2018, 12:52 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!