Bug 1252414 - Handle lost_context for webgl ClearBuffer*. r=jgilbert
authorJerryShih <hshih@mozilla.com>
Thu, 17 Mar 2016 01:45:00 -0400
changeset 289572 8c8ed5ea5eaf988f640dfa38470ef37edaaa0ed4
parent 289571 1b7694d14856a0d0d1be59e586c315d4f2e02e1e
child 289573 1364b664788acdf0c2df71106b1223ded167df51
push id18283
push usercbook@mozilla.com
push dateMon, 21 Mar 2016 15:02:44 +0000
treeherderfx-team@af22a2e633c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1252414
milestone48.0a1
Bug 1252414 - Handle lost_context for webgl ClearBuffer*. r=jgilbert
dom/canvas/WebGL2ContextMRTs.cpp
--- a/dom/canvas/WebGL2ContextMRTs.cpp
+++ b/dom/canvas/WebGL2ContextMRTs.cpp
@@ -89,79 +89,107 @@ WebGL2Context::ClearBufferfv_base(GLenum
     }
 
     gl->fClearBufferfv(buffer, drawbuffer, value);
 }
 
 void
 WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Int32Array& value)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     value.ComputeLengthAndData();
     if (!ValidateClearBuffer("clearBufferiv", buffer, drawbuffer, value.Length())) {
         return;
     }
 
     ClearBufferiv_base(buffer, drawbuffer, value.Data());
 }
 
 void
 WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLint>& value)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     if (!ValidateClearBuffer("clearBufferiv", buffer, drawbuffer, value.Length())) {
         return;
     }
 
     ClearBufferiv_base(buffer, drawbuffer, value.Elements());
 }
 
 void
 WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Uint32Array& value)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     value.ComputeLengthAndData();
     if (!ValidateClearBuffer("clearBufferuiv", buffer, drawbuffer, value.Length())) {
         return;
     }
 
     ClearBufferuiv_base(buffer, drawbuffer, value.Data());
 }
 
 void
 WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLuint>& value)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     if (!ValidateClearBuffer("clearBufferuiv", buffer, drawbuffer, value.Length())) {
         return;
     }
 
     ClearBufferuiv_base(buffer, drawbuffer, value.Elements());
 }
 
 void
 WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Float32Array& value)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     value.ComputeLengthAndData();
     if (!ValidateClearBuffer("clearBufferfv", buffer, drawbuffer, value.Length())) {
         return;
     }
 
     ClearBufferfv_base(buffer, drawbuffer, value.Data());
 }
 
 void
 WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLfloat>& value)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     if (!ValidateClearBuffer("clearBufferfv", buffer, drawbuffer, value.Length())) {
         return;
     }
 
     ClearBufferfv_base(buffer, drawbuffer, value.Elements());
 }
 
 void
 WebGL2Context::ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
 {
+    if (IsContextLost()) {
+        return;
+    }
+
     if (buffer != LOCAL_GL_DEPTH_STENCIL) {
         return ErrorInvalidEnumInfo("clearBufferfi: buffer", buffer);
     }
     MakeContextCurrent();
     gl->fClearBufferfi(buffer, drawbuffer, depth, stencil);
 }
 
 } // namespace mozilla