diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-09-12 16:36:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 16:36:08 -0400 |
commit | 26745b27419f687dec1e23434a5be827d4342768 (patch) | |
tree | 5ee5e5f2b9f49a506cc64037ccc5706aa7736c7c /components/script/dom/webgltexture.rs | |
parent | 910cc23a6e85cced43905f7615065b23bdb54b42 (diff) | |
parent | 4edb7b194c99a1d394dddaeac2f5064ed8e93f62 (diff) | |
download | servo-26745b27419f687dec1e23434a5be827d4342768.tar.gz servo-26745b27419f687dec1e23434a5be827d4342768.zip |
Auto merge of #21461 - jdm:webgltmp2, r=nox
Various webgl fixes for framebuffer attachment test
These changes resolve all panics on macOS when running framebuffer-object-attachment.html in headless and headful testing.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes OR
- [x] Fixes #13710. Fixes #20570.
<!-- 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/21461)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webgltexture.rs')
-rw-r--r-- | components/script/dom/webgltexture.rs | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 2ecfd0bfab2..4d8e58380f7 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -146,7 +146,7 @@ impl WebGLTexture { } }; - let base_image_info = self.base_image_info().unwrap(); + let base_image_info = self.base_image_info(); if !base_image_info.is_initialized() { return Err(WebGLError::InvalidOperation); } @@ -186,6 +186,22 @@ impl WebGLTexture { DOMToTextureCommand::Detach(self.id), ); } + + /* + If a texture object is deleted while its image is attached to the currently + bound framebuffer, then it is as if FramebufferTexture2D had been called, with + a texture of 0, for each attachment point to which this image was attached + in the currently bound framebuffer. + - GLES 2.0, 4.4.3, "Attaching Texture Images to a Framebuffer" + */ + let currently_bound_framebuffer = + self.upcast::<WebGLObject>() + .context() + .bound_framebuffer(); + if let Some(fb) = currently_bound_framebuffer { + fb.detach_texture(self); + } + context.send_command(WebGLCommand::DeleteTexture(self.id)); } } @@ -327,7 +343,7 @@ impl WebGLTexture { fn is_cube_complete(&self) -> bool { debug_assert_eq!(self.face_count.get(), 6); - let image_info = self.base_image_info().unwrap(); + let image_info = self.base_image_info(); if !image_info.is_defined() { return false; } @@ -389,10 +405,10 @@ impl WebGLTexture { self.image_info_array.borrow_mut()[pos as usize] = image_info; } - fn base_image_info(&self) -> Option<ImageInfo> { + fn base_image_info(&self) -> ImageInfo { assert!((self.base_mipmap_level as usize) < MAX_LEVEL_COUNT); - Some(self.image_info_at_face(0, self.base_mipmap_level)) + self.image_info_at_face(0, self.base_mipmap_level) } pub fn set_attached_to_dom(&self) { |