Commit 2f2ea8b4 by Geoff Lang Committed by Commit Bot

Fix depth pitch calculations for compressed textures.

Depth pitch computations were not taking into account the block size and simply multiplying the row pitch with the pixel height. This caused our load functions to use a very high depth pitch, reading past the end of the user-supplied buffer. BUG=angleproject:3190 BUG=angleproject:3920 Change-Id: I4ef4763b542735993568c51ae4b5a235659b9094 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1811837Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 197005d8
...@@ -1212,11 +1212,23 @@ bool InternalFormat::computeDepthPitch(GLsizei height, ...@@ -1212,11 +1212,23 @@ bool InternalFormat::computeDepthPitch(GLsizei height,
GLuint rowPitch, GLuint rowPitch,
GLuint *resultOut) const GLuint *resultOut) const
{ {
GLuint rows = CheckedNumeric<GLuint> pixelsHeight(imageHeight > 0 ? static_cast<GLuint>(imageHeight)
(imageHeight > 0 ? static_cast<GLuint>(imageHeight) : static_cast<GLuint>(height)); : static_cast<GLuint>(height));
CheckedNumeric<GLuint> rowCount;
if (compressed)
{
CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
rowCount = (pixelsHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
}
else
{
rowCount = pixelsHeight;
}
CheckedNumeric<GLuint> checkedRowPitch(rowPitch); CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
return CheckedMathResult(checkedRowPitch * rows, resultOut); return CheckedMathResult(checkedRowPitch * rowCount, resultOut);
} }
bool InternalFormat::computeDepthPitch(GLenum formatType, bool InternalFormat::computeDepthPitch(GLenum formatType,
......
...@@ -39,11 +39,6 @@ ...@@ -39,11 +39,6 @@
// GL_OES_rgb8_rgba8 only enables GL_RGBA8 for render buffers (not textures) // GL_OES_rgb8_rgba8 only enables GL_RGBA8 for render buffers (not textures)
3797 VULKAN : KHR-GLES2.texture_3d.copy_sub_image.rgba8 = FAIL 3797 VULKAN : KHR-GLES2.texture_3d.copy_sub_image.rgba8 = FAIL
// Compressed texture tests on Android
3190 VULKAN PIXEL2 : KHR-GLES2.texture_3d.compressed_texture.rgba_astc_* = SKIP
3190 VULKAN PIXEL2 : KHR-GLES2.texture_3d.compressed_texture.sgb8_alpha8_astc_* = SKIP
3190 VULKAN PIXEL2 : KHR-GLES2.texture_3d.compressed_texture.srgb8_alpha8_astc_* = SKIP
// Bug in dEQP uses an incorrect enum (GL_HALF_FLOAT instead of GL_HALF_FLOAT_OES) // Bug in dEQP uses an incorrect enum (GL_HALF_FLOAT instead of GL_HALF_FLOAT_OES)
3451 : KHR-GLES2.core.internalformat.texture2d.rgb_half_float_rgb16f = FAIL 3451 : KHR-GLES2.core.internalformat.texture2d.rgb_half_float_rgb16f = FAIL
3451 : KHR-GLES2.core.internalformat.texture2d.rgba_half_float_rgba16f = FAIL 3451 : KHR-GLES2.core.internalformat.texture2d.rgba_half_float_rgba16f = FAIL
......
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