Commit 8509d86e by Geoff Lang

Pipe the imageSize parameter from the entry point to avoid recomputation.

BUG=angleproject:884 Change-Id: Ic4d5bdc5b65ebcb8c57b960e84708e945db0276a Reviewed-on: https://chromium-review.googlesource.com/272422Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent a30c78ae
......@@ -190,14 +190,14 @@ Error Texture::setSubImage(GLenum target, size_t level, const Box &area, GLenum
}
Error Texture::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const Extents &size,
const PixelUnpackState &unpack, const uint8_t *pixels)
const PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
// Release from previous calls to eglBindTexImage, to avoid calling the Impl after
releaseTexImageInternal();
Error error = mTexture->setCompressedImage(target, level, internalFormat, size, unpack, pixels);
Error error = mTexture->setCompressedImage(target, level, internalFormat, size, unpack, imageSize, pixels);
if (error.isError())
{
return error;
......@@ -209,11 +209,11 @@ Error Texture::setCompressedImage(GLenum target, size_t level, GLenum internalFo
}
Error Texture::setCompressedSubImage(GLenum target, size_t level, const Box &area, GLenum format,
const PixelUnpackState &unpack, const uint8_t *pixels)
const PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target)));
return mTexture->setCompressedSubImage(target, level, area, format, unpack, pixels);
return mTexture->setCompressedSubImage(target, level, area, format, unpack, imageSize, pixels);
}
Error Texture::copyImage(GLenum target, size_t level, const Rectangle &sourceArea, GLenum internalFormat,
......
......@@ -62,9 +62,9 @@ class Texture final : public FramebufferAttachmentObject
const PixelUnpackState &unpack, const uint8_t *pixels);
virtual Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const Extents &size,
const PixelUnpackState &unpack, const uint8_t *pixels);
const PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels);
virtual Error setCompressedSubImage(GLenum target, size_t level, const Box &area, GLenum format,
const PixelUnpackState &unpack, const uint8_t *pixels);
const PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels);
virtual Error copyImage(GLenum target, size_t level, const Rectangle &sourceArea, GLenum internalFormat,
const Framebuffer *source);
......
......@@ -50,9 +50,9 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
const gl::PixelUnpackState &unpack, const uint8_t *pixels) = 0;
virtual gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) = 0;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) = 0;
virtual gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) = 0;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) = 0;
virtual gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) = 0;
......
......@@ -772,7 +772,7 @@ gl::Error TextureD3D_2D::setSubImage(GLenum target, size_t level, const gl::Box
gl::Error TextureD3D_2D::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D && size.depth == 1);
......@@ -783,7 +783,7 @@ gl::Error TextureD3D_2D::setCompressedImage(GLenum target, size_t level, GLenum
}
gl::Error TextureD3D_2D::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0);
......@@ -1325,7 +1325,7 @@ gl::Error TextureD3D_Cube::setSubImage(GLenum target, size_t level, const gl::Bo
}
gl::Error TextureD3D_Cube::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(size.depth == 1);
......@@ -1339,7 +1339,7 @@ gl::Error TextureD3D_Cube::setCompressedImage(GLenum target, size_t level, GLenu
}
gl::Error TextureD3D_Cube::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(area.depth == 1 && area.z == 0);
......@@ -1969,7 +1969,7 @@ gl::Error TextureD3D_3D::setSubImage(GLenum target, size_t level, const gl::Box
}
gl::Error TextureD3D_3D::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_3D);
......@@ -1981,7 +1981,7 @@ gl::Error TextureD3D_3D::setCompressedImage(GLenum target, size_t level, GLenum
}
gl::Error TextureD3D_3D::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_3D);
......@@ -2478,7 +2478,7 @@ gl::Error TextureD3D_2DArray::setSubImage(GLenum target, size_t level, const gl:
}
gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
......@@ -2504,7 +2504,7 @@ gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target, size_t level, GL
}
gl::Error TextureD3D_2DArray::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
......
......@@ -134,9 +134,9 @@ class TextureD3D_2D : public TextureD3D
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) override;
......@@ -197,9 +197,9 @@ class TextureD3D_Cube : public TextureD3D
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) override;
......@@ -259,9 +259,9 @@ class TextureD3D_3D : public TextureD3D
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) override;
......@@ -319,9 +319,9 @@ class TextureD3D_2DArray : public TextureD3D
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) override;
......
......@@ -136,27 +136,22 @@ gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &are
}
gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(CompatibleTextureTarget(mTextureType, target));
SetUnpackStateForTexImage(mStateManager, unpack);
const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
size_t depthPitch = internalFormatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height,
unpack.alignment, unpack.rowLength);
size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, size.width, size.height) * depthPitch;
mStateManager->bindTexture(mTextureType, mTextureID);
if (UseTexImage2D(mTextureType))
{
ASSERT(size.depth == 1);
mFunctions->compressedTexImage2D(target, level, internalFormat, size.width, size.height, 0, dataSize, pixels);
mFunctions->compressedTexImage2D(target, level, internalFormat, size.width, size.height, 0, imageSize, pixels);
}
else if (UseTexImage3D(mTextureType))
{
mFunctions->compressedTexImage3D(target, level, internalFormat, size.width, size.height, size.depth, 0,
dataSize, pixels);
imageSize, pixels);
}
else
{
......@@ -167,28 +162,23 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte
}
gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels)
{
ASSERT(CompatibleTextureTarget(mTextureType, target));
SetUnpackStateForTexImage(mStateManager, unpack);
const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(format);
size_t depthPitch = internalFormatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height,
unpack.alignment, unpack.rowLength);
size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, area.width, area.height) * depthPitch;
mStateManager->bindTexture(mTextureType, mTextureID);
if (UseTexImage2D(mTextureType))
{
ASSERT(area.z == 0 && area.depth == 1);
mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, format, dataSize,
mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, format, imageSize,
pixels);
}
else if (UseTexImage3D(mTextureType))
{
mFunctions->compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth,
format, dataSize, pixels);
format, imageSize, pixels);
}
else
{
......
......@@ -32,9 +32,9 @@ class TextureGL : public TextureImpl
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override;
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) override;
......
......@@ -744,7 +744,7 @@ void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum interna
Extents size(width, height, 1);
Texture *texture = context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error = texture->setCompressedImage(target, level, internalformat, size, context->getState().getUnpackState(),
reinterpret_cast<const uint8_t *>(data));
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
context->recordError(error);
......@@ -789,7 +789,7 @@ void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffs
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error = texture->setCompressedSubImage(target, level, area, format, context->getState().getUnpackState(),
reinterpret_cast<const uint8_t *>(data));
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
context->recordError(error);
......
......@@ -229,7 +229,7 @@ void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum interna
Extents size(width, height, depth);
Texture *texture = context->getTargetTexture(target);
Error error = texture->setCompressedImage(target, level, internalformat, size, context->getState().getUnpackState(),
reinterpret_cast<const uint8_t *>(data));
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
context->recordError(error);
......@@ -283,7 +283,7 @@ void GL_APIENTRY CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffs
Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = context->getTargetTexture(target);
Error error = texture->setCompressedSubImage(target, level, area, format, context->getState().getUnpackState(),
reinterpret_cast<const uint8_t *>(data));
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
context->recordError(error);
......
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