Truncate Buffer/Texture on GL_OOM.

This commit is contained in:
wolfbeast 2019-07-19 19:08:25 +02:00 committed by Roy Tam
commit 537197dfdc
5 changed files with 25 additions and 3 deletions

View file

@ -51,8 +51,6 @@ WebGLTexture::ImageInfo::Clear()
WebGLTexture::ImageInfo&
WebGLTexture::ImageInfo::operator =(const ImageInfo& a)
{
MOZ_ASSERT(a.IsDefined());
Mutable(mFormat) = a.mFormat;
Mutable(mWidth) = a.mWidth;
Mutable(mHeight) = a.mHeight;
@ -1216,6 +1214,12 @@ WebGLTexture::TexParameter(TexTarget texTarget, GLenum pname, const FloatOrInt&
mContext->gl->fTexParameterf(texTarget.get(), pname, clamped.f);
}
void WebGLTexture::Truncate() {
for (auto& cur : mImageInfoArr) {
SetImageInfo(&cur, ImageInfo());
}
}
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLTexture)