Commit e095d73a authored by Austin Eng's avatar Austin Eng Committed by Commit Bot

Create GPUDevice from GPUDeviceDescriptor

This patch updates GPUAdapter::createDevice to take a GPUDeviceDescriptor
which will contain parameters for Device creation.

Bug: 941531
Change-Id: I2c96a892846a8ec7ee2e0cf253141faac5b871e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1521236
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641116}
parent e17fb70e
......@@ -734,6 +734,9 @@ modules_dictionary_idl_files =
"webaudio/wave_shaper_options.idl",
"webgl/webgl_context_attributes.idl",
"webgl/webgl_context_event_init.idl",
"webgpu/gpu_device_descriptor.idl",
"webgpu/gpu_extensions.idl",
"webgpu/gpu_limits.idl",
"webgpu/gpu_request_adapter_options.idl",
"webmidi/midi_connection_event_init.idl",
"webmidi/midi_message_event_init.idl",
......
......@@ -17,8 +17,8 @@ const String& GPUAdapter::name() const {
return name_;
}
GPUDevice* GPUAdapter::createDevice() {
return GPUDevice::Create(this);
GPUDevice* GPUAdapter::createDevice(const GPUDeviceDescriptor* descriptor) {
return GPUDevice::Create(this, descriptor);
}
GPUAdapter::GPUAdapter(const String& name) : name_(name) {}
......
......@@ -12,6 +12,7 @@
namespace blink {
class GPUDevice;
class GPUDeviceDescriptor;
class GPUAdapter final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
......@@ -23,7 +24,7 @@ class GPUAdapter final : public ScriptWrappable {
const String& name() const;
GPUDevice* createDevice();
GPUDevice* createDevice(const GPUDeviceDescriptor* descriptor);
private:
String name_;
......
......@@ -9,5 +9,5 @@
] interface GPUAdapter {
readonly attribute DOMString name;
GPUDevice createDevice();
GPUDevice createDevice(GPUDeviceDescriptor descriptor);
};
......@@ -6,14 +6,20 @@
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_adapter.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device_descriptor.h"
namespace blink {
// static
GPUDevice* GPUDevice::Create(GPUAdapter* adapter) {
return MakeGarbageCollected<GPUDevice>(adapter);
GPUDevice* GPUDevice::Create(GPUAdapter* adapter,
const GPUDeviceDescriptor* descriptor) {
return MakeGarbageCollected<GPUDevice>(adapter, descriptor);
}
// TODO(enga): Handle adapter options and device descriptor
GPUDevice::GPUDevice(GPUAdapter* adapter, const GPUDeviceDescriptor* descriptor)
: adapter_(adapter) {}
GPUAdapter* GPUDevice::adapter() const {
return adapter_;
}
......@@ -23,6 +29,4 @@ void GPUDevice::Trace(blink::Visitor* visitor) {
ScriptWrappable::Trace(visitor);
}
GPUDevice::GPUDevice(GPUAdapter* adapter) : adapter_(adapter) {}
} // namespace blink
......@@ -10,14 +10,16 @@
namespace blink {
class GPUAdapter;
class GPUDeviceDescriptor;
class GPUDevice final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
static GPUDevice* Create(GPUAdapter*);
static GPUDevice* Create(GPUAdapter* adapter,
const GPUDeviceDescriptor* descriptor);
GPUDevice(GPUAdapter*);
GPUDevice(GPUAdapter* adapter, const GPUDeviceDescriptor* descriptor);
GPUAdapter* adapter() const;
......
// 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://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
dictionary GPUDeviceDescriptor {
GPUExtensions extensions;
GPULimits limits;
};
// 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://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
dictionary GPUExtensions {
};
// 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://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
dictionary GPULimits {
};
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