aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webgl2renderingcontext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/webgl2renderingcontext.rs')
-rw-r--r--components/script/dom/webgl2renderingcontext.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
index c0c3aab5ad6..03eb5e7abc2 100644
--- a/components/script/dom/webgl2renderingcontext.rs
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as constants;
use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
@@ -176,9 +175,8 @@ impl WebGL2RenderingContext {
size: Size2D<u32>,
attrs: GLContextAttributes,
) -> Option<DomRoot<WebGL2RenderingContext>> {
- WebGL2RenderingContext::new_inherited(window, canvas, size, attrs).map(|ctx| {
- reflect_dom_object(Box::new(ctx), window, WebGL2RenderingContextBinding::Wrap)
- })
+ WebGL2RenderingContext::new_inherited(window, canvas, size, attrs)
+ .map(|ctx| reflect_dom_object(Box::new(ctx), window))
}
}
@@ -222,7 +220,7 @@ impl WebGL2RenderingContext {
fn unbind_from(&self, slot: &MutNullableDom<WebGLBuffer>, buffer: &WebGLBuffer) {
if slot.get().map_or(false, |b| buffer == &*b) {
- buffer.decrement_attached_counter();
+ buffer.decrement_attached_counter(false);
slot.set(None);
}
}
@@ -349,7 +347,11 @@ impl WebGL2RenderingContext {
}
let fb_slot = self.base.get_draw_framebuffer_slot();
- if fb_slot.get().is_none() && self.default_fb_readbuffer.get() == constants::NONE {
+ let fb_readbuffer_valid = match fb_slot.get() {
+ Some(fb) => fb.attachment(fb.read_buffer()).is_some(),
+ None => self.default_fb_readbuffer.get() != constants::NONE,
+ };
+ if !fb_readbuffer_valid {
return self.base.webgl_error(InvalidOperation);
}
@@ -3401,7 +3403,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
for slot in &[&generic_slot, &indexed_binding.buffer] {
if let Some(old) = slot.get() {
- old.decrement_attached_counter();
+ old.decrement_attached_counter(false);
}
slot.set(buffer);
}
@@ -3479,7 +3481,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
for slot in &[&generic_slot, &indexed_binding.buffer] {
if let Some(old) = slot.get() {
- old.decrement_attached_counter();
+ old.decrement_attached_counter(false);
}
slot.set(buffer);
}
@@ -3882,7 +3884,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
}
}
-impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<WebGL2RenderingContext> {
+impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<'_, WebGL2RenderingContext> {
#[allow(unsafe_code)]
unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource {
let this = &*self.unsafe_get();