Remove deprecated API surface, Pt. 1

- Remove Device.getDefaultQueue()
 - Remove Extent3D.depth
 - Remove setIndexBufferWithFormat
 - Remove TextureUsage::OutputAttachment

Change-Id: If1c39b5630c88c3b87b37e317aafe7442419f7d0
Bug: dawn:22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50700
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Brandon Jones
2021-05-13 17:51:23 +00:00
committed by Commit Bot service account
parent 82ba34a941
commit 76e5a9f6dd
16 changed files with 44 additions and 442 deletions

View File

@@ -653,14 +653,11 @@ namespace dawn_native {
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, fixedCopySize));
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(destination->texture));
@@ -669,26 +666,26 @@ namespace dawn_native {
// 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(GetDevice(), *destination, fixedCopySize));
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, *copySize));
}
const TexelBlockInfo& blockInfo =
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
TextureDataLayout srcLayout = FixUpDeprecatedTextureDataLayoutOptions(
GetDevice(), source->layout, blockInfo, fixedCopySize);
GetDevice(), source->layout, blockInfo, *copySize);
if (GetDevice()->IsValidationEnabled()) {
DAWN_TRY(ValidateLinearTextureCopyOffset(srcLayout, blockInfo));
DAWN_TRY(ValidateLinearTextureData(srcLayout, source->buffer->GetSize(), blockInfo,
fixedCopySize));
*copySize));
mTopLevelBuffers.insert(source->buffer);
mTopLevelTextures.insert(destination->texture);
}
ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, fixedCopySize);
ApplyDefaultTextureDataLayoutOptions(&srcLayout, blockInfo, *copySize);
// Skip noop copies.
if (fixedCopySize.width != 0 && fixedCopySize.height != 0 &&
fixedCopySize.depthOrArrayLayers != 0) {
if (copySize->width != 0 && copySize->height != 0 &&
copySize->depthOrArrayLayers != 0) {
// Record the copy command.
CopyBufferToTextureCmd* copy =
allocator->Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture);
@@ -701,7 +698,7 @@ namespace dawn_native {
copy->destination.mipLevel = destination->mipLevel;
copy->destination.aspect =
ConvertAspect(destination->texture->GetFormat(), destination->aspect);
copy->copySize = fixedCopySize;
copy->copySize = *copySize;
}
return {};
@@ -712,11 +709,8 @@ namespace dawn_native {
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, fixedCopySize));
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(source->texture));
DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source));
@@ -728,26 +722,26 @@ namespace dawn_native {
// 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(GetDevice(), *source, fixedCopySize));
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, *copySize));
}
const TexelBlockInfo& blockInfo =
source->texture->GetFormat().GetAspectInfo(source->aspect).block;
TextureDataLayout dstLayout = FixUpDeprecatedTextureDataLayoutOptions(
GetDevice(), destination->layout, blockInfo, fixedCopySize);
GetDevice(), destination->layout, blockInfo, *copySize);
if (GetDevice()->IsValidationEnabled()) {
DAWN_TRY(ValidateLinearTextureCopyOffset(dstLayout, blockInfo));
DAWN_TRY(ValidateLinearTextureData(dstLayout, destination->buffer->GetSize(),
blockInfo, fixedCopySize));
blockInfo, *copySize));
mTopLevelTextures.insert(source->texture);
mTopLevelBuffers.insert(destination->buffer);
}
ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, fixedCopySize);
ApplyDefaultTextureDataLayoutOptions(&dstLayout, blockInfo, *copySize);
// Skip noop copies.
if (fixedCopySize.width != 0 && fixedCopySize.height != 0 &&
fixedCopySize.depthOrArrayLayers != 0) {
if (copySize->width != 0 && copySize->height != 0 &&
copySize->depthOrArrayLayers != 0) {
// Record the copy command.
CopyTextureToBufferCmd* copy =
allocator->Allocate<CopyTextureToBufferCmd>(Command::CopyTextureToBuffer);
@@ -759,7 +753,7 @@ namespace dawn_native {
copy->destination.offset = dstLayout.offset;
copy->destination.bytesPerRow = dstLayout.bytesPerRow;
copy->destination.rowsPerImage = dstLayout.rowsPerImage;
copy->copySize = fixedCopySize;
copy->copySize = *copySize;
}
return {};
@@ -770,20 +764,18 @@ namespace dawn_native {
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, fixedCopySize));
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, fixedCopySize));
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
DAWN_TRY(
ValidateTextureToTextureCopyRestrictions(*source, *destination, fixedCopySize));
ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize));
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, fixedCopySize));
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, fixedCopySize));
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *source, *copySize));
DAWN_TRY(ValidateTextureCopyRange(GetDevice(), *destination, *copySize));
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
@@ -793,8 +785,8 @@ namespace dawn_native {
}
// Skip noop copies.
if (fixedCopySize.width != 0 && fixedCopySize.height != 0 &&
fixedCopySize.depthOrArrayLayers != 0) {
if (copySize->width != 0 && copySize->height != 0 &&
copySize->depthOrArrayLayers != 0) {
CopyTextureToTextureCmd* copy =
allocator->Allocate<CopyTextureToTextureCmd>(Command::CopyTextureToTexture);
copy->source.texture = source->texture;
@@ -806,7 +798,7 @@ namespace dawn_native {
copy->destination.mipLevel = destination->mipLevel;
copy->destination.aspect =
ConvertAspect(destination->texture->GetFormat(), destination->aspect);
copy->copySize = fixedCopySize;
copy->copySize = *copySize;
}
return {};

View File

@@ -455,8 +455,8 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Source texture must have sampled usage");
}
if (!(dst.texture->GetUsage() & wgpu::TextureUsage::OutputAttachment)) {
return DAWN_VALIDATION_ERROR("Dest texture must have outputAttachment usage");
if (!(dst.texture->GetUsage() & wgpu::TextureUsage::RenderAttachment)) {
return DAWN_VALIDATION_ERROR("Dest texture must have RenderAttachment usage");
}
return ValidateTextureToTextureCopyCommonRestrictions(src, dst, copySize);

View File

@@ -985,12 +985,6 @@ namespace dawn_native {
return mQueue.Get();
}
QueueBase* DeviceBase::APIGetDefaultQueue() {
EmitDeprecationWarning(
"Device::GetDefaultQueue is deprecated, use Device::GetQueue() instead");
return APIGetQueue();
}
ExternalTextureBase* DeviceBase::APICreateExternalTexture(
const ExternalTextureDescriptor* descriptor) {
Ref<ExternalTextureBase> result = nullptr;
@@ -1305,12 +1299,10 @@ namespace dawn_native {
ResultOrError<Ref<TextureBase>> DeviceBase::CreateTexture(const TextureDescriptor* descriptor) {
DAWN_TRY(ValidateIsAlive());
TextureDescriptor fixedDescriptor = *descriptor;
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(this, &(fixedDescriptor.size)));
if (IsValidationEnabled()) {
DAWN_TRY(ValidateTextureDescriptor(this, &fixedDescriptor));
DAWN_TRY(ValidateTextureDescriptor(this, descriptor));
}
return CreateTextureImpl(&fixedDescriptor);
return CreateTextureImpl(descriptor);
}
ResultOrError<Ref<TextureViewBase>> DeviceBase::CreateTextureView(

View File

@@ -200,8 +200,6 @@ namespace dawn_native {
// For Dawn Wire
BufferBase* APICreateErrorBuffer();
// TODO(dawn:22): Remove once the deprecation period is finished.
QueueBase* APIGetDefaultQueue();
QueueBase* APIGetQueue();
void APIInjectError(wgpu::ErrorType type, const char* message);

View File

@@ -315,21 +315,17 @@ namespace dawn_native {
size_t dataSize,
const TextureDataLayout* dataLayout,
const Extent3D* writeSize) {
Extent3D fixedWriteSize = *writeSize;
DAWN_TRY(FixUpDeprecatedGPUExtent3DDepth(GetDevice(), &fixedWriteSize));
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, writeSize));
DAWN_TRY(ValidateWriteTexture(destination, dataSize, dataLayout, &fixedWriteSize));
if (fixedWriteSize.width == 0 || fixedWriteSize.height == 0 ||
fixedWriteSize.depthOrArrayLayers == 0) {
if (writeSize->width == 0 || writeSize->height == 0 || writeSize->depthOrArrayLayers == 0) {
return {};
}
const TexelBlockInfo& blockInfo =
destination->texture->GetFormat().GetAspectInfo(destination->aspect).block;
TextureDataLayout layout = *dataLayout;
ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, fixedWriteSize);
return WriteTextureImpl(*destination, data, layout, fixedWriteSize);
ApplyDefaultTextureDataLayoutOptions(&layout, blockInfo, *writeSize);
return WriteTextureImpl(*destination, data, layout, *writeSize);
}
MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination,
@@ -389,14 +385,12 @@ namespace dawn_native {
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, &fixedCopySize,
options));
DAWN_TRY(
ValidateCopyTextureForBrowser(GetDevice(), source, destination, copySize, options));
}
return DoCopyTextureForBrowser(GetDevice(), source, destination, &fixedCopySize, options);
return DoCopyTextureForBrowser(GetDevice(), source, destination, copySize, options);
}
MaybeError QueueBase::ValidateSubmit(uint32_t commandCount,

View File

@@ -203,16 +203,6 @@ namespace dawn_native {
});
}
void RenderEncoderBase::APISetIndexBufferWithFormat(BufferBase* buffer,
wgpu::IndexFormat format,
uint64_t offset,
uint64_t size) {
GetDevice()->EmitDeprecationWarning(
"RenderEncoderBase::SetIndexBufferWithFormat is deprecated. Use "
"RenderEncoderBase::SetIndexBuffer instead.");
APISetIndexBuffer(buffer, format, offset, size);
}
void RenderEncoderBase::APISetIndexBuffer(BufferBase* buffer,
wgpu::IndexFormat format,
uint64_t offset,

View File

@@ -49,10 +49,6 @@ namespace dawn_native {
wgpu::IndexFormat format,
uint64_t offset,
uint64_t size);
void APISetIndexBufferWithFormat(BufferBase* buffer,
wgpu::IndexFormat format,
uint64_t offset,
uint64_t size);
void APISetBindGroup(uint32_t groupIndex,
BindGroupBase* group,

View File

@@ -248,26 +248,6 @@ namespace dawn_native {
} // 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->nextInChain != nullptr) {

View File

@@ -39,8 +39,6 @@ namespace dawn_native {
bool IsValidSampleCount(uint32_t sampleCount);
MaybeError FixUpDeprecatedGPUExtent3DDepth(DeviceBase* device, Extent3D* extent);
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture;