mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Make unittests and fuzzers use webgpu.h
BUG=dawn:22 Change-Id: Iff5465ad7a9456f9c6b2ee380af748b3afc129b7 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12741 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
cab352c2f6
commit
45b51f5df7
@@ -22,21 +22,21 @@ namespace {
|
||||
|
||||
class TextureValidationTest : public ValidationTest {
|
||||
protected:
|
||||
dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
wgpu::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
wgpu::TextureDescriptor descriptor;
|
||||
descriptor.size.width = kWidth;
|
||||
descriptor.size.height = kHeight;
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = kDefaultArraySize;
|
||||
descriptor.mipLevelCount = kDefaultMipLevels;
|
||||
descriptor.sampleCount = kDefaultSampleCount;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||
descriptor.format = kDefaultTextureFormat;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::Sampled;
|
||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::Sampled;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
dawn::Queue queue = device.CreateQueue();
|
||||
wgpu::Queue queue = device.CreateQueue();
|
||||
|
||||
private:
|
||||
static constexpr uint32_t kWidth = 32;
|
||||
@@ -45,16 +45,16 @@ class TextureValidationTest : public ValidationTest {
|
||||
static constexpr uint32_t kDefaultMipLevels = 1;
|
||||
static constexpr uint32_t kDefaultSampleCount = 1;
|
||||
|
||||
static constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
static constexpr wgpu::TextureFormat kDefaultTextureFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||
};
|
||||
|
||||
// Test the validation of sample count
|
||||
TEST_F(TextureValidationTest, SampleCount) {
|
||||
dawn::TextureDescriptor defaultDescriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor defaultDescriptor = CreateDefaultTextureDescriptor();
|
||||
|
||||
// sampleCount == 1 is allowed.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.sampleCount = 1;
|
||||
|
||||
device.CreateTexture(&descriptor);
|
||||
@@ -62,7 +62,7 @@ TEST_F(TextureValidationTest, SampleCount) {
|
||||
|
||||
// sampleCount == 4 is allowed.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.sampleCount = 4;
|
||||
|
||||
device.CreateTexture(&descriptor);
|
||||
@@ -70,7 +70,7 @@ TEST_F(TextureValidationTest, SampleCount) {
|
||||
|
||||
// It is an error to create a texture with an invalid sampleCount.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.sampleCount = 3;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
@@ -78,7 +78,7 @@ TEST_F(TextureValidationTest, SampleCount) {
|
||||
|
||||
// It is an error to create a multisampled texture with mipLevelCount > 1.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.sampleCount = 4;
|
||||
descriptor.mipLevelCount = 2;
|
||||
|
||||
@@ -87,7 +87,7 @@ TEST_F(TextureValidationTest, SampleCount) {
|
||||
|
||||
// Currently we do not support multisampled 2D array textures.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.sampleCount = 4;
|
||||
descriptor.arrayLayerCount = 2;
|
||||
|
||||
@@ -97,11 +97,11 @@ TEST_F(TextureValidationTest, SampleCount) {
|
||||
|
||||
// Test the validation of the mip level count
|
||||
TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
dawn::TextureDescriptor defaultDescriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor defaultDescriptor = CreateDefaultTextureDescriptor();
|
||||
|
||||
// mipLevelCount == 1 is allowed
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.height = 32;
|
||||
descriptor.mipLevelCount = 1;
|
||||
@@ -111,7 +111,7 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// mipLevelCount == 0 is an error
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.height = 32;
|
||||
descriptor.mipLevelCount = 0;
|
||||
@@ -121,7 +121,7 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// Full mip chains are allowed
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.height = 32;
|
||||
// Mip level sizes: 32, 16, 8, 4, 2, 1
|
||||
@@ -132,7 +132,7 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// Too big mip chains on width are disallowed
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 31;
|
||||
descriptor.size.height = 32;
|
||||
// Mip level width: 31, 15, 7, 3, 1, 1
|
||||
@@ -143,7 +143,7 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// Too big mip chains on height are disallowed
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.height = 31;
|
||||
// Mip level height: 31, 15, 7, 3, 1, 1
|
||||
@@ -154,7 +154,7 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// Undefined shift check if miplevel is bigger than the integer bit width.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.height = 32;
|
||||
descriptor.mipLevelCount = 100;
|
||||
@@ -164,7 +164,7 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// Non square mip map halves the resolution until a 1x1 dimension.
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = defaultDescriptor;
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = 32;
|
||||
descriptor.size.height = 8;
|
||||
// Mip maps: 32 * 8, 16 * 4, 8 * 2, 4 * 1, 2 * 1, 1 * 1
|
||||
@@ -176,15 +176,15 @@ TEST_F(TextureValidationTest, MipLevelCount) {
|
||||
|
||||
// Test that it is valid to destroy a texture
|
||||
TEST_F(TextureValidationTest, DestroyTexture) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||
texture.Destroy();
|
||||
}
|
||||
|
||||
// Test that it's valid to destroy a destroyed texture
|
||||
TEST_F(TextureValidationTest, DestroyDestroyedTexture) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||
texture.Destroy();
|
||||
texture.Destroy();
|
||||
}
|
||||
@@ -192,21 +192,21 @@ TEST_F(TextureValidationTest, DestroyDestroyedTexture) {
|
||||
// Test that it's invalid to submit a destroyed texture in a queue
|
||||
// in the case of destroy, encode, submit
|
||||
TEST_F(TextureValidationTest, DestroyEncodeSubmit) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateView();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||
wgpu::TextureView textureView = texture.CreateView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({textureView});
|
||||
|
||||
// Destroy the texture
|
||||
texture.Destroy();
|
||||
|
||||
dawn::CommandEncoder encoder_post_destroy = device.CreateCommandEncoder();
|
||||
wgpu::CommandEncoder encoder_post_destroy = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder_post_destroy.BeginRenderPass(&renderPass);
|
||||
wgpu::RenderPassEncoder pass = encoder_post_destroy.BeginRenderPass(&renderPass);
|
||||
pass.EndPass();
|
||||
}
|
||||
dawn::CommandBuffer commands = encoder_post_destroy.Finish();
|
||||
wgpu::CommandBuffer commands = encoder_post_destroy.Finish();
|
||||
|
||||
// Submit should fail due to destroyed texture
|
||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||
@@ -215,18 +215,18 @@ TEST_F(TextureValidationTest, DestroyEncodeSubmit) {
|
||||
// Test that it's invalid to submit a destroyed texture in a queue
|
||||
// in the case of encode, destroy, submit
|
||||
TEST_F(TextureValidationTest, EncodeDestroySubmit) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateView();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||
wgpu::TextureView textureView = texture.CreateView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({textureView});
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.EndPass();
|
||||
}
|
||||
dawn::CommandBuffer commands = encoder.Finish();
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
||||
// Destroy the texture
|
||||
texture.Destroy();
|
||||
@@ -237,20 +237,22 @@ TEST_F(TextureValidationTest, EncodeDestroySubmit) {
|
||||
|
||||
// Test it is an error to create an OutputAttachment texture with a non-renderable format.
|
||||
TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
wgpu::TextureDescriptor descriptor;
|
||||
descriptor.size = {1, 1, 1};
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||
|
||||
// Succeeds because RGBA8Unorm is renderable
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::TextureFormat nonRenderableFormats[] = {
|
||||
dawn::TextureFormat::RG11B10Float, dawn::TextureFormat::R8Snorm,
|
||||
dawn::TextureFormat::RG8Snorm, dawn::TextureFormat::RGBA8Snorm,
|
||||
wgpu::TextureFormat nonRenderableFormats[] = {
|
||||
wgpu::TextureFormat::RG11B10Float,
|
||||
wgpu::TextureFormat::R8Snorm,
|
||||
wgpu::TextureFormat::RG8Snorm,
|
||||
wgpu::TextureFormat::RGBA8Snorm,
|
||||
};
|
||||
|
||||
for (dawn::TextureFormat format : nonRenderableFormats) {
|
||||
for (wgpu::TextureFormat format : nonRenderableFormats) {
|
||||
// Fails because `format` is non-renderable
|
||||
descriptor.format = format;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
@@ -259,8 +261,8 @@ TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
|
||||
|
||||
// Test it is an error to create a texture with format "Undefined".
|
||||
TEST_F(TextureValidationTest, TextureFormatUndefined) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = dawn::TextureFormat::Undefined;
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = wgpu::TextureFormat::Undefined;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
@@ -273,52 +275,52 @@ class CompressedTextureFormatsValidationTests : public TextureValidationTest {
|
||||
}
|
||||
|
||||
protected:
|
||||
dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
dawn::TextureDescriptor descriptor =
|
||||
wgpu::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
wgpu::TextureDescriptor descriptor =
|
||||
TextureValidationTest::CreateDefaultTextureDescriptor();
|
||||
descriptor.usage =
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
const std::array<dawn::TextureFormat, 14> kBCFormats = {
|
||||
dawn::TextureFormat::BC1RGBAUnorm, dawn::TextureFormat::BC1RGBAUnormSrgb,
|
||||
dawn::TextureFormat::BC2RGBAUnorm, dawn::TextureFormat::BC2RGBAUnormSrgb,
|
||||
dawn::TextureFormat::BC3RGBAUnorm, dawn::TextureFormat::BC3RGBAUnormSrgb,
|
||||
dawn::TextureFormat::BC4RUnorm, dawn::TextureFormat::BC4RSnorm,
|
||||
dawn::TextureFormat::BC5RGUnorm, dawn::TextureFormat::BC5RGSnorm,
|
||||
dawn::TextureFormat::BC6HRGBUfloat, dawn::TextureFormat::BC6HRGBSfloat,
|
||||
dawn::TextureFormat::BC7RGBAUnorm, dawn::TextureFormat::BC7RGBAUnormSrgb};
|
||||
const std::array<wgpu::TextureFormat, 14> kBCFormats = {
|
||||
wgpu::TextureFormat::BC1RGBAUnorm, wgpu::TextureFormat::BC1RGBAUnormSrgb,
|
||||
wgpu::TextureFormat::BC2RGBAUnorm, wgpu::TextureFormat::BC2RGBAUnormSrgb,
|
||||
wgpu::TextureFormat::BC3RGBAUnorm, wgpu::TextureFormat::BC3RGBAUnormSrgb,
|
||||
wgpu::TextureFormat::BC4RUnorm, wgpu::TextureFormat::BC4RSnorm,
|
||||
wgpu::TextureFormat::BC5RGUnorm, wgpu::TextureFormat::BC5RGSnorm,
|
||||
wgpu::TextureFormat::BC6HRGBUfloat, wgpu::TextureFormat::BC6HRGBSfloat,
|
||||
wgpu::TextureFormat::BC7RGBAUnorm, wgpu::TextureFormat::BC7RGBAUnormSrgb};
|
||||
};
|
||||
|
||||
// Test the validation of texture size when creating textures in compressed texture formats.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, TextureSize) {
|
||||
// Test that it is invalid to use a number that is not a multiple of 4 (the compressed block
|
||||
// width and height of all BC formats) as the width or height of textures in BC formats.
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
for (wgpu::TextureFormat format : kBCFormats) {
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
ASSERT_TRUE(descriptor.size.width % 4 == 0 && descriptor.size.height % 4 == 0);
|
||||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.size.width = 31;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.size.height = 31;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.size.width = 12;
|
||||
descriptor.size.height = 32;
|
||||
@@ -331,9 +333,9 @@ TEST_F(CompressedTextureFormatsValidationTests, TextureSize) {
|
||||
// is not enabled.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, UseBCFormatWithoutEnablingExtension) {
|
||||
const std::vector<const char*> kEmptyVector;
|
||||
dawn::Device deviceWithoutExtension = CreateDeviceFromAdapter(adapter, kEmptyVector);
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::Device deviceWithoutExtension = CreateDeviceFromAdapter(adapter, kEmptyVector);
|
||||
for (wgpu::TextureFormat format : kBCFormats) {
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
ASSERT_DEVICE_ERROR(deviceWithoutExtension.CreateTexture(&descriptor));
|
||||
}
|
||||
@@ -343,25 +345,25 @@ TEST_F(CompressedTextureFormatsValidationTests, UseBCFormatWithoutEnablingExtens
|
||||
TEST_F(CompressedTextureFormatsValidationTests, TextureUsage) {
|
||||
// Test that only CopySrc, CopyDst and Sampled are accepted as the texture usage of the
|
||||
// textures in BC formats.
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
for (wgpu::TextureFormat format : kBCFormats) {
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.usage = dawn::TextureUsage::Storage;
|
||||
descriptor.usage = wgpu::TextureUsage::Storage;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
{
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.usage = dawn::TextureUsage::Present;
|
||||
descriptor.usage = wgpu::TextureUsage::Present;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
}
|
||||
@@ -370,8 +372,8 @@ TEST_F(CompressedTextureFormatsValidationTests, TextureUsage) {
|
||||
// Test the validation of sample count when creating textures in compressed texture formats.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, SampleCount) {
|
||||
// Test that it is invalid to specify SampleCount > 1 when we create a texture in BC formats.
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
for (wgpu::TextureFormat format : kBCFormats) {
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.sampleCount = 4;
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
@@ -381,8 +383,8 @@ TEST_F(CompressedTextureFormatsValidationTests, SampleCount) {
|
||||
// Test the validation of creating 2D array textures in compressed texture formats.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, 2DArrayTexture) {
|
||||
// Test that it is allowed to create a 2D array texture in BC formats.
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
for (wgpu::TextureFormat format : kBCFormats) {
|
||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
descriptor.format = format;
|
||||
descriptor.arrayLayerCount = 6;
|
||||
device.CreateTexture(&descriptor);
|
||||
|
||||
Reference in New Issue
Block a user