dawn.node: Replace GPUAdapter requestAdapterInfo() with info
Roll third_party/gpuweb/ a6805d529..002b4939b (116 commits)
https://github.com/gpuweb/gpuweb/compare/a6805d5298c6...002b4939ba7a
Created with:
roll-dep third_party/gpuweb
Bug: 335383516
Change-Id: I833ecccf7a38b53067e1e6b21d6ae5469cf03504
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/184380
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/DEPS b/DEPS
index 1e9870a..ec02250 100644
--- a/DEPS
+++ b/DEPS
@@ -369,7 +369,7 @@
'condition': 'dawn_node',
},
'third_party/gpuweb': {
- 'url': '{github_git}/gpuweb/gpuweb.git@a6805d5298c6979392768ed13f442e35b9a35b22',
+ 'url': '{github_git}/gpuweb/gpuweb.git@002b4939ba7ad3db1f83470e7c6a0a488fc548a6',
'condition': 'dawn_node',
},
diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h
index 99aa7e2..36104ed 100644
--- a/include/dawn/native/DawnNative.h
+++ b/include/dawn/native/DawnNative.h
@@ -87,6 +87,8 @@
Adapter(const Adapter& other);
Adapter& operator=(const Adapter& other);
+ wgpu::Status GetInfo(WGPUAdapterInfo* info) const;
+
// Essentially webgpu.h's wgpuAdapterGetProperties while we don't have WGPUAdapter in
// dawn.json
wgpu::Status GetProperties(wgpu::AdapterProperties* properties) const;
diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp
index 65e4d12..6416645 100644
--- a/src/dawn/native/DawnNative.cpp
+++ b/src/dawn/native/DawnNative.cpp
@@ -89,6 +89,10 @@
return *this;
}
+wgpu::Status Adapter::GetInfo(WGPUAdapterInfo* info) const {
+ return mImpl->APIGetInfo(FromAPI(info));
+}
+
wgpu::Status Adapter::GetProperties(wgpu::AdapterProperties* properties) const {
return GetProperties(reinterpret_cast<WGPUAdapterProperties*>(properties));
}
diff --git a/src/dawn/node/binding/GPUAdapter.cpp b/src/dawn/node/binding/GPUAdapter.cpp
index e4925fb..e6484ce 100644
--- a/src/dawn/node/binding/GPUAdapter.cpp
+++ b/src/dawn/node/binding/GPUAdapter.cpp
@@ -113,6 +113,13 @@
return interop::GPUSupportedLimits::Create<GPUSupportedLimits>(env, wgpuLimits);
}
+interop::Interface<interop::GPUAdapterInfo> GPUAdapter::getInfo(Napi::Env env) {
+ WGPUAdapterInfo info = {};
+ adapter_.GetInfo(&info);
+
+ return interop::GPUAdapterInfo::Create<GPUAdapterInfo>(env, info);
+}
+
bool GPUAdapter::getIsFallbackAdapter(Napi::Env) {
WGPUAdapterProperties adapterProperties = {};
adapter_.GetProperties(&adapterProperties);
@@ -197,15 +204,4 @@
return promise;
}
-interop::Promise<interop::Interface<interop::GPUAdapterInfo>> GPUAdapter::requestAdapterInfo(
- Napi::Env env) {
- interop::Promise<interop::Interface<interop::GPUAdapterInfo>> promise(env, PROMISE_INFO);
-
- WGPUAdapterProperties adapterProperties = {};
- adapter_.GetProperties(&adapterProperties);
-
- promise.Resolve(interop::GPUAdapterInfo::Create<GPUAdapterInfo>(env, adapterProperties));
- return promise;
-}
-
} // namespace wgpu::binding
diff --git a/src/dawn/node/binding/GPUAdapter.h b/src/dawn/node/binding/GPUAdapter.h
index ff66638..87f5307 100644
--- a/src/dawn/node/binding/GPUAdapter.h
+++ b/src/dawn/node/binding/GPUAdapter.h
@@ -48,10 +48,9 @@
interop::Promise<interop::Interface<interop::GPUDevice>> requestDevice(
Napi::Env env,
interop::GPUDeviceDescriptor descriptor) override;
- interop::Promise<interop::Interface<interop::GPUAdapterInfo>> requestAdapterInfo(
- Napi::Env) override;
interop::Interface<interop::GPUSupportedFeatures> getFeatures(Napi::Env) override;
interop::Interface<interop::GPUSupportedLimits> getLimits(Napi::Env) override;
+ interop::Interface<interop::GPUAdapterInfo> getInfo(Napi::Env) override;
bool getIsFallbackAdapter(Napi::Env) override;
bool getIsCompatibilityMode(Napi::Env) override;
diff --git a/src/dawn/node/binding/GPUAdapterInfo.cpp b/src/dawn/node/binding/GPUAdapterInfo.cpp
index 43634af..bedffcf 100644
--- a/src/dawn/node/binding/GPUAdapterInfo.cpp
+++ b/src/dawn/node/binding/GPUAdapterInfo.cpp
@@ -30,28 +30,17 @@
#include <iomanip>
#include <sstream>
-namespace {
-
-std::string FormatDevice(uint32_t deviceId) {
- std::ostringstream device;
- device << "0x" << std::setfill('0') << std::uppercase << std::internal << std::hex
- << std::setw(4) << deviceId;
- return device.str();
-}
-
-} // namespace
-
namespace wgpu::binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUAdapterInfo
////////////////////////////////////////////////////////////////////////////////
-GPUAdapterInfo::GPUAdapterInfo(WGPUAdapterProperties properties)
- : vendor_(properties.vendorName),
- architecture_(properties.architecture),
- device_(FormatDevice(properties.deviceID)),
- description_(properties.name) {}
+GPUAdapterInfo::GPUAdapterInfo(WGPUAdapterInfo info)
+ : vendor_(info.vendor),
+ architecture_(info.architecture),
+ device_(info.device),
+ description_(info.description) {}
std::string GPUAdapterInfo::getVendor(Napi::Env) {
return vendor_;
diff --git a/src/dawn/node/binding/GPUAdapterInfo.h b/src/dawn/node/binding/GPUAdapterInfo.h
index 5531050..caa308f 100644
--- a/src/dawn/node/binding/GPUAdapterInfo.h
+++ b/src/dawn/node/binding/GPUAdapterInfo.h
@@ -41,7 +41,7 @@
// GPUAdapterInfo is an implementation of interop::GPUAdapterInfo.
class GPUAdapterInfo final : public interop::GPUAdapterInfo {
public:
- explicit GPUAdapterInfo(WGPUAdapterProperties);
+ explicit GPUAdapterInfo(WGPUAdapterInfo);
// interop::GPUAdapterInfo interface compliance
std::string getVendor(Napi::Env) override;
diff --git a/third_party/gpuweb b/third_party/gpuweb
index a6805d5..002b493 160000
--- a/third_party/gpuweb
+++ b/third_party/gpuweb
@@ -1 +1 @@
-Subproject commit a6805d5298c6979392768ed13f442e35b9a35b22
+Subproject commit 002b4939ba7ad3db1f83470e7c6a0a488fc548a6