mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 665070 - part 14: check error in copyTexImage2D - r=jrmuizel
This commit is contained in:
parent
bdf543b289
commit
318d5ac451
@ -939,6 +939,10 @@ public:
|
||||
|
||||
struct ImageInfo {
|
||||
ImageInfo() : mWidth(0), mHeight(0), mFormat(0), mType(0), mIsDefined(PR_FALSE) {}
|
||||
ImageInfo(WebGLsizei width, WebGLsizei height,
|
||||
WebGLenum format, WebGLenum type)
|
||||
: mWidth(width), mHeight(height), mFormat(format), mType(type), mIsDefined(PR_TRUE) {}
|
||||
|
||||
PRBool operator==(const ImageInfo& a) const {
|
||||
return mWidth == a.mWidth && mHeight == a.mHeight &&
|
||||
mFormat == a.mFormat && mType == a.mType;
|
||||
@ -1102,7 +1106,7 @@ public:
|
||||
|
||||
void SetImageInfo(WebGLenum aTarget, WebGLint aLevel,
|
||||
WebGLsizei aWidth, WebGLsizei aHeight,
|
||||
WebGLenum aFormat = 0, WebGLenum aType = 0)
|
||||
WebGLenum aFormat, WebGLenum aType)
|
||||
{
|
||||
if ( (aTarget == LOCAL_GL_TEXTURE_2D) != (mTarget == LOCAL_GL_TEXTURE_2D) )
|
||||
return;
|
||||
@ -1111,14 +1115,7 @@ public:
|
||||
|
||||
EnsureMaxLevelWithCustomImagesAtLeast(aLevel);
|
||||
|
||||
ImageInfo& imageInfo = ImageInfoAt(aLevel, face);
|
||||
imageInfo.mWidth = aWidth;
|
||||
imageInfo.mHeight = aHeight;
|
||||
if (aFormat)
|
||||
imageInfo.mFormat = aFormat;
|
||||
if (aType)
|
||||
imageInfo.mType = aType;
|
||||
imageInfo.mIsDefined = PR_TRUE;
|
||||
ImageInfoAt(aLevel, face) = ImageInfo(aWidth, aHeight, aFormat, aType);
|
||||
|
||||
if (aLevel > 0)
|
||||
SetCustomMipmap();
|
||||
|
@ -730,9 +730,9 @@ WebGLContext::CopyTexSubImage2D_base(WebGLenum target,
|
||||
|
||||
if (CanvasUtils::CheckSaneSubrectSize(x, y, width, height, framebufferWidth, framebufferHeight)) {
|
||||
if (sub)
|
||||
gl->fCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
gl->fCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
else
|
||||
gl->fCopyTexImage2D(target, level, internalformat, x, y, width, height, 0);
|
||||
gl->fCopyTexImage2D(target, level, internalformat, x, y, width, height, 0);
|
||||
} else {
|
||||
|
||||
// the rect doesn't fit in the framebuffer
|
||||
@ -773,10 +773,11 @@ WebGLContext::CopyTexSubImage2D_base(WebGLenum target,
|
||||
// now initialize the texture as black
|
||||
|
||||
if (sub)
|
||||
gl->fTexSubImage2D(target, level, 0, 0, width, height, internalformat, LOCAL_GL_UNSIGNED_BYTE, tempZeroData);
|
||||
gl->fTexSubImage2D(target, level, 0, 0, width, height,
|
||||
internalformat, LOCAL_GL_UNSIGNED_BYTE, tempZeroData);
|
||||
else
|
||||
gl->fTexImage2D(target, level, internalformat, width, height, 0, internalformat, LOCAL_GL_UNSIGNED_BYTE, tempZeroData);
|
||||
|
||||
gl->fTexImage2D(target, level, internalformat, width, height,
|
||||
0, internalformat, LOCAL_GL_UNSIGNED_BYTE, tempZeroData);
|
||||
free(tempZeroData);
|
||||
|
||||
// if we are completely outside of the framebuffer, we can exit now with our black texture
|
||||
@ -875,9 +876,31 @@ WebGLContext::CopyTexImage2D(WebGLenum target,
|
||||
if (!tex)
|
||||
return ErrorInvalidOperation("copyTexImage2D: no texture bound to this target");
|
||||
|
||||
tex->SetImageInfo(target, level, width, height);
|
||||
const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(level, WebGLTexture::FaceForTarget(target));
|
||||
|
||||
return CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
|
||||
// copyTexImage2D only generates textures with type = UNSIGNED_BYTE
|
||||
GLenum type = LOCAL_GL_UNSIGNED_BYTE;
|
||||
|
||||
bool sizeMayChange = width != imageInfo.mWidth ||
|
||||
height != imageInfo.mHeight ||
|
||||
internalformat != imageInfo.mFormat ||
|
||||
type != imageInfo.mType;
|
||||
|
||||
if (sizeMayChange) {
|
||||
UpdateWebGLErrorAndClearGLError();
|
||||
CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
|
||||
GLenum error = LOCAL_GL_NO_ERROR;
|
||||
UpdateWebGLErrorAndClearGLError(&error);
|
||||
if (error) {
|
||||
LogMessageIfVerbose("copyTexImage2D generated error %s", ErrorName(error));
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
|
||||
}
|
||||
|
||||
tex->SetImageInfo(target, level, width, height, internalformat, type);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -6,7 +6,6 @@ conformance/glsl-conformance.html
|
||||
conformance/invalid-passed-params.html
|
||||
conformance/more/conformance/quickCheckAPI.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2DBadArgs.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/deleteBufferBadArgs.html
|
||||
conformance/more/functions/texImage2DBadArgs.html
|
||||
@ -16,4 +15,3 @@ conformance/more/functions/uniformfArrayLen1.html
|
||||
conformance/object-deletion-behaviour.html
|
||||
conformance/read-pixels-test.html
|
||||
conformance/tex-sub-image-2d-bad-args.html
|
||||
conformance/uninitialized-test.html
|
||||
|
@ -7,10 +7,8 @@ conformance/object-deletion-behaviour.html
|
||||
conformance/read-pixels-test.html
|
||||
conformance/tex-input-validation.html
|
||||
conformance/tex-sub-image-2d-bad-args.html
|
||||
conformance/uninitialized-test.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2DBadArgs.html
|
||||
conformance/more/functions/deleteBufferBadArgs.html
|
||||
conformance/more/functions/texImage2DBadArgs.html
|
||||
conformance/more/functions/texSubImage2DBadArgs.html
|
||||
|
@ -4,11 +4,9 @@ conformance/invalid-passed-params.html
|
||||
conformance/object-deletion-behaviour.html
|
||||
conformance/read-pixels-test.html
|
||||
conformance/tex-sub-image-2d-bad-args.html
|
||||
conformance/uninitialized-test.html
|
||||
conformance/more/conformance/quickCheckAPI.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2DBadArgs.html
|
||||
conformance/more/functions/deleteBufferBadArgs.html
|
||||
conformance/more/functions/texImage2DBadArgs.html
|
||||
conformance/more/functions/texSubImage2DBadArgs.html
|
||||
|
Loading…
Reference in New Issue
Block a user