Fix a bug about mip dimension calculation

Mip dimension should be greater than or equal to 1, while width >> level
may lead to 0.

Bug: dawn:547

Change-Id: Ib3dfb9fbdbed0e922df6efa366598eff0ca10df2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/49506
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Yunchao He
2021-04-30 17:51:58 +00:00
committed by Commit Bot service account
parent bf64a6c8b8
commit 4043ee9c06
3 changed files with 30 additions and 13 deletions

View File

@@ -39,8 +39,8 @@ namespace utils {
TextureDataCopyLayout layout;
layout.mipSize = {textureSizeAtLevel0.width >> mipmapLevel,
textureSizeAtLevel0.height >> mipmapLevel,
layout.mipSize = {std::max(textureSizeAtLevel0.width >> mipmapLevel, 1u),
std::max(textureSizeAtLevel0.height >> mipmapLevel, 1u),
textureSizeAtLevel0.depthOrArrayLayers};
layout.bytesPerRow = GetMinimumBytesPerRow(format, layout.mipSize.width);