Open Bug 1484159 Opened 8 years ago Updated 3 years ago

WebGL texture fail with png containing gAMA chunk(sRGB) when creating it from dataview

Categories

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

62 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: cacheflood, Unassigned)

Details

Attachments

(1 file)

136.33 KB, application/x-7z-compressed
Details
Attached file testimages.7z —
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 Build ID: 20180813190114 Steps to reproduce: Following code: function generateTexture(dataViewOfImage, gl) { var imageData; imageData = new Blob([dataViewOfImage], { type: "image/png" }); var url = URL.createObjectURL(imageData); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([155, 155, 255, 127])); var image = new Image(); image.onload = function () { gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.generateMipmap(gl.TEXTURE_2D); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); gl.bindTexture(gl.TEXTURE_2D, null); } image.crossOrigin = "anonymous"; image.src = url; return texture; } Attached 2 images, Actual results: Images containing containg sRGB fails. Texture generation fails Error: WebGL warning: generateMipmap: The base level of the texture does not have power-of-two dimensions. Same error is on Chrome browser, but it fails on gl.texImage2D row: WebGL: INVALID_VALUE: texImage2D: bad image data Internet Explorer (11) and EDGE works (because they do not care the sRBG?) My solution was to remove the gAMA chunk from PGN files before streaming those to browser, then all works. Expected results: Texture creation successfully.
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: