Bug 1305832 - ZeroTextureData doesn't need x/y/zOffset, so remove those args. - r=ethlin

This commit is contained in:
Jeff Gilbert 2016-09-27 13:00:57 -07:00
Родитель dcd2721cd1
Коммит 1aa90c537b
4 изменённых файлов: 16 добавлений и 24 удалений

Просмотреть файл

@ -2287,8 +2287,8 @@ ZeroTexImageWithClear(WebGLContext* webgl, GLContext* gl, TexImageTarget target,
bool
ZeroTextureData(WebGLContext* webgl, const char* funcName, GLuint tex,
TexImageTarget target, uint32_t level,
const webgl::FormatUsageInfo* usage, uint32_t xOffset, uint32_t yOffset,
uint32_t zOffset, uint32_t width, uint32_t height, uint32_t depth)
const webgl::FormatUsageInfo* usage, uint32_t width, uint32_t height,
uint32_t depth)
{
// This has two usecases:
// 1. Lazy zeroing of uninitialized textures:
@ -2323,8 +2323,6 @@ ZeroTextureData(WebGLContext* webgl, const char* funcName, GLuint tex,
ScopedBindTexture scopeBindTexture(gl, tex, scopeBindTarget);
auto compression = usage->format->compression;
if (compression) {
MOZ_RELEASE_ASSERT(!xOffset && !yOffset && !zOffset, "GFX: Can't zero compressed texture with offsets.");
auto sizedFormat = usage->format->sizedFormat;
MOZ_RELEASE_ASSERT(sizedFormat, "GFX: texture sized format not set");
@ -2353,13 +2351,10 @@ ZeroTextureData(WebGLContext* webgl, const char* funcName, GLuint tex,
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1); // Don't bother with striding it
// well.
GLenum error = DoCompressedTexSubImage(gl, target.get(), level, xOffset, yOffset,
zOffset, width, height, depth, sizedFormat,
byteCount, zeros.get());
if (error)
return false;
return true;
const auto error = DoCompressedTexSubImage(gl, target.get(), level, 0, 0, 0,
width, height, depth, sizedFormat,
byteCount, zeros.get());
return !error;
}
const auto driverUnpackInfo = usage->idealUnpack;
@ -2393,12 +2388,9 @@ ZeroTextureData(WebGLContext* webgl, const char* funcName, GLuint tex,
ScopedUnpackReset scopedReset(webgl);
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1); // Don't bother with striding it well.
const auto error = DoTexSubImage(gl, target, level, xOffset, yOffset, zOffset, width,
height, depth, packing, zeros.get());
if (error)
return false;
return true;
const auto error = DoTexSubImage(gl, target, level, 0, 0, 0, width, height, depth,
packing, zeros.get());
return !error;
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2147,8 +2147,8 @@ Intersect(uint32_t srcSize, int32_t dstStartInSrc, uint32_t dstSize,
bool
ZeroTextureData(WebGLContext* webgl, const char* funcName, GLuint tex,
TexImageTarget target, uint32_t level,
const webgl::FormatUsageInfo* usage, uint32_t xOffset, uint32_t yOffset,
uint32_t zOffset, uint32_t width, uint32_t height, uint32_t depth);
const webgl::FormatUsageInfo* usage, uint32_t width, uint32_t height,
uint32_t depth);
////

Просмотреть файл

@ -596,8 +596,8 @@ WebGLTexture::InitializeImageData(const char* funcName, TexImageTarget target,
const auto& height = imageInfo.mHeight;
const auto& depth = imageInfo.mDepth;
if (!ZeroTextureData(mContext, funcName, mGLName, target, level, usage, 0, 0, 0,
width, height, depth))
if (!ZeroTextureData(mContext, funcName, mGLName, target, level, usage, width, height,
depth))
{
return false;
}

Просмотреть файл

@ -2021,9 +2021,8 @@ WebGLTexture::CopyTexImage2D(TexImageTarget target, GLint level, GLenum internal
// 1. Zero the texture data.
// 2. CopyTexSubImage the subrect.
const uint8_t zOffset = 0;
if (!ZeroTextureData(mContext, funcName, mGLName, target, level, dstUsage, 0, 0,
zOffset, width, height, depth))
if (!ZeroTextureData(mContext, funcName, mGLName, target, level, dstUsage, width,
height, depth))
{
mContext->ErrorOutOfMemory("%s: Failed to zero texture data.", funcName);
MOZ_ASSERT(false, "Failed to zero texture data.");
@ -2036,6 +2035,7 @@ WebGLTexture::CopyTexImage2D(TexImageTarget target, GLint level, GLenum internal
return;
}
const uint8_t zOffset = 0;
error = DoCopyTexSubImage(gl, target, level, writeX, writeY, zOffset, readX,
readY, rwWidth, rwHeight);
} while (false);