Commit c0338bf6 authored by Yan's avatar Yan Committed by Commit Bot

Add copyImageBitmapToTexture API in blink

copyImageBitmapToTexture API is part of WebGPU spec that copy image bitmap to a
WebGPU texture.

This patch adds idl related part for copyImageBitmapToTexture.

BUG=966582

Change-Id: I08ffa4f8b42f2b6686bd6d197d9356fa2da241ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899173
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721913}
parent 092b3741
......@@ -96,6 +96,8 @@ bindings_modules_generated_union_type_files = [
"$bindings_modules_v8_output_dir/unsigned_long_or_unsigned_long_sequence.h",
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_extent_3d_dict.cc",
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_extent_3d_dict.h",
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_origin_2d_dict.cc",
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_origin_2d_dict.h",
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_origin_3d_dict.cc",
"$bindings_modules_v8_output_dir/unsigned_long_sequence_or_gpu_origin_3d_dict.h",
"$bindings_modules_v8_output_dir/webgl_rendering_context_or_webgl2_rendering_context.cc",
......
......@@ -849,8 +849,10 @@ modules_dictionary_idl_files =
"webgpu/gpu_extensions.idl",
"webgpu/gpu_extent_3d_dict.idl",
"webgpu/gpu_fence_descriptor.idl",
"webgpu/gpu_image_bitmap_copy_view.idl",
"webgpu/gpu_limits.idl",
"webgpu/gpu_object_descriptor_base.idl",
"webgpu/gpu_origin_2d_dict.idl",
"webgpu/gpu_origin_3d_dict.idl",
"webgpu/gpu_pipeline_descriptor_base.idl",
"webgpu/gpu_pipeline_layout_descriptor.idl",
......
......@@ -7,6 +7,7 @@
typedef unsigned long long GPUBufferSize;
typedef (sequence<double> or GPUColorDict) GPUColor;
typedef (sequence<unsigned long> or GPUExtent3DDict) GPUExtent3D;
typedef (sequence<unsigned long> or GPUOrigin2DDict) GPUOrigin2D;
typedef (sequence<unsigned long> or GPUOrigin3DDict) GPUOrigin3D;
[
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://gpuweb.github.io/gpuweb/
dictionary GPUImageBitmapCopyView {
required ImageBitmap imageBitmap;
GPUOrigin2D origin = {};
};
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://gpuweb.github.io/gpuweb/
dictionary GPUOrigin2DDict {
unsigned long x = 0;
unsigned long y = 0;
};
......@@ -5,11 +5,16 @@
#include "third_party/blink/renderer/modules/webgpu/gpu_queue.h"
#include "gpu/command_buffer/client/webgpu_interface.h"
#include "third_party/blink/renderer/bindings/modules/v8/unsigned_long_sequence_or_gpu_extent_3d_dict.h"
#include "third_party/blink/renderer/bindings/modules/v8/unsigned_long_sequence_or_gpu_origin_2d_dict.h"
#include "third_party/blink/renderer/bindings/modules/v8/unsigned_long_sequence_or_gpu_origin_3d_dict.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_command_buffer.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_fence.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_fence_descriptor.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_texture_copy_view.h"
namespace blink {
......@@ -59,4 +64,18 @@ GPUFence* GPUQueue::createFence(const GPUFenceDescriptor* descriptor) {
GetProcs().queueCreateFence(GetHandle(), &desc));
}
// TODO(shaobo.yan@intel.com): Implement this function
void GPUQueue::copyImageBitmapToTexture(
GPUImageBitmapCopyView* source,
GPUTextureCopyView* destination,
UnsignedLongSequenceOrGPUExtent3DDict& copy_size,
ExceptionState& exception_state) {
NOTIMPLEMENTED();
// TODO(shaobo.yan@intel.com): Validate source copy size, format and dest copy
// size format
// TODO(shaobo.yan@intel.com): Implement sharing to staging texture path.
return;
}
} // namespace blink
......@@ -6,12 +6,17 @@
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_QUEUE_H_
#include "third_party/blink/renderer/modules/webgpu/dawn_object.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
namespace blink {
class ExceptionState;
class GPUCommandBuffer;
class GPUFence;
class GPUFenceDescriptor;
class GPUImageBitmapCopyView;
class GPUTextureCopyView;
class UnsignedLongSequenceOrGPUExtent3DDict;
class GPUQueue : public DawnObject<WGPUQueue> {
DEFINE_WRAPPERTYPEINFO();
......@@ -25,7 +30,12 @@ class GPUQueue : public DawnObject<WGPUQueue> {
void submit(const HeapVector<Member<GPUCommandBuffer>>& buffers);
void signal(GPUFence* fence, uint64_t signal_value);
GPUFence* createFence(const GPUFenceDescriptor* descriptor);
void copyImageBitmapToTexture(GPUImageBitmapCopyView* source,
GPUTextureCopyView* destination,
UnsignedLongSequenceOrGPUExtent3DDict& copySize,
ExceptionState& exception_state);
private:
DISALLOW_COPY_AND_ASSIGN(GPUQueue);
};
......
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