Treat 'mipLevelCount == 0' as error
It's no longer a valid default value. Bug: dawn:1026 Change-Id: I9de656f29c8b7673de412cef35dcfb8a45121ac7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64165 Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
This commit is contained in:
parent
8626b2142d
commit
b166b99f86
|
@ -418,9 +418,7 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(jie.a.chen@intel.com): Remove 'desc.mipLevelCount == 0' once the WebGPU change is
|
||||
// landed.
|
||||
if (desc.mipLevelCount == 0 || desc.mipLevelCount == wgpu::kMipLevelCountUndefined) {
|
||||
if (desc.mipLevelCount == wgpu::kMipLevelCountUndefined) {
|
||||
desc.mipLevelCount = texture->GetNumMipLevels() - desc.baseMipLevel;
|
||||
}
|
||||
return desc;
|
||||
|
|
|
@ -79,6 +79,13 @@ namespace {
|
|||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to create a view with zero 'mipLevelCount'.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.mipLevelCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a 2D texture view on a 2D texture.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
|
@ -160,6 +167,14 @@ namespace {
|
|||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to create a view with zero 'mipLevelCount'.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = wgpu::TextureViewDimension::e2D;
|
||||
descriptor.mipLevelCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a 2D texture view on a 2D array texture.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
|
@ -231,6 +246,13 @@ namespace {
|
|||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to create a view with zero 'mipLevelCount'.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base3DTextureViewDescriptor;
|
||||
descriptor.mipLevelCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a 3D texture view on a 3D texture.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base3DTextureViewDescriptor;
|
||||
|
@ -475,6 +497,14 @@ namespace {
|
|||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to create a view with zero 'mipLevelCount'.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = wgpu::TextureViewDimension::Cube;
|
||||
descriptor.mipLevelCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a cube map texture view with arrayLayerCount == 6.
|
||||
{
|
||||
wgpu::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
|
|
Loading…
Reference in New Issue