DawnNative: Add dawn::native::InstanceProcessEvents()

Make this a standalone function instead of a dawn::native::Instance's
member method.

Some code base don't use dawn::native::Instance but instead use
wgpu::Instance. And InstanceProcessEvents() function actually returns
a bool unlike wgpu::Instance::ProcessEvents() which returns void.

Bug: dawn:752
Change-Id: Ia354a4ed5b5568ee23bcc70935c104059a9f6fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
This commit is contained in:
Le Hoang Quyen 2023-03-29 07:06:18 +00:00 committed by Dawn LUCI CQ
parent f22675dfc3
commit 947a7deb99
3 changed files with 7 additions and 7 deletions

View File

@ -187,8 +187,6 @@ class DAWN_NATIVE_EXPORT Instance {
uint64_t GetDeviceCountForTesting() const; uint64_t GetDeviceCountForTesting() const;
bool ProcessEvents();
// Returns the underlying WGPUInstance object. // Returns the underlying WGPUInstance object.
WGPUInstance Get() const; WGPUInstance Get() const;
@ -225,6 +223,8 @@ DAWN_NATIVE_EXPORT std::vector<const char*> GetProcMapNamesForTesting();
DAWN_NATIVE_EXPORT bool DeviceTick(WGPUDevice device); DAWN_NATIVE_EXPORT bool DeviceTick(WGPUDevice device);
DAWN_NATIVE_EXPORT bool InstanceProcessEvents(WGPUInstance instance);
// ErrorInjector functions used for testing only. Defined in dawn_native/ErrorInjector.cpp // ErrorInjector functions used for testing only. Defined in dawn_native/ErrorInjector.cpp
DAWN_NATIVE_EXPORT void EnableErrorInjector(); DAWN_NATIVE_EXPORT void EnableErrorInjector();
DAWN_NATIVE_EXPORT void DisableErrorInjector(); DAWN_NATIVE_EXPORT void DisableErrorInjector();

View File

@ -136,7 +136,7 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
// Flush remaining callbacks to avoid memory leaks. // Flush remaining callbacks to avoid memory leaks.
// TODO(crbug.com/dawn/1712): DeviceNull's APITick() will always return true so cannot // TODO(crbug.com/dawn/1712): DeviceNull's APITick() will always return true so cannot
// do a polling loop here. // do a polling loop here.
sInstance->ProcessEvents(); dawn::native::InstanceProcessEvents(sInstance->Get());
// Note: Deleting the server will release all created objects. // Note: Deleting the server will release all created objects.
// Deleted devices will wait for idle on destruction. // Deleted devices will wait for idle on destruction.

View File

@ -251,10 +251,6 @@ uint64_t Instance::GetDeviceCountForTesting() const {
return mImpl->GetDeviceCountForTesting(); return mImpl->GetDeviceCountForTesting();
} }
bool Instance::ProcessEvents() {
return mImpl->APIProcessEvents();
}
WGPUInstance Instance::Get() const { WGPUInstance Instance::Get() const {
return ToAPI(mImpl); return ToAPI(mImpl);
} }
@ -298,6 +294,10 @@ DAWN_NATIVE_EXPORT bool DeviceTick(WGPUDevice device) {
return FromAPI(device)->APITick(); return FromAPI(device)->APITick();
} }
DAWN_NATIVE_EXPORT bool InstanceProcessEvents(WGPUInstance instance) {
return FromAPI(instance)->APIProcessEvents();
}
// ExternalImageDescriptor // ExternalImageDescriptor
ExternalImageDescriptor::ExternalImageDescriptor(ExternalImageType type) : mType(type) {} ExternalImageDescriptor::ExternalImageDescriptor(ExternalImageType type) : mType(type) {}