aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglframebuffer.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2018-08-15 13:27:44 -0400
committerJosh Matthews <josh@joshmatthews.net>2018-09-10 15:56:15 -0400
commitd179435eabbcb2038a8c1c33f86465c10334eebc (patch)
treeff0fd285f9f5a97999cd6af0c96a6f9a557f4d01 /components/script/dom/webglframebuffer.rs
parent80ed8292415d3fba6201c47061a8252e09e9ac68 (diff)
downloadservo-d179435eabbcb2038a8c1c33f86465c10334eebc.tar.gz
servo-d179435eabbcb2038a8c1c33f86465c10334eebc.zip
webgl: Ensure that framebuffers have a color attachment before reading or writing.
Diffstat (limited to 'components/script/dom/webglframebuffer.rs')
-rw-r--r--components/script/dom/webglframebuffer.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs
index c2798ba4620..53d72857b54 100644
--- a/components/script/dom/webglframebuffer.rs
+++ b/components/script/dom/webglframebuffer.rs
@@ -203,6 +203,16 @@ impl WebGLFramebuffer {
return self.status.get();
}
+ pub fn check_status_for_rendering(&self) -> u32 {
+ let result = self.check_status();
+ if result == constants::FRAMEBUFFER_COMPLETE {
+ if self.color.borrow().is_none() {
+ return constants::FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+ }
+ result
+ }
+
pub fn renderbuffer(&self, attachment: u32, rb: Option<&WebGLRenderbuffer>) -> WebGLResult<()> {
let binding = match attachment {
constants::COLOR_ATTACHMENT0 => &self.color,