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>
This commit is contained in:
Jiawei Shao 2022-06-15 00:21:26 +00:00 committed by Dawn LUCI CQ
parent 6d48f573af
commit 314840bba1
4 changed files with 17 additions and 45 deletions

View File

@ -720,7 +720,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest,
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetFormat) {
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
if (!utils::TextureFormatSupportsMultisampling(format) ||
!utils::TextureFormatSupportsRendering(format)) {
utils::IsDepthOrStencilFormat(format)) {
continue;
}

View File

@ -145,10 +145,6 @@ TEST_F(TextureValidationTest, SampleCount) {
descriptor.sampleCount = 4;
for (wgpu::TextureFormat format : utils::kFormatsInCoreSpec) {
if (!utils::TextureFormatSupportsRendering(format)) {
continue;
}
descriptor.format = format;
if (utils::TextureFormatSupportsMultisampling(format)) {
device.CreateTexture(&descriptor);

View File

@ -130,6 +130,21 @@ bool IsDepthOnlyFormat(wgpu::TextureFormat textureFormat) {
}
}
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 TextureFormatSupportsMultisampling(wgpu::TextureFormat textureFormat) {
}
}
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:

View File

@ -228,10 +228,10 @@ bool IsASTCTextureFormat(wgpu::TextureFormat textureFormat);
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);