mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 01:27:30 +09:00
[angle] Cherry-pick compressed tex depth stride fix.
This commit is contained in:
parent
34dc51690f
commit
8fe6e9636d
1 changed files with 12 additions and 3 deletions
|
|
@ -863,13 +863,22 @@ gl::ErrorOrResult<GLuint> InternalFormat::computeDepthPitch(GLenum formatType,
|
||||||
GLint rowLength,
|
GLint rowLength,
|
||||||
GLint imageHeight) const
|
GLint imageHeight) 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;
|
||||||
|
}
|
||||||
|
|
||||||
GLuint rowPitch = 0;
|
GLuint rowPitch = 0;
|
||||||
ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch);
|
ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch);
|
||||||
|
|
||||||
CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
|
CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
|
||||||
auto depthPitch = checkedRowPitch * rows;
|
auto depthPitch = checkedRowPitch * rowCount;
|
||||||
ANGLE_TRY_CHECKED_MATH(depthPitch);
|
ANGLE_TRY_CHECKED_MATH(depthPitch);
|
||||||
return depthPitch.ValueOrDie();
|
return depthPitch.ValueOrDie();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue