Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Window.createImageBitmap: 2 is not a valid argument count for any overload. #21003

Closed
makc opened this issue Jan 5, 2021 · 15 comments

Comments

@makc
Copy link
Contributor

makc commented Jan 5, 2021

Sometimes I get this error.

Steps to reproduce the behavior:

  1. Load a gltf model with r124, Idk
  2. Look into browser console
  3. See error

Code

let manager = new THREE.LoadingManager, loader = new GLTFLoader( manager );
...
loader.load( config.path, function( result ) {
// nothing special here

Live example

n/a

Expected behavior

The error never happens

Screenshots

gltfloader stack

gltfloader code

Platform:

  • Device: Desktop
  • OS: Windows 10
  • Browser: Firefox
  • Three.js version: r124
@makc
Copy link
Contributor Author

makc commented Jan 5, 2021

Sometimes

Ok, I was able to narrow it down - it happens when FF is in iOS simulation mode:
ff

@makc
Copy link
Contributor Author

makc commented Jan 5, 2021

so there is createImageBitmap fails when providing options object closed as a duplicate of Wrong results with UNPACK_FLIP_Y_WEBGL and createImageBitmap imageOrientation

Looks the patches in bug 1367251 is adding the options, so close as duplicate.

which is still open after 4 years. not sure if you want to do anything about it.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 5, 2021

GLTFLoader should not use ImageBitmapLoader with Firefox, see:

// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
// expensive work of uploading a texture to the GPU off the main thread.
if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
this.textureLoader = new THREE.ImageBitmapLoader( this.options.manager );
} else {
this.textureLoader = new THREE.TextureLoader( this.options.manager );
}

@makc
Copy link
Contributor Author

makc commented Jan 5, 2021

a ha @Mugen87 that makes sense now. since FF fakes user agent and pretends to be an iPhone, this fails

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 5, 2021

Closing then.

@Mugen87 Mugen87 closed this as completed Jan 5, 2021
@aardgoose
Copy link
Contributor

FWIW, I have submitted patches to FF to add options support for createImageBitmap. Pending review on latest revision at the moment.

@mrdoob
Copy link
Owner

mrdoob commented Jan 11, 2021

@aardgoose 🙏🙏🙏

@qbytx
Copy link

qbytx commented Apr 9, 2021

I was using the latest version of GLTFLoader and, inexplicably, a three.js app that was working fine previously on firefox 87.0 hit a snag with this error. I had to force the loader to use THREE.TextureLoader to get everything working again.

@passion2434

This comment has been minimized.

@passion2434

This comment has been minimized.

@mrdoob
Copy link
Owner

mrdoob commented Apr 10, 2021

@Joshua3d can you create a jsfiddle that reproduces the issue?

@aardgoose
Copy link
Contributor

The createImageBitmap patches have now landed in Firefox nightly and the flipY and premulitplyAlpha options are supported.
The resize and colorSpaceConversion options aren't supported yet.

The gl.pixelStorei gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL and gl.UNPACK_FLIP_Y_WEBGL parameters are ignored as per latest spec.

@mrdoob
Copy link
Owner

mrdoob commented Sep 3, 2021

Nice!

@mrdoob
Copy link
Owner

mrdoob commented Sep 3, 2021

When do you think we'll be able to remove this code?

// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
// expensive work of uploading a texture to the GPU off the main thread.
if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
this.textureLoader = new ImageBitmapLoader( this.options.manager );
} else {
this.textureLoader = new TextureLoader( this.options.manager );
}

@aardgoose
Copy link
Contributor

It's targeted for Firefox 93 due in early October unless it hits problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants