WebGL2.0: Nightly 48 warns about invalid internal format

RESOLVED INVALID

Status

()

Core
Canvas: WebGL
RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: marcot, Unassigned)

Tracking

48 Branch
x86_64
Windows 10
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

5.65 MB, application/x-zip-compressed
Details
(Reporter)

Description

2 years ago
Created attachment 8745923 [details]
FFnightlyInternalFormatWarning.zip

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36

Steps to reproduce:

open the attached html in Firefox Nightly with webgl2.0 flag enabled


Actual results:

browser logs:
Error: WebGL: texImage2D: Invalid internalformat: 0x0000


Expected results:

no warnings.
(Reporter)

Updated

2 years ago
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

Updated

2 years ago
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core

Comment 1

2 years ago
Debugging the test case, I see that the code calls glTexImage2D with the following parameters:

internalFormat = GL_R16F = 0x822D = 33325
format = GL_RED = 0x1903 = 6403
type = GL_HALF_FLOAT = 0x140B = 5131

The issue is that the page was compiled with an old version of Emscripten that did not yet have GL_HALF_FLOAT support. The support was added in https://github.com/kripken/emscripten/commit/ee595a2729cf54879b3f505cc9e1cbbce541cde3.

Because the support was missing, it caused the GL code to issue a GL error GL_INVALID_ENUM, and then subsequently run here https://github.com/kripken/emscripten/commit/ee595a2729cf54879b3f505cc9e1cbbce541cde3#diff-78a51faf7f8c4f62113aae3d5d4ae8eeL500, which set internalFormat to 0 for the subsequent call to WebGL.texImage2D(). InternalFormat = 0 itself is invalid, so Firefox is issuing an error correctly here.

Btw, if you run the Unity3D compilation with the Emscripten linker flag -s GL_ASSERTIONS=1, you may get some of the more verbose debug logging messages, e.g. this print was available for the missing enum case: https://github.com/kripken/emscripten/commit/ee595a2729cf54879b3f505cc9e1cbbce541cde3#diff-78a51faf7f8c4f62113aae3d5d4ae8eeR499. It can be a good first go-to on any odd GL behavior in Emscripten, as well as checking through glGetError()s for any clues.

Auditing the code path, I realize that we can simplify Emscripten here a bit, so authored these changes, which also completes our texture format support for WebGL 2: https://github.com/kripken/emscripten/pull/4277.

I'll call this invalid since this was an Emscripten issue and not a Firefox issue. Thanks for the test case Marco!
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID

Comment 2

2 years ago
For tracking reference, I think the test page was built with Emscripten 1.34.1(?). The GL_HALF_FLOAT support was added in 1.34.9.
You need to log in before you can comment on or make changes to this bug.