mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
[WebGL] Only allow texture uploads from pixelbuffer if bound.
Throw an error if it mismatches.
This commit is contained in:
parent
43ebe6d86f
commit
bdfe49f178
1 changed files with 20 additions and 0 deletions
|
|
@ -390,6 +390,16 @@ WebGLContext::TexImage(const char* funcName, uint8_t funcDims, GLenum rawTarget,
|
||||||
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTarget, &target, &tex))
|
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTarget, &target, &tex))
|
||||||
return;
|
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};
|
const webgl::PackingInfo pi = {unpackFormat, unpackType};
|
||||||
tex->TexImage(funcName, target, level, internalFormat, width, height, depth, border,
|
tex->TexImage(funcName, target, level, internalFormat, width, height, depth, border,
|
||||||
pi, src);
|
pi, src);
|
||||||
|
|
@ -407,6 +417,16 @@ WebGLContext::TexSubImage(const char* funcName, uint8_t funcDims, GLenum rawTarg
|
||||||
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTarget, &target, &tex))
|
if (!ValidateTexImageTarget(this, funcName, funcDims, rawTarget, &target, &tex))
|
||||||
return;
|
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};
|
const webgl::PackingInfo pi = {unpackFormat, unpackType};
|
||||||
tex->TexSubImage(funcName, target, level, xOffset, yOffset, zOffset, width, height,
|
tex->TexSubImage(funcName, target, level, xOffset, yOffset, zOffset, width, height,
|
||||||
depth, pi, src);
|
depth, pi, src);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue