diff options
author | Moonchild <moonchild@palemoon.org> | 2021-03-24 12:16:08 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-03-24 12:16:08 +0000 |
commit | 16f0b30ebed903b9e6121a626160b2af45da7715 (patch) | |
tree | ecb5f8cb300ac1216168d425a65c49e12134d127 | |
parent | c0723780767ea449144981dd43b8e0e0bd8b4800 (diff) | |
download | aura-central-16f0b30ebed903b9e6121a626160b2af45da7715.tar.gz |
[WebGL] Only allow texture uploads from pixelbuffer if bound.
Throw an error if it mismatches.
-rw-r--r-- | dom/canvas/WebGLContextTextures.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dom/canvas/WebGLContextTextures.cpp b/dom/canvas/WebGLContextTextures.cpp index 30716438f..66138361a 100644 --- a/dom/canvas/WebGLContextTextures.cpp +++ b/dom/canvas/WebGLContextTextures.cpp @@ -390,6 +390,16 @@ WebGLContext::TexImage(const char* funcName, uint8_t funcDims, GLenum rawTarget, if (!ValidateTexImageTarget(this, funcName, funcDims, rawTarget, &target, &tex)) return; + const bool isUploadFromPbo = bool(src.mPboOffset); + const bool isPboBound = bool(mBoundPixelUnpackBuffer); + if (isUploadFromPbo != isPboBound) { + SynthesizeGLError(LOCAL_GL_INVALID_OPERATION, + "Tex upload from %s but PIXEL_UNPACK_BUFFER %s bound.", + isUploadFromPbo ? "PBO" : "non-PBO", + isPboBound ? "was" : "was not"); + return; + } + const webgl::PackingInfo pi = {unpackFormat, unpackType}; tex->TexImage(funcName, target, level, internalFormat, width, height, depth, border, pi, src); @@ -407,6 +417,16 @@ WebGLContext::TexSubImage(const char* funcName, uint8_t funcDims, GLenum rawTarg if (!ValidateTexImageTarget(this, funcName, funcDims, rawTarget, &target, &tex)) return; + const bool isUploadFromPbo = bool(src.mPboOffset); + const bool isPboBound = bool(mBoundPixelUnpackBuffer); + if (isUploadFromPbo != isPboBound) { + SynthesizeGLError(LOCAL_GL_INVALID_OPERATION, + "Tex upload from %s but PIXEL_UNPACK_BUFFER %s bound.", + isUploadFromPbo ? "PBO" : "non-PBO", + isPboBound ? "was" : "was not"); + return; + } + const webgl::PackingInfo pi = {unpackFormat, unpackType}; tex->TexSubImage(funcName, target, level, xOffset, yOffset, zOffset, width, height, depth, pi, src); |