API evolution GPUExtent3D.depth -> depthOrArrayLayers (Step 2) Still leave deprecated `depth` functional as there are some references in other clients. Using `depth` and `depthOrArrayLayers` at the same time is invalid. Add DeprecatedAPITests. Bug: chromium:1176969 Change-Id: Ia06645e4f3c17588323dd36b11f9f3988b2e3aba Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44640 Commit-Queue: Shrek Shao <shrekshao@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/CommandBuffer.cpp b/src/dawn_native/CommandBuffer.cpp index bde0c63..9fd1a99 100644 --- a/src/dawn_native/CommandBuffer.cpp +++ b/src/dawn_native/CommandBuffer.cpp
@@ -77,7 +77,8 @@ const Extent3D& copySize) { switch (copy.texture->GetDimension()) { case wgpu::TextureDimension::e2D: - return {copy.aspect, {copy.origin.z, copySize.depth}, {copy.mipLevel, 1}}; + return { + copy.aspect, {copy.origin.z, copySize.depthOrArrayLayers}, {copy.mipLevel, 1}}; default: UNREACHABLE(); } @@ -181,7 +182,7 @@ } const uint64_t overwrittenRangeSize = - copyTextureDataSizePerRow * heightInBlocks * copy->copySize.depth; + copyTextureDataSizePerRow * heightInBlocks * copy->copySize.depthOrArrayLayers; if (copy->destination.buffer->GetSize() > overwrittenRangeSize) { return false; }
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp index 9c85531f..00e6255 100644 --- a/src/dawn_native/CommandEncoder.cpp +++ b/src/dawn_native/CommandEncoder.cpp
@@ -626,11 +626,14 @@ const ImageCopyTexture* destination, const Extent3D* copySize) { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { + Extent3D fixedCopySize = *copySize; + DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize)); + if (GetDevice()->IsValidationEnabled()) { DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *source)); DAWN_TRY(ValidateCanUseAs(source->buffer, wgpu::BufferUsage::CopySrc)); - DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize)); + DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, fixedCopySize)); DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst)); DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(destination->texture)); @@ -639,25 +642,26 @@ // because in the latter we divide copyExtent.width by blockWidth and // copyExtent.height by blockHeight while the divisibility conditions are // checked in validating texture copy range. - DAWN_TRY(ValidateTextureCopyRange(*destination, *copySize)); + DAWN_TRY(ValidateTextureCopyRange(*destination, fixedCopySize)); } const TexelBlockInfo& blockInfo = destination->texture->GetFormat().GetAspectInfo(destination->aspect).block; TextureDataLayout srcLayout = FixUpDeprecatedTextureDataLayoutOptions( - GetDevice(), source->layout, blockInfo, *copySize); + GetDevice(), source->layout, blockInfo, fixedCopySize); if (GetDevice()->IsValidationEnabled()) { DAWN_TRY(ValidateLinearTextureCopyOffset(srcLayout, blockInfo)); DAWN_TRY(ValidateLinearTextureData(srcLayout, source->buffer->GetSize(), blockInfo, - *copySize)); + fixedCopySize)); mTopLevelBuffers.insert(source->buffer); mTopLevelTextures.insert(destination->texture); } - ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, *copySize); + ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, fixedCopySize); // Skip noop copies. - if (copySize->width != 0 && copySize->height != 0 && copySize->depth != 0) { + if (fixedCopySize.width != 0 && fixedCopySize.height != 0 && + fixedCopySize.depthOrArrayLayers != 0) { // Record the copy command. CopyBufferToTextureCmd* copy = allocator->Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture); @@ -670,7 +674,7 @@ copy->destination.mipLevel = destination->mipLevel; copy->destination.aspect = ConvertAspect(destination->texture->GetFormat(), destination->aspect); - copy->copySize = *copySize; + copy->copySize = fixedCopySize; } return {}; @@ -681,8 +685,11 @@ const ImageCopyBuffer* destination, const Extent3D* copySize) { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { + Extent3D fixedCopySize = *copySize; + DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize)); + if (GetDevice()->IsValidationEnabled()) { - DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize)); + DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, fixedCopySize)); DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc)); DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(source->texture)); DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source)); @@ -694,25 +701,26 @@ // because in the latter we divide copyExtent.width by blockWidth and // copyExtent.height by blockHeight while the divisibility conditions are // checked in validating texture copy range. - DAWN_TRY(ValidateTextureCopyRange(*source, *copySize)); + DAWN_TRY(ValidateTextureCopyRange(*source, fixedCopySize)); } const TexelBlockInfo& blockInfo = source->texture->GetFormat().GetAspectInfo(source->aspect).block; TextureDataLayout dstLayout = FixUpDeprecatedTextureDataLayoutOptions( - GetDevice(), destination->layout, blockInfo, *copySize); + GetDevice(), destination->layout, blockInfo, fixedCopySize); if (GetDevice()->IsValidationEnabled()) { DAWN_TRY(ValidateLinearTextureCopyOffset(dstLayout, blockInfo)); DAWN_TRY(ValidateLinearTextureData(dstLayout, destination->buffer->GetSize(), - blockInfo, *copySize)); + blockInfo, fixedCopySize)); mTopLevelTextures.insert(source->texture); mTopLevelBuffers.insert(destination->buffer); } - ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, *copySize); + ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, fixedCopySize); // Skip noop copies. - if (copySize->width != 0 && copySize->height != 0 && copySize->depth != 0) { + if (fixedCopySize.width != 0 && fixedCopySize.height != 0 && + fixedCopySize.depthOrArrayLayers != 0) { // Record the copy command. CopyTextureToBufferCmd* copy = allocator->Allocate<CopyTextureToBufferCmd>(Command::CopyTextureToBuffer); @@ -724,7 +732,7 @@ copy->destination.offset = dstLayout.offset; copy->destination.bytesPerRow = dstLayout.bytesPerRow; copy->destination.rowsPerImage = dstLayout.rowsPerImage; - copy->copySize = *copySize; + copy->copySize = fixedCopySize; } return {}; @@ -735,18 +743,20 @@ const ImageCopyTexture* destination, const Extent3D* copySize) { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { + Extent3D fixedCopySize = *copySize; + DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize)); if (GetDevice()->IsValidationEnabled()) { DAWN_TRY(GetDevice()->ValidateObject(source->texture)); DAWN_TRY(GetDevice()->ValidateObject(destination->texture)); - DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize)); - DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize)); + DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, fixedCopySize)); + DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, fixedCopySize)); DAWN_TRY( - ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize)); + ValidateTextureToTextureCopyRestrictions(*source, *destination, fixedCopySize)); - DAWN_TRY(ValidateTextureCopyRange(*source, *copySize)); - DAWN_TRY(ValidateTextureCopyRange(*destination, *copySize)); + DAWN_TRY(ValidateTextureCopyRange(*source, fixedCopySize)); + DAWN_TRY(ValidateTextureCopyRange(*destination, fixedCopySize)); DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc)); DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst)); @@ -756,7 +766,8 @@ } // Skip noop copies. - if (copySize->width != 0 && copySize->height != 0 && copySize->depth != 0) { + if (fixedCopySize.width != 0 && fixedCopySize.height != 0 && + fixedCopySize.depthOrArrayLayers != 0) { CopyTextureToTextureCmd* copy = allocator->Allocate<CopyTextureToTextureCmd>(Command::CopyTextureToTexture); copy->source.texture = source->texture; @@ -768,7 +779,7 @@ copy->destination.mipLevel = destination->mipLevel; copy->destination.aspect = ConvertAspect(destination->texture->GetFormat(), destination->aspect); - copy->copySize = *copySize; + copy->copySize = fixedCopySize; } return {};
diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp index e8e2b2e..e4ad9e2 100644 --- a/src/dawn_native/CommandValidation.cpp +++ b/src/dawn_native/CommandValidation.cpp
@@ -103,7 +103,7 @@ uint32_t heightInBlocks = copySize.height / blockInfo.height; uint64_t bytesInLastRow = Safe32x32(widthInBlocks, blockInfo.byteSize); - if (copySize.depth == 0) { + if (copySize.depthOrArrayLayers == 0) { return 0; } @@ -122,14 +122,14 @@ // // This means that if the computation of depth * bytesPerImage doesn't overflow, none of the // computations for requiredBytesInCopy will. (and it's not a very pessimizing check) - ASSERT(copySize.depth <= 1 || (bytesPerRow != wgpu::kCopyStrideUndefined && - rowsPerImage != wgpu::kCopyStrideUndefined)); + ASSERT(copySize.depthOrArrayLayers <= 1 || (bytesPerRow != wgpu::kCopyStrideUndefined && + rowsPerImage != wgpu::kCopyStrideUndefined)); uint64_t bytesPerImage = Safe32x32(bytesPerRow, rowsPerImage); - if (bytesPerImage > std::numeric_limits<uint64_t>::max() / copySize.depth) { + if (bytesPerImage > std::numeric_limits<uint64_t>::max() / copySize.depthOrArrayLayers) { return DAWN_VALIDATION_ERROR("requiredBytesInCopy is too large."); } - uint64_t requiredBytesInCopy = bytesPerImage * (copySize.depth - 1); + uint64_t requiredBytesInCopy = bytesPerImage * (copySize.depthOrArrayLayers - 1); if (heightInBlocks > 0) { ASSERT(heightInBlocks <= 1 || bytesPerRow != wgpu::kCopyStrideUndefined); uint64_t bytesInLastImage = Safe32x32(bytesPerRow, heightInBlocks - 1) + bytesInLastRow; @@ -159,14 +159,14 @@ TextureDataLayout layout = originalLayout; if (copyExtent.height != 0 && layout.rowsPerImage == 0) { - if (copyExtent.depth > 1) { + if (copyExtent.depthOrArrayLayers > 1) { device->EmitDeprecationWarning( "rowsPerImage soon must be non-zero if copy depth > 1 (it will no longer " "default to the copy height)."); ASSERT(copyExtent.height % blockInfo.height == 0); uint32_t heightInBlocks = copyExtent.height / blockInfo.height; layout.rowsPerImage = heightInBlocks; - } else if (copyExtent.depth == 1) { + } else if (copyExtent.depthOrArrayLayers == 1) { device->EmitDeprecationWarning( "rowsPerImage soon must be non-zero or unspecified if copy depth == 1 (it will " "no longer default to the copy height)."); @@ -179,7 +179,7 @@ ASSERT(copyExtent.width % blockInfo.width == 0); uint32_t widthInBlocks = copyExtent.width / blockInfo.width; uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize; - if (copyExtent.height == 1 && copyExtent.depth == 1 && + if (copyExtent.height == 1 && copyExtent.depthOrArrayLayers == 1 && bytesInLastRow > layout.bytesPerRow) { device->EmitDeprecationWarning( "Soon, even if copy height == 1, bytesPerRow must be >= the byte size of each row " @@ -203,11 +203,11 @@ uint32_t widthInBlocks = copyExtent.width / blockInfo.width; uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize; - ASSERT(heightInBlocks <= 1 && copyExtent.depth <= 1); + ASSERT(heightInBlocks <= 1 && copyExtent.depthOrArrayLayers <= 1); layout->bytesPerRow = Align(bytesInLastRow, kTextureBytesPerRowAlignment); } if (layout->rowsPerImage == wgpu::kCopyStrideUndefined) { - ASSERT(copyExtent.depth <= 1); + ASSERT(copyExtent.depthOrArrayLayers <= 1); layout->rowsPerImage = heightInBlocks; } } @@ -219,8 +219,9 @@ ASSERT(copyExtent.height % blockInfo.height == 0); uint32_t heightInBlocks = copyExtent.height / blockInfo.height; - if (copyExtent.depth > 1 && (layout.bytesPerRow == wgpu::kCopyStrideUndefined || - layout.rowsPerImage == wgpu::kCopyStrideUndefined)) { + if (copyExtent.depthOrArrayLayers > 1 && + (layout.bytesPerRow == wgpu::kCopyStrideUndefined || + layout.rowsPerImage == wgpu::kCopyStrideUndefined)) { return DAWN_VALIDATION_ERROR( "If copy depth > 1, bytesPerRow and rowsPerImage must be specified."); } @@ -316,7 +317,7 @@ // For 2D textures, include the array layer as depth so it can be checked with other // dimensions. ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D); - mipSize.depth = texture->GetArrayLayers(); + mipSize.depthOrArrayLayers = texture->GetArrayLayers(); // All texture dimensions are in uint32_t so by doing checks in uint64_t we avoid // overflows. @@ -324,8 +325,9 @@ static_cast<uint64_t>(mipSize.width) || static_cast<uint64_t>(textureCopy.origin.y) + static_cast<uint64_t>(copySize.height) > static_cast<uint64_t>(mipSize.height) || - static_cast<uint64_t>(textureCopy.origin.z) + static_cast<uint64_t>(copySize.depth) > - static_cast<uint64_t>(mipSize.depth)) { + static_cast<uint64_t>(textureCopy.origin.z) + + static_cast<uint64_t>(copySize.depthOrArrayLayers) > + static_cast<uint64_t>(mipSize.depthOrArrayLayers)) { return DAWN_VALIDATION_ERROR("Touching outside of the texture"); } @@ -422,7 +424,7 @@ if (src.texture == dst.texture && src.mipLevel == dst.mipLevel) { ASSERT(src.texture->GetDimension() == wgpu::TextureDimension::e2D && dst.texture->GetDimension() == wgpu::TextureDimension::e2D); - if (IsRangeOverlapped(src.origin.z, dst.origin.z, copySize.depth)) { + if (IsRangeOverlapped(src.origin.z, dst.origin.z, copySize.depthOrArrayLayers)) { return DAWN_VALIDATION_ERROR( "Copy subresources cannot be overlapped when copying within the same " "texture.");
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index 6e082dd..cf65c42 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp
@@ -1247,10 +1247,12 @@ ResultOrError<Ref<TextureBase>> DeviceBase::CreateTextureInternal( const TextureDescriptor* descriptor) { DAWN_TRY(ValidateIsAlive()); + TextureDescriptor fixedDescriptor = *descriptor; + DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(this, &(fixedDescriptor.size))); if (IsValidationEnabled()) { - DAWN_TRY(ValidateTextureDescriptor(this, descriptor)); + DAWN_TRY(ValidateTextureDescriptor(this, &fixedDescriptor)); } - return CreateTextureImpl(descriptor); + return CreateTextureImpl(&fixedDescriptor); } MaybeError DeviceBase::CreateTextureViewInternal(TextureViewBase** result,
diff --git a/src/dawn_native/Queue.cpp b/src/dawn_native/Queue.cpp index e3e9141..d5fa05a 100644 --- a/src/dawn_native/Queue.cpp +++ b/src/dawn_native/Queue.cpp
@@ -115,9 +115,9 @@ uint64_t imageAdditionalStride = dataLayout.bytesPerRow * (dataRowsPerImage - alignedRowsPerImage); - CopyTextureData(dstPointer, srcPointer, writeSizePixel.depth, alignedRowsPerImage, - imageAdditionalStride, alignedBytesPerRow, optimallyAlignedBytesPerRow, - dataLayout.bytesPerRow); + CopyTextureData(dstPointer, srcPointer, writeSizePixel.depthOrArrayLayers, + alignedRowsPerImage, imageAdditionalStride, alignedBytesPerRow, + optimallyAlignedBytesPerRow, dataLayout.bytesPerRow); return uploadHandle; } @@ -305,17 +305,21 @@ size_t dataSize, const TextureDataLayout* dataLayout, const Extent3D* writeSize) { - DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, writeSize)); + Extent3D fixedWriteSize = *writeSize; + DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedWriteSize)); - if (writeSize->width == 0 || writeSize->height == 0 || writeSize->depth == 0) { + DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, &fixedWriteSize)); + + if (fixedWriteSize.width == 0 || fixedWriteSize.height == 0 || + fixedWriteSize.depthOrArrayLayers == 0) { return {}; } const TexelBlockInfo& blockInfo = destination->texture->GetFormat().GetAspectInfo(destination->aspect).block; TextureDataLayout layout = *dataLayout; - ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, *writeSize); - return WriteTextureImpl(*destination, data, layout, *writeSize); + ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, fixedWriteSize); + return WriteTextureImpl(*destination, data, layout, fixedWriteSize); } MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination, @@ -375,12 +379,14 @@ const ImageCopyTexture* destination, const Extent3D* copySize, const CopyTextureForBrowserOptions* options) { + Extent3D fixedCopySize = *copySize; + DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedCopySize)); if (GetDevice()->IsValidationEnabled()) { - DAWN_TRY( - ValidateCopyTextureForBrowser(GetDevice(), source, destination, copySize, options)); + DAWN_TRY(ValidateCopyTextureForBrowser(GetDevice(), source, destination, &fixedCopySize, + options)); } - return DoCopyTextureForBrowser(GetDevice(), source, destination, copySize, options); + return DoCopyTextureForBrowser(GetDevice(), source, destination, &fixedCopySize, options); } MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,
diff --git a/src/dawn_native/SwapChain.cpp b/src/dawn_native/SwapChain.cpp index 84f5a56..96ef193 100644 --- a/src/dawn_native/SwapChain.cpp +++ b/src/dawn_native/SwapChain.cpp
@@ -180,7 +180,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = mWidth; descriptor.size.height = mHeight; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = mFormat; descriptor.mipLevelCount = 1;
diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index 21ae34b..8679e95 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp
@@ -118,7 +118,7 @@ // Multisampled 2D array texture is not supported because on Metal it requires the // version of macOS be greater than 10.14. if (descriptor->dimension != wgpu::TextureDimension::e2D || - descriptor->size.depth > 1) { + descriptor->size.depthOrArrayLayers > 1) { return DAWN_VALIDATION_ERROR("Multisampled texture must be 2D with depth=1"); } @@ -164,7 +164,7 @@ MaybeError ValidateTextureSize(const TextureDescriptor* descriptor, const Format* format) { ASSERT(descriptor->size.width != 0 && descriptor->size.height != 0 && - descriptor->size.depth != 0); + descriptor->size.depthOrArrayLayers != 0); Extent3D maxExtent; switch (descriptor->dimension) { @@ -182,7 +182,7 @@ } if (descriptor->size.width > maxExtent.width || descriptor->size.height > maxExtent.height || - descriptor->size.depth > maxExtent.depth) { + descriptor->size.depthOrArrayLayers > maxExtent.depthOrArrayLayers) { return DAWN_VALIDATION_ERROR("Texture dimension (width, height or depth) exceeded"); } @@ -191,7 +191,8 @@ maxMippedDimension = std::max(maxMippedDimension, descriptor->size.height); } if (descriptor->dimension == wgpu::TextureDimension::e3D) { - maxMippedDimension = std::max(maxMippedDimension, descriptor->size.depth); + maxMippedDimension = + std::max(maxMippedDimension, descriptor->size.depthOrArrayLayers); } if (Log2(maxMippedDimension) + 1 < descriptor->mipLevelCount) { return DAWN_VALIDATION_ERROR("Texture has too many mip levels"); @@ -243,6 +244,26 @@ } // anonymous namespace + MaybeError FixUpDeprecatedGPUExtent3DDepth(DeviceBase* device, Extent3D* extent) { + if (extent->depth != 1) { + // deprecated depth is assigned + if (extent->depthOrArrayLayers != 1) { + // both deprecated and updated API is used + return DAWN_VALIDATION_ERROR( + "Deprecated GPUExtent3D.depth and updated GPUExtent3D.depthOrArrayLengths are " + "both assigned."); + } + + extent->depthOrArrayLayers = extent->depth; + + device->EmitDeprecationWarning( + "GPUExtent3D.depth is deprecated. Please use GPUExtent3D.depthOrArrayLayers " + "instead."); + } + + return {}; + } + MaybeError ValidateTextureDescriptor(const DeviceBase* device, const TextureDescriptor* descriptor) { if (descriptor == nullptr) { @@ -264,7 +285,7 @@ // TODO(jiawei.shao@intel.com): check stuff based on the dimension if (descriptor->size.width == 0 || descriptor->size.height == 0 || - descriptor->size.depth == 0 || descriptor->mipLevelCount == 0) { + descriptor->size.depthOrArrayLayers == 0 || descriptor->mipLevelCount == 0) { return DAWN_VALIDATION_ERROR("Cannot create an empty texture"); } @@ -399,7 +420,8 @@ mSampleCount(descriptor->sampleCount), mUsage(descriptor->usage), mState(state) { - uint32_t subresourceCount = mMipLevelCount * mSize.depth * GetAspectCount(mFormat.aspects); + uint32_t subresourceCount = + mMipLevelCount * mSize.depthOrArrayLayers * GetAspectCount(mFormat.aspects); mIsSubresourceContentInitializedAtIndex = std::vector<bool>(subresourceCount, false); // Add readonly storage usage if the texture has a storage usage. The validation rules in @@ -446,7 +468,7 @@ uint32_t TextureBase::GetDepth() const { ASSERT(!IsError()); ASSERT(mDimension == wgpu::TextureDimension::e3D); - return mSize.depth; + return mSize.depthOrArrayLayers; } uint32_t TextureBase::GetArrayLayers() const { ASSERT(!IsError()); @@ -455,7 +477,7 @@ if (mDimension == wgpu::TextureDimension::e3D) { return 1; } - return mSize.depth; + return mSize.depthOrArrayLayers; } uint32_t TextureBase::GetNumMipLevels() const { ASSERT(!IsError()); @@ -554,7 +576,7 @@ return extent; } - extent.depth = std::max(mSize.depth >> level, 1u); + extent.depthOrArrayLayers = std::max(mSize.depthOrArrayLayers >> level, 1u); return extent; } @@ -584,7 +606,7 @@ uint32_t clampedCopyExtentHeight = (origin.y + extent.height > virtualSizeAtLevel.height) ? (virtualSizeAtLevel.height - origin.y) : extent.height; - return {clampedCopyExtentWidth, clampedCopyExtentHeight, extent.depth}; + return {clampedCopyExtentWidth, clampedCopyExtentHeight, extent.depthOrArrayLayers}; } TextureViewBase* TextureBase::CreateView(const TextureViewDescriptor* descriptor) {
diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h index 52cfa06..108e11b 100644 --- a/src/dawn_native/Texture.h +++ b/src/dawn_native/Texture.h
@@ -38,6 +38,8 @@ bool IsValidSampleCount(uint32_t sampleCount); + MaybeError FixUpDeprecatedGPUExtent3DDepth(DeviceBase* device, Extent3D* extent); + static constexpr wgpu::TextureUsage kReadOnlyTextureUsages = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture;
diff --git a/src/dawn_native/d3d12/CommandBufferD3D12.cpp b/src/dawn_native/d3d12/CommandBufferD3D12.cpp index 0d8d83a..020d0c6 100644 --- a/src/dawn_native/d3d12/CommandBufferD3D12.cpp +++ b/src/dawn_native/d3d12/CommandBufferD3D12.cpp
@@ -81,8 +81,8 @@ copySize.width == srcSize.width && // copySize.height == dstSize.height && // copySize.height == srcSize.height && // - copySize.depth == dstSize.depth && // - copySize.depth == srcSize.depth; + copySize.depthOrArrayLayers == dstSize.depthOrArrayLayers && // + copySize.depthOrArrayLayers == srcSize.depthOrArrayLayers; } void RecordCopyTextureToBufferFromTextureCopySplit(ID3D12GraphicsCommandList* commandList, @@ -143,7 +143,7 @@ // that uses copySplits.copies2D[1]. std::array<uint64_t, TextureCopySplits::kMaxTextureCopySplits> bufferOffsetsForNextSlice = {{0u, 0u}}; - for (uint32_t copySlice = 0; copySlice < copySize.depth; ++copySlice) { + for (uint32_t copySlice = 0; copySlice < copySize.depthOrArrayLayers; ++copySlice) { const uint32_t splitIndex = copySlice % copySplits.copies2D.size(); const Texture2DCopySplit& copySplitPerLayerBase = copySplits.copies2D[splitIndex]; @@ -882,7 +882,7 @@ // it is not allowed to copy with overlapped subresources, but we still // add the ASSERT here as a reminder for this possible misuse. ASSERT(!IsRangeOverlapped(copy->source.origin.z, copy->destination.origin.z, - copy->copySize.depth)); + copy->copySize.depthOrArrayLayers)); } source->TrackUsageAndTransitionNow(commandContext, wgpu::TextureUsage::CopySrc, srcRange); @@ -908,7 +908,8 @@ copy->copySize.width, copy->copySize.height, 1u}; for (Aspect aspect : IterateEnumMask(srcRange.aspects)) { - for (uint32_t slice = 0; slice < copy->copySize.depth; ++slice) { + for (uint32_t slice = 0; slice < copy->copySize.depthOrArrayLayers; + ++slice) { D3D12_TEXTURE_COPY_LOCATION srcLocation = ComputeTextureCopyLocationForTexture( source, copy->source.mipLevel,
diff --git a/src/dawn_native/d3d12/D3D12Backend.cpp b/src/dawn_native/d3d12/D3D12Backend.cpp index 22d13dd..3975698 100644 --- a/src/dawn_native/d3d12/D3D12Backend.cpp +++ b/src/dawn_native/d3d12/D3D12Backend.cpp
@@ -79,7 +79,7 @@ TextureDescriptor textureDescriptor = {}; textureDescriptor.usage = static_cast<wgpu::TextureUsage>(descriptor->usage); textureDescriptor.dimension = static_cast<wgpu::TextureDimension>(mDimension); - textureDescriptor.size = {mSize.width, mSize.height, mSize.depth}; + textureDescriptor.size = {mSize.width, mSize.height, mSize.depthOrArrayLayers}; textureDescriptor.format = static_cast<wgpu::TextureFormat>(mFormat); textureDescriptor.mipLevelCount = mMipLevelCount; textureDescriptor.sampleCount = mSampleCount;
diff --git a/src/dawn_native/d3d12/TextureCopySplitter.cpp b/src/dawn_native/d3d12/TextureCopySplitter.cpp index e8cfae2..d75257e 100644 --- a/src/dawn_native/d3d12/TextureCopySplitter.cpp +++ b/src/dawn_native/d3d12/TextureCopySplitter.cpp
@@ -131,7 +131,7 @@ copy.copies[0].bufferOffset = texelOffset; copy.copies[0].bufferSize.width = copySize.width + texelOffset.x; copy.copies[0].bufferSize.height = rowsPerImageInTexels + texelOffset.y; - copy.copies[0].bufferSize.depth = copySize.depth; + copy.copies[0].bufferSize.depthOrArrayLayers = copySize.depthOrArrayLayers; return copy; } @@ -178,12 +178,12 @@ uint32_t texelsPerRow = bytesPerRow / blockInfo.byteSize * blockInfo.width; copy.copies[0].copySize.width = texelsPerRow - texelOffset.x; copy.copies[0].copySize.height = copySize.height; - copy.copies[0].copySize.depth = copySize.depth; + copy.copies[0].copySize.depthOrArrayLayers = copySize.depthOrArrayLayers; copy.copies[0].bufferOffset = texelOffset; copy.copies[0].bufferSize.width = texelsPerRow; copy.copies[0].bufferSize.height = rowsPerImageInTexels + texelOffset.y; - copy.copies[0].bufferSize.depth = copySize.depth; + copy.copies[0].bufferSize.depthOrArrayLayers = copySize.depthOrArrayLayers; copy.copies[1].textureOffset.x = origin.x + copy.copies[0].copySize.width; copy.copies[1].textureOffset.y = origin.y; @@ -192,14 +192,14 @@ ASSERT(copySize.width > copy.copies[0].copySize.width); copy.copies[1].copySize.width = copySize.width - copy.copies[0].copySize.width; copy.copies[1].copySize.height = copySize.height; - copy.copies[1].copySize.depth = copySize.depth; + copy.copies[1].copySize.depthOrArrayLayers = copySize.depthOrArrayLayers; copy.copies[1].bufferOffset.x = 0; copy.copies[1].bufferOffset.y = texelOffset.y + blockInfo.height; copy.copies[1].bufferOffset.z = 0; copy.copies[1].bufferSize.width = copy.copies[1].copySize.width; copy.copies[1].bufferSize.height = rowsPerImageInTexels + texelOffset.y + blockInfo.height; - copy.copies[1].bufferSize.depth = copySize.depth; + copy.copies[1].bufferSize.depthOrArrayLayers = copySize.depthOrArrayLayers; return copy; } @@ -233,7 +233,7 @@ // When the copy only refers one texture 2D array layer copies.copies2D[1] will never be // used so we can safely early return here. - if (copySize.depth == 1) { + if (copySize.depthOrArrayLayers == 1) { return copies; }
diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp index 6b90c0a..ba70e43 100644 --- a/src/dawn_native/d3d12/TextureD3D12.cpp +++ b/src/dawn_native/d3d12/TextureD3D12.cpp
@@ -344,7 +344,7 @@ return DAWN_VALIDATION_ERROR("Mip level count must be 1"); } - if (descriptor->size.depth != 1) { + if (descriptor->size.depthOrArrayLayers != 1) { return DAWN_VALIDATION_ERROR("Depth must be 1"); } @@ -360,7 +360,7 @@ const D3D12_RESOURCE_DESC d3dDescriptor = d3d12Resource->GetDesc(); if ((dawnDescriptor->size.width != d3dDescriptor.Width) || (dawnDescriptor->size.height != d3dDescriptor.Height) || - (dawnDescriptor->size.depth != 1)) { + (dawnDescriptor->size.depthOrArrayLayers != 1)) { return DAWN_VALIDATION_ERROR("D3D12 texture size doesn't match descriptor"); } @@ -485,7 +485,7 @@ const Extent3D& size = GetSize(); resourceDescriptor.Width = size.width; resourceDescriptor.Height = size.height; - resourceDescriptor.DepthOrArraySize = size.depth; + resourceDescriptor.DepthOrArraySize = size.depthOrArrayLayers; // This will need to be much more nuanced when WebGPU has // texture view compatibility rules.
diff --git a/src/dawn_native/d3d12/UtilsD3D12.cpp b/src/dawn_native/d3d12/UtilsD3D12.cpp index 7f6d08f..7f3df52 100644 --- a/src/dawn_native/d3d12/UtilsD3D12.cpp +++ b/src/dawn_native/d3d12/UtilsD3D12.cpp
@@ -93,7 +93,7 @@ texture->GetD3D12CopyableSubresourceFormat(aspect); bufferLocation.PlacedFootprint.Footprint.Width = bufferSize.width; bufferLocation.PlacedFootprint.Footprint.Height = bufferSize.height; - bufferLocation.PlacedFootprint.Footprint.Depth = bufferSize.depth; + bufferLocation.PlacedFootprint.Footprint.Depth = bufferSize.depthOrArrayLayers; bufferLocation.PlacedFootprint.Footprint.RowPitch = rowPitch; return bufferLocation; } @@ -105,7 +105,7 @@ sourceRegion.front = offset.z; sourceRegion.right = offset.x + copySize.width; sourceRegion.bottom = offset.y + copySize.height; - sourceRegion.back = offset.z + copySize.depth; + sourceRegion.back = offset.z + copySize.depthOrArrayLayers; return sourceRegion; } @@ -201,7 +201,7 @@ std::array<uint64_t, TextureCopySplits::kMaxTextureCopySplits> bufferOffsetsForNextSlice = { {0u, 0u}}; - for (uint32_t copySlice = 0; copySlice < copySize.depth; ++copySlice) { + for (uint32_t copySlice = 0; copySlice < copySize.depthOrArrayLayers; ++copySlice) { const uint32_t splitIndex = copySlice % copySplits.copies2D.size(); const Texture2DCopySplit& copySplitPerLayerBase = copySplits.copies2D[splitIndex];
diff --git a/src/dawn_native/metal/CommandBufferMTL.mm b/src/dawn_native/metal/CommandBufferMTL.mm index 58b85fb..a8794d7 100644 --- a/src/dawn_native/metal/CommandBufferMTL.mm +++ b/src/dawn_native/metal/CommandBufferMTL.mm
@@ -638,7 +638,7 @@ const TextureBufferCopySplit::CopyInfo& copyInfo = splitCopies.copies[i]; const uint32_t copyBaseLayer = copyInfo.textureOrigin.z; - const uint32_t copyLayerCount = copyInfo.copyExtent.depth; + const uint32_t copyLayerCount = copyInfo.copyExtent.depthOrArrayLayers; const MTLOrigin textureOrigin = MTLOriginMake(copyInfo.textureOrigin.x, copyInfo.textureOrigin.y, 0); const MTLSize copyExtent = @@ -688,7 +688,7 @@ const TextureBufferCopySplit::CopyInfo& copyInfo = splitCopies.copies[i]; const uint32_t copyBaseLayer = copyInfo.textureOrigin.z; - const uint32_t copyLayerCount = copyInfo.copyExtent.depth; + const uint32_t copyLayerCount = copyInfo.copyExtent.depthOrArrayLayers; const MTLOrigin textureOrigin = MTLOriginMake(copyInfo.textureOrigin.x, copyInfo.textureOrigin.y, 0); const MTLSize copyExtent = @@ -738,7 +738,7 @@ const MTLOrigin destinationOriginNoLayer = MTLOriginMake(copy->destination.origin.x, copy->destination.origin.y, 0); - for (uint32_t slice = 0; slice < copy->copySize.depth; ++slice) { + for (uint32_t slice = 0; slice < copy->copySize.depthOrArrayLayers; ++slice) { [commandContext->EnsureBlit() copyFromTexture:srcTexture->GetMTLTexture() sourceSlice:copy->source.origin.z + slice
diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm index e570639..6dcf97d 100644 --- a/src/dawn_native/metal/DeviceMTL.mm +++ b/src/dawn_native/metal/DeviceMTL.mm
@@ -313,7 +313,7 @@ const Extent3D clampedSize = texture->ClampToMipLevelVirtualSize(dst->mipLevel, dst->origin, copySizePixels); const uint32_t copyBaseLayer = dst->origin.z; - const uint32_t copyLayerCount = copySizePixels.depth; + const uint32_t copyLayerCount = copySizePixels.depthOrArrayLayers; const uint64_t bytesPerImage = dataLayout.rowsPerImage * dataLayout.bytesPerRow; MTLBlitOption blitOption = ComputeMTLBlitOption(texture->GetFormat(), dst->aspect);
diff --git a/src/dawn_native/metal/TextureMTL.mm b/src/dawn_native/metal/TextureMTL.mm index d10c675..4918174 100644 --- a/src/dawn_native/metal/TextureMTL.mm +++ b/src/dawn_native/metal/TextureMTL.mm
@@ -275,7 +275,7 @@ return DAWN_VALIDATION_ERROR("IOSurface mip level count must be 1"); } - if (descriptor->size.depth != 1) { + if (descriptor->size.depthOrArrayLayers != 1) { return DAWN_VALIDATION_ERROR("IOSurface array layer count must be 1"); } @@ -285,7 +285,7 @@ if (descriptor->size.width != IOSurfaceGetWidthOfPlane(ioSurface, plane) || descriptor->size.height != IOSurfaceGetHeightOfPlane(ioSurface, plane) || - descriptor->size.depth != 1) { + descriptor->size.depthOrArrayLayers != 1) { return DAWN_VALIDATION_ERROR("IOSurface size doesn't match descriptor"); } @@ -317,7 +317,7 @@ // Choose the correct MTLTextureType and paper over differences in how the array layer count // is specified. - mtlDesc.depth = descriptor->size.depth; + mtlDesc.depth = descriptor->size.depthOrArrayLayers; mtlDesc.arrayLength = 1; switch (descriptor->dimension) { case wgpu::TextureDimension::e2D: @@ -532,8 +532,8 @@ (largestMipSize.height / blockInfo.height), 512llu); - // TODO(enga): Multiply by largestMipSize.depth and do a larger 3D copy to clear a whole - // range of subresources when tracking that is improved. + // TODO(enga): Multiply by largestMipSize.depthOrArrayLayers and do a larger 3D copy to + // clear a whole range of subresources when tracking that is improved. uint64_t bufferSize = largestMipBytesPerImage * 1; if (bufferSize > std::numeric_limits<NSUInteger>::max()) {
diff --git a/src/dawn_native/metal/UtilsMetal.mm b/src/dawn_native/metal/UtilsMetal.mm index 953deb9..bc41ec5 100644 --- a/src/dawn_native/metal/UtilsMetal.mm +++ b/src/dawn_native/metal/UtilsMetal.mm
@@ -60,9 +60,9 @@ // compute the correct range when checking if the buffer is big enough to contain the // data for the whole copy. Instead of looking at the position of the last texel in the // buffer, it computes the volume of the 3D box with bytesPerRow * (rowsPerImage / - // format.blockHeight) * copySize.depth. For example considering the pixel buffer below - // where in memory, each row data (D) of the texture is followed by some padding data - // (P): + // format.blockHeight) * copySize.depthOrArrayLayers. For example considering the pixel + // buffer below where in memory, each row data (D) of the texture is followed by some + // padding data (P): // |DDDDDDD|PP| // |DDDDDDD|PP| // |DDDDDDD|PP| @@ -85,7 +85,8 @@ ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D); // Check whether buffer size is big enough. - bool needWorkaround = bufferSize - bufferOffset < bytesPerImage * copyExtent.depth; + bool needWorkaround = + bufferSize - bufferOffset < bytesPerImage * copyExtent.depthOrArrayLayers; if (!needWorkaround) { copy.count = 1; copy.copies[0].bufferOffset = bufferOffset; @@ -93,25 +94,25 @@ copy.copies[0].bytesPerImage = bytesPerImage; copy.copies[0].textureOrigin = origin; copy.copies[0].copyExtent = {clampedCopyExtent.width, clampedCopyExtent.height, - copyExtent.depth}; + copyExtent.depthOrArrayLayers}; return copy; } uint64_t currentOffset = bufferOffset; // Doing all the copy except the last image. - if (copyExtent.depth > 1) { + if (copyExtent.depthOrArrayLayers > 1) { copy.copies[copy.count].bufferOffset = currentOffset; copy.copies[copy.count].bytesPerRow = bytesPerRow; copy.copies[copy.count].bytesPerImage = bytesPerImage; copy.copies[copy.count].textureOrigin = origin; copy.copies[copy.count].copyExtent = {clampedCopyExtent.width, clampedCopyExtent.height, - copyExtent.depth - 1}; + copyExtent.depthOrArrayLayers - 1}; ++copy.count; // Update offset to copy to the last image. - currentOffset += (copyExtent.depth - 1) * bytesPerImage; + currentOffset += (copyExtent.depthOrArrayLayers - 1) * bytesPerImage; } // Doing all the copy in last image except the last row. @@ -121,7 +122,7 @@ copy.copies[copy.count].bytesPerRow = bytesPerRow; copy.copies[copy.count].bytesPerImage = bytesPerRow * (copyBlockRowCount - 1); copy.copies[copy.count].textureOrigin = {origin.x, origin.y, - origin.z + copyExtent.depth - 1}; + origin.z + copyExtent.depthOrArrayLayers - 1}; ASSERT(copyExtent.height - blockInfo.height < texture->GetMipLevelVirtualSize(mipLevel).height); @@ -146,7 +147,7 @@ copy.copies[copy.count].bytesPerImage = lastRowDataSize; copy.copies[copy.count].textureOrigin = {origin.x, origin.y + copyExtent.height - blockInfo.height, - origin.z + copyExtent.depth - 1}; + origin.z + copyExtent.depthOrArrayLayers - 1}; copy.copies[copy.count].copyExtent = {clampedCopyExtent.width, lastRowCopyExtentHeight, 1}; ++copy.count;
diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp index e78c68b..6573d12 100644 --- a/src/dawn_native/opengl/CommandBufferGL.cpp +++ b/src/dawn_native/opengl/CommandBufferGL.cpp
@@ -472,7 +472,7 @@ blitMask |= GL_STENCIL_BUFFER_BIT; } // Iterate over all layers, doing a single blit for each. - for (uint32_t layer = 0; layer < copySize.depth; ++layer) { + for (uint32_t layer = 0; layer < copySize.depthOrArrayLayers; ++layer) { // Bind all required aspects for this layer. for (Aspect aspect : IterateEnumMask(src.aspect)) { GLenum glAttachment; @@ -652,7 +652,8 @@ if (texture->GetArrayLayers() > 1) { // TODO(jiawei.shao@intel.com): do a single copy when the data is // correctly packed. - for (size_t copyZ = 0; copyZ < copyExtent.depth; ++copyZ) { + for (size_t copyZ = 0; copyZ < copyExtent.depthOrArrayLayers; + ++copyZ) { uintptr_t offsetPerImage = static_cast<uintptr_t>( src.offset + copyZ * src.bytesPerRow * src.rowsPerImage); uint32_t dstOriginY = dst.origin.y; @@ -702,13 +703,15 @@ uint64_t copyDataSize = (copySize.width / blockInfo.width) * (copySize.height / blockInfo.height) * - blockInfo.byteSize * copySize.depth; + blockInfo.byteSize * + copySize.depthOrArrayLayers; if (texture->GetArrayLayers() > 1) { gl.CompressedTexSubImage3D( target, dst.mipLevel, dst.origin.x, dst.origin.y, dst.origin.z, - copyExtent.width, copyExtent.height, copyExtent.depth, - format.internalFormat, copyDataSize, + copyExtent.width, copyExtent.height, + copyExtent.depthOrArrayLayers, format.internalFormat, + copyDataSize, reinterpret_cast<void*>(static_cast<uintptr_t>(src.offset))); } else { gl.CompressedTexSubImage2D( @@ -734,8 +737,8 @@ if (texture->GetArrayLayers() > 1) { gl.TexSubImage3D(target, dst.mipLevel, dst.origin.x, dst.origin.y, dst.origin.z, copySize.width, - copySize.height, copySize.depth, format.format, - format.type, + copySize.height, copySize.depthOrArrayLayers, + format.format, format.type, reinterpret_cast<void*>( static_cast<uintptr_t>(src.offset))); } else { @@ -839,7 +842,7 @@ } const uint64_t bytesPerImage = dst.bytesPerRow * dst.rowsPerImage; - for (uint32_t layer = 0; layer < copySize.depth; ++layer) { + for (uint32_t layer = 0; layer < copySize.depthOrArrayLayers; ++layer) { gl.FramebufferTextureLayer(GL_READ_FRAMEBUFFER, glAttachment, texture->GetHandle(), src.mipLevel, src.origin.z + layer); @@ -892,7 +895,8 @@ src.mipLevel, src.origin.x, src.origin.y, src.origin.z, dstTexture->GetHandle(), dstTexture->GetGLTarget(), dst.mipLevel, dst.origin.x, dst.origin.y, dst.origin.z, - copySize.width, copySize.height, copy->copySize.depth); + copySize.width, copySize.height, + copy->copySize.depthOrArrayLayers); } else { CopyTextureToTextureWithBlit(gl, src, dst, copySize); }
diff --git a/src/dawn_native/opengl/QueueGL.cpp b/src/dawn_native/opengl/QueueGL.cpp index 23eb143..17260b9 100644 --- a/src/dawn_native/opengl/QueueGL.cpp +++ b/src/dawn_native/opengl/QueueGL.cpp
@@ -59,7 +59,8 @@ const OpenGLFunctions& gl = ToBackend(GetDevice())->gl; Texture* texture = ToBackend(destination.texture); - SubresourceRange range(Aspect::Color, {destination.origin.z, writeSizePixel.depth}, + SubresourceRange range(Aspect::Color, + {destination.origin.z, writeSizePixel.depthOrArrayLayers}, {destination.mipLevel, 1}); if (IsCompleteSubresourceCopiedTo(texture, writeSizePixel, destination.mipLevel)) { texture->SetIsSubresourceContentInitialized(true, range); @@ -97,7 +98,7 @@ const uint8_t* slice = static_cast<const uint8_t*>(data); for (uint32_t z = destination.origin.z; - z < destination.origin.z + writeSizePixel.depth; ++z) { + z < destination.origin.z + writeSizePixel.depthOrArrayLayers; ++z) { const uint8_t* d = slice; for (uint32_t y = destination.origin.y; @@ -122,8 +123,8 @@ gl.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, dataLayout.rowsPerImage * blockInfo.height); gl.TexSubImage3D(target, destination.mipLevel, destination.origin.x, destination.origin.y, destination.origin.z, writeSizePixel.width, - writeSizePixel.height, writeSizePixel.depth, format.format, - format.type, data); + writeSizePixel.height, writeSizePixel.depthOrArrayLayers, + format.format, format.type, data); gl.PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); } gl.PixelStorei(GL_UNPACK_ROW_LENGTH, 0); @@ -138,7 +139,7 @@ } } else { const uint8_t* slice = static_cast<const uint8_t*>(data); - for (uint32_t z = 0; z < writeSizePixel.depth; ++z) { + for (uint32_t z = 0; z < writeSizePixel.depthOrArrayLayers; ++z) { const uint8_t* d = slice; for (uint32_t y = 0; y < writeSizePixel.height; ++y) { gl.TexSubImage3D(target, destination.mipLevel, destination.origin.x,
diff --git a/src/dawn_native/opengl/TextureGL.cpp b/src/dawn_native/opengl/TextureGL.cpp index 5582d97..c7fc9ef 100644 --- a/src/dawn_native/opengl/TextureGL.cpp +++ b/src/dawn_native/opengl/TextureGL.cpp
@@ -29,7 +29,7 @@ GLenum TargetForTexture(const TextureDescriptor* descriptor) { switch (descriptor->dimension) { case wgpu::TextureDimension::e2D: - if (descriptor->size.depth > 1) { + if (descriptor->size.depthOrArrayLayers > 1) { ASSERT(descriptor->sampleCount == 1); return GL_TEXTURE_2D_ARRAY; } else {
diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp index 98bfb58..62a0caf 100644 --- a/src/dawn_native/vulkan/CommandBufferVk.cpp +++ b/src/dawn_native/vulkan/CommandBufferVk.cpp
@@ -58,7 +58,7 @@ Extent3D imageExtentDst = ComputeTextureCopyExtent(dstCopy, copySize); return imageExtentSrc.width == imageExtentDst.width && imageExtentSrc.height == imageExtentDst.height && - imageExtentSrc.depth == imageExtentDst.depth; + imageExtentSrc.depthOrArrayLayers == imageExtentDst.depthOrArrayLayers; } VkImageCopy ComputeImageCopyRegion(const TextureCopy& srcCopy, @@ -76,7 +76,7 @@ region.srcSubresource.aspectMask = VulkanAspectMask(aspect); region.srcSubresource.mipLevel = srcCopy.mipLevel; region.srcSubresource.baseArrayLayer = srcCopy.origin.z; - region.srcSubresource.layerCount = copySize.depth; + region.srcSubresource.layerCount = copySize.depthOrArrayLayers; region.srcOffset.x = srcCopy.origin.x; region.srcOffset.y = srcCopy.origin.y; @@ -85,7 +85,7 @@ region.dstSubresource.aspectMask = VulkanAspectMask(aspect); region.dstSubresource.mipLevel = dstCopy.mipLevel; region.dstSubresource.baseArrayLayer = dstCopy.origin.z; - region.dstSubresource.layerCount = copySize.depth; + region.dstSubresource.layerCount = copySize.depthOrArrayLayers; region.dstOffset.x = dstCopy.origin.x; region.dstOffset.y = dstCopy.origin.y; @@ -459,7 +459,7 @@ // Create the temporary buffer. Note that We don't need to respect WebGPU's 256 alignment // because it isn't a hard constraint in Vulkan. uint64_t tempBufferSize = - widthInBlocks * heightInBlocks * copySize.depth * blockInfo.byteSize; + widthInBlocks * heightInBlocks * copySize.depthOrArrayLayers * blockInfo.byteSize; BufferDescriptor tempBufferDescriptor; tempBufferDescriptor.size = tempBufferSize; tempBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; @@ -689,8 +689,8 @@ // subresources should all be GENERAL instead of what we set now. Currently // it is not allowed to copy with overlapped subresources, but we still // add the ASSERT here as a reminder for this possible misuse. - ASSERT( - !IsRangeOverlapped(src.origin.z, dst.origin.z, copy->copySize.depth)); + ASSERT(!IsRangeOverlapped(src.origin.z, dst.origin.z, + copy->copySize.depthOrArrayLayers)); } // TODO after Yunchao's CL
diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp index 870b59f..28f9499 100644 --- a/src/dawn_native/vulkan/TextureVk.cpp +++ b/src/dawn_native/vulkan/TextureVk.cpp
@@ -199,12 +199,12 @@ case wgpu::TextureDimension::e2D: info->imageType = VK_IMAGE_TYPE_2D; info->extent = {size.width, size.height, 1}; - info->arrayLayers = size.depth; + info->arrayLayers = size.depthOrArrayLayers; break; case wgpu::TextureDimension::e3D: info->imageType = VK_IMAGE_TYPE_3D; - info->extent = {size.width, size.height, size.depth}; + info->extent = {size.width, size.height, size.depthOrArrayLayers}; info->arrayLayers = 1; break; @@ -456,7 +456,7 @@ return DAWN_VALIDATION_ERROR("Mip level count must be 1"); } - if (descriptor->size.depth != 1) { + if (descriptor->size.depthOrArrayLayers != 1) { return DAWN_VALIDATION_ERROR("Array layer count must be 1"); }
diff --git a/src/dawn_native/vulkan/UtilsVulkan.cpp b/src/dawn_native/vulkan/UtilsVulkan.cpp index 7e58319..6167201 100644 --- a/src/dawn_native/vulkan/UtilsVulkan.cpp +++ b/src/dawn_native/vulkan/UtilsVulkan.cpp
@@ -130,7 +130,7 @@ region.imageOffset.z = 0; region.imageSubresource.baseArrayLayer = textureCopy.origin.z; - region.imageSubresource.layerCount = copySize.depth; + region.imageSubresource.layerCount = copySize.depthOrArrayLayers; Extent3D imageExtent = ComputeTextureCopyExtent(textureCopy, copySize); region.imageExtent.width = imageExtent.width;
diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index a518e89..e44aeb2 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp
@@ -298,7 +298,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kRTSize; descriptor.size.height = kRTSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/BufferZeroInitTests.cpp b/src/tests/end2end/BufferZeroInitTests.cpp index 327723e..67226ef 100644 --- a/src/tests/end2end/BufferZeroInitTests.cpp +++ b/src/tests/end2end/BufferZeroInitTests.cpp
@@ -96,7 +96,7 @@ wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - for (uint32_t arrayLayer = 0; arrayLayer < size.depth; ++arrayLayer) { + for (uint32_t arrayLayer = 0; arrayLayer < size.depthOrArrayLayers; ++arrayLayer) { wgpu::TextureViewDescriptor viewDescriptor; viewDescriptor.format = format; viewDescriptor.dimension = wgpu::TextureViewDimension::e2D; @@ -145,7 +145,7 @@ const uint64_t expectedValueCount = bufferSize / sizeof(float); std::vector<float> expectedValues(expectedValueCount, 0.f); - for (uint32_t slice = 0; slice < spec.textureSize.depth; ++slice) { + for (uint32_t slice = 0; slice < spec.textureSize.depthOrArrayLayers; ++slice) { const uint64_t baseOffsetBytesPerSlice = spec.bufferOffset + spec.bytesPerRow * spec.rowsPerImage * slice; for (uint32_t y = 0; y < spec.textureSize.height; ++y) { @@ -963,7 +963,8 @@ constexpr wgpu::Extent3D kTextureSize = {64u, 4u, 3u}; // bytesPerRow == texelBlockSizeInBytes * copySize.width && rowsPerImage == copySize.height && - // bytesPerRow * (rowsPerImage * (copySize.depth - 1) + copySize.height) == buffer.size + // bytesPerRow * (rowsPerImage * (copySize.depthOrArrayLayers - 1) + copySize.height) == + // buffer.size { TestBufferZeroInitInCopyTextureToBuffer( {kTextureSize, 0u, 0u, kTextureBytesPerRowAlignment, kTextureSize.height, 0u}); @@ -976,7 +977,7 @@ {kTextureSize, 0u, 0u, kTextureBytesPerRowAlignment, kRowsPerImage, 1u}); } - // bytesPerRow * rowsPerImage * copySize.depth < buffer.size + // bytesPerRow * rowsPerImage * copySize.depthOrArrayLayers < buffer.size { constexpr uint64_t kExtraBufferSize = 16u; TestBufferZeroInitInCopyTextureToBuffer({kTextureSize, 0u, kExtraBufferSize,
diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp index b9b6d6c..91db43a 100644 --- a/src/tests/end2end/ColorStateTests.cpp +++ b/src/tests/end2end/ColorStateTests.cpp
@@ -771,7 +771,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kRTSize; descriptor.size.height = kRTSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp index a95f834a..06b8afa 100644 --- a/src/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/tests/end2end/CompressedTextureFormatTests.cpp
@@ -64,14 +64,14 @@ copyRowsPerImage = copyHeightInBlock; } uint32_t copyBytesPerImage = copyBytesPerRow * copyRowsPerImage; - uint32_t uploadBufferSize = - copyConfig.bufferOffset + copyBytesPerImage * copyConfig.copyExtent3D.depth; + uint32_t uploadBufferSize = copyConfig.bufferOffset + + copyBytesPerImage * copyConfig.copyExtent3D.depthOrArrayLayers; // Fill data with the pre-prepared one-block compressed texture data. std::vector<uint8_t> data(uploadBufferSize, 0); std::vector<uint8_t> oneBlockCompressedTextureData = GetOneBlockBCFormatTextureData(copyConfig.textureDescriptor.format); - for (uint32_t layer = 0; layer < copyConfig.copyExtent3D.depth; ++layer) { + for (uint32_t layer = 0; layer < copyConfig.copyExtent3D.depthOrArrayLayers; ++layer) { for (uint32_t h = 0; h < copyHeightInBlock; ++h) { for (uint32_t w = 0; w < copyWidthInBlock; ++w) { uint32_t uploadBufferOffset = copyConfig.bufferOffset + @@ -227,14 +227,14 @@ if (config.copyOrigin3D.y + config.copyExtent3D.height > virtualSizeAtLevel.height) { noPaddingExtent3D.height = virtualSizeAtLevel.height - config.copyOrigin3D.y; } - noPaddingExtent3D.depth = 1u; + noPaddingExtent3D.depthOrArrayLayers = 1u; std::vector<RGBA8> expectedData = GetExpectedData(config.textureDescriptor.format, noPaddingExtent3D); wgpu::Origin3D firstLayerCopyOrigin = {config.copyOrigin3D.x, config.copyOrigin3D.y, 0}; for (uint32_t layer = config.copyOrigin3D.z; - layer < config.copyOrigin3D.z + config.copyExtent3D.depth; ++layer) { + layer < config.copyOrigin3D.z + config.copyExtent3D.depthOrArrayLayers; ++layer) { wgpu::BindGroup bindGroup = CreateBindGroupForTest( renderPipeline.GetBindGroupLayout(0), bcTexture, config.textureDescriptor.format, layer, config.viewMipmapLevel); @@ -391,7 +391,7 @@ static std::vector<RGBA8> FillExpectedData(const wgpu::Extent3D& testRegion, RGBA8 leftColorInBlock, RGBA8 rightColorInBlock) { - ASSERT(testRegion.depth == 1); + ASSERT(testRegion.depthOrArrayLayers == 1); std::vector<RGBA8> expectedData(testRegion.width * testRegion.height, leftColorInBlock); for (uint32_t y = 0; y < testRegion.height; ++y) { @@ -409,7 +409,7 @@ static wgpu::Extent3D GetVirtualSizeAtLevel(const CopyConfig& config) { return {config.textureDescriptor.size.width >> config.viewMipmapLevel, config.textureDescriptor.size.height >> config.viewMipmapLevel, - config.textureDescriptor.size.depth}; + config.textureDescriptor.size.depthOrArrayLayers}; } static wgpu::Extent3D GetPhysicalSizeAtLevel(const CopyConfig& config) { @@ -484,7 +484,7 @@ config.copyExtent3D = config.textureDescriptor.size; constexpr uint32_t kArrayLayerCount = 3; - config.textureDescriptor.size.depth = kArrayLayerCount; + config.textureDescriptor.size.depthOrArrayLayers = kArrayLayerCount; config.copyOrigin3D.z = kArrayLayerCount - 1; for (wgpu::TextureFormat format : utils::kBCFormats) { @@ -973,8 +973,8 @@ } // Test the workaround in the B2T copies when (bufferSize - bufferOffset < bytesPerImage * -// copyExtent.depth) on Metal backends. As copyExtent.depth can only be 1 for BC formats, on Metal -// backend we will use two copies to implement such copy. +// copyExtent.depthOrArrayLayers) on Metal backends. As copyExtent.depthOrArrayLayers can only be 1 +// for BC formats, on Metal backend we will use two copies to implement such copy. TEST_P(CompressedTextureBCFormatTest, LargeImageHeight) { // TODO(jiawei.shao@intel.com): find out why this test fails on Windows Intel OpenGL drivers. DAWN_SKIP_TEST_IF(IsIntel() && IsOpenGL() && IsWindows()); @@ -995,7 +995,7 @@ } // Test the workaround in the B2T copies when (bufferSize - bufferOffset < bytesPerImage * -// copyExtent.depth) and copyExtent needs to be clamped. +// copyExtent.depthOrArrayLayers) and copyExtent needs to be clamped. TEST_P(CompressedTextureBCFormatTest, LargeImageHeightAndClampedCopyExtent) { // TODO(jiawei.shao@intel.com): find out why this test fails on Windows Intel OpenGL drivers. DAWN_SKIP_TEST_IF(IsIntel() && IsOpenGL() && IsWindows()); @@ -1055,7 +1055,7 @@ config.rowsPerImage = 8; config.copyExtent3D = config.textureDescriptor.size; - config.copyExtent3D.depth = kArrayLayerCount; + config.copyExtent3D.depthOrArrayLayers = kArrayLayerCount; for (wgpu::TextureFormat format : utils::kBCFormats) { config.textureDescriptor.format = format; @@ -1084,7 +1084,7 @@ constexpr uint32_t kCopyLayerCount = 2; config.copyOrigin3D = {0, 0, kCopyBaseArrayLayer}; config.copyExtent3D = config.textureDescriptor.size; - config.copyExtent3D.depth = kCopyLayerCount; + config.copyExtent3D.depthOrArrayLayers = kCopyLayerCount; for (wgpu::TextureFormat format : utils::kBCFormats) { config.textureDescriptor.format = format;
diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp index f6d6a3d..0c457cb 100644 --- a/src/tests/end2end/CopyTests.cpp +++ b/src/tests/end2end/CopyTests.cpp
@@ -46,7 +46,7 @@ static std::vector<uint8_t> GetExpectedTextureData(const utils::TextureDataCopyLayout& layout) { uint32_t bytesPerTexelBlock = layout.bytesPerRow / layout.texelBlocksPerRow; std::vector<uint8_t> textureData(layout.byteLength); - for (uint32_t layer = 0; layer < layout.mipSize.depth; ++layer) { + for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) { const uint32_t byteOffsetPerSlice = layout.bytesPerImage * layer; for (uint32_t y = 0; y < layout.mipSize.height; ++y) { for (uint32_t x = 0; x < layout.mipSize.width * bytesPerTexelBlock; ++x) { @@ -64,7 +64,7 @@ static std::vector<RGBA8> GetExpectedTextureDataRGBA8( const utils::TextureDataCopyLayout& layout) { std::vector<RGBA8> textureData(layout.texelBlockCount); - for (uint32_t layer = 0; layer < layout.mipSize.depth; ++layer) { + for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) { const uint32_t texelIndexOffsetPerSlice = layout.texelBlocksPerImage * layer; for (uint32_t y = 0; y < layout.mipSize.height; ++y) { for (uint32_t x = 0; x < layout.mipSize.width; ++x) { @@ -185,7 +185,7 @@ // Texels in single slice. const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion( bufferSpec.bytesPerRow, bufferSpec.rowsPerImage, copySizePerSlice, textureSpec.format); - const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth; + const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depthOrArrayLayers; std::vector<RGBA8> expected(texelCountInCopyRegion); for (uint32_t slice = textureSpec.copyOrigin.z; slice < maxArrayLayer; ++slice) { // Pack the data used to create the upload buffer in the specified copy region to have @@ -207,7 +207,7 @@ << ", " << textureSpec.copyOrigin.y << ", " << textureSpec.copyOrigin.z << "), (" << textureSpec.copyOrigin.x + copySize.width << ", " << textureSpec.copyOrigin.y + copySize.height << ", " - << textureSpec.copyOrigin.z + copySize.depth << ")) from " + << textureSpec.copyOrigin.z + copySize.depthOrArrayLayers << ")) from " << textureSpec.textureSize.width << " x " << textureSpec.textureSize.height << " texture at mip level " << textureSpec.copyLevel << " layer " << slice << " to " << bufferSpec.size << "-byte buffer with offset " << bufferOffset @@ -258,7 +258,7 @@ textureSpec.format, textureSpec.textureSize, textureSpec.copyLevel, bufferSpec.rowsPerImage); - const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth; + const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depthOrArrayLayers; wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer( buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage); @@ -333,7 +333,9 @@ // `level` mip level const utils::TextureDataCopyLayout srcDataCopyLayout = utils::GetTextureDataCopyLayoutForTexture2DAtLevel( - format, {srcSpec.textureSize.width, srcSpec.textureSize.height, copySize.depth}, + format, + {srcSpec.textureSize.width, srcSpec.textureSize.height, + copySize.depthOrArrayLayers}, srcSpec.copyLevel); // Initialize the source texture @@ -358,10 +360,12 @@ encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Size); // Copy the data from the srcSpec.copyOrigin.z-th layer to (srcSpec.copyOrigin.z + - // copySize.depth)-th layer of dstTexture to outputBuffer + // copySize.depthOrArrayLayers)-th layer of dstTexture to outputBuffer const utils::TextureDataCopyLayout dstDataCopyLayout = utils::GetTextureDataCopyLayoutForTexture2DAtLevel( - format, {dstSpec.textureSize.width, dstSpec.textureSize.height, copySize.depth}, + format, + {dstSpec.textureSize.width, dstSpec.textureSize.height, + copySize.depthOrArrayLayers}, dstSpec.copyLevel); wgpu::BufferDescriptor outputBufferDescriptor; outputBufferDescriptor.size = dstDataCopyLayout.byteLength; @@ -384,7 +388,7 @@ bytesPerTexel); std::vector<uint8_t> expectedDstDataPerSlice(validDataSizePerDstTextureLayer); - for (uint32_t slice = 0; slice < copySize.depth; ++slice) { + for (uint32_t slice = 0; slice < copySize.depthOrArrayLayers; ++slice) { // For each source texture array slice involved in the copy, emulate the T2T copy // on the CPU side by "copying" the copy data from the "source texture" // (srcTextureCopyData) to the "destination texture" (expectedDstDataPerSlice).
diff --git a/src/tests/end2end/CopyTextureForBrowserTests.cpp b/src/tests/end2end/CopyTextureForBrowserTests.cpp index deb3a70..17c3fd6 100644 --- a/src/tests/end2end/CopyTextureForBrowserTests.cpp +++ b/src/tests/end2end/CopyTextureForBrowserTests.cpp
@@ -36,7 +36,7 @@ static std::vector<RGBA8> GetSourceTextureData(const utils::TextureDataCopyLayout& layout) { std::vector<RGBA8> textureData(layout.texelBlockCount); - for (uint32_t layer = 0; layer < layout.mipSize.depth; ++layer) { + for (uint32_t layer = 0; layer < layout.mipSize.depthOrArrayLayers; ++layer) { const uint32_t sliceOffset = layout.texelBlocksPerImage * layer; for (uint32_t y = 0; y < layout.mipSize.height; ++y) { const uint32_t rowOffset = layout.texelBlocksPerRow * y; @@ -141,7 +141,8 @@ const utils::TextureDataCopyLayout copyLayout = utils::GetTextureDataCopyLayoutForTexture2DAtLevel( kTextureFormat, - {srcSpec.textureSize.width, srcSpec.textureSize.height, copySize.depth}, + {srcSpec.textureSize.width, srcSpec.textureSize.height, + copySize.depthOrArrayLayers}, srcSpec.level); const std::vector<RGBA8> textureArrayCopyData = GetSourceTextureData(copyLayout);
diff --git a/src/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/tests/end2end/D3D12ResourceWrappingTests.cpp index 47f311b..0a703c7 100644 --- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp +++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
@@ -191,7 +191,7 @@ // Test an error occurs if the descriptor depth isn't 1 TEST_P(D3D12SharedHandleValidation, InvalidDepth) { DAWN_SKIP_TEST_IF(UsesWire()); - baseDawnDescriptor.size.depth = 2; + baseDawnDescriptor.size.depthOrArrayLayers = 2; wgpu::Texture texture; ComPtr<ID3D11Texture2D> d3d11Texture;
diff --git a/src/tests/end2end/DeprecatedAPITests.cpp b/src/tests/end2end/DeprecatedAPITests.cpp index 9d69f89..e1b8491 100644 --- a/src/tests/end2end/DeprecatedAPITests.cpp +++ b/src/tests/end2end/DeprecatedAPITests.cpp
@@ -172,6 +172,291 @@ EXPECT_DEPRECATION_WARNING(queue.CreateFence()); } +// Test GPUExtent3D.depth deprecation in TextureDescriptor.size +TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationTextureDescriptor) { + wgpu::TextureDescriptor kBaseDesc; + kBaseDesc.usage = wgpu::TextureUsage::Sampled; + kBaseDesc.size.width = 1; + kBaseDesc.size.height = 1; + kBaseDesc.format = wgpu::TextureFormat::RGBA8Unorm; + kBaseDesc.dimension = wgpu::TextureDimension::e2D; + + { + // Valid: default + wgpu::TextureDescriptor desc = kBaseDesc; + wgpu::Texture texture; + texture = device.CreateTexture(&desc); + } + { + // Warning: use deprecated depth but still valid + wgpu::TextureDescriptor desc = kBaseDesc; + desc.mipLevelCount = 2; + desc.size.width = 2; + desc.size.height = 2; + desc.size.depth = 2; + wgpu::Texture texture; + EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc)); + } + { + // Warning: use deprecated depth + // Error: use deprecated depth and the descriptor is invalid + // because 2D texture with depth == 0 is not allowed + // This is to verify the deprecated depth is picked up by the implementation. + wgpu::TextureDescriptor desc = kBaseDesc; + desc.size.depth = 0; + wgpu::Texture texture; + ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(texture = device.CreateTexture(&desc))); + } + { + // Error: use both deprecated depth and depthOrArrayLayers + wgpu::TextureDescriptor desc = kBaseDesc; + desc.size.depth = 2; + desc.size.depthOrArrayLayers = 2; + wgpu::Texture texture; + ASSERT_DEVICE_ERROR(texture = device.CreateTexture(&desc)); + } + { + // Valid: use updated depthOrArrayLayers + wgpu::TextureDescriptor desc = kBaseDesc; + desc.mipLevelCount = 2; + desc.size.width = 2; + desc.size.height = 2; + desc.size.depthOrArrayLayers = 2; + wgpu::Texture texture; + texture = device.CreateTexture(&desc); + } + { + // Error: use updated depthOrArrayLayers and the descriptor is invalid + // because 2D texture with depthOrArrayLayers == 0 is not allowed + wgpu::TextureDescriptor desc = kBaseDesc; + desc.size.depthOrArrayLayers = 0; + wgpu::Texture texture; + ASSERT_DEVICE_ERROR(texture = device.CreateTexture(&desc)); + } +} + +// Test GPUExtent3D.depth deprecation in CopyBufferToTexture, CopyTextureToBuffer, and +// CopyTextureToTexture +TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationCopy) { + wgpu::BufferDescriptor bufferDesc; + bufferDesc.size = 4 * 256; + bufferDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; + wgpu::Buffer srcBuffer = device.CreateBuffer(&bufferDesc); + + wgpu::TextureDescriptor dstTextureDesc; + dstTextureDesc.usage = wgpu::TextureUsage::CopyDst; + dstTextureDesc.size.width = 4; + dstTextureDesc.size.height = 4; + dstTextureDesc.size.depthOrArrayLayers = 1; + dstTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm; + dstTextureDesc.dimension = wgpu::TextureDimension::e2D; + wgpu::Texture dstTexture = device.CreateTexture(&dstTextureDesc); + + wgpu::TextureDescriptor srcTextureDesc = dstTextureDesc; + srcTextureDesc.usage = wgpu::TextureUsage::CopySrc; + wgpu::Texture srcTexture = device.CreateTexture(&srcTextureDesc); + + wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(srcBuffer, 0, 256, 4); + wgpu::ImageCopyTexture imageCopyDstTexture = + utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All); + wgpu::ImageCopyTexture imageCopySrcTexture = + utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All); + + wgpu::Extent3D kBaseExtent3D; + kBaseExtent3D.width = 4; + kBaseExtent3D.height = 4; + + { + // Valid: default + wgpu::Extent3D extent3D = kBaseExtent3D; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D); + encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D); + encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D); + encoder.Finish(); + } + { + // Warning: empty copy use deprecated depth == 0 but still valid + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.width = 0; + extent3D.height = 0; + extent3D.depth = 0; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + EXPECT_DEPRECATION_WARNING( + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D)); + EXPECT_DEPRECATION_WARNING( + encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D)); + EXPECT_DEPRECATION_WARNING( + encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D)); + encoder.Finish(); + } + { + // Warning: use deprecated depth + // Error: depth > 1 + // This is to verify the deprecated depth is picked up by the implementation. + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.depth = 2; + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + EXPECT_DEPRECATION_WARNING( + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D)); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + EXPECT_DEPRECATION_WARNING( + encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D)); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + EXPECT_DEPRECATION_WARNING(encoder.CopyTextureToTexture( + &imageCopySrcTexture, &imageCopyDstTexture, &extent3D)); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + } + { + // Error: use both deprecated depth and depthOrArrayLayers + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.width = 0; + extent3D.height = 0; + extent3D.depth = 0; + extent3D.depthOrArrayLayers = 0; + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + } + { + // Valid: use updated depthOrArrayLayers + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.width = 0; + extent3D.height = 0; + extent3D.depthOrArrayLayers = 0; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D); + encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D); + encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D); + encoder.Finish(); + } + { + // Error: use updated depthOrArrayLayers and is invalid + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.depthOrArrayLayers = 2; + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyDstTexture, &extent3D); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyTextureToBuffer(&imageCopySrcTexture, &imageCopyBuffer, &extent3D); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + { + wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); + encoder.CopyTextureToTexture(&imageCopySrcTexture, &imageCopyDstTexture, &extent3D); + ASSERT_DEVICE_ERROR(encoder.Finish()); + } + } +} + +// Test GPUExtent3D.depth deprecation in WriteTexture +TEST_P(DeprecationTests, GPUExtent3DDepthDeprecationWriteTexture) { + wgpu::TextureDescriptor dstTextureDesc; + dstTextureDesc.usage = wgpu::TextureUsage::CopyDst; + dstTextureDesc.size.width = 4; + dstTextureDesc.size.height = 4; + dstTextureDesc.size.depthOrArrayLayers = 1; + dstTextureDesc.format = wgpu::TextureFormat::RGBA8Unorm; + dstTextureDesc.dimension = wgpu::TextureDimension::e2D; + wgpu::Texture dstTexture = device.CreateTexture(&dstTextureDesc); + + size_t dataSize = 4 * 256; + std::vector<uint8_t> data(dataSize); + + wgpu::TextureDataLayout textureDataLayout; + textureDataLayout.offset = 0; + textureDataLayout.bytesPerRow = 256; + textureDataLayout.rowsPerImage = 4; + + wgpu::ImageCopyTexture imageCopyDstTexture = + utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All); + + wgpu::Extent3D kBaseExtent3D; + kBaseExtent3D.width = 4; + kBaseExtent3D.height = 4; + + { + // Valid: default + wgpu::Extent3D extent3D = kBaseExtent3D; + wgpu::Queue queue = device.GetQueue(); + queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout, + &extent3D); + } + { + // Warning: use deprecated depth == 0 but still valid + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.width = 0; + extent3D.height = 0; + extent3D.depth = 0; + wgpu::Queue queue = device.GetQueue(); + EXPECT_DEPRECATION_WARNING(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, + &textureDataLayout, &extent3D)); + } + { + // Warning: use deprecated depth + // Error: depth > 1 for 2D textures + // This is to verify the deprecated depth is picked up by the implementation. + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.depth = 2; + wgpu::Queue queue = device.GetQueue(); + ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(queue.WriteTexture( + &imageCopyDstTexture, data.data(), dataSize, &textureDataLayout, &extent3D))); + } + { + // Error: use both deprecated depth and depthOrArrayLayers + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.width = 0; + extent3D.height = 0; + extent3D.depth = 0; + extent3D.depthOrArrayLayers = 0; + wgpu::Queue queue = device.GetQueue(); + ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, + &textureDataLayout, &extent3D)); + } + { + // Valid: use updated depthOrArrayLayers + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.width = 0; + extent3D.height = 0; + extent3D.depthOrArrayLayers = 0; + wgpu::Queue queue = device.GetQueue(); + queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, &textureDataLayout, + &extent3D); + } + { + // Error: use updated depthOrArrayLayers and depthOrArrayLayers > 1 for 2D textures + wgpu::Extent3D extent3D = kBaseExtent3D; + extent3D.depthOrArrayLayers = 2; + wgpu::Queue queue = device.GetQueue(); + ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyDstTexture, data.data(), dataSize, + &textureDataLayout, &extent3D)); + } +} + DAWN_INSTANTIATE_TEST(DeprecationTests, D3D12Backend(), MetalBackend(),
diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index 3696c19..460f77b 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp
@@ -29,7 +29,7 @@ renderTargetDescriptor.dimension = wgpu::TextureDimension::e2D; renderTargetDescriptor.size.width = kRTSize; renderTargetDescriptor.size.height = kRTSize; - renderTargetDescriptor.size.depth = 1; + renderTargetDescriptor.size.depthOrArrayLayers = 1; renderTargetDescriptor.sampleCount = 1; renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm; renderTargetDescriptor.mipLevelCount = 1; @@ -43,7 +43,7 @@ depthDescriptor.dimension = wgpu::TextureDimension::e2D; depthDescriptor.size.width = kRTSize; depthDescriptor.size.height = kRTSize; - depthDescriptor.size.depth = 1; + depthDescriptor.size.depthOrArrayLayers = 1; depthDescriptor.sampleCount = 1; depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8; depthDescriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp index 3e2752f..0ddac92 100644 --- a/src/tests/end2end/DeviceLostTests.cpp +++ b/src/tests/end2end/DeviceLostTests.cpp
@@ -234,7 +234,7 @@ wgpu::TextureDescriptor descriptor; descriptor.size.width = 4; descriptor.size.height = 4; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.mipLevelCount = 1; descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.usage = wgpu::TextureUsage::RenderAttachment;
diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp index d26fb8e..10ebad2 100644 --- a/src/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp
@@ -182,7 +182,7 @@ // Test an error occurs if the descriptor depth isn't 1 TEST_P(IOSurfaceValidationTests, InvalidDepth) { DAWN_SKIP_TEST_IF(UsesWire()); - descriptor.size.depth = 2; + descriptor.size.depthOrArrayLayers = 2; ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapIOSurface(&descriptor, defaultIOSurface.get(), 0));
diff --git a/src/tests/end2end/MultisampledRenderingTests.cpp b/src/tests/end2end/MultisampledRenderingTests.cpp index 62e0ae8..2eeadbb 100644 --- a/src/tests/end2end/MultisampledRenderingTests.cpp +++ b/src/tests/end2end/MultisampledRenderingTests.cpp
@@ -101,7 +101,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kWidth << (mipLevelCount - 1); descriptor.size.height = kHeight << (mipLevelCount - 1); - descriptor.size.depth = arrayLayerCount; + descriptor.size.depthOrArrayLayers = arrayLayerCount; descriptor.sampleCount = sampleCount; descriptor.format = format; descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/NonzeroTextureCreationTests.cpp b/src/tests/end2end/NonzeroTextureCreationTests.cpp index 91fab10..e479fee 100644 --- a/src/tests/end2end/NonzeroTextureCreationTests.cpp +++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp
@@ -33,7 +33,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; @@ -53,7 +53,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.mipLevelCount = 1; descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc; @@ -75,7 +75,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = mipLevels; @@ -99,7 +99,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = arrayLayers; + descriptor.size.depthOrArrayLayers = arrayLayers; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; @@ -125,7 +125,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Snorm; descriptor.mipLevelCount = 1; @@ -163,7 +163,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = 2; + descriptor.size.depthOrArrayLayers = 2; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Snorm; descriptor.mipLevelCount = 1; @@ -196,7 +196,7 @@ baseDescriptor.dimension = wgpu::TextureDimension::e2D; baseDescriptor.size.width = kSize; baseDescriptor.size.height = kSize; - baseDescriptor.size.depth = 1; + baseDescriptor.size.depthOrArrayLayers = 1; baseDescriptor.sampleCount = 1; baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm; baseDescriptor.mipLevelCount = 1; @@ -208,10 +208,10 @@ wgpu::TextureDescriptor descriptor = baseDescriptor; // Some textures may be cleared with render pass load/store ops. // Test above the max attachment count. - descriptor.size.depth = kMaxColorAttachments + 1; + descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1; wgpu::Texture texture = device.CreateTexture(&descriptor); - for (uint32_t i = 0; i < descriptor.size.depth; ++i) { + for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) { EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i); } } @@ -230,11 +230,11 @@ wgpu::TextureDescriptor descriptor = baseDescriptor; // Some textures may be cleared with render pass load/store ops. // Test above the max attachment count. - descriptor.size.depth = kMaxColorAttachments + 1; + descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1; descriptor.mipLevelCount = 3; wgpu::Texture texture = device.CreateTexture(&descriptor); - for (uint32_t i = 0; i < descriptor.size.depth; ++i) { + for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) { for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) { EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i); } @@ -248,7 +248,7 @@ baseDescriptor.dimension = wgpu::TextureDimension::e2D; baseDescriptor.size.width = kSize; baseDescriptor.size.height = kSize; - baseDescriptor.size.depth = 1; + baseDescriptor.size.depthOrArrayLayers = 1; baseDescriptor.sampleCount = 1; baseDescriptor.format = wgpu::TextureFormat::RGBA8Snorm; baseDescriptor.mipLevelCount = 1; @@ -260,10 +260,10 @@ wgpu::TextureDescriptor descriptor = baseDescriptor; // Some textures may be cleared with render pass load/store ops. // Test above the max attachment count. - descriptor.size.depth = kMaxColorAttachments + 1; + descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1; wgpu::Texture texture = device.CreateTexture(&descriptor); - for (uint32_t i = 0; i < descriptor.size.depth; ++i) { + for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) { EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, 0, i); } } @@ -282,11 +282,11 @@ wgpu::TextureDescriptor descriptor = baseDescriptor; // Some textures may be cleared with render pass load/store ops. // Test above the max attachment count. - descriptor.size.depth = kMaxColorAttachments + 1; + descriptor.size.depthOrArrayLayers = kMaxColorAttachments + 1; descriptor.mipLevelCount = 3; wgpu::Texture texture = device.CreateTexture(&descriptor); - for (uint32_t i = 0; i < descriptor.size.depth; ++i) { + for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) { for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) { EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, 0, 0, 1, 1, j, i); }
diff --git a/src/tests/end2end/QueueTests.cpp b/src/tests/end2end/QueueTests.cpp index bd8fd9d..4f635e9 100644 --- a/src/tests/end2end/QueueTests.cpp +++ b/src/tests/end2end/QueueTests.cpp
@@ -286,7 +286,7 @@ const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kTextureFormat); wgpu::Extent3D mipSize = {textureSpec.textureSize.width >> textureSpec.level, textureSpec.textureSize.height >> textureSpec.level, - textureSpec.textureSize.depth}; + textureSpec.textureSize.depthOrArrayLayers}; uint32_t bytesPerRow = dataSpec.bytesPerRow; if (bytesPerRow == wgpu::kCopyStrideUndefined) { bytesPerRow = mipSize.width * bytesPerTexel; @@ -296,7 +296,7 @@ dataSpec.rowsPerImage > 0 ? dataSpec.rowsPerImage : mipSize.height; uint32_t bytesPerImage = bytesPerRow * appliedRowsPerImage; - const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth; + const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depthOrArrayLayers; uint64_t dataOffset = dataSpec.offset; const uint32_t texelCountLastLayer =
diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index c8bc7ce..25d9427 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp
@@ -60,7 +60,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kRTSize; descriptor.size.height = kRTSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp index 55eb5cf..5d65ae8 100644 --- a/src/tests/end2end/RenderPassTests.cpp +++ b/src/tests/end2end/RenderPassTests.cpp
@@ -59,7 +59,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kRTSize; descriptor.size.height = kRTSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = kFormat; descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp index 7dd08de..0f5b080 100644 --- a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp +++ b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
@@ -97,7 +97,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = textureWidthLevel0; descriptor.size.height = textureHeightLevel0; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 9855154..c3ce811 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp
@@ -93,7 +93,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = 2; descriptor.size.height = 2; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp index 010376c..fdcd891 100644 --- a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp +++ b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp
@@ -121,7 +121,7 @@ renderTargetDesc.dimension = wgpu::TextureDimension::e2D; renderTargetDesc.size.width = kTextureSize; renderTargetDesc.size.height = kTextureSize; - renderTargetDesc.size.depth = kArrayLayerCount; + renderTargetDesc.size.depthOrArrayLayers = kArrayLayerCount; renderTargetDesc.sampleCount = 1; renderTargetDesc.format = format; renderTargetDesc.mipLevelCount = kMipLevelCount;
diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp index 1396d6e..4a34bd6 100644 --- a/src/tests/end2end/TextureViewTests.cpp +++ b/src/tests/end2end/TextureViewTests.cpp
@@ -37,7 +37,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = arrayLayerCount; + descriptor.size.depthOrArrayLayers = arrayLayerCount; descriptor.sampleCount = 1; descriptor.format = kDefaultFormat; descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp index 8076c13..11ab992 100644 --- a/src/tests/end2end/TextureZeroInitTests.cpp +++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -45,7 +45,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kSize; descriptor.size.height = kSize; - descriptor.size.depth = arrayLayerCount; + descriptor.size.depthOrArrayLayers = arrayLayerCount; descriptor.sampleCount = 1; descriptor.format = format; descriptor.mipLevelCount = mipLevelCount; @@ -1425,7 +1425,7 @@ wgpu::TextureDescriptor descriptor; descriptor.size.width = kUnalignedSize; descriptor.size.height = kUnalignedSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.format = wgpu::TextureFormat::R8Snorm; descriptor.usage = wgpu::TextureUsage::CopySrc; wgpu::Texture texture = device.CreateTexture(&descriptor);
diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp index a2cd14e..8000549 100644 --- a/src/tests/perf_tests/DrawCallPerf.cpp +++ b/src/tests/perf_tests/DrawCallPerf.cpp
@@ -287,7 +287,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kTextureSize; descriptor.size.height = kTextureSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.usage = wgpu::TextureUsage::RenderAttachment; descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
diff --git a/src/tests/perf_tests/SubresourceTrackingPerf.cpp b/src/tests/perf_tests/SubresourceTrackingPerf.cpp index 7f32843..0ddf864 100644 --- a/src/tests/perf_tests/SubresourceTrackingPerf.cpp +++ b/src/tests/perf_tests/SubresourceTrackingPerf.cpp
@@ -64,7 +64,7 @@ mMaterials = device.CreateTexture(&materialDesc); wgpu::TextureDescriptor uploadTexDesc = materialDesc; - uploadTexDesc.size.depth = 1; + uploadTexDesc.size.depthOrArrayLayers = 1; uploadTexDesc.mipLevelCount = 1; uploadTexDesc.usage = wgpu::TextureUsage::CopySrc; mUploadTexture = device.CreateTexture(&uploadTexDesc);
diff --git a/src/tests/unittests/d3d12/CopySplitTests.cpp b/src/tests/unittests/d3d12/CopySplitTests.cpp index adc546d..e18b5be 100644 --- a/src/tests/unittests/d3d12/CopySplitTests.cpp +++ b/src/tests/unittests/d3d12/CopySplitTests.cpp
@@ -49,7 +49,8 @@ const auto& copy = copySplit.copies[i]; ASSERT_LE(copy.bufferOffset.x + copy.copySize.width, copy.bufferSize.width); ASSERT_LE(copy.bufferOffset.y + copy.copySize.height, copy.bufferSize.height); - ASSERT_LE(copy.bufferOffset.z + copy.copySize.depth, copy.bufferSize.depth); + ASSERT_LE(copy.bufferOffset.z + copy.copySize.depthOrArrayLayers, + copy.bufferSize.depthOrArrayLayers); } } @@ -75,9 +76,9 @@ bool overlapY = RangesOverlap(a.textureOffset.y, a.textureOffset.y + a.copySize.height, b.textureOffset.y, b.textureOffset.y + b.copySize.height); - bool overlapZ = - RangesOverlap(a.textureOffset.z, a.textureOffset.z + a.copySize.depth, - b.textureOffset.z, b.textureOffset.z + b.copySize.depth); + bool overlapZ = RangesOverlap( + a.textureOffset.z, a.textureOffset.z + a.copySize.depthOrArrayLayers, + b.textureOffset.z, b.textureOffset.z + b.copySize.depthOrArrayLayers); ASSERT_TRUE(!overlapX || !overlapY || !overlapZ); } } @@ -93,7 +94,8 @@ uint32_t minZ = copySplit.copies[0].textureOffset.z; uint32_t maxX = copySplit.copies[0].textureOffset.x + copySplit.copies[0].copySize.width; uint32_t maxY = copySplit.copies[0].textureOffset.y + copySplit.copies[0].copySize.height; - uint32_t maxZ = copySplit.copies[0].textureOffset.z + copySplit.copies[0].copySize.depth; + uint32_t maxZ = + copySplit.copies[0].textureOffset.z + copySplit.copies[0].copySize.depthOrArrayLayers; for (uint32_t i = 1; i < copySplit.count; ++i) { const auto& copy = copySplit.copies[i]; @@ -102,7 +104,7 @@ minZ = std::min(minZ, copy.textureOffset.z); maxX = std::max(maxX, copy.textureOffset.x + copy.copySize.width); maxY = std::max(maxY, copy.textureOffset.y + copy.copySize.height); - maxZ = std::max(maxZ, copy.textureOffset.z + copy.copySize.depth); + maxZ = std::max(maxZ, copy.textureOffset.z + copy.copySize.depthOrArrayLayers); } ASSERT_EQ(minX, textureSpec.x); @@ -119,7 +121,7 @@ uint32_t count = 0; for (uint32_t i = 0; i < copySplit.count; ++i) { const auto& copy = copySplit.copies[i]; - count += copy.copySize.width * copy.copySize.height * copy.copySize.depth; + count += copy.copySize.width * copy.copySize.height * copy.copySize.depthOrArrayLayers; } ASSERT_EQ(count, textureSpec.width * textureSpec.height * textureSpec.depth); } @@ -192,11 +194,12 @@ const auto& copy = copySplit.copies[i]; os << " " << i << ": Texture at (" << copy.textureOffset.x << ", " << copy.textureOffset.y << ", " << copy.textureOffset.z << "), size (" - << copy.copySize.width << ", " << copy.copySize.height << ", " << copy.copySize.depth - << ")" << std::endl; + << copy.copySize.width << ", " << copy.copySize.height << ", " + << copy.copySize.depthOrArrayLayers << ")" << std::endl; os << " " << i << ": Buffer at (" << copy.bufferOffset.x << ", " << copy.bufferOffset.y << ", " << copy.bufferOffset.z << "), footprint (" << copy.bufferSize.width << ", " - << copy.bufferSize.height << ", " << copy.bufferSize.depth << ")" << std::endl; + << copy.bufferSize.height << ", " << copy.bufferSize.depthOrArrayLayers << ")" + << std::endl; } return os; }
diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp index 62e4c9c..29b664a 100644 --- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp +++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
@@ -41,7 +41,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = arrayLayerCount; + descriptor.size.depthOrArrayLayers = arrayLayerCount; descriptor.sampleCount = sampleCount; descriptor.format = format; descriptor.mipLevelCount = mipLevelCount; @@ -663,7 +663,7 @@ ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor)); wgpu::TextureDescriptor errorTextureDescriptor; - errorTextureDescriptor.size.depth = 0; + errorTextureDescriptor.size.depthOrArrayLayers = 0; ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor)); wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0); @@ -1252,7 +1252,7 @@ ASSERT_DEVICE_ERROR(wgpu::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor)); wgpu::TextureDescriptor errorTextureDescriptor; - errorTextureDescriptor.size.depth = 0; + errorTextureDescriptor.size.depthOrArrayLayers = 0; ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor)); wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0); @@ -1533,12 +1533,12 @@ TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 1}, destination, 0, {0, 0, 1}, {16, 16, 1}); - // Copy multiple slices (srcImageCopyTexture.arrayLayer + copySize.depth == + // Copy multiple slices (srcImageCopyTexture.arrayLayer + copySize.depthOrArrayLayers == // srcImageCopyTexture.texture.arrayLayerCount) TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 2}, destination, 0, {0, 0, 0}, {16, 16, 2}); - // Copy multiple slices (dstImageCopyTexture.arrayLayer + copySize.depth == + // Copy multiple slices (dstImageCopyTexture.arrayLayer + copySize.depthOrArrayLayers == // dstImageCopyTexture.texture.arrayLayerCount) TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, {0, 0, 2}, {16, 16, 2});
diff --git a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp index f115c30c..6d8a2e7 100644 --- a/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp +++ b/src/tests/unittests/validation/QueueWriteTextureValidationTests.cpp
@@ -38,7 +38,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = size.width; descriptor.size.height = size.height; - descriptor.size.depth = size.depth; + descriptor.size.depthOrArrayLayers = size.depthOrArrayLayers; descriptor.sampleCount = sampleCount; descriptor.format = format; descriptor.mipLevelCount = mipLevelCount; @@ -358,7 +358,7 @@ // Test WriteTexture with texture in error state causes errors. TEST_F(QueueWriteTextureValidationTest, TextureInErrorState) { wgpu::TextureDescriptor errorTextureDescriptor; - errorTextureDescriptor.size.depth = 0; + errorTextureDescriptor.size.depthOrArrayLayers = 0; ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor)); wgpu::ImageCopyTexture errorImageCopyTexture =
diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp index 9de9bdc..b02ec28 100644 --- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
@@ -55,7 +55,7 @@ descriptor.dimension = dimension; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = arrayLayerCount; + descriptor.size.depthOrArrayLayers = arrayLayerCount; descriptor.sampleCount = sampleCount; descriptor.format = format; descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp index 93175ea..1a9aaac 100644 --- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -238,7 +238,7 @@ wgpu::TextureDescriptor baseTextureDescriptor; baseTextureDescriptor.size.width = 4; baseTextureDescriptor.size.height = 4; - baseTextureDescriptor.size.depth = 1; + baseTextureDescriptor.size.depthOrArrayLayers = 1; baseTextureDescriptor.mipLevelCount = 1; baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D; baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp index 7ff68f0..48da264 100644 --- a/src/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/tests/unittests/validation/TextureValidationTests.cpp
@@ -33,7 +33,7 @@ wgpu::TextureDescriptor descriptor; descriptor.size.width = kWidth; descriptor.size.height = kHeight; - descriptor.size.depth = kDefaultDepth; + descriptor.size.depthOrArrayLayers = kDefaultDepth; descriptor.mipLevelCount = kDefaultMipLevels; descriptor.sampleCount = kDefaultSampleCount; descriptor.dimension = wgpu::TextureDimension::e2D; @@ -109,7 +109,7 @@ { wgpu::TextureDescriptor descriptor = defaultDescriptor; descriptor.sampleCount = 4; - descriptor.size.depth = 2; + descriptor.size.depthOrArrayLayers = 2; ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); } @@ -217,7 +217,7 @@ wgpu::TextureDescriptor descriptor = defaultDescriptor; descriptor.size.width = 32; descriptor.size.height = 8; - descriptor.size.depth = 64; + descriptor.size.depthOrArrayLayers = 64; descriptor.dimension = wgpu::TextureDimension::e3D; // Non square mip map halves width, height and depth until a 1x1x1 dimension for a 3D // texture. So there are 7 mipmaps at most: 32 * 8 * 64, 16 * 4 * 32, 8 * 2 * 16, @@ -231,7 +231,7 @@ wgpu::TextureDescriptor descriptor = defaultDescriptor; descriptor.size.width = 32; descriptor.size.height = 8; - descriptor.size.depth = 64; + descriptor.size.depthOrArrayLayers = 64; // Non square mip map halves width and height until a 1x1 dimension for a 2D texture, // even its depth > 1. So there are 6 mipmaps at most: 32 * 8, 16 * 4, 8 * 2, 4 * 1, 2 * // 1, 1 * 1. @@ -261,21 +261,21 @@ { wgpu::TextureDescriptor descriptor = defaultDescriptor; - descriptor.size.depth = kMaxTextureArrayLayers + 1u; + descriptor.size.depthOrArrayLayers = kMaxTextureArrayLayers + 1u; ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); } // Array layer count less than kMaxTextureArrayLayers is allowed { wgpu::TextureDescriptor descriptor = defaultDescriptor; - descriptor.size.depth = kMaxTextureArrayLayers >> 1; + descriptor.size.depthOrArrayLayers = kMaxTextureArrayLayers >> 1; device.CreateTexture(&descriptor); } // Array layer count equal to kMaxTextureArrayLayers is allowed { wgpu::TextureDescriptor descriptor = defaultDescriptor; - descriptor.size.depth = kMaxTextureArrayLayers; + descriptor.size.depthOrArrayLayers = kMaxTextureArrayLayers; device.CreateTexture(&descriptor); } } @@ -602,7 +602,7 @@ for (wgpu::TextureFormat format : utils::kBCFormats) { wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); descriptor.format = format; - descriptor.size.depth = 6; + descriptor.size.depthOrArrayLayers = 6; device.CreateTexture(&descriptor); } } @@ -612,7 +612,7 @@ for (wgpu::TextureFormat format : utils::kBCFormats) { wgpu::TextureDescriptor descriptor = CreateDefaultTextureDescriptor(); descriptor.format = format; - descriptor.size.depth = 4; + descriptor.size.depthOrArrayLayers = 4; descriptor.dimension = wgpu::TextureDimension::e3D; ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor)); }
diff --git a/src/tests/unittests/validation/TextureViewValidationTests.cpp b/src/tests/unittests/validation/TextureViewValidationTests.cpp index e2f5476..31ad3c1 100644 --- a/src/tests/unittests/validation/TextureViewValidationTests.cpp +++ b/src/tests/unittests/validation/TextureViewValidationTests.cpp
@@ -35,7 +35,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = arrayLayerCount; + descriptor.size.depthOrArrayLayers = arrayLayerCount; descriptor.sampleCount = sampleCount; descriptor.format = kDefaultTextureFormat; descriptor.mipLevelCount = mipLevelCount;
diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp index 27b3c9c..d4a5ba9 100644 --- a/src/tests/unittests/validation/ValidationTest.cpp +++ b/src/tests/unittests/validation/ValidationTest.cpp
@@ -187,7 +187,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = attachmentFormat; descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/tests/white_box/D3D12DescriptorHeapTests.cpp index 41985b1..cbbe21d 100644 --- a/src/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
@@ -73,7 +73,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = format; descriptor.mipLevelCount = 1; @@ -747,7 +747,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = kRTSize; descriptor.size.height = kRTSize; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/D3D12ResourceHeapTests.cpp b/src/tests/white_box/D3D12ResourceHeapTests.cpp index 450cb9e..b9606ce 100644 --- a/src/tests/white_box/D3D12ResourceHeapTests.cpp +++ b/src/tests/white_box/D3D12ResourceHeapTests.cpp
@@ -54,7 +54,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = 8; descriptor.size.height = 8; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::BC1RGBAUnorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp index 1ab886b..c5b36e6 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
@@ -225,7 +225,7 @@ // Test an error occurs if the descriptor depth isn't 1 TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) { - defaultDescriptor.size.depth = 2; + defaultDescriptor.size.depthOrArrayLayers = 2; ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage(device, &defaultDescriptor, defaultFd, @@ -770,7 +770,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = 640; descriptor.size.height = 480; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::BGRA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp index 7df34ab..9e16567 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
@@ -314,7 +314,7 @@ // Test an error occurs if the descriptor depth isn't 1 TEST_P(VulkanImageWrappingValidationTests, InvalidDepth) { DAWN_SKIP_TEST_IF(UsesWire()); - defaultDescriptor.size.depth = 2; + defaultDescriptor.size.depthOrArrayLayers = 2; ASSERT_DEVICE_ERROR(wgpu::Texture texture = WrapVulkanImage( device, &defaultDescriptor, defaultFd, defaultAllocationSize, @@ -929,7 +929,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = 640; descriptor.size.height = 480; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = wgpu::TextureFormat::BGRA8Unorm; descriptor.mipLevelCount = 1;
diff --git a/src/utils/TestUtils.cpp b/src/utils/TestUtils.cpp index 323c3c2..673ad78 100644 --- a/src/utils/TestUtils.cpp +++ b/src/utils/TestUtils.cpp
@@ -40,7 +40,8 @@ TextureDataCopyLayout layout; layout.mipSize = {textureSizeAtLevel0.width >> mipmapLevel, - textureSizeAtLevel0.height >> mipmapLevel, textureSizeAtLevel0.depth}; + textureSizeAtLevel0.height >> mipmapLevel, + textureSizeAtLevel0.depthOrArrayLayers}; layout.bytesPerRow = GetMinimumBytesPerRow(format, layout.mipSize.width); @@ -83,7 +84,7 @@ ASSERT(copyExtent.height % blockHeight == 0); uint32_t heightInBlocks = copyExtent.height / blockHeight; return RequiredBytesInCopy(bytesPerRow, rowsPerImage, widthInBlocks, heightInBlocks, - copyExtent.depth, blockSize); + copyExtent.depthOrArrayLayers, blockSize); } uint64_t RequiredBytesInCopy(uint64_t bytesPerRow,
diff --git a/src/utils/WGPUHelpers.cpp b/src/utils/WGPUHelpers.cpp index 8370c91..751c4e5 100644 --- a/src/utils/WGPUHelpers.cpp +++ b/src/utils/WGPUHelpers.cpp
@@ -258,7 +258,7 @@ descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.size.width = width; descriptor.size.height = height; - descriptor.size.depth = 1; + descriptor.size.depthOrArrayLayers = 1; descriptor.sampleCount = 1; descriptor.format = BasicRenderPass::kDefaultColorFormat; descriptor.mipLevelCount = 1;