Closed Bug 1258209 Opened 8 years ago Closed 4 years ago

FRAMEBUFFER_INCOMPLETE_ATTACHMENT happens in Firefox but not in Chrome on Nexus 5X

Categories

(Core :: Graphics: CanvasWebGL, defect, P3)

45 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1338656

People

(Reporter: Craig.Gidney, Unassigned, NeedInfo)

Details

(Whiteboard: gfx-noted)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID: 20160210153822
Firefox for Android

Steps to reproduce:

Run the following javascript snippet, which binds a float texture and a frame buffer and then checks for frame buffer completeness. Alternatively, navigate to this jsfiddle ( http://jsfiddle.net/fspks0go/3/embedded/result/ ) that the code was cut out of.

Triggering question on stackoverflow: http://stackoverflow.com/questions/36109347/framebuffer-incomplete-attachment-only-happens-on-android-w-firefox/36116802


var canvas = document.createElement('canvas');
var gl = canvas.getContext('webgl');
var GL = WebGLRenderingContext;
if (gl.getExtension('OES_texture_float') === null) {
    alert("No float support.");
}

var texture = gl.createTexture();
var frameBuffer = gl.createFramebuffer();
gl.bindTexture(GL.TEXTURE_2D, texture);
gl.bindFramebuffer(GL.FRAMEBUFFER, frameBuffer);

gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER, GL.NEAREST);
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, GL.NEAREST);
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S, GL.CLAMP_TO_EDGE);
gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T, GL.CLAMP_TO_EDGE);
gl.texImage2D(
    GL.TEXTURE_2D, //target
    0,             //level
    GL.RGBA,       //internalformat
    2,             //width
    2,             //height
    0,             //border
    GL.RGBA,       //format
    GL.FLOAT,      // type [changing to UNSIGNED_BYTE "fixes" the failure...?]
    null           // pixels
);
gl.framebufferTexture2D(
    GL.FRAMEBUFFER,
    GL.COLOR_ATTACHMENT0,
    GL.TEXTURE_2D,
    texture,
    0);

var result = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
if (result === GL.FRAMEBUFFER_COMPLETE) {
    alert("success (FRAMEBUFFER_COMPLETE)");
} else {
    alert("ERROR " + ({
        [0]: "Argument wasn't a frame buffer",
        [GL.INVALID_ENUM]: "INVALID_ENUM",
        [GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT]: "FRAMEBUFFER_INCOMPLETE_ATTACHMENT",
        [GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT]:
            "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",
        [GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS]: "FRAMEBUFFER_INCOMPLETE_DIMENSIONS",
        [GL.FRAMEBUFFER_UNSUPPORTED]: "FRAMEBUFFER_UNSUPPORTED"
    }[result] || result));
}


Actual results:

On my Nexus 5X in Firefox 45.0:

    alert ERROR FRAMEBUFFER_INCOMPLETE_ATTACHMENT

on my Nexus 5X in Chrome 49.0.2623.91:

    alert success (FRAMEBUFFER_COMPLETE)

on my desktop machine in Firefox 44:

    alert success (FRAMEBUFFER_COMPLETE)

(Consequently, the linked jsfiddle code behaves correctly in Chrome on the Nexus 5X and on my desktop, but errors in Firefox on the 5X.)


Expected results:

    alert success (FRAMEBUFFER_COMPLETE)

Since the GPU capabilities are determined by the phone, Firefox and Chrome should agree on whether rendering to a float texture is supported. (Apparently the FRAMEBUFFER_INCOMPLETE_ATTACHMENT error is how you check for this.)

Because rendering to float textures seems to work correctly in Chrome (e.g. the linked jsfiddle does the right things), Chrome is probably correct about float rendering being supported by the GPU.
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
Flags: needinfo?(jgilbert)
Whiteboard: gfx-noted
Try asking for:
https://www.khronos.org/registry/webgl/extensions/WEBGL_color_buffer_float/

If it is not available, Firefox does not believe it can support WEBGL_color_buffer_float on that hardware, and thus doesn't allow floating-point texture formats to be renderable when OES_texture_float is activated.

Unfortunately Chrome never exposes support for WEBGL_color_buffer_float, so it's not possible to tell if they are accidentally allowing float-renderables even though they don't completely support WEBGL_color_buffer_float on that hardware.

So it's possible Chrome is wrong to offer it.
Does Firefox support WEBGL_color_buffer_float on that hardware? Does OES_texture_half_float and/or EXT_color_buffer_half_float work?
Flags: needinfo?(jgilbert) → needinfo?(Craig.Gidney)
> Does Firefox support WEBGL_color_buffer_float on that hardware? Does OES_texture_half_float and/or EXT_color_buffer_half_float work?

gl.getExtension returns a non-undefined result for WEBGL_color_buffer_float, OES_texture_half_float, and EXT_color_buffer_half_float when run on firefox mobile on the phone in question.

I'd be really surprised if hardware support was the issue, since http://algorithmicassertions.com/quirk#circuit={%22cols%22:[[%22X^t%22]]} works when run in chrome on the phone (but not in firefox) and the repro was derived from that.
Oh, and the same error still occurred after calling getExtension with all those options in addition to as OES_texture_float.
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.