summaryrefslogtreecommitdiffstats
path: root/gfx/angle
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-02-05 18:40:41 +0000
committerMoonchild <moonchild@palemoon.org>2021-02-05 18:43:01 +0000
commit08903c0c9c5983a5f9bb48b25dc59085033a4bdb (patch)
treeb1cafd67505737d6662efe7354881e4a837bb5cd /gfx/angle
parentcca738e986de696cbd414a9d35209d6aa166ae5e (diff)
downloadUXP-08903c0c9c5983a5f9bb48b25dc59085033a4bdb.tar
UXP-08903c0c9c5983a5f9bb48b25dc59085033a4bdb.tar.gz
UXP-08903c0c9c5983a5f9bb48b25dc59085033a4bdb.tar.lz
UXP-08903c0c9c5983a5f9bb48b25dc59085033a4bdb.tar.xz
UXP-08903c0c9c5983a5f9bb48b25dc59085033a4bdb.zip
[angle] Cherry-pick compressed tex depth stride fix.RELBASE_20210205
Diffstat (limited to 'gfx/angle')
-rwxr-xr-xgfx/angle/src/libANGLE/formatutils.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/gfx/angle/src/libANGLE/formatutils.cpp b/gfx/angle/src/libANGLE/formatutils.cpp
index 9a8c1b790..caeaf6c6e 100755
--- a/gfx/angle/src/libANGLE/formatutils.cpp
+++ b/gfx/angle/src/libANGLE/formatutils.cpp
@@ -863,13 +863,22 @@ gl::ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType,
GLint rowLength,
GLint imageHeight) const
{
- GLuint rows =
- (imageHeight > 0 ? static_cast<GLuint>(imageHeight) : static_cast<GLuint>(height));
+ CheckedNumeric<GLuint> pixelsHeight(imageHeight > 0 ? static_cast<GLuint>(imageHeight)
+ : static_cast<GLuint>(height));
+
+ CheckedNumeric<GLuint> rowCount;
+ if (compressed) {
+ CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
+ rowCount = (pixelsHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
+ } else {
+ rowCount = pixelsHeight;
+ }
+
GLuint rowPitch = 0;
ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch);
CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
- auto depthPitch = checkedRowPitch * rows;
+ auto depthPitch = checkedRowPitch * rowCount;
ANGLE_TRY_CHECKED_MATH(depthPitch);
return depthPitch.ValueOrDie();
}