Commit f9dfe985 authored by Corentin Wallez's avatar Corentin Wallez Committed by Commit Bot

WebGPU: remove simple deprecated code paths

Following the PSA for API deprecations, the following are removed:

 - GPUTextureDescriptor.arrayLayerCount
 - GPUTextureCopyView.arrayLayer
 - GPUBuffer.setSubData

Also updates a couple uses of the deprecated WGPUBufferCopyView members.

Bug: dawn:22
Change-Id: If826f85a42cb9c713bb958ef29a512b8583e3f41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2351970Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797404}
parent eb956ee2
...@@ -772,15 +772,6 @@ WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view, ...@@ -772,15 +772,6 @@ WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view,
dawn_view.mipLevel = webgpu_view->mipLevel(); dawn_view.mipLevel = webgpu_view->mipLevel();
dawn_view.origin = AsDawnType(&webgpu_view->origin()); dawn_view.origin = AsDawnType(&webgpu_view->origin());
if (webgpu_view->hasArrayLayer()) {
device->AddConsoleWarning(
"GPUTextureCopyView.arrayLayer deprecated: use .origin.z");
dawn_view.arrayLayer = webgpu_view->arrayLayer();
} else {
dawn_view.arrayLayer = dawn_view.origin.z;
dawn_view.origin.z = 0;
}
return dawn_view; return dawn_view;
} }
......
...@@ -138,34 +138,6 @@ void GPUBuffer::Trace(Visitor* visitor) const { ...@@ -138,34 +138,6 @@ void GPUBuffer::Trace(Visitor* visitor) const {
DawnObject<WGPUBuffer>::Trace(visitor); DawnObject<WGPUBuffer>::Trace(visitor);
} }
void GPUBuffer::setSubData(uint64_t dst_byte_offset,
const FlexibleArrayBufferView& src,
uint64_t src_byte_offset,
uint64_t byte_length,
ExceptionState& exception_state) {
device_->AddConsoleWarning(
"GPUBuffer.setSubData is deprecated: use GPUQueue.writeBuffer instead");
const uint8_t* src_base =
reinterpret_cast<const uint8_t*>(src.BaseAddressMaybeOnStack());
size_t src_byte_length = src.ByteLengthAsSizeT();
if (src_byte_offset > src_byte_length) {
exception_state.ThrowRangeError("srcOffset is too large");
return;
}
if (byte_length == 0) {
byte_length = src_byte_length - src_byte_offset;
} else if (byte_length > src_byte_length - src_byte_offset) {
exception_state.ThrowRangeError("byteLength is too large");
return;
}
const uint8_t* data = &src_base[src_byte_offset];
GetProcs().bufferSetSubData(GetHandle(), dst_byte_offset, byte_length, data);
}
void GPUBuffer::OnOldMapAsyncCallback(ScriptPromiseResolver* resolver, void GPUBuffer::OnOldMapAsyncCallback(ScriptPromiseResolver* resolver,
WGPUBufferMapAsyncStatus status, WGPUBufferMapAsyncStatus status,
void* data, void* data,
......
...@@ -37,11 +37,6 @@ class GPUBuffer : public DawnObject<WGPUBuffer> { ...@@ -37,11 +37,6 @@ class GPUBuffer : public DawnObject<WGPUBuffer> {
void Trace(Visitor* visitor) const override; void Trace(Visitor* visitor) const override;
// gpu_buffer.idl // gpu_buffer.idl
void setSubData(uint64_t dst_byte_offset,
const FlexibleArrayBufferView& src,
uint64_t src_byte_offset,
uint64_t byte_length,
ExceptionState& exception_state);
ScriptPromise mapAsync(ScriptState* script_state, ScriptPromise mapAsync(ScriptState* script_state,
uint32_t mode, uint32_t mode,
uint64_t offset, uint64_t offset,
......
...@@ -7,11 +7,6 @@ ...@@ -7,11 +7,6 @@
[ [
Exposed(Window WebGPU, Worker WebGPU) Exposed(Window WebGPU, Worker WebGPU)
] interface GPUBuffer { ] interface GPUBuffer {
[RaisesException] void setSubData(
GPUSize64 dstOffset,
[AllowShared, FlexibleArrayBufferView] ArrayBufferView src,
optional GPUSize64 srcOffset = 0,
optional GPUSize64 byteLength = 0);
[CallWith=ScriptState, RaisesException] Promise<void> mapAsync( [CallWith=ScriptState, RaisesException] Promise<void> mapAsync(
GPUMapModeFlags mode, GPUMapModeFlags mode,
optional GPUSize64 offset = 0, optional GPUSize64 offset = 0,
......
...@@ -115,9 +115,9 @@ WGPUBufferCopyView AsDawnType(const GPUBufferCopyView* webgpu_view) { ...@@ -115,9 +115,9 @@ WGPUBufferCopyView AsDawnType(const GPUBufferCopyView* webgpu_view) {
WGPUBufferCopyView dawn_view = {}; WGPUBufferCopyView dawn_view = {};
dawn_view.nextInChain = nullptr; dawn_view.nextInChain = nullptr;
dawn_view.buffer = webgpu_view->buffer()->GetHandle(); dawn_view.buffer = webgpu_view->buffer()->GetHandle();
dawn_view.offset = webgpu_view->offset(); dawn_view.layout.offset = webgpu_view->offset();
dawn_view.bytesPerRow = webgpu_view->bytesPerRow(); dawn_view.layout.bytesPerRow = webgpu_view->bytesPerRow();
dawn_view.rowsPerImage = webgpu_view->rowsPerImage(); dawn_view.layout.rowsPerImage = webgpu_view->rowsPerImage();
return dawn_view; return dawn_view;
} }
......
...@@ -436,9 +436,9 @@ bool GPUQueue::CopyContentFromCPU(StaticBitmapImage* image, ...@@ -436,9 +436,9 @@ bool GPUQueue::CopyContentFromCPU(StaticBitmapImage* image,
WGPUBufferCopyView dawn_intermediate = {}; WGPUBufferCopyView dawn_intermediate = {};
dawn_intermediate.nextInChain = nullptr; dawn_intermediate.nextInChain = nullptr;
dawn_intermediate.buffer = buffer; dawn_intermediate.buffer = buffer;
dawn_intermediate.offset = 0; dawn_intermediate.layout.offset = 0;
dawn_intermediate.bytesPerRow = info.wgpu_bytes_per_row; dawn_intermediate.layout.bytesPerRow = info.wgpu_bytes_per_row;
dawn_intermediate.rowsPerImage = image->height(); dawn_intermediate.layout.rowsPerImage = image->height();
WGPUCommandEncoder encoder = WGPUCommandEncoder encoder =
GetProcs().deviceCreateCommandEncoder(device_->GetHandle(), nullptr); GetProcs().deviceCreateCommandEncoder(device_->GetHandle(), nullptr);
......
...@@ -24,20 +24,10 @@ WGPUTextureDescriptor AsDawnType(const GPUTextureDescriptor* webgpu_desc, ...@@ -24,20 +24,10 @@ WGPUTextureDescriptor AsDawnType(const GPUTextureDescriptor* webgpu_desc,
dawn_desc.dimension = dawn_desc.dimension =
AsDawnEnum<WGPUTextureDimension>(webgpu_desc->dimension()); AsDawnEnum<WGPUTextureDimension>(webgpu_desc->dimension());
dawn_desc.size = AsDawnType(&webgpu_desc->size()); dawn_desc.size = AsDawnType(&webgpu_desc->size());
if (webgpu_desc->hasArrayLayerCount()) {
device->AddConsoleWarning("arrayLayerCount is deprecated: use size.depth");
dawn_desc.arrayLayerCount = webgpu_desc->arrayLayerCount();
} else {
if (dawn_desc.dimension == WGPUTextureDimension_2D) {
dawn_desc.arrayLayerCount = dawn_desc.size.depth;
dawn_desc.size.depth = 1;
}
}
dawn_desc.format = AsDawnEnum<WGPUTextureFormat>(webgpu_desc->format()); dawn_desc.format = AsDawnEnum<WGPUTextureFormat>(webgpu_desc->format());
dawn_desc.mipLevelCount = webgpu_desc->mipLevelCount(); dawn_desc.mipLevelCount = webgpu_desc->mipLevelCount();
dawn_desc.sampleCount = webgpu_desc->sampleCount(); dawn_desc.sampleCount = webgpu_desc->sampleCount();
if (webgpu_desc->hasLabel()) { if (webgpu_desc->hasLabel()) {
dawn_desc.label = webgpu_desc->label().Utf8().data(); dawn_desc.label = webgpu_desc->label().Utf8().data();
} }
......
...@@ -7,6 +7,5 @@ ...@@ -7,6 +7,5 @@
dictionary GPUTextureCopyView { dictionary GPUTextureCopyView {
required GPUTexture texture; required GPUTexture texture;
GPUSize32 mipLevel = 0; GPUSize32 mipLevel = 0;
GPUSize32 arrayLayer;
GPUOrigin3D origin = {}; GPUOrigin3D origin = {};
}; };
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
dictionary GPUTextureDescriptor : GPUObjectDescriptorBase { dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
required GPUExtent3D size; required GPUExtent3D size;
// TODO(crbug.com/1069302): arrayLayerCount is deprecated; remove it.
unsigned long arrayLayerCount;
GPUIntegerCoordinate mipLevelCount = 1; GPUIntegerCoordinate mipLevelCount = 1;
GPUSize32 sampleCount = 1; GPUSize32 sampleCount = 1;
GPUTextureDimension dimension = "2d"; GPUTextureDimension dimension = "2d";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment