Three.js: nPOT textures can be swapped during the uploading process if the textures were already in Browser Cache.

Created on 22 Mar 2018  路  8Comments  路  Source: mrdoob/three.js

Description of the problem

nPOT textures can be swapped during the uploading process if the textures were already in Browser Cache.

Repeating of the problem
  • Open this link in Chrome on Android device.
  • Toilets must be bottom of screen, baths must be on top of screen.
  • Reload some page
  • Now bath and toilets mixed on both sides (or may be only baths, or only toilets)
Simple fix

Adding var _canvas in this line fixes it.

One more possible (unconfirmed) fix: use createImageBitmap on Image before doing the resize.

It seems that texImage2d somehow doesnt get update from that canvas in time.

Three.js version
  • [x] Dev
Browser
  • [x] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [ ] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [x] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)

Device: Huawei Nova
Android 7.0
Chrome 65.0.3325.109

Second Device: Meizu M2 Note
Android 5.1.1
Chrome 65.0.3325.109

Proofs

PC (as reference)
PC

Mobile (Huawei Nova) (bug)
Mobile bug

Mobile (Huawei Nova) (bug)
Mobile bug

Browser Issue

Most helpful comment

Ok, they fixed it even before we reported, its a duplicate of https://github.com/mrdoob/three.js/issues/13379

All 8 comments

Confirmed on my Moto G

It seems that texImage2d somehow doesn't get update from that canvas in time.

I'm not sure that is a three.js bug. When the call texImage2d() returns, WebGL ensures that you can reuse the given image/buffer without affecting the upload. If this is not the case, there is maybe a problem in the browser implementation.

BTW: I can't reproduce the error in Firefox (Android).

The implementation of makePowerOfTwo() was changed because it was not memory efficient to create a new canvas for each texture resize. So reintroducing var will also reintroducing the former memory related problems.

I can also reproduce this on windows with Chrome 66, but not with Firefox or Edge. Perhaps it's a bug in Chrome?

I think so. The behavior in Chrome does not conform to the standard. At least from my point of view...

Yep, this is Chrome bug, and was represented in raw openGl.
Test link: https://jsfiddle.net/6nLucq2y/9/, perhaps it's memory bug,

Can you please file a bug at? https://bugs.chromium.org/p/chromium/issues/list

You've already prepared a nice test case 馃槆

Ok, they fixed it even before we reported, its a duplicate of https://github.com/mrdoob/three.js/issues/13379

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fuzihaofzh picture fuzihaofzh  路  3Comments

zsitro picture zsitro  路  3Comments

boyravikumar picture boyravikumar  路  3Comments

scrubs picture scrubs  路  3Comments

donmccurdy picture donmccurdy  路  3Comments