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

Refreshing WebGL pages leads to textures being dropped #22152

Closed
Manishearth opened this issue Nov 9, 2018 · 0 comments
Closed

Refreshing WebGL pages leads to textures being dropped #22152

Manishearth opened this issue Nov 9, 2018 · 0 comments

Comments

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Nov 9, 2018

If you open https://threejs.org/examples/webgl_animation_cloth.html and refresh the page, the cloth and/or grass get replaced with black textures. If you keep refreshing you keep getting various broken states with one or more texture missing.

When I ran this on Android I got a console error from the constellation about a pipeline (I don't have this now, but android master should exhibit it). On desktop I get no error at all, but the behavior is the same.

cc @nox @jdm

@jdm jdm added the A-content/webgl label Nov 9, 2018
@jdm jdm added this to In progress in WebGL content Nov 30, 2018
bors-servo added a commit that referenced this issue Nov 30, 2018
Fix missing textures on reloading three.js image content

The fundamental problem is that three.js sets the crossOrigin property of an image, which kicks off an image microtask, and then sets the src. When the image URL is in the image cache (such as when reloading a page), this causes the shortcut to be taken and the image data is made available immediately, but the queued image task is unaware of this and asks the image cache to feed the image data. The existing code then ended up in an unexpected state when trying to deal with this data, such that when three.js received the image load notification and performed the texImage2D operation on the image data, it would discover that the image element did not claim to have a URL, and it would treat this as a broken image. Ultimately, this caused the texture that three.js obtained to be completely black.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22152.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22336)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 1, 2018
Fix missing textures on reloading three.js image content

The fundamental problem is that three.js sets the crossOrigin property of an image, which kicks off an image microtask, and then sets the src. When the image URL is in the image cache (such as when reloading a page), this causes the shortcut to be taken and the image data is made available immediately, but the queued image task is unaware of this and asks the image cache to feed the image data. The existing code then ended up in an unexpected state when trying to deal with this data, such that when three.js received the image load notification and performed the texImage2D operation on the image data, it would discover that the image element did not claim to have a URL, and it would treat this as a broken image. Ultimately, this caused the texture that three.js obtained to be completely black.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22152.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22336)
<!-- Reviewable:end -->
@atouchet atouchet moved this from In progress to Done in WebGL content Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
WebGL content
  
Done
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.