Closed Bug 877309 Opened 8 years ago Closed 8 years ago

Drawing a webgl canvas to another canvas shows last bound framebuffer

Categories

(Core :: Canvas: WebGL, defect)

20 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: wbaxter, Assigned: jgilbert)

Details

Attachments

(2 files)

Attached file 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.
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
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
Yep, oops.
Assignee: nobody → jgilbert
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #756852 - Flags: review?(bjacob)
Nice!  Thanks for the quick fix.
Attachment #756852 - Flags: review?(bjacob) → review+
https://hg.mozilla.org/mozilla-central/rev/338bb731eb55
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.