Add AdapterBase::APIGetInstance
This method is useful for Chrome to query the Instance from Device by calling device.GetAdapter().GetInstance(). Then instance.ProcessEvents() can be used to poll for events instead of device.Tick(). Bug: dawn:1726 Change-Id: I45b5760bc07869a191ae3fd02ec25b99d78b068b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125360 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
86adbdadf0
commit
99b8081e31
|
@ -78,6 +78,11 @@
|
||||||
"adapter": {
|
"adapter": {
|
||||||
"category": "object",
|
"category": "object",
|
||||||
"methods": [
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "get instance",
|
||||||
|
"tags": ["dawn"],
|
||||||
|
"returns": "instance"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "get limits",
|
"name": "get limits",
|
||||||
"returns": "bool",
|
"returns": "bool",
|
||||||
|
|
|
@ -219,6 +219,7 @@
|
||||||
"TextureGetUsage"
|
"TextureGetUsage"
|
||||||
],
|
],
|
||||||
"client_handwritten_commands": [
|
"client_handwritten_commands": [
|
||||||
|
"AdapterGetInstance",
|
||||||
"BufferDestroy",
|
"BufferDestroy",
|
||||||
"BufferUnmap",
|
"BufferUnmap",
|
||||||
"DeviceCreateErrorBuffer",
|
"DeviceCreateErrorBuffer",
|
||||||
|
|
|
@ -83,6 +83,13 @@ MaybeError AdapterBase::Initialize() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InstanceBase* AdapterBase::APIGetInstance() const {
|
||||||
|
auto instance = GetInstance();
|
||||||
|
ASSERT(instance != nullptr);
|
||||||
|
instance->Reference();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
bool AdapterBase::APIGetLimits(SupportedLimits* limits) const {
|
bool AdapterBase::APIGetLimits(SupportedLimits* limits) const {
|
||||||
return GetLimits(limits);
|
return GetLimits(limits);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ class AdapterBase : public RefCounted {
|
||||||
MaybeError Initialize();
|
MaybeError Initialize();
|
||||||
|
|
||||||
// WebGPU API
|
// WebGPU API
|
||||||
|
InstanceBase* APIGetInstance() const;
|
||||||
bool APIGetLimits(SupportedLimits* limits) const;
|
bool APIGetLimits(SupportedLimits* limits) const;
|
||||||
void APIGetProperties(AdapterProperties* properties) const;
|
void APIGetProperties(AdapterProperties* properties) const;
|
||||||
bool APIHasFeature(wgpu::FeatureName feature) const;
|
bool APIHasFeature(wgpu::FeatureName feature) const;
|
||||||
|
@ -56,6 +57,9 @@ class AdapterBase : public RefCounted {
|
||||||
uint32_t GetDeviceId() const;
|
uint32_t GetDeviceId() const;
|
||||||
const gpu_info::DriverVersion& GetDriverVersion() const;
|
const gpu_info::DriverVersion& GetDriverVersion() const;
|
||||||
wgpu::BackendType GetBackendType() const;
|
wgpu::BackendType GetBackendType() const;
|
||||||
|
|
||||||
|
// This method differs from APIGetInstance() in that it won't increase the ref count of the
|
||||||
|
// instance.
|
||||||
InstanceBase* GetInstance() const;
|
InstanceBase* GetInstance() const;
|
||||||
|
|
||||||
void ResetInternalDeviceForTesting();
|
void ResetInternalDeviceForTesting();
|
||||||
|
|
|
@ -127,6 +127,11 @@ bool Adapter::OnRequestDeviceCallback(uint64_t requestSerial,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WGPUInstance Adapter::GetInstance() const {
|
||||||
|
dawn::ErrorLog() << "adapter.GetInstance not supported with dawn_wire.";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
WGPUDevice Adapter::CreateDevice(const WGPUDeviceDescriptor*) {
|
WGPUDevice Adapter::CreateDevice(const WGPUDeviceDescriptor*) {
|
||||||
dawn::ErrorLog() << "adapter.CreateDevice not supported with dawn_wire.";
|
dawn::ErrorLog() << "adapter.CreateDevice not supported with dawn_wire.";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -51,6 +51,7 @@ class Adapter final : public ObjectBase {
|
||||||
const WGPUFeatureName* features);
|
const WGPUFeatureName* features);
|
||||||
|
|
||||||
// Unimplementable. Only availale in dawn_native.
|
// Unimplementable. Only availale in dawn_native.
|
||||||
|
WGPUInstance GetInstance() const;
|
||||||
WGPUDevice CreateDevice(const WGPUDeviceDescriptor*);
|
WGPUDevice CreateDevice(const WGPUDeviceDescriptor*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue