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

@ -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;
}