Deprecate TextureDescriptor::arrayLayerCount -> size.depth
This updates CL: - Adds a deprecation warning to use size.depth instead of arrayLayerCount. - Changes all tests and samples to use size.depth. - Adds deprecation tests for the change. In particular the state tracking in TextureBase isn't changed yet because it requires non-trivial changes in the backends. It will be done in a follow-up CL. Bug:dawn:22 Change-Id: Ic02dfb5baaba8d5b06cd339ce988e9b1d16cb5e9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23101 Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
6b3a974b42
commit
4234d78201
|
@ -56,7 +56,6 @@ void initTextures() {
|
||||||
descriptor.size.width = 1024;
|
descriptor.size.width = 1024;
|
||||||
descriptor.size.height = 1024;
|
descriptor.size.height = 1024;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -189,7 +189,6 @@ wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device) {
|
||||||
descriptor.size.width = 640;
|
descriptor.size.width = 640;
|
||||||
descriptor.size.height = 480;
|
descriptor.size.height = 480;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -1001,6 +1001,13 @@ namespace dawn_native {
|
||||||
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTextureInternal(
|
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTextureInternal(
|
||||||
const TextureDescriptor* descriptor) {
|
const TextureDescriptor* descriptor) {
|
||||||
DAWN_TRY(ValidateIsAlive());
|
DAWN_TRY(ValidateIsAlive());
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
||||||
|
// GPUTextureDescriptor.size.depth is done.
|
||||||
|
TextureDescriptor fixedDescriptor;
|
||||||
|
DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(this, descriptor));
|
||||||
|
descriptor = &fixedDescriptor;
|
||||||
|
|
||||||
if (IsValidationEnabled()) {
|
if (IsValidationEnabled()) {
|
||||||
DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
|
DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,6 @@ namespace dawn_native {
|
||||||
desc.usage = swapChain->GetUsage();
|
desc.usage = swapChain->GetUsage();
|
||||||
desc.dimension = wgpu::TextureDimension::e2D;
|
desc.dimension = wgpu::TextureDimension::e2D;
|
||||||
desc.size = {swapChain->GetWidth(), swapChain->GetHeight(), 1};
|
desc.size = {swapChain->GetWidth(), swapChain->GetHeight(), 1};
|
||||||
desc.arrayLayerCount = 1;
|
|
||||||
desc.format = swapChain->GetFormat();
|
desc.format = swapChain->GetFormat();
|
||||||
desc.mipLevelCount = 1;
|
desc.mipLevelCount = 1;
|
||||||
desc.sampleCount = 1;
|
desc.sampleCount = 1;
|
||||||
|
@ -181,7 +180,6 @@ namespace dawn_native {
|
||||||
descriptor.size.width = mWidth;
|
descriptor.size.width = mWidth;
|
||||||
descriptor.size.height = mHeight;
|
descriptor.size.height = mHeight;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = mFormat;
|
descriptor.format = mFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -101,8 +101,9 @@ namespace dawn_native {
|
||||||
|
|
||||||
// Multisampled 2D array texture is not supported because on Metal it requires the
|
// Multisampled 2D array texture is not supported because on Metal it requires the
|
||||||
// version of macOS be greater than 10.14.
|
// version of macOS be greater than 10.14.
|
||||||
if (descriptor->arrayLayerCount > 1) {
|
if (descriptor->size.depth > 1) {
|
||||||
return DAWN_VALIDATION_ERROR("Multisampled 2D array texture is not supported.");
|
return DAWN_VALIDATION_ERROR(
|
||||||
|
"Multisampled textures with depth > 1 are not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format->isCompressed) {
|
if (format->isCompressed) {
|
||||||
|
@ -163,7 +164,8 @@ namespace dawn_native {
|
||||||
"The size of the texture is incompatible with the texture format");
|
"The size of the texture is incompatible with the texture format");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->arrayLayerCount > kMaxTexture2DArrayLayers) {
|
if (descriptor->dimension == wgpu::TextureDimension::e2D &&
|
||||||
|
descriptor->size.depth > kMaxTexture2DArrayLayers) {
|
||||||
return DAWN_VALIDATION_ERROR("Texture 2D array layer count exceeded");
|
return DAWN_VALIDATION_ERROR("Texture 2D array layer count exceeded");
|
||||||
}
|
}
|
||||||
if (descriptor->mipLevelCount > kMaxTexture2DMipLevels) {
|
if (descriptor->mipLevelCount > kMaxTexture2DMipLevels) {
|
||||||
|
@ -218,8 +220,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
// TODO(jiawei.shao@intel.com): check stuff based on the dimension
|
// TODO(jiawei.shao@intel.com): check stuff based on the dimension
|
||||||
if (descriptor->size.width == 0 || descriptor->size.height == 0 ||
|
if (descriptor->size.width == 0 || descriptor->size.height == 0 ||
|
||||||
descriptor->size.depth == 0 || descriptor->arrayLayerCount == 0 ||
|
descriptor->size.depth == 0 || descriptor->mipLevelCount == 0) {
|
||||||
descriptor->mipLevelCount == 0) {
|
|
||||||
return DAWN_VALIDATION_ERROR("Cannot create an empty texture");
|
return DAWN_VALIDATION_ERROR("Cannot create an empty texture");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,6 +327,25 @@ namespace dawn_native {
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResultOrError<TextureDescriptor> FixTextureDescriptor(DeviceBase* device,
|
||||||
|
const TextureDescriptor* desc) {
|
||||||
|
TextureDescriptor fixedDesc = *desc;
|
||||||
|
|
||||||
|
if (desc->arrayLayerCount != 1) {
|
||||||
|
if (desc->size.depth != 1) {
|
||||||
|
return DAWN_VALIDATION_ERROR("arrayLayerCount and size.depth cannot both be != 1");
|
||||||
|
} else {
|
||||||
|
fixedDesc.size.depth = fixedDesc.arrayLayerCount;
|
||||||
|
fixedDesc.arrayLayerCount = 1;
|
||||||
|
device->EmitDeprecationWarning(
|
||||||
|
"wgpu::TextureDescriptor::arrayLayerCount is deprecated in favor of "
|
||||||
|
"::size::depth");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {std::move(fixedDesc)};
|
||||||
|
}
|
||||||
|
|
||||||
bool IsValidSampleCount(uint32_t sampleCount) {
|
bool IsValidSampleCount(uint32_t sampleCount) {
|
||||||
switch (sampleCount) {
|
switch (sampleCount) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -352,11 +372,17 @@ namespace dawn_native {
|
||||||
mDimension(descriptor->dimension),
|
mDimension(descriptor->dimension),
|
||||||
mFormat(device->GetValidInternalFormat(descriptor->format)),
|
mFormat(device->GetValidInternalFormat(descriptor->format)),
|
||||||
mSize(descriptor->size),
|
mSize(descriptor->size),
|
||||||
mArrayLayerCount(descriptor->arrayLayerCount),
|
mArrayLayerCount(descriptor->size.depth),
|
||||||
mMipLevelCount(descriptor->mipLevelCount),
|
mMipLevelCount(descriptor->mipLevelCount),
|
||||||
mSampleCount(descriptor->sampleCount),
|
mSampleCount(descriptor->sampleCount),
|
||||||
mUsage(descriptor->usage),
|
mUsage(descriptor->usage),
|
||||||
mState(state) {
|
mState(state) {
|
||||||
|
// TODO(cwallez@chromium.org): Store the array layers in size.depth instead if extracting it
|
||||||
|
// in mArrayLayerCount.
|
||||||
|
ASSERT(mDimension == wgpu::TextureDimension::e2D);
|
||||||
|
mArrayLayerCount = mSize.depth;
|
||||||
|
mSize.depth = 1;
|
||||||
|
|
||||||
uint32_t subresourceCount = GetSubresourceCount();
|
uint32_t subresourceCount = GetSubresourceCount();
|
||||||
mIsSubresourceContentInitializedAtIndex = std::vector<bool>(subresourceCount, false);
|
mIsSubresourceContentInitializedAtIndex = std::vector<bool>(subresourceCount, false);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,11 @@ namespace dawn_native {
|
||||||
const TextureBase* texture,
|
const TextureBase* texture,
|
||||||
const TextureViewDescriptor* descriptor);
|
const TextureViewDescriptor* descriptor);
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
||||||
|
// GPUTextureDescriptor.size.depth is done.
|
||||||
|
ResultOrError<TextureDescriptor> FixTextureDescriptor(DeviceBase* device,
|
||||||
|
const TextureDescriptor* desc);
|
||||||
|
|
||||||
bool IsValidSampleCount(uint32_t sampleCount);
|
bool IsValidSampleCount(uint32_t sampleCount);
|
||||||
|
|
||||||
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
|
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
|
||||||
|
|
|
@ -336,8 +336,8 @@ namespace dawn_native { namespace d3d12 {
|
||||||
return DAWN_VALIDATION_ERROR("Mip level count must be 1");
|
return DAWN_VALIDATION_ERROR("Mip level count must be 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->arrayLayerCount != 1) {
|
if (descriptor->size.depth != 1) {
|
||||||
return DAWN_VALIDATION_ERROR("Array layer count must be 1");
|
return DAWN_VALIDATION_ERROR("Depth must be 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->sampleCount != 1) {
|
if (descriptor->sampleCount != 1) {
|
||||||
|
@ -393,6 +393,12 @@ namespace dawn_native { namespace d3d12 {
|
||||||
const TextureDescriptor* textureDescriptor =
|
const TextureDescriptor* textureDescriptor =
|
||||||
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
||||||
|
// GPUTextureDescriptor.size.depth is done.
|
||||||
|
TextureDescriptor fixedDescriptor;
|
||||||
|
DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(device, textureDescriptor));
|
||||||
|
textureDescriptor = &fixedDescriptor;
|
||||||
|
|
||||||
Ref<Texture> dawnTexture =
|
Ref<Texture> dawnTexture =
|
||||||
AcquireRef(new Texture(device, textureDescriptor, TextureState::OwnedExternal));
|
AcquireRef(new Texture(device, textureDescriptor, TextureState::OwnedExternal));
|
||||||
DAWN_TRY(dawnTexture->InitializeAsExternalTexture(textureDescriptor, sharedHandle,
|
DAWN_TRY(dawnTexture->InitializeAsExternalTexture(textureDescriptor, sharedHandle,
|
||||||
|
|
|
@ -269,6 +269,15 @@ namespace dawn_native { namespace metal {
|
||||||
uint32_t plane) {
|
uint32_t plane) {
|
||||||
const TextureDescriptor* textureDescriptor =
|
const TextureDescriptor* textureDescriptor =
|
||||||
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
||||||
|
// GPUTextureDescriptor.size.depth is done.
|
||||||
|
TextureDescriptor fixedDescriptor;
|
||||||
|
if (ConsumedError(FixTextureDescriptor(this, textureDescriptor), &fixedDescriptor)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
textureDescriptor = &fixedDescriptor;
|
||||||
|
|
||||||
if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
|
if (ConsumedError(ValidateTextureDescriptor(this, textureDescriptor))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ namespace dawn_native { namespace metal {
|
||||||
return DAWN_VALIDATION_ERROR("IOSurface mip level count must be 1");
|
return DAWN_VALIDATION_ERROR("IOSurface mip level count must be 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->arrayLayerCount != 1) {
|
if (descriptor->size.depth != 1) {
|
||||||
return DAWN_VALIDATION_ERROR("IOSurface array layer count must be 1");
|
return DAWN_VALIDATION_ERROR("IOSurface array layer count must be 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,17 +301,18 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
MTLTextureDescriptor* CreateMetalTextureDescriptor(const TextureDescriptor* descriptor) {
|
MTLTextureDescriptor* CreateMetalTextureDescriptor(const TextureDescriptor* descriptor) {
|
||||||
MTLTextureDescriptor* mtlDesc = [MTLTextureDescriptor new];
|
MTLTextureDescriptor* mtlDesc = [MTLTextureDescriptor new];
|
||||||
mtlDesc.textureType = MetalTextureType(descriptor->dimension, descriptor->arrayLayerCount,
|
mtlDesc.textureType = MetalTextureType(descriptor->dimension, descriptor->size.depth,
|
||||||
descriptor->sampleCount);
|
descriptor->sampleCount);
|
||||||
mtlDesc.usage = MetalTextureUsage(descriptor->usage);
|
mtlDesc.usage = MetalTextureUsage(descriptor->usage);
|
||||||
mtlDesc.pixelFormat = MetalPixelFormat(descriptor->format);
|
mtlDesc.pixelFormat = MetalPixelFormat(descriptor->format);
|
||||||
|
|
||||||
mtlDesc.width = descriptor->size.width;
|
mtlDesc.width = descriptor->size.width;
|
||||||
mtlDesc.height = descriptor->size.height;
|
mtlDesc.height = descriptor->size.height;
|
||||||
mtlDesc.depth = descriptor->size.depth;
|
ASSERT(descriptor->dimension == wgpu::TextureDimension::e2D);
|
||||||
|
mtlDesc.depth = 1;
|
||||||
|
|
||||||
mtlDesc.mipmapLevelCount = descriptor->mipLevelCount;
|
mtlDesc.mipmapLevelCount = descriptor->mipLevelCount;
|
||||||
mtlDesc.arrayLength = descriptor->arrayLayerCount;
|
mtlDesc.arrayLength = descriptor->size.depth;
|
||||||
mtlDesc.storageMode = MTLStorageModePrivate;
|
mtlDesc.storageMode = MTLStorageModePrivate;
|
||||||
|
|
||||||
mtlDesc.sampleCount = descriptor->sampleCount;
|
mtlDesc.sampleCount = descriptor->sampleCount;
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native { namespace opengl {
|
||||||
GLenum TargetForTexture(const TextureDescriptor* descriptor) {
|
GLenum TargetForTexture(const TextureDescriptor* descriptor) {
|
||||||
switch (descriptor->dimension) {
|
switch (descriptor->dimension) {
|
||||||
case wgpu::TextureDimension::e2D:
|
case wgpu::TextureDimension::e2D:
|
||||||
if (descriptor->arrayLayerCount > 1) {
|
if (descriptor->size.depth > 1) {
|
||||||
ASSERT(descriptor->sampleCount == 1);
|
ASSERT(descriptor->sampleCount == 1);
|
||||||
return GL_TEXTURE_2D_ARRAY;
|
return GL_TEXTURE_2D_ARRAY;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -558,6 +558,12 @@ namespace dawn_native { namespace vulkan {
|
||||||
const TextureDescriptor* textureDescriptor =
|
const TextureDescriptor* textureDescriptor =
|
||||||
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
reinterpret_cast<const TextureDescriptor*>(descriptor->cTextureDescriptor);
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once migration from GPUTextureDescriptor.arrayLayerCount to
|
||||||
|
// GPUTextureDescriptor.size.depth is done.
|
||||||
|
TextureDescriptor fixedDescriptor;
|
||||||
|
DAWN_TRY_ASSIGN(fixedDescriptor, FixTextureDescriptor(this, textureDescriptor));
|
||||||
|
textureDescriptor = &fixedDescriptor;
|
||||||
|
|
||||||
// Check services support this combination of handle type / image info
|
// Check services support this combination of handle type / image info
|
||||||
if (!mExternalSemaphoreService->Supported()) {
|
if (!mExternalSemaphoreService->Supported()) {
|
||||||
return DAWN_VALIDATION_ERROR("External semaphore usage not supported");
|
return DAWN_VALIDATION_ERROR("External semaphore usage not supported");
|
||||||
|
|
|
@ -430,7 +430,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
return DAWN_VALIDATION_ERROR("Mip level count must be 1");
|
return DAWN_VALIDATION_ERROR("Mip level count must be 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->arrayLayerCount != 1) {
|
if (descriptor->size.depth != 1) {
|
||||||
return DAWN_VALIDATION_ERROR("Array layer count must be 1");
|
return DAWN_VALIDATION_ERROR("Array layer count must be 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,6 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
descriptor.size.width = kRTSize;
|
descriptor.size.width = kRTSize;
|
||||||
descriptor.size.height = kRTSize;
|
descriptor.size.height = kRTSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -60,7 +60,6 @@ class ClipSpaceTest : public DawnTest {
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.usage =
|
textureDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.size = {kSize, kSize, 1};
|
textureDescriptor.size = {kSize, kSize, 1};
|
||||||
|
|
|
@ -748,7 +748,6 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
||||||
descriptor.size.width = kRTSize;
|
descriptor.size.width = kRTSize;
|
||||||
descriptor.size.height = kRTSize;
|
descriptor.size.height = kRTSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -481,7 +481,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyIntoNonZeroArrayLayer) {
|
||||||
config.copyExtent3D = config.textureDescriptor.size;
|
config.copyExtent3D = config.textureDescriptor.size;
|
||||||
|
|
||||||
constexpr uint32_t kArrayLayerCount = 3;
|
constexpr uint32_t kArrayLayerCount = 3;
|
||||||
config.textureDescriptor.arrayLayerCount = kArrayLayerCount;
|
config.textureDescriptor.size.depth = kArrayLayerCount;
|
||||||
config.viewArrayLayer = kArrayLayerCount - 1;
|
config.viewArrayLayer = kArrayLayerCount - 1;
|
||||||
|
|
||||||
for (wgpu::TextureFormat format : kBCFormats) {
|
for (wgpu::TextureFormat format : kBCFormats) {
|
||||||
|
|
|
@ -80,8 +80,7 @@ class CopyTests_T2B : public CopyTests {
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = textureSpec.width;
|
descriptor.size.width = textureSpec.width;
|
||||||
descriptor.size.height = textureSpec.height;
|
descriptor.size.height = textureSpec.height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = textureSpec.arraySize;
|
||||||
descriptor.arrayLayerCount = textureSpec.arraySize;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||||
|
@ -204,7 +203,6 @@ protected:
|
||||||
descriptor.size.width = textureSpec.width;
|
descriptor.size.width = textureSpec.width;
|
||||||
descriptor.size.height = textureSpec.height;
|
descriptor.size.height = textureSpec.height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||||
|
@ -299,8 +297,7 @@ class CopyTests_T2T : public CopyTests {
|
||||||
srcDescriptor.dimension = wgpu::TextureDimension::e2D;
|
srcDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
srcDescriptor.size.width = srcSpec.width;
|
srcDescriptor.size.width = srcSpec.width;
|
||||||
srcDescriptor.size.height = srcSpec.height;
|
srcDescriptor.size.height = srcSpec.height;
|
||||||
srcDescriptor.size.depth = 1;
|
srcDescriptor.size.depth = srcSpec.arraySize;
|
||||||
srcDescriptor.arrayLayerCount = srcSpec.arraySize;
|
|
||||||
srcDescriptor.sampleCount = 1;
|
srcDescriptor.sampleCount = 1;
|
||||||
srcDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
srcDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
srcDescriptor.mipLevelCount = srcSpec.level + 1;
|
srcDescriptor.mipLevelCount = srcSpec.level + 1;
|
||||||
|
@ -315,8 +312,7 @@ class CopyTests_T2T : public CopyTests {
|
||||||
dstDescriptor.dimension = wgpu::TextureDimension::e2D;
|
dstDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
dstDescriptor.size.width = dstSpec.width;
|
dstDescriptor.size.width = dstSpec.width;
|
||||||
dstDescriptor.size.height = dstSpec.height;
|
dstDescriptor.size.height = dstSpec.height;
|
||||||
dstDescriptor.size.depth = 1;
|
dstDescriptor.size.depth = dstSpec.arraySize;
|
||||||
dstDescriptor.arrayLayerCount = dstSpec.arraySize;
|
|
||||||
dstDescriptor.sampleCount = 1;
|
dstDescriptor.sampleCount = 1;
|
||||||
dstDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
dstDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
||||||
|
|
|
@ -64,7 +64,6 @@ class CullingTest : public DawnTest {
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.usage =
|
textureDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.size = {kSize, kSize, 1};
|
textureDescriptor.size = {kSize, kSize, 1};
|
||||||
|
|
|
@ -63,7 +63,6 @@ namespace {
|
||||||
baseDawnDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
baseDawnDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
baseDawnDescriptor.size = {kTestWidth, kTestHeight, 1};
|
baseDawnDescriptor.size = {kTestWidth, kTestHeight, 1};
|
||||||
baseDawnDescriptor.sampleCount = 1;
|
baseDawnDescriptor.sampleCount = 1;
|
||||||
baseDawnDescriptor.arrayLayerCount = 1;
|
|
||||||
baseDawnDescriptor.mipLevelCount = 1;
|
baseDawnDescriptor.mipLevelCount = 1;
|
||||||
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
|
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
|
||||||
wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::OutputAttachment |
|
||||||
|
@ -173,10 +172,10 @@ TEST_P(D3D12SharedHandleValidation, InvalidMipLevelCount) {
|
||||||
ASSERT_EQ(texture.Get(), nullptr);
|
ASSERT_EQ(texture.Get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test an error occurs if the descriptor array layer count isn't 1
|
// Test an error occurs if the descriptor depth isn't 1
|
||||||
TEST_P(D3D12SharedHandleValidation, InvalidArrayLayerCount) {
|
TEST_P(D3D12SharedHandleValidation, InvalidDepth) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
baseDawnDescriptor.arrayLayerCount = 2;
|
baseDawnDescriptor.size.depth = 2;
|
||||||
|
|
||||||
wgpu::Texture texture;
|
wgpu::Texture texture;
|
||||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||||
|
|
|
@ -82,6 +82,56 @@ TEST_P(DeprecationTests, SetSubDataStillWorks) {
|
||||||
EXPECT_BUFFER_U32_EQ(data, buffer, 0);
|
EXPECT_BUFFER_U32_EQ(data, buffer, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that using TextureDescriptor::arrayLayerCount emits a warning.
|
||||||
|
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountDeprecated) {
|
||||||
|
wgpu::TextureDescriptor desc;
|
||||||
|
desc.usage = wgpu::TextureUsage::Sampled;
|
||||||
|
desc.dimension = wgpu::TextureDimension::e2D;
|
||||||
|
desc.size = {1, 1, 1};
|
||||||
|
desc.arrayLayerCount = 2;
|
||||||
|
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
desc.mipLevelCount = 1;
|
||||||
|
desc.sampleCount = 1;
|
||||||
|
|
||||||
|
EXPECT_DEPRECATION_WARNING(device.CreateTexture(&desc));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that using both TextureDescriptor::arrayLayerCount and size.depth triggers an error.
|
||||||
|
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountAndDepthSizeIsError) {
|
||||||
|
wgpu::TextureDescriptor desc;
|
||||||
|
desc.usage = wgpu::TextureUsage::Sampled;
|
||||||
|
desc.dimension = wgpu::TextureDimension::e2D;
|
||||||
|
desc.size = {1, 1, 2};
|
||||||
|
desc.arrayLayerCount = 2;
|
||||||
|
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
desc.mipLevelCount = 1;
|
||||||
|
desc.sampleCount = 1;
|
||||||
|
|
||||||
|
ASSERT_DEVICE_ERROR(device.CreateTexture(&desc));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that TextureDescriptor::arrayLayerCount does correct state tracking.
|
||||||
|
TEST_P(DeprecationTests, TextureDescriptorArrayLayerCountStateTracking) {
|
||||||
|
wgpu::TextureDescriptor desc;
|
||||||
|
desc.usage = wgpu::TextureUsage::Sampled;
|
||||||
|
desc.dimension = wgpu::TextureDimension::e2D;
|
||||||
|
desc.size = {1, 1, 1};
|
||||||
|
desc.arrayLayerCount = 2;
|
||||||
|
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
desc.mipLevelCount = 1;
|
||||||
|
desc.sampleCount = 1;
|
||||||
|
|
||||||
|
wgpu::Texture texture;
|
||||||
|
EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc));
|
||||||
|
|
||||||
|
wgpu::TextureViewDescriptor viewDesc;
|
||||||
|
viewDesc.dimension = wgpu::TextureViewDimension::e2DArray;
|
||||||
|
viewDesc.arrayLayerCount = 2;
|
||||||
|
texture.CreateView(&viewDesc);
|
||||||
|
viewDesc.arrayLayerCount = 3;
|
||||||
|
ASSERT_DEVICE_ERROR(texture.CreateView(&viewDesc));
|
||||||
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
|
|
@ -30,7 +30,6 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
renderTargetDescriptor.size.width = kRTSize;
|
renderTargetDescriptor.size.width = kRTSize;
|
||||||
renderTargetDescriptor.size.height = kRTSize;
|
renderTargetDescriptor.size.height = kRTSize;
|
||||||
renderTargetDescriptor.size.depth = 1;
|
renderTargetDescriptor.size.depth = 1;
|
||||||
renderTargetDescriptor.arrayLayerCount = 1;
|
|
||||||
renderTargetDescriptor.sampleCount = 1;
|
renderTargetDescriptor.sampleCount = 1;
|
||||||
renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderTargetDescriptor.mipLevelCount = 1;
|
renderTargetDescriptor.mipLevelCount = 1;
|
||||||
|
@ -45,7 +44,6 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
depthDescriptor.size.width = kRTSize;
|
depthDescriptor.size.width = kRTSize;
|
||||||
depthDescriptor.size.height = kRTSize;
|
depthDescriptor.size.height = kRTSize;
|
||||||
depthDescriptor.size.depth = 1;
|
depthDescriptor.size.depth = 1;
|
||||||
depthDescriptor.arrayLayerCount = 1;
|
|
||||||
depthDescriptor.sampleCount = 1;
|
depthDescriptor.sampleCount = 1;
|
||||||
depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
depthDescriptor.mipLevelCount = 1;
|
depthDescriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -229,7 +229,6 @@ TEST_P(DeviceLostTest, CreateTextureFails) {
|
||||||
descriptor.size.width = 4;
|
descriptor.size.width = 4;
|
||||||
descriptor.size.height = 4;
|
descriptor.size.height = 4;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||||
|
|
|
@ -122,7 +122,6 @@ class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
||||||
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
descriptor.size = {10, 10, 1};
|
descriptor.size = {10, 10, 1};
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||||
}
|
}
|
||||||
|
@ -180,10 +179,10 @@ TEST_P(IOSurfaceValidationTests, InvalidMipLevelCount) {
|
||||||
ASSERT_EQ(texture.Get(), nullptr);
|
ASSERT_EQ(texture.Get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test an error occurs if the descriptor array layer count isn't 1
|
// Test an error occurs if the descriptor depth isn't 1
|
||||||
TEST_P(IOSurfaceValidationTests, InvalidArrayLayerCount) {
|
TEST_P(IOSurfaceValidationTests, InvalidDepth) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
descriptor.arrayLayerCount = 2;
|
descriptor.size.depth = 2;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
|
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
|
||||||
WrapIOSurface(&descriptor, defaultIOSurface.get(), 0));
|
WrapIOSurface(&descriptor, defaultIOSurface.get(), 0));
|
||||||
|
@ -298,7 +297,6 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::Sampled;
|
textureDescriptor.usage = wgpu::TextureUsage::Sampled;
|
||||||
wgpu::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
wgpu::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||||
|
@ -340,7 +338,6 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||||
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||||
|
@ -461,7 +458,6 @@ TEST_P(IOSurfaceUsageTests, UnclearedTextureIsCleared) {
|
||||||
textureDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
textureDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,7 @@ class MultisampledRenderingTest : public DawnTest {
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = kWidth << (mipLevelCount - 1);
|
descriptor.size.width = kWidth << (mipLevelCount - 1);
|
||||||
descriptor.size.height = kHeight << (mipLevelCount - 1);
|
descriptor.size.height = kHeight << (mipLevelCount - 1);
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayerCount;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = sampleCount;
|
descriptor.sampleCount = sampleCount;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
|
|
|
@ -34,7 +34,6 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClears) {
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
@ -58,7 +57,6 @@ TEST_P(NonzeroTextureCreationTests, Depth32TextureCreationDepthClears) {
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
|
@ -80,7 +78,6 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) {
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = mipLevels;
|
descriptor.mipLevelCount = mipLevels;
|
||||||
|
@ -104,8 +101,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayers;
|
||||||
descriptor.arrayLayerCount = arrayLayers;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
@ -128,7 +124,6 @@ TEST_P(NonzeroTextureCreationTests, NonrenderableTextureFormat) {
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
@ -161,8 +156,7 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableTextureClearWithMultiArrayLayer
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 2;
|
||||||
descriptor.arrayLayerCount = 2;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Snorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
@ -198,7 +192,6 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
||||||
baseDescriptor.sampleCount = 1;
|
baseDescriptor.sampleCount = 1;
|
||||||
baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
baseDescriptor.mipLevelCount = 1;
|
baseDescriptor.mipLevelCount = 1;
|
||||||
baseDescriptor.arrayLayerCount = 1;
|
|
||||||
baseDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
baseDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
|
|
||||||
RGBA8 filled(255, 255, 255, 255);
|
RGBA8 filled(255, 255, 255, 255);
|
||||||
|
@ -207,10 +200,10 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
||||||
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
||||||
// Some textures may be cleared with render pass load/store ops.
|
// Some textures may be cleared with render pass load/store ops.
|
||||||
// Test above the max attachment count.
|
// Test above the max attachment count.
|
||||||
descriptor.arrayLayerCount = kMaxColorAttachments + 1;
|
descriptor.size.depth = kMaxColorAttachments + 1;
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,11 +222,11 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
||||||
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
||||||
// Some textures may be cleared with render pass load/store ops.
|
// Some textures may be cleared with render pass load/store ops.
|
||||||
// Test above the max attachment count.
|
// Test above the max attachment count.
|
||||||
descriptor.arrayLayerCount = kMaxColorAttachments + 1;
|
descriptor.size.depth = kMaxColorAttachments + 1;
|
||||||
descriptor.mipLevelCount = 3;
|
descriptor.mipLevelCount = 3;
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
|
||||||
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
|
||||||
}
|
}
|
||||||
|
@ -251,7 +244,6 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableAllSubresourcesFilled) {
|
||||||
baseDescriptor.sampleCount = 1;
|
baseDescriptor.sampleCount = 1;
|
||||||
baseDescriptor.format = wgpu::TextureFormat::RGBA8Snorm;
|
baseDescriptor.format = wgpu::TextureFormat::RGBA8Snorm;
|
||||||
baseDescriptor.mipLevelCount = 1;
|
baseDescriptor.mipLevelCount = 1;
|
||||||
baseDescriptor.arrayLayerCount = 1;
|
|
||||||
baseDescriptor.usage = wgpu::TextureUsage::CopySrc;
|
baseDescriptor.usage = wgpu::TextureUsage::CopySrc;
|
||||||
|
|
||||||
RGBA8 filled(1, 1, 1, 1);
|
RGBA8 filled(1, 1, 1, 1);
|
||||||
|
@ -260,10 +252,10 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableAllSubresourcesFilled) {
|
||||||
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
||||||
// Some textures may be cleared with render pass load/store ops.
|
// Some textures may be cleared with render pass load/store ops.
|
||||||
// Test above the max attachment count.
|
// Test above the max attachment count.
|
||||||
descriptor.arrayLayerCount = kMaxColorAttachments + 1;
|
descriptor.size.depth = kMaxColorAttachments + 1;
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,11 +274,11 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableAllSubresourcesFilled) {
|
||||||
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
wgpu::TextureDescriptor descriptor = baseDescriptor;
|
||||||
// Some textures may be cleared with render pass load/store ops.
|
// Some textures may be cleared with render pass load/store ops.
|
||||||
// Test above the max attachment count.
|
// Test above the max attachment count.
|
||||||
descriptor.arrayLayerCount = kMaxColorAttachments + 1;
|
descriptor.size.depth = kMaxColorAttachments + 1;
|
||||||
descriptor.mipLevelCount = 3;
|
descriptor.mipLevelCount = 3;
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.arrayLayerCount; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depth; ++i) {
|
||||||
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ class RenderPassLoadOpTests : public DawnTest {
|
||||||
descriptor.size.width = kRTSize;
|
descriptor.size.width = kRTSize;
|
||||||
descriptor.size.height = kRTSize;
|
descriptor.size.height = kRTSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -57,7 +57,6 @@ protected:
|
||||||
descriptor.size.width = kRTSize;
|
descriptor.size.width = kRTSize;
|
||||||
descriptor.size.height = kRTSize;
|
descriptor.size.height = kRTSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = kFormat;
|
descriptor.format = kFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -90,7 +90,6 @@ protected:
|
||||||
descriptor.size.width = 2;
|
descriptor.size.width = 2;
|
||||||
descriptor.size.height = 2;
|
descriptor.size.height = 2;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -411,10 +411,9 @@ class StorageTextureTests : public DawnTest {
|
||||||
uint32_t height = kHeight,
|
uint32_t height = kHeight,
|
||||||
uint32_t arrayLayerCount = 1) {
|
uint32_t arrayLayerCount = 1) {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.size = {width, height, 1};
|
descriptor.size = {width, height, arrayLayerCount};
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.usage = usage;
|
descriptor.usage = usage;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
return device.CreateTexture(&descriptor);
|
return device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,8 +121,7 @@ class SubresourceOutputAttachmentTest : public DawnTest {
|
||||||
renderTargetDesc.dimension = wgpu::TextureDimension::e2D;
|
renderTargetDesc.dimension = wgpu::TextureDimension::e2D;
|
||||||
renderTargetDesc.size.width = kTextureSize;
|
renderTargetDesc.size.width = kTextureSize;
|
||||||
renderTargetDesc.size.height = kTextureSize;
|
renderTargetDesc.size.height = kTextureSize;
|
||||||
renderTargetDesc.size.depth = 1;
|
renderTargetDesc.size.depth = kArrayLayerCount;
|
||||||
renderTargetDesc.arrayLayerCount = kArrayLayerCount;
|
|
||||||
renderTargetDesc.sampleCount = 1;
|
renderTargetDesc.sampleCount = 1;
|
||||||
renderTargetDesc.format = format;
|
renderTargetDesc.format = format;
|
||||||
renderTargetDesc.mipLevelCount = kMipLevelCount;
|
renderTargetDesc.mipLevelCount = kMipLevelCount;
|
||||||
|
|
|
@ -27,8 +27,7 @@ class TextureSubresourceTest : public DawnTest {
|
||||||
wgpu::TextureUsage usage) {
|
wgpu::TextureUsage usage) {
|
||||||
wgpu::TextureDescriptor texDesc;
|
wgpu::TextureDescriptor texDesc;
|
||||||
texDesc.dimension = wgpu::TextureDimension::e2D;
|
texDesc.dimension = wgpu::TextureDimension::e2D;
|
||||||
texDesc.size = {kSize, kSize, 1};
|
texDesc.size = {kSize, kSize, arrayLayerCount};
|
||||||
texDesc.arrayLayerCount = arrayLayerCount;
|
|
||||||
texDesc.sampleCount = 1;
|
texDesc.sampleCount = 1;
|
||||||
texDesc.mipLevelCount = mipLevelCount;
|
texDesc.mipLevelCount = mipLevelCount;
|
||||||
texDesc.usage = usage;
|
texDesc.usage = usage;
|
||||||
|
|
|
@ -37,8 +37,7 @@ namespace {
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayerCount;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = kDefaultFormat;
|
descriptor.format = kDefaultFormat;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
|
|
|
@ -44,8 +44,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = kSize;
|
descriptor.size.width = kSize;
|
||||||
descriptor.size.height = kSize;
|
descriptor.size.height = kSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayerCount;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
|
|
|
@ -69,7 +69,6 @@ class ViewportTest : public DawnTest {
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.usage =
|
textureDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.size = {kSize, kSize, 1};
|
textureDescriptor.size = {kSize, kSize, 1};
|
||||||
|
|
|
@ -26,12 +26,11 @@ class BindGroupValidationTest : public ValidationTest {
|
||||||
uint32_t layerCount) {
|
uint32_t layerCount) {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size = {16, 16, 1};
|
descriptor.size = {16, 16, layerCount};
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = usage;
|
descriptor.usage = usage;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.arrayLayerCount = layerCount;
|
|
||||||
|
|
||||||
return device.CreateTexture(&descriptor);
|
return device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,7 @@ class CopyCommandTest : public ValidationTest {
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayerCount;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = sampleCount;
|
descriptor.sampleCount = sampleCount;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
|
@ -548,7 +547,7 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||||
|
|
||||||
wgpu::TextureDescriptor errorTextureDescriptor;
|
wgpu::TextureDescriptor errorTextureDescriptor;
|
||||||
errorTextureDescriptor.arrayLayerCount = 0;
|
errorTextureDescriptor.size.depth = 0;
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
|
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
|
||||||
|
|
||||||
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
|
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
|
||||||
|
@ -879,7 +878,7 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||||
|
|
||||||
wgpu::TextureDescriptor errorTextureDescriptor;
|
wgpu::TextureDescriptor errorTextureDescriptor;
|
||||||
errorTextureDescriptor.arrayLayerCount = 0;
|
errorTextureDescriptor.size.depth = 0;
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
|
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
|
||||||
|
|
||||||
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
|
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
|
||||||
|
|
|
@ -55,8 +55,7 @@ wgpu::Texture CreateTexture(wgpu::Device& device,
|
||||||
descriptor.dimension = dimension;
|
descriptor.dimension = dimension;
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayerCount;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = sampleCount;
|
descriptor.sampleCount = sampleCount;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
|
|
|
@ -227,7 +227,6 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
||||||
baseTextureDescriptor.size.width = 4;
|
baseTextureDescriptor.size.width = 4;
|
||||||
baseTextureDescriptor.size.height = 4;
|
baseTextureDescriptor.size.height = 4;
|
||||||
baseTextureDescriptor.size.depth = 1;
|
baseTextureDescriptor.size.depth = 1;
|
||||||
baseTextureDescriptor.arrayLayerCount = 1;
|
|
||||||
baseTextureDescriptor.mipLevelCount = 1;
|
baseTextureDescriptor.mipLevelCount = 1;
|
||||||
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
baseTextureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
baseTextureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
||||||
|
|
|
@ -33,7 +33,6 @@ namespace {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size = {1, 1, 1};
|
descriptor.size = {1, 1, 1};
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = usage;
|
descriptor.usage = usage;
|
||||||
|
|
|
@ -89,8 +89,7 @@ class StorageTextureValidationTests : public ValidationTest {
|
||||||
uint32_t arrayLayerCount = 1) {
|
uint32_t arrayLayerCount = 1) {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size = {16, 16, 1};
|
descriptor.size = {16, 16, arrayLayerCount};
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = sampleCount;
|
descriptor.sampleCount = sampleCount;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -28,8 +28,7 @@ namespace {
|
||||||
wgpu::TextureUsage usage) {
|
wgpu::TextureUsage usage) {
|
||||||
wgpu::TextureDescriptor texDesc;
|
wgpu::TextureDescriptor texDesc;
|
||||||
texDesc.dimension = wgpu::TextureDimension::e2D;
|
texDesc.dimension = wgpu::TextureDimension::e2D;
|
||||||
texDesc.size = {kSize, kSize, 1};
|
texDesc.size = {kSize, kSize, arrayLayerCount};
|
||||||
texDesc.arrayLayerCount = arrayLayerCount;
|
|
||||||
texDesc.sampleCount = 1;
|
texDesc.sampleCount = 1;
|
||||||
texDesc.mipLevelCount = mipLevelCount;
|
texDesc.mipLevelCount = mipLevelCount;
|
||||||
texDesc.usage = usage;
|
texDesc.usage = usage;
|
||||||
|
|
|
@ -31,8 +31,7 @@ class TextureValidationTest : public ValidationTest {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.size.width = kWidth;
|
descriptor.size.width = kWidth;
|
||||||
descriptor.size.height = kHeight;
|
descriptor.size.height = kHeight;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = kDefaultDepth;
|
||||||
descriptor.arrayLayerCount = kDefaultArraySize;
|
|
||||||
descriptor.mipLevelCount = kDefaultMipLevels;
|
descriptor.mipLevelCount = kDefaultMipLevels;
|
||||||
descriptor.sampleCount = kDefaultSampleCount;
|
descriptor.sampleCount = kDefaultSampleCount;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
|
@ -46,7 +45,7 @@ class TextureValidationTest : public ValidationTest {
|
||||||
private:
|
private:
|
||||||
static constexpr uint32_t kWidth = 32;
|
static constexpr uint32_t kWidth = 32;
|
||||||
static constexpr uint32_t kHeight = 32;
|
static constexpr uint32_t kHeight = 32;
|
||||||
static constexpr uint32_t kDefaultArraySize = 1;
|
static constexpr uint32_t kDefaultDepth = 1;
|
||||||
static constexpr uint32_t kDefaultMipLevels = 1;
|
static constexpr uint32_t kDefaultMipLevels = 1;
|
||||||
static constexpr uint32_t kDefaultSampleCount = 1;
|
static constexpr uint32_t kDefaultSampleCount = 1;
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ TEST_F(TextureValidationTest, SampleCount) {
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||||
descriptor.sampleCount = 4;
|
descriptor.sampleCount = 4;
|
||||||
descriptor.arrayLayerCount = 2;
|
descriptor.size.depth = 2;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||||
}
|
}
|
||||||
|
@ -204,7 +203,7 @@ TEST_F(TextureValidationTest, ArrayLayerCount) {
|
||||||
// Array layer count exceeding kMaxTexture2DArrayLayers is not allowed
|
// Array layer count exceeding kMaxTexture2DArrayLayers is not allowed
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||||
descriptor.arrayLayerCount = kMaxTexture2DArrayLayers + 1u;
|
descriptor.size.depth = kMaxTexture2DArrayLayers + 1u;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||||
}
|
}
|
||||||
|
@ -212,7 +211,7 @@ TEST_F(TextureValidationTest, ArrayLayerCount) {
|
||||||
// Array layer count less than kMaxTexture2DArrayLayers is allowed;
|
// Array layer count less than kMaxTexture2DArrayLayers is allowed;
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||||
descriptor.arrayLayerCount = kMaxTexture2DArrayLayers >> 1;
|
descriptor.size.depth = kMaxTexture2DArrayLayers >> 1;
|
||||||
|
|
||||||
device.CreateTexture(&descriptor);
|
device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
@ -220,7 +219,7 @@ TEST_F(TextureValidationTest, ArrayLayerCount) {
|
||||||
// Array layer count equal to kMaxTexture2DArrayLayers is allowed;
|
// Array layer count equal to kMaxTexture2DArrayLayers is allowed;
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
wgpu::TextureDescriptor descriptor = defaultDescriptor;
|
||||||
descriptor.arrayLayerCount = kMaxTexture2DArrayLayers;
|
descriptor.size.depth = kMaxTexture2DArrayLayers;
|
||||||
|
|
||||||
device.CreateTexture(&descriptor);
|
device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
@ -487,7 +486,7 @@ TEST_F(CompressedTextureFormatsValidationTests, 2DArrayTexture) {
|
||||||
for (wgpu::TextureFormat format : kBCFormats) {
|
for (wgpu::TextureFormat format : kBCFormats) {
|
||||||
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.arrayLayerCount = 6;
|
descriptor.size.depth = 6;
|
||||||
device.CreateTexture(&descriptor);
|
device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,7 @@ wgpu::Texture Create2DArrayTexture(wgpu::Device& device,
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = arrayLayerCount;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
|
||||||
descriptor.sampleCount = sampleCount;
|
descriptor.sampleCount = sampleCount;
|
||||||
descriptor.format = kDefaultTextureFormat;
|
descriptor.format = kDefaultTextureFormat;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
|
|
|
@ -105,7 +105,6 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device)
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = attachmentFormat;
|
descriptor.format = attachmentFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -49,7 +49,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
defaultDescriptor.size = {1, 1, 1};
|
defaultDescriptor.size = {1, 1, 1};
|
||||||
defaultDescriptor.sampleCount = 1;
|
defaultDescriptor.sampleCount = 1;
|
||||||
defaultDescriptor.arrayLayerCount = 1;
|
|
||||||
defaultDescriptor.mipLevelCount = 1;
|
defaultDescriptor.mipLevelCount = 1;
|
||||||
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
|
@ -204,9 +203,9 @@ namespace dawn_native { namespace vulkan {
|
||||||
close(defaultFd);
|
close(defaultFd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test an error occurs if the descriptor array layer count isn't 1
|
// Test an error occurs if the descriptor depth isn't 1
|
||||||
TEST_P(VulkanImageWrappingValidationTests, InvalidArrayLayerCount) {
|
TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) {
|
||||||
defaultDescriptor.arrayLayerCount = 2;
|
defaultDescriptor.size.depth = 2;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
|
ASSERT_DEVICE_ERROR(wgpu::Texture texture =
|
||||||
WrapVulkanImage(device, &defaultDescriptor, defaultFd,
|
WrapVulkanImage(device, &defaultDescriptor, defaultFd,
|
||||||
|
@ -761,7 +760,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
descriptor.size.width = 640;
|
descriptor.size.width = 640;
|
||||||
descriptor.size.height = 480;
|
descriptor.size.height = 480;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
|
@ -212,7 +212,6 @@ namespace dawn_native { namespace vulkan {
|
||||||
defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
defaultDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
defaultDescriptor.size = {1, 1, 1};
|
defaultDescriptor.size = {1, 1, 1};
|
||||||
defaultDescriptor.sampleCount = 1;
|
defaultDescriptor.sampleCount = 1;
|
||||||
defaultDescriptor.arrayLayerCount = 1;
|
|
||||||
defaultDescriptor.mipLevelCount = 1;
|
defaultDescriptor.mipLevelCount = 1;
|
||||||
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
|
@ -291,10 +290,10 @@ namespace dawn_native { namespace vulkan {
|
||||||
EXPECT_EQ(texture.Get(), nullptr);
|
EXPECT_EQ(texture.Get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test an error occurs if the descriptor array layer count isn't 1
|
// Test an error occurs if the descriptor depth isn't 1
|
||||||
TEST_P(VulkanImageWrappingValidationTests, InvalidArrayLayerCount) {
|
TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
defaultDescriptor.arrayLayerCount = 2;
|
defaultDescriptor.size.depth = 2;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(
|
ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(
|
||||||
device, &defaultDescriptor, defaultFd, defaultAllocationSize,
|
device, &defaultDescriptor, defaultFd, defaultAllocationSize,
|
||||||
|
|
|
@ -252,7 +252,6 @@ namespace utils {
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
descriptor.size.height = height;
|
descriptor.size.height = height;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = BasicRenderPass::kDefaultColorFormat;
|
descriptor.format = BasicRenderPass::kDefaultColorFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
|
|
Loading…
Reference in New Issue