readPixels fails with RGB buffer after webgl2 refactor
Categories
(Core :: Graphics: CanvasWebGL, defect, P3)
Tracking
()
People
(Reporter: mhirsch, Unassigned)
Details
(Whiteboard: [gfx-noted])
Attachments
(1 file)
|
131.08 KB,
text/html
|
Details |
Comment 1•9 years ago
|
||
Updated•9 years ago
|
Updated•9 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
What are you testing on? On firefox 67 I still get the "Error: WebGL warning: readPixels: Incompatible format or type" message running the attached example.
Comment 3•6 years ago
|
||
Unfortunately, RGB/UNSIGNED_BYTE is not guaranteed to be an acceptable format and type combo.
For non-float textures the only acceptable formats are:
- RGBA/UNSIGNED_BYTE
- getParameter(IMPLEMENTATION_COLOR_READ_FORMAT)/getParameter(IMPLEMENTATION_COLOR_READ_TYPE)
- (IMPLEMENTATION_COLOR_READ_FORMAT/TYPE might be give you RGBA/UNSIGNED_BYTE anyways)
It looks like this testcase relies on RGB/UNSIGNED_BYTE being valid, but that's only true for some drivers, and may change with updates to either Firefox or graphics drivers.
Comment 4•5 years ago
|
||
We see a similar issue using WebGL2.
We have a 16-bit per channel image editing app that runs on Chrome and we would like to add support for Firefox. However, in Firefox we can't get 16-bit R, RGB, RGBA (R16UI, RGB16UI, RGBA16UI) values from our context.
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_SHORT, arrayBufView);
WebGL warning: readPixels: Incompatible format or type.
gl.readPixels(0, 0, width, height, gl.RGB, gl.UNSIGNED_SHORT, arrayBufView);
WebGL warning: readPixels: Incompatible format or type.
We would like to run our app in Firefox but Chrome seems to have much more flexibility in 'readPixels'.
Comment 5•5 years ago
|
||
What do these show on this machine for this FBO?
getParameter(IMPLEMENTATION_COLOR_READ_FORMAT)
getParameter(IMPLEMENTATION_COLOR_READ_TYPE)
Comment 6•5 years ago
|
||
gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT)
6408
gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE)
5121
Comment 7•5 years ago
|
||
I have a made a jsfiddle to help us: https://jsfiddle.net/prkxz4q7/2/
I get the following:
R8 -> RED / UNSIGNED_BYTE
RG8 -> RG / UNSIGNED_BYTE
RGB8 -> RGBA / UNSIGNED_BYTE
RGBA8 -> RGBA / UNSIGNED_BYTE
R16UI -> RED_INTEGER / UNSIGNED_SHORT
RG16UI -> RG_INTEGER / UNSIGNED_SHORT
RGB16UI -> - / -
RGBA16UI -> RGBA_INTEGER / UNSIGNED_SHORT
Is that what you get?
Comment 8•5 years ago
|
||
Yes I get the same in Firefox and Chrome on that jsfiddle. I can make a better jsfiddle later if that would help. I opened a bug a couple days ago (https://bugzilla.mozilla.org/show_bug.cgi?id=1663214) and made a very quick jsfiddle example but I can make a better/more specific one if that would help.
rb_format -> IMPLEMENTATION_COLOR_READ_FORMAT / _TYPE
R8 -> RED / UNSIGNED_BYTE
RG8 -> RG / UNSIGNED_BYTE
RGB8 -> RGBA / UNSIGNED_BYTE
RGBA8 -> RGBA / UNSIGNED_BYTE
R16UI -> RED_INTEGER / UNSIGNED_SHORT
RG16UI -> RG_INTEGER / UNSIGNED_SHORT
RGB16UI -> - / -
RGBA16UI -> RGBA_INTEGER / UNSIGNED_SHORT
Comment 9•5 years ago
|
||
Base on that output, shouldn't I be able to do a readPixels like?
let pix = new Uint16Array(size);
gl.readPixels(0, 0, w, h, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, pix);
https://jsfiddle.net/cpm5fgzr/
WebGL warning: readPixels: Incompatible format or type.
Description
•