summaryrefslogtreecommitdiffstats
path: root/gfx
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-02-05 18:40:41 +0000
committerMoonchild <moonchild@palemoon.org>2021-02-05 18:40:41 +0000
commitaab1c211a6a4ced65a61b630b962bc870ed8c324 (patch)
tree2339bcf2345a84efdfd5abcf8b787101673f375b /gfx
parent66d028942c3246f17f3f86ce40c230041556d27d (diff)
downloadUXP-aab1c211a6a4ced65a61b630b962bc870ed8c324.tar
UXP-aab1c211a6a4ced65a61b630b962bc870ed8c324.tar.gz
UXP-aab1c211a6a4ced65a61b630b962bc870ed8c324.tar.lz
UXP-aab1c211a6a4ced65a61b630b962bc870ed8c324.tar.xz
UXP-aab1c211a6a4ced65a61b630b962bc870ed8c324.zip
[angle] Cherry-pick compressed tex depth stride fix.
Diffstat (limited to 'gfx')
-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();
}