mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Add more constants for max texture sizes
Currently we only implemented 2D and 2DArray texture. kMaxTextureSize is actually for 2D texture only. This patch adds a few more constants for texture size for 1D and 3D textures, and changes kMaxTextureSize to kMaxTextureDimension2D. Bug: dawn:558 Change-Id: I9088dd7c060dc096a65abea37c7fb01f760524e9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36540 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
77fcdf7eaa
commit
0325e4503b
@@ -128,23 +128,23 @@ TEST_P(SwapChainValidationTests, InvalidCreationSize) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateSwapChain(surface, &desc));
|
||||
}
|
||||
|
||||
// A width of kMaxTextureSize is valid but kMaxTextureSize + 1 isn't.
|
||||
// A width of kMaxTextureDimension2D is valid but kMaxTextureDimension2D + 1 isn't.
|
||||
{
|
||||
wgpu::SwapChainDescriptor desc = goodDescriptor;
|
||||
desc.width = kMaxTextureSize;
|
||||
desc.width = kMaxTextureDimension2D;
|
||||
device.CreateSwapChain(surface, &desc);
|
||||
|
||||
desc.width = kMaxTextureSize + 1;
|
||||
desc.width = kMaxTextureDimension2D + 1;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSwapChain(surface, &desc));
|
||||
}
|
||||
|
||||
// A height of kMaxTextureSize is valid but kMaxTextureSize + 1 isn't.
|
||||
// A height of kMaxTextureDimension2D is valid but kMaxTextureDimension2D + 1 isn't.
|
||||
{
|
||||
wgpu::SwapChainDescriptor desc = goodDescriptor;
|
||||
desc.height = kMaxTextureSize;
|
||||
desc.height = kMaxTextureDimension2D;
|
||||
device.CreateSwapChain(surface, &desc);
|
||||
|
||||
desc.height = kMaxTextureSize + 1;
|
||||
desc.height = kMaxTextureDimension2D + 1;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSwapChain(surface, &desc));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,26 +213,26 @@ namespace {
|
||||
TEST_F(TextureValidationTest, ArrayLayerCount) {
|
||||
wgpu::TextureDescriptor defaultDescriptor = CreateDefaultTextureDescriptor();
|
||||
|
||||
// Array layer count exceeding kMaxTexture2DArrayLayers is not allowed
|
||||
// Array layer count exceeding kMaxTextureArrayLayers is not allowed
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.depth = kMaxTexture2DArrayLayers + 1u;
|
||||
descriptor.size.depth = kMaxTextureArrayLayers + 1u;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
// Array layer count less than kMaxTexture2DArrayLayers is allowed;
|
||||
// Array layer count less than kMaxTextureArrayLayers is allowed;
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.depth = kMaxTexture2DArrayLayers >> 1;
|
||||
descriptor.size.depth = kMaxTextureArrayLayers >> 1;
|
||||
|
||||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
// Array layer count equal to kMaxTexture2DArrayLayers is allowed;
|
||||
// Array layer count equal to kMaxTextureArrayLayers is allowed;
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.depth = kMaxTexture2DArrayLayers;
|
||||
descriptor.size.depth = kMaxTextureArrayLayers;
|
||||
|
||||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
@@ -242,29 +242,29 @@ namespace {
|
||||
TEST_F(TextureValidationTest, TextureSize) {
|
||||
wgpu::TextureDescriptor defaultDescriptor = CreateDefaultTextureDescriptor();
|
||||
|
||||
// Texture size exceeding kMaxTextureSize is not allowed
|
||||
// Texture size exceeding kMaxTextureDimension2D is not allowed
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = kMaxTextureSize + 1u;
|
||||
descriptor.size.height = kMaxTextureSize + 1u;
|
||||
descriptor.size.width = kMaxTextureDimension2D + 1u;
|
||||
descriptor.size.height = kMaxTextureDimension2D + 1u;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||
}
|
||||
|
||||
// Texture size less than kMaxTextureSize is allowed
|
||||
// Texture size less than kMaxTextureDimension2D is allowed
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = kMaxTextureSize >> 1;
|
||||
descriptor.size.height = kMaxTextureSize >> 1;
|
||||
descriptor.size.width = kMaxTextureDimension2D >> 1;
|
||||
descriptor.size.height = kMaxTextureDimension2D >> 1;
|
||||
|
||||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
// Texture equal to kMaxTextureSize is allowed
|
||||
// Texture equal to kMaxTextureDimension2D is allowed
|
||||
{
|
||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||
descriptor.size.width = kMaxTextureSize;
|
||||
descriptor.size.height = kMaxTextureSize;
|
||||
descriptor.size.width = kMaxTextureDimension2D;
|
||||
descriptor.size.height = kMaxTextureDimension2D;
|
||||
|
||||
device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user