mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
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:
committed by
Commit Bot service account
parent
bf64a6c8b8
commit
4043ee9c06
@@ -671,6 +671,27 @@ TEST_P(CopyTests_T2B, TextureMipAligned) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test that copying mips when one dimension is 256-byte aligned and another dimension reach one
|
||||
// works
|
||||
TEST_P(CopyTests_T2B, TextureMipDimensionReachOne) {
|
||||
constexpr uint32_t mipLevelCount = 4;
|
||||
constexpr uint32_t kWidth = 256 << mipLevelCount;
|
||||
constexpr uint32_t kHeight = 2;
|
||||
|
||||
TextureSpec defaultTextureSpec;
|
||||
defaultTextureSpec.textureSize = {kWidth, kHeight, 1};
|
||||
|
||||
TextureSpec textureSpec = defaultTextureSpec;
|
||||
textureSpec.levelCount = mipLevelCount;
|
||||
|
||||
for (unsigned int i = 0; i < 4; ++i) {
|
||||
textureSpec.copyLevel = i;
|
||||
DoTest(textureSpec,
|
||||
MinimumBufferSpec(std::max(kWidth >> i, 1u), std::max(kHeight >> i, 1u)),
|
||||
{std::max(kWidth >> i, 1u), std::max(kHeight >> i, 1u), 1});
|
||||
}
|
||||
}
|
||||
|
||||
// Test that copying mips without 256-byte aligned sizes works
|
||||
TEST_P(CopyTests_T2B, TextureMipUnaligned) {
|
||||
constexpr uint32_t kWidth = 259;
|
||||
|
||||
Reference in New Issue
Block a user