Remove call of TextureFormatSupportsRendering from TextureValidationTest/SampleCount
This patch removes the call of TextureFormatSupportsRendering() from
the dawn_unittest TextureValidationTest/SampleCount as in Dawn we have
already updated the restriction that non-renderable formats cannot be
used to create multisampled textures.
Bug: dawn:1459
Test: dawn_unittests
Change-Id: I3b7a016328c8cd06c771c58dd181005b61e01510
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93421
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
index f9a99ff..452a222 100644
--- a/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
@@ -720,7 +720,7 @@
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetFormat) {
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
if (!utils::TextureFormatSupportsMultisampling(format) ||
- !utils::TextureFormatSupportsRendering(format)) {
+ utils::IsDepthOrStencilFormat(format)) {
continue;
}
diff --git a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp
index 5659423..543d7e0 100644
--- a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp
@@ -145,10 +145,6 @@
descriptor.sampleCount = 4;
for (wgpu::TextureFormat format : utils::kFormatsInCoreSpec) {
- if (!utils::TextureFormatSupportsRendering(format)) {
- continue;
- }
-
descriptor.format = format;
if (utils::TextureFormatSupportsMultisampling(format)) {
device.CreateTexture(&descriptor);
diff --git a/src/dawn/utils/TextureUtils.cpp b/src/dawn/utils/TextureUtils.cpp
index f11d724..ad2739f 100644
--- a/src/dawn/utils/TextureUtils.cpp
+++ b/src/dawn/utils/TextureUtils.cpp
@@ -130,6 +130,21 @@
}
}
+bool IsDepthOrStencilFormat(wgpu::TextureFormat textureFormat) {
+ switch (textureFormat) {
+ case wgpu::TextureFormat::Depth16Unorm:
+ case wgpu::TextureFormat::Depth24Plus:
+ case wgpu::TextureFormat::Depth32Float:
+ case wgpu::TextureFormat::Depth24PlusStencil8:
+ case wgpu::TextureFormat::Depth24UnormStencil8:
+ case wgpu::TextureFormat::Depth32FloatStencil8:
+ case wgpu::TextureFormat::Stencil8:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool TextureFormatSupportsMultisampling(wgpu::TextureFormat textureFormat) {
if (IsBCTextureFormat(textureFormat) || IsETC2TextureFormat(textureFormat) ||
IsASTCTextureFormat(textureFormat)) {
@@ -157,45 +172,6 @@
}
}
-bool TextureFormatSupportsRendering(wgpu::TextureFormat textureFormat) {
- switch (textureFormat) {
- case wgpu::TextureFormat::R8Unorm:
- case wgpu::TextureFormat::R8Uint:
- case wgpu::TextureFormat::R8Sint:
- case wgpu::TextureFormat::RG8Unorm:
- case wgpu::TextureFormat::RG8Uint:
- case wgpu::TextureFormat::RG8Sint:
- case wgpu::TextureFormat::RGBA8Unorm:
- case wgpu::TextureFormat::RGBA8Uint:
- case wgpu::TextureFormat::RGBA8Sint:
- case wgpu::TextureFormat::BGRA8Unorm:
- case wgpu::TextureFormat::BGRA8UnormSrgb:
- case wgpu::TextureFormat::R16Uint:
- case wgpu::TextureFormat::R16Sint:
- case wgpu::TextureFormat::R16Float:
- case wgpu::TextureFormat::RG16Uint:
- case wgpu::TextureFormat::RG16Sint:
- case wgpu::TextureFormat::RG16Float:
- case wgpu::TextureFormat::RGBA16Uint:
- case wgpu::TextureFormat::RGBA16Sint:
- case wgpu::TextureFormat::RGBA16Float:
- case wgpu::TextureFormat::R32Uint:
- case wgpu::TextureFormat::R32Sint:
- case wgpu::TextureFormat::R32Float:
- case wgpu::TextureFormat::RG32Uint:
- case wgpu::TextureFormat::RG32Sint:
- case wgpu::TextureFormat::RG32Float:
- case wgpu::TextureFormat::RGBA32Uint:
- case wgpu::TextureFormat::RGBA32Sint:
- case wgpu::TextureFormat::RGBA32Float:
- case wgpu::TextureFormat::RGB10A2Unorm:
- return true;
-
- default:
- return false;
- }
-}
-
bool TextureFormatSupportsResolveTarget(wgpu::TextureFormat textureFormat) {
switch (textureFormat) {
case wgpu::TextureFormat::R8Unorm:
diff --git a/src/dawn/utils/TextureUtils.h b/src/dawn/utils/TextureUtils.h
index 80fecab..5b0025d 100644
--- a/src/dawn/utils/TextureUtils.h
+++ b/src/dawn/utils/TextureUtils.h
@@ -228,10 +228,10 @@
bool IsDepthOnlyFormat(wgpu::TextureFormat textureFormat);
bool IsStencilOnlyFormat(wgpu::TextureFormat textureFormat);
+bool IsDepthOrStencilFormat(wgpu::TextureFormat textureFormat);
bool TextureFormatSupportsMultisampling(wgpu::TextureFormat textureFormat);
bool TextureFormatSupportsResolveTarget(wgpu::TextureFormat textureFormat);
-bool TextureFormatSupportsRendering(wgpu::TextureFormat textureFormat);
uint32_t GetTexelBlockSizeInBytes(wgpu::TextureFormat textureFormat);
uint32_t GetTextureFormatBlockWidth(wgpu::TextureFormat textureFormat);