Commit 48590358 by Jeff Gilbert Committed by Commit Bot

Remove formatType arg from computeCompressedImageSize.

BUG=angleproject:2230 Change-Id: Ie291ba05efa89bc4ea52966e975d5a21431a461f Reviewed-on: https://chromium-review.googlesource.com/757877 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent cac94a91
...@@ -1075,7 +1075,7 @@ ErrorOrResult<GLuint> InternalFormat::computeRowPitch(GLenum formatType, ...@@ -1075,7 +1075,7 @@ ErrorOrResult<GLuint> InternalFormat::computeRowPitch(GLenum formatType,
if (compressed) if (compressed)
{ {
ASSERT(rowLength == 0); ASSERT(rowLength == 0);
return computeCompressedImageSize(formatType, Extents(width, 1, 1)); return computeCompressedImageSize(Extents(width, 1, 1));
} }
CheckedNumeric<GLuint> checkedWidth(rowLength > 0 ? rowLength : width); CheckedNumeric<GLuint> checkedWidth(rowLength > 0 ? rowLength : width);
...@@ -1113,8 +1113,7 @@ ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType, ...@@ -1113,8 +1113,7 @@ ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType,
return computeDepthPitch(height, imageHeight, rowPitch); return computeDepthPitch(height, imageHeight, rowPitch);
} }
ErrorOrResult<GLuint> InternalFormat::computeCompressedImageSize(GLenum formatType, ErrorOrResult<GLuint> InternalFormat::computeCompressedImageSize(const Extents &size) const
const Extents &size) const
{ {
CheckedNumeric<GLuint> checkedWidth(size.width); CheckedNumeric<GLuint> checkedWidth(size.width);
CheckedNumeric<GLuint> checkedHeight(size.height); CheckedNumeric<GLuint> checkedHeight(size.height);
...@@ -1171,7 +1170,7 @@ ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte( ...@@ -1171,7 +1170,7 @@ ErrorOrResult<GLuint> InternalFormat::computePackUnpackEndByte(
CheckedNumeric<GLuint> checkedCopyBytes = 0; CheckedNumeric<GLuint> checkedCopyBytes = 0;
if (compressed) if (compressed)
{ {
ANGLE_TRY_RESULT(computeCompressedImageSize(formatType, size), checkedCopyBytes); ANGLE_TRY_RESULT(computeCompressedImageSize(size), checkedCopyBytes);
} }
else if (size.height != 0 && (!is3D || size.depth != 0)) else if (size.height != 0 && (!is3D || size.depth != 0))
{ {
......
...@@ -68,8 +68,7 @@ struct InternalFormat ...@@ -68,8 +68,7 @@ struct InternalFormat
GLint rowLength, GLint rowLength,
GLint imageHeight) const; GLint imageHeight) const;
ErrorOrResult<GLuint> computeCompressedImageSize(GLenum formatType, ErrorOrResult<GLuint> computeCompressedImageSize(const Extents &size) const;
const Extents &size) const;
ErrorOrResult<GLuint> computeSkipBytes(GLuint rowPitch, ErrorOrResult<GLuint> computeSkipBytes(GLuint rowPitch,
GLuint depthPitch, GLuint depthPitch,
......
...@@ -852,8 +852,7 @@ gl::Error TextureGL::setStorage(const gl::Context *context, ...@@ -852,8 +852,7 @@ gl::Error TextureGL::setStorage(const gl::Context *context,
internalFormat); internalFormat);
GLuint dataSize = 0; GLuint dataSize = 0;
ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize( ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize(levelSize),
GL_UNSIGNED_BYTE, levelSize),
dataSize); dataSize);
mFunctions->compressedTexImage2D(target, static_cast<GLint>(level), mFunctions->compressedTexImage2D(target, static_cast<GLint>(level),
compressedTexImageFormat.format, compressedTexImageFormat.format,
...@@ -883,8 +882,7 @@ gl::Error TextureGL::setStorage(const gl::Context *context, ...@@ -883,8 +882,7 @@ gl::Error TextureGL::setStorage(const gl::Context *context,
internalFormat); internalFormat);
GLuint dataSize = 0; GLuint dataSize = 0;
ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize( ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize(levelSize),
GL_UNSIGNED_BYTE, levelSize),
dataSize); dataSize);
mFunctions->compressedTexImage2D( mFunctions->compressedTexImage2D(
face, static_cast<GLint>(level), compressedTexImageFormat.format, face, static_cast<GLint>(level), compressedTexImageFormat.format,
...@@ -944,7 +942,7 @@ gl::Error TextureGL::setStorage(const gl::Context *context, ...@@ -944,7 +942,7 @@ gl::Error TextureGL::setStorage(const gl::Context *context,
GLuint dataSize = 0; GLuint dataSize = 0;
ANGLE_TRY_RESULT( ANGLE_TRY_RESULT(
internalFormatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, levelSize), internalFormatInfo.computeCompressedImageSize(levelSize),
dataSize); dataSize);
mFunctions->compressedTexImage3D(target, i, compressedTexImageFormat.format, mFunctions->compressedTexImage3D(target, i, compressedTexImageFormat.format,
levelSize.width, levelSize.height, levelSize.width, levelSize.height,
......
...@@ -2713,8 +2713,7 @@ bool ValidateCompressedTexImage2D(Context *context, ...@@ -2713,8 +2713,7 @@ bool ValidateCompressedTexImage2D(Context *context,
} }
const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalformat); const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalformat);
auto blockSizeOrErr = auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1));
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, 1));
if (blockSizeOrErr.isError()) if (blockSizeOrErr.isError())
{ {
context->handleError(blockSizeOrErr.getError()); context->handleError(blockSizeOrErr.getError());
...@@ -2807,8 +2806,7 @@ bool ValidateCompressedTexSubImage2D(Context *context, ...@@ -2807,8 +2806,7 @@ bool ValidateCompressedTexSubImage2D(Context *context,
} }
const InternalFormat &formatInfo = GetSizedInternalFormatInfo(format); const InternalFormat &formatInfo = GetSizedInternalFormatInfo(format);
auto blockSizeOrErr = auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1));
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, 1));
if (blockSizeOrErr.isError()) if (blockSizeOrErr.isError())
{ {
context->handleError(blockSizeOrErr.getError()); context->handleError(blockSizeOrErr.getError());
......
...@@ -1386,8 +1386,7 @@ bool ValidateCompressedTexImage3D(Context *context, ...@@ -1386,8 +1386,7 @@ bool ValidateCompressedTexImage3D(Context *context,
return false; return false;
} }
auto blockSizeOrErr = auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, depth));
if (blockSizeOrErr.isError()) if (blockSizeOrErr.isError())
{ {
context->handleError(InvalidValue()); context->handleError(InvalidValue());
...@@ -2015,8 +2014,7 @@ bool ValidateCompressedTexSubImage3D(Context *context, ...@@ -2015,8 +2014,7 @@ bool ValidateCompressedTexSubImage3D(Context *context,
return false; return false;
} }
auto blockSizeOrErr = auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
formatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, gl::Extents(width, height, depth));
if (blockSizeOrErr.isError()) if (blockSizeOrErr.isError())
{ {
context->handleError(blockSizeOrErr.getError()); context->handleError(blockSizeOrErr.getError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment