dawn.node: Support GPUAdapter.name

Bug: dawn:1133
Change-Id: I52291cf3c24f836844c841ce49f7c1f6c75e20b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90244
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Corentin Wallez 2022-05-16 09:15:21 +00:00 committed by Dawn LUCI CQ
parent f9f1c4b526
commit 15b720be2d
2 changed files with 8 additions and 2 deletions

View File

@ -145,10 +145,15 @@ class Features : public interop::GPUSupportedFeatures {
// wgpu::bindings::GPUAdapter
// TODO(crbug.com/dawn/1133): This is a stub implementation. Properly implement.
////////////////////////////////////////////////////////////////////////////////
GPUAdapter::GPUAdapter(dawn::native::Adapter a, const Flags& flags) : adapter_(a), flags_(flags) {}
GPUAdapter::GPUAdapter(dawn::native::Adapter a, const Flags& flags) : adapter_(a), flags_(flags) {
wgpu::AdapterProperties props;
adapter_.GetProperties(&props);
name_ = props.name;
}
// TODO(dawn:1133): Avoid the extra copy by making the generator make a virtual method with const std::string&
std::string GPUAdapter::getName(Napi::Env) {
return "dawn-adapter";
return name_;
}
interop::Interface<interop::GPUSupportedFeatures> GPUAdapter::getFeatures(Napi::Env env) {

View File

@ -42,6 +42,7 @@ class GPUAdapter final : public interop::GPUAdapter {
private:
dawn::native::Adapter adapter_;
const Flags& flags_;
std::string name_;
};
} // namespace wgpu::binding