Commit fc9980cd authored by Kai Ninomiya's avatar Kai Ninomiya Committed by Commit Bot

WebGPU: deprecate GPUTextureCopyView.arrayLayer

Bug: 1069302
Change-Id: Iaa4a7ed6f20d4e625dbf9127d325121b1d56fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2223092
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773892}
parent bd7bb638
......@@ -11,6 +11,7 @@
#include "third_party/blink/renderer/bindings/modules/v8/unsigned_long_enforce_range_sequence_or_gpu_origin_3d_dict.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_programmable_stage_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_copy_view.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_shader_module.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
......@@ -750,7 +751,8 @@ WGPUOrigin3D AsDawnType(
return dawn_origin;
}
WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view) {
WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view,
GPUDevice* device) {
DCHECK(webgpu_view);
DCHECK(webgpu_view->texture());
......@@ -758,9 +760,17 @@ WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view) {
dawn_view.nextInChain = nullptr;
dawn_view.texture = webgpu_view->texture()->GetHandle();
dawn_view.mipLevel = webgpu_view->mipLevel();
dawn_view.arrayLayer = webgpu_view->arrayLayer();
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;
}
......
......@@ -46,7 +46,8 @@ WGPUExtent3D AsDawnType(
const UnsignedLongEnforceRangeSequenceOrGPUExtent3DDict*);
WGPUOrigin3D AsDawnType(
const UnsignedLongEnforceRangeSequenceOrGPUOrigin3DDict*);
WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view);
WGPUTextureCopyView AsDawnType(const GPUTextureCopyView* webgpu_view,
GPUDevice* device);
using OwnedProgrammableStageDescriptor =
std::tuple<WGPUProgrammableStageDescriptor, std::unique_ptr<char[]>>;
OwnedProgrammableStageDescriptor AsDawnType(
......
......@@ -254,7 +254,7 @@ void GPUCommandEncoder::copyBufferToTexture(
if (!dawn_source) {
return;
}
WGPUTextureCopyView dawn_destination = AsDawnType(destination);
WGPUTextureCopyView dawn_destination = AsDawnType(destination, device_);
WGPUExtent3D dawn_copy_size = AsDawnType(&copy_size);
GetProcs().commandEncoderCopyBufferToTexture(
......@@ -271,7 +271,7 @@ void GPUCommandEncoder::copyTextureToBuffer(
return;
}
WGPUTextureCopyView dawn_source = AsDawnType(source);
WGPUTextureCopyView dawn_source = AsDawnType(source, device_);
base::Optional<WGPUBufferCopyView> dawn_destination = AsDawnType(destination);
if (!dawn_destination) {
return;
......@@ -293,8 +293,8 @@ void GPUCommandEncoder::copyTextureToTexture(
return;
}
WGPUTextureCopyView dawn_source = AsDawnType(source);
WGPUTextureCopyView dawn_destination = AsDawnType(destination);
WGPUTextureCopyView dawn_source = AsDawnType(source, device_);
WGPUTextureCopyView dawn_destination = AsDawnType(destination, device_);
WGPUExtent3D dawn_copy_size = AsDawnType(&copy_size);
GetProcs().commandEncoderCopyTextureToTexture(
......
......@@ -258,7 +258,7 @@ void GPUQueue::copyImageBitmapToTexture(
return;
}
WGPUTextureCopyView dawn_destination = AsDawnType(destination);
WGPUTextureCopyView dawn_destination = AsDawnType(destination, device_);
const CanvasColorParams& color_params =
source->imageBitmap()->GetCanvasColorParams();
......
......@@ -7,6 +7,6 @@
dictionary GPUTextureCopyView {
required GPUTexture texture;
GPUSize32 mipLevel = 0;
GPUSize32 arrayLayer = 0;
GPUSize32 arrayLayer;
GPUOrigin3D origin = {};
};
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