mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Drop deprecated rowsPerImage/bytesPerRow behavior
Removes the last remaining code paths supporting the old rowsPerImage and bytesPerRow defaulting behavior, and updates all related tests to strictly expect the spec-complaint behavior. Change-Id: I022db0b142939d82e33d5989460488881e5a1ab3 Bug: dawn:520 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/56803 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
fc37b32c55
commit
aeff235dc3
@@ -693,18 +693,18 @@ namespace dawn_native {
|
||||
}
|
||||
const TexelBlockInfo& blockInfo =
|
||||
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
||||
TextureDataLayout srcLayout = FixUpDeprecatedTextureDataLayoutOptions(
|
||||
GetDevice(), source->layout, blockInfo, *copySize);
|
||||
if (GetDevice()->IsValidationEnabled()) {
|
||||
DAWN_TRY(ValidateLinearTextureCopyOffset(
|
||||
srcLayout, blockInfo, destination->texture->GetFormat().HasDepthOrStencil()));
|
||||
DAWN_TRY(ValidateLinearTextureData(srcLayout, source->buffer->GetSize(), blockInfo,
|
||||
*copySize));
|
||||
source->layout, blockInfo,
|
||||
destination->texture->GetFormat().HasDepthOrStencil()));
|
||||
DAWN_TRY(ValidateLinearTextureData(source->layout, source->buffer->GetSize(),
|
||||
blockInfo, *copySize));
|
||||
|
||||
mTopLevelBuffers.insert(source->buffer);
|
||||
mTopLevelTextures.insert(destination->texture);
|
||||
}
|
||||
|
||||
TextureDataLayout srcLayout = source->layout;
|
||||
ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, *copySize);
|
||||
|
||||
CopyBufferToTextureCmd* copy =
|
||||
@@ -745,18 +745,18 @@ namespace dawn_native {
|
||||
}
|
||||
const TexelBlockInfo& blockInfo =
|
||||
source->texture->GetFormat().GetAspectInfo(source->aspect).block;
|
||||
TextureDataLayout dstLayout = FixUpDeprecatedTextureDataLayoutOptions(
|
||||
GetDevice(), destination->layout, blockInfo, *copySize);
|
||||
if (GetDevice()->IsValidationEnabled()) {
|
||||
DAWN_TRY(ValidateLinearTextureCopyOffset(
|
||||
dstLayout, blockInfo, source->texture->GetFormat().HasDepthOrStencil()));
|
||||
DAWN_TRY(ValidateLinearTextureData(dstLayout, destination->buffer->GetSize(),
|
||||
blockInfo, *copySize));
|
||||
destination->layout, blockInfo,
|
||||
source->texture->GetFormat().HasDepthOrStencil()));
|
||||
DAWN_TRY(ValidateLinearTextureData(
|
||||
destination->layout, destination->buffer->GetSize(), blockInfo, *copySize));
|
||||
|
||||
mTopLevelTextures.insert(source->texture);
|
||||
mTopLevelBuffers.insert(destination->buffer);
|
||||
}
|
||||
|
||||
TextureDataLayout dstLayout = destination->layout;
|
||||
ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, *copySize);
|
||||
|
||||
CopyTextureToBufferCmd* copy =
|
||||
|
||||
@@ -143,45 +143,6 @@ namespace dawn_native {
|
||||
return {};
|
||||
}
|
||||
|
||||
TextureDataLayout FixUpDeprecatedTextureDataLayoutOptions(
|
||||
DeviceBase* device,
|
||||
const TextureDataLayout& originalLayout,
|
||||
const TexelBlockInfo& blockInfo,
|
||||
const Extent3D& copyExtent) {
|
||||
// TODO(crbug.com/dawn/520): Remove deprecated functionality.
|
||||
TextureDataLayout layout = originalLayout;
|
||||
|
||||
if (copyExtent.height != 0 && layout.rowsPerImage == 0) {
|
||||
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.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).");
|
||||
layout.rowsPerImage = wgpu::kCopyStrideUndefined;
|
||||
}
|
||||
}
|
||||
|
||||
// Only bother to fix-up for height == 1 && depth == 1.
|
||||
// The other cases that used to be allowed were zero-size copies.
|
||||
ASSERT(copyExtent.width % blockInfo.width == 0);
|
||||
uint32_t widthInBlocks = copyExtent.width / blockInfo.width;
|
||||
uint32_t bytesInLastRow = widthInBlocks * blockInfo.byteSize;
|
||||
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 "
|
||||
"or left unspecified.");
|
||||
layout.bytesPerRow = wgpu::kCopyStrideUndefined;
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
|
||||
// Replace wgpu::kCopyStrideUndefined with real values, so backends don't have to think about
|
||||
// it.
|
||||
void ApplyDefaultTextureDataLayoutOptions(TextureDataLayout* layout,
|
||||
|
||||
@@ -36,11 +36,6 @@ namespace dawn_native {
|
||||
uint32_t bytesPerRow,
|
||||
uint32_t rowsPerImage);
|
||||
|
||||
TextureDataLayout FixUpDeprecatedTextureDataLayoutOptions(
|
||||
DeviceBase* device,
|
||||
const TextureDataLayout& originalLayout,
|
||||
const TexelBlockInfo& blockInfo,
|
||||
const Extent3D& copyExtent);
|
||||
void ApplyDefaultTextureDataLayoutOptions(TextureDataLayout* layout,
|
||||
const TexelBlockInfo& blockInfo,
|
||||
const Extent3D& copyExtent);
|
||||
|
||||
@@ -278,13 +278,13 @@ namespace dawn_native {
|
||||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize) {
|
||||
GetDevice()->ConsumedError(
|
||||
WriteTextureInternal(destination, data, dataSize, dataLayout, writeSize));
|
||||
WriteTextureInternal(destination, data, dataSize, *dataLayout, writeSize));
|
||||
}
|
||||
|
||||
MaybeError QueueBase::WriteTextureInternal(const ImageCopyTexture* destination,
|
||||
const void* data,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D* writeSize) {
|
||||
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, writeSize));
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace dawn_native {
|
||||
|
||||
const TexelBlockInfo& blockInfo =
|
||||
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
||||
TextureDataLayout layout = *dataLayout;
|
||||
TextureDataLayout layout = dataLayout;
|
||||
ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, *writeSize);
|
||||
return WriteTextureImpl(*destination, data, layout, *writeSize);
|
||||
}
|
||||
@@ -460,7 +460,7 @@ namespace dawn_native {
|
||||
|
||||
MaybeError QueueBase::ValidateWriteTexture(const ImageCopyTexture* destination,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D* writeSize) const {
|
||||
DAWN_TRY(GetDevice()->ValidateIsAlive());
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
@@ -468,7 +468,7 @@ namespace dawn_native {
|
||||
|
||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *writeSize));
|
||||
|
||||
if (dataLayout->offset > dataSize) {
|
||||
if (dataLayout.offset > dataSize) {
|
||||
return DAWN_VALIDATION_ERROR("Queue::WriteTexture out of range");
|
||||
}
|
||||
|
||||
@@ -490,9 +490,7 @@ namespace dawn_native {
|
||||
const TexelBlockInfo& blockInfo =
|
||||
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
|
||||
|
||||
TextureDataLayout layout = FixUpDeprecatedTextureDataLayoutOptions(GetDevice(), *dataLayout,
|
||||
blockInfo, *writeSize);
|
||||
DAWN_TRY(ValidateLinearTextureData(layout, dataSize, blockInfo, *writeSize));
|
||||
DAWN_TRY(ValidateLinearTextureData(dataLayout, dataSize, blockInfo, *writeSize));
|
||||
|
||||
DAWN_TRY(destination->texture->ValidateCanUseInSubmitNow());
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace dawn_native {
|
||||
MaybeError WriteTextureInternal(const ImageCopyTexture* destination,
|
||||
const void* data,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D* writeSize);
|
||||
MaybeError CopyTextureForBrowserInternal(const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
@@ -97,7 +97,7 @@ namespace dawn_native {
|
||||
size_t size) const;
|
||||
MaybeError ValidateWriteTexture(const ImageCopyTexture* destination,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D* writeSize) const;
|
||||
|
||||
void SubmitInternal(uint32_t commandCount, CommandBufferBase* const* commands);
|
||||
|
||||
Reference in New Issue
Block a user