Add DeviceBase::APIGetAdapter

Adds a way to query the adapter from a device. Only valid in Dawn Native.
Returns a new reference to the caller. The caller is responsible for
releasing it.

This is needed so in Chrome, SharedImage can query the WGPUAdapter from
the WGPUDevice, and then WGPUAdapterProperties may be queried from the
WGPUAdapter.

Change-Id: I719a8728eff06ab7a22be3db5fb5cfd2ebb2f0f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99703
Reviewed-by: Zhenyao Mo <zmo@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng
2022-08-18 18:02:00 +00:00
committed by Dawn LUCI CQ
parent 1ac1514ad2
commit bf3243568c
6 changed files with 19 additions and 0 deletions

View File

@@ -1284,6 +1284,11 @@ MaybeError DeviceBase::Tick() {
return {};
}
AdapterBase* DeviceBase::APIGetAdapter() {
mAdapter->Reference();
return mAdapter;
}
QueueBase* DeviceBase::APIGetQueue() {
// Backends gave the primary queue during initialization.
ASSERT(mQueue != nullptr);