Drawing a webgl canvas to another canvas shows last bound framebuffer

RESOLVED FIXED in mozilla24

Status

()

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: wbaxter, Assigned: jgilbert)

Tracking

20 Branch
mozilla24
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
Created attachment 755547 [details]
index.html

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36

Steps to reproduce:

If you are doing offscreen rendering to a texture render target, and don't re-bind the primary framebuffer, then when you do a call like context2d.drawImage(webglCanvas, 0, 0), what you get is a copy of the last bound framebuffer, rather than the content that is actually showing on the WebGL canvas.

This is not the result that the spec leads me to expect.

I have a repro at http://www.billbaxter.com/rttRepro, and also attached.


Actual results:

If you call drawImage with the webgl canvas as the source, you seem to get the last framebuffer bound rather than the primary/screen framebuffer of the webgl canvas.


Expected results:

I think context2d.drawImage should never copy an offscreen framebuffer from a webgl canvas, but rather always the primary framebuffer.
(Reporter)

Comment 1

6 years ago
Note that it seems that Firefox behaves the same whether or not preserveDrawingBuffer is set to true or not.  In the case of preserveDrawingBuffer=false, the spec says you can't count on drawImage working properly unless you do it before returning from your requestAnimationFrame callback.

You can turn preserveDrawingBuffer on in the demo with http://www.billbaxter.com/rttRepro?preserve

Updated

6 years ago
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
(Assignee)

Comment 2

6 years ago
Created attachment 756852 [details] [diff] [review]
patch: Read from screen, not current bound FBO for WebGLContext::Render

Yep, oops.
Assignee: nobody → jgilbert
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #756852 - Flags: review?(bjacob)
(Reporter)

Comment 3

6 years ago
Nice!  Thanks for the quick fix.
Attachment #756852 - Flags: review?(bjacob) → review+

Comment 5

6 years ago
https://hg.mozilla.org/mozilla-central/rev/338bb731eb55
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.