mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
Validate the declaration of storage texture format in shader
This patch adds the validation on the storage texture format declared in shaders when we create a rendering or compute pipeline with read-only or write-only storage textures. This patch also fixes a typo in the TextureValidationTest. BUG=dawn:267 TEST=dawn_unittests Change-Id: Id302b4b7803d7e03b57c61de1290cc71ba940e2c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16940 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
2550e96724
commit
971a6233c2
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "common/Constants.h"
|
||||
#include "utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "utils/TextureFormatUtils.h"
|
||||
#include "utils/WGPUHelpers.h"
|
||||
|
||||
namespace {
|
||||
@@ -345,37 +346,13 @@ TEST_F(TextureValidationTest, TextureFormatNotSupportTextureUsageStorage) {
|
||||
descriptor.size = {1, 1, 1};
|
||||
descriptor.usage = wgpu::TextureUsage::Storage;
|
||||
|
||||
wgpu::TextureFormat kSupportedFormatsWithStorageUsage[] = {
|
||||
wgpu::TextureFormat::R32Uint, wgpu::TextureFormat::R32Sint,
|
||||
wgpu::TextureFormat::R32Uint, wgpu::TextureFormat::RGBA8Unorm,
|
||||
wgpu::TextureFormat::RGBA8Snorm, wgpu::TextureFormat::RGBA8Uint,
|
||||
wgpu::TextureFormat::RGBA8Sint, wgpu::TextureFormat::RG32Uint,
|
||||
wgpu::TextureFormat::RG32Sint, wgpu::TextureFormat::RG32Float,
|
||||
wgpu::TextureFormat::RGBA16Uint, wgpu::TextureFormat::RGBA16Sint,
|
||||
wgpu::TextureFormat::RGBA16Float, wgpu::TextureFormat::RGBA32Uint,
|
||||
wgpu::TextureFormat::RGBA32Sint, wgpu::TextureFormat::RGBA32Float};
|
||||
for (wgpu::TextureFormat format : kSupportedFormatsWithStorageUsage) {
|
||||
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
|
||||
descriptor.format = format;
|
||||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
wgpu::TextureFormat kUnsupportedFormatsWithStorageUsage[] = {
|
||||
wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::R8Snorm,
|
||||
wgpu::TextureFormat::R8Uint, wgpu::TextureFormat::R8Sint,
|
||||
wgpu::TextureFormat::R16Uint, wgpu::TextureFormat::R16Sint,
|
||||
wgpu::TextureFormat::R16Float, wgpu::TextureFormat::RG8Unorm,
|
||||
wgpu::TextureFormat::RG8Snorm, wgpu::TextureFormat::RG8Uint,
|
||||
wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG16Uint,
|
||||
wgpu::TextureFormat::RG16Sint, wgpu::TextureFormat::RG16Float,
|
||||
wgpu::TextureFormat::RGBA8UnormSrgb, wgpu::TextureFormat::BGRA8Unorm,
|
||||
wgpu::TextureFormat::BGRA8UnormSrgb, wgpu::TextureFormat::RGB10A2Unorm,
|
||||
wgpu::TextureFormat::RG11B10Float,
|
||||
|
||||
wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8,
|
||||
wgpu::TextureFormat::Depth32Float};
|
||||
for (wgpu::TextureFormat format : kUnsupportedFormatsWithStorageUsage) {
|
||||
descriptor.format = format;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
if (utils::TextureFormatSupportsStorageTexture(format)) {
|
||||
device.CreateTexture(&descriptor);
|
||||
} else {
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user