summaryrefslogtreecommitdiffstats
path: root/dom/canvas/WebGLRenderbuffer.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-07-19 19:08:25 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-07-19 19:08:25 +0200
commit3f9e299b6ee9ec68eb41694703b939dab35e43a3 (patch)
tree7b903719c55703366c6c5068286e813e55af1d6d /dom/canvas/WebGLRenderbuffer.cpp
parentb0a8ed215774469e1d5476d670bb9e2ccbd23ed8 (diff)
downloadUXP-3f9e299b6ee9ec68eb41694703b939dab35e43a3.tar
UXP-3f9e299b6ee9ec68eb41694703b939dab35e43a3.tar.gz
UXP-3f9e299b6ee9ec68eb41694703b939dab35e43a3.tar.lz
UXP-3f9e299b6ee9ec68eb41694703b939dab35e43a3.tar.xz
UXP-3f9e299b6ee9ec68eb41694703b939dab35e43a3.zip
Truncate Buffer/Texture on GL_OOM.
Diffstat (limited to 'dom/canvas/WebGLRenderbuffer.cpp')
-rw-r--r--dom/canvas/WebGLRenderbuffer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/dom/canvas/WebGLRenderbuffer.cpp b/dom/canvas/WebGLRenderbuffer.cpp
index ec076fdbb..32397dd1a 100644
--- a/dom/canvas/WebGLRenderbuffer.cpp
+++ b/dom/canvas/WebGLRenderbuffer.cpp
@@ -215,6 +215,16 @@ WebGLRenderbuffer::RenderbufferStorage(const char* funcName, uint32_t samples,
if (error) {
const char* errorName = mContext->ErrorName(error);
mContext->GenerateWarning("%s generated error %s", funcName, errorName);
+ if (error == LOCAL_GL_OUT_OF_MEMORY) {
+ // Truncate.
+ mSamples = 0;
+ mFormat = nullptr;
+ mWidth = 0;
+ mHeight = 0;
+ mImageDataStatus = WebGLImageDataStatus::NoImageData;
+
+ InvalidateStatusOfAttachedFBs();
+ }
return;
}