Allow arrayLayerCount=0 during the deprecation period.
The value 0 is the default value for default-constructed C descriptors and should be allowed. Bug: dawn:22 Change-Id: I876ec4d9c6d70a798b0d6cea5c2ccecaad850eff Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26100 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
8c9858e9b8
commit
8c201dfadc
|
@ -331,9 +331,9 @@ namespace dawn_native {
|
||||||
const TextureDescriptor* desc) {
|
const TextureDescriptor* desc) {
|
||||||
TextureDescriptor fixedDesc = *desc;
|
TextureDescriptor fixedDesc = *desc;
|
||||||
|
|
||||||
if (desc->arrayLayerCount != 1) {
|
if (desc->arrayLayerCount >= 2) {
|
||||||
if (desc->size.depth != 1) {
|
if (desc->size.depth != 1) {
|
||||||
return DAWN_VALIDATION_ERROR("arrayLayerCount and size.depth cannot both be != 1");
|
return DAWN_VALIDATION_ERROR("arrayLayerCount and size.depth cannot both be set.");
|
||||||
} else {
|
} else {
|
||||||
fixedDesc.size.depth = fixedDesc.arrayLayerCount;
|
fixedDesc.size.depth = fixedDesc.arrayLayerCount;
|
||||||
fixedDesc.arrayLayerCount = 1;
|
fixedDesc.arrayLayerCount = 1;
|
||||||
|
|
|
@ -132,6 +132,20 @@ TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountStateTracking) {
|
||||||
ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc));
|
ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that using TextureDescriptor::arrayLayerCount = 0 is allowed
|
||||||
|
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountZero) {
|
||||||
|
wgpu::TextureDescriptor desc;
|
||||||
|
desc.usage = wgpu::TextureUsage::Sampled;
|
||||||
|
desc.dimension = wgpu::TextureDimension::e2D;
|
||||||
|
desc.size = {1, 1, 1};
|
||||||
|
desc.arrayLayerCount = 0;
|
||||||
|
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
desc.mipLevelCount = 1;
|
||||||
|
desc.sampleCount = 1;
|
||||||
|
|
||||||
|
device.CreateTexture(&desc);
|
||||||
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
|
Loading…
Reference in New Issue