Open Bug 1279855 Opened 8 years ago Updated 2 years ago

WebGL texImage2D "expensive reformat"

Categories

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

49 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jonas.schlatter, Unassigned)

Details

(Whiteboard: [gfx-noted])

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20160611004009

Steps to reproduce:

Using texImage2D in conformity to https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D 

gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img);


Actual results:

yields

Error: WebGL: texImage2D: Chosen format/type incured an expensive reformat: 0x1908/0x1401

translating to: GL_RGBA to GL_UNSIGNED_BYTE is an expensive reformat.


Expected results:

This should not happen, since unsigned_byte is the type to handle rgba format within webGL? (None of the other types matched, either)
Nical, does it fall into your bucket?
Flags: needinfo?(nical.bugzilla)
Jeff is our WebGL expert.
Flags: needinfo?(nical.bugzilla) → needinfo?(jgilbert)
Whiteboard: [gfx-noted]
(In reply to jonas.schlatter from comment #0)
> User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:49.0) Gecko/20100101
> Firefox/49.0
> Build ID: 20160611004009
> 
> Steps to reproduce:
> 
> Using texImage2D in conformity to
> https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/
> texImage2D 
> 
> gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img);
> 
> 
> Actual results:
> 
> yields
> 
> Error: WebGL: texImage2D: Chosen format/type incured an expensive reformat:
> 0x1908/0x1401
> 
> translating to: GL_RGBA to GL_UNSIGNED_BYTE is an expensive reformat.
> 
> 
> Expected results:
> 
> This should not happen, since unsigned_byte is the type to handle rgba
> format within webGL? (None of the other types matched, either)

It's not actually an error. It's supposed to be a warning. (the c++ is GenerateWarning)
I'll take a look at making this actually a warning.

If we're hitting this, there's not getting around the truth: An expensive reformat is occurring.
This could be because the original format is YUV, in which case there *is* no direct upload format that can be selected.
Component: Untriaged → Canvas: WebGL
Flags: needinfo?(jgilbert)
Product: Firefox → Core
In Firefox Beta (V50), the problem gets even worse. I get three warnings whenever I try to use texImage2D with an HTMLImageElement:

Error: WebGL: texImage2D: Incurred CPU-side conversion, which is very slow.util.js:965:16
Error: WebGL: texImage2D: Incurred CPU pixel conversion, which is very slow.util.js:965:16
Error: WebGL: texImage2D: Chosen format/type incurred an expensive reformat: 0x1908/0x1401

These errors even show up in the WebGL conformance tests:

https://www.khronos.org/registry/webgl/sdk/tests/conformance/more/functions/texImage2DHTML.html

What are we supposed to do to get rid of these errors?
`srcFormat` here is BGRA8, and BGRA8->RGBA8 isn't cheap, so we warn about it.
This perf warning should probably be behind a dev pref.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.