diff --git a/src/dawn/node/binding/GPUAdapter.cpp b/src/dawn/node/binding/GPUAdapter.cpp index 3f7aa6cc4f..637c41ff12 100644 --- a/src/dawn/node/binding/GPUAdapter.cpp +++ b/src/dawn/node/binding/GPUAdapter.cpp @@ -125,11 +125,7 @@ interop::Interface GPUAdapter::getLimits(Napi::Env interop::Interface GPUAdapter::getInfo(Napi::Env env) { wgpu::AdapterInfo info = {}; wgpu::AdapterPropertiesSubgroups subgroupProperties = {}; - - wgpu::Adapter wgpuAdapter = adapter_.Get(); - if (wgpuAdapter.HasFeature(FeatureName::Subgroups)) { - info.nextInChain = &subgroupProperties; - } + info.nextInChain = &subgroupProperties; adapter_.GetInfo(&info); diff --git a/src/dawn/node/binding/GPUAdapterInfo.cpp b/src/dawn/node/binding/GPUAdapterInfo.cpp index 4aeca3335a..e8f9446d75 100644 --- a/src/dawn/node/binding/GPUAdapterInfo.cpp +++ b/src/dawn/node/binding/GPUAdapterInfo.cpp @@ -45,7 +45,7 @@ GPUAdapterInfo::GPUAdapterInfo(const wgpu::AdapterInfo& info) if (chain->sType == wgpu::SType::AdapterPropertiesSubgroups) { subgroup_properties_ = *static_cast(chain); // Clear to prevent using invalid pointer. - subgroup_properties_->nextInChain = nullptr; + subgroup_properties_.nextInChain = nullptr; break; } } @@ -68,17 +68,11 @@ std::string GPUAdapterInfo::getDescription(Napi::Env) { } std::variant GPUAdapterInfo::getSubgroupMinSize(Napi::Env) { - if (subgroup_properties_.has_value()) { - return subgroup_properties_->subgroupMinSize; - } - return interop::Undefined; + return subgroup_properties_.subgroupMinSize; } std::variant GPUAdapterInfo::getSubgroupMaxSize(Napi::Env) { - if (subgroup_properties_.has_value()) { - return subgroup_properties_->subgroupMaxSize; - } - return interop::Undefined; + return subgroup_properties_.subgroupMaxSize; } } // namespace wgpu::binding diff --git a/src/dawn/node/binding/GPUAdapterInfo.h b/src/dawn/node/binding/GPUAdapterInfo.h index d5e84c4c27..1eb81cb69f 100644 --- a/src/dawn/node/binding/GPUAdapterInfo.h +++ b/src/dawn/node/binding/GPUAdapterInfo.h @@ -56,7 +56,7 @@ class GPUAdapterInfo final : public interop::GPUAdapterInfo { std::string architecture_; std::string device_; std::string description_; - std::optional subgroup_properties_; + wgpu::AdapterPropertiesSubgroups subgroup_properties_; }; } // namespace wgpu::binding diff --git a/src/dawn/node/binding/GPUDevice.cpp b/src/dawn/node/binding/GPUDevice.cpp index b64475ebef..ffadb351f2 100644 --- a/src/dawn/node/binding/GPUDevice.cpp +++ b/src/dawn/node/binding/GPUDevice.cpp @@ -211,6 +211,8 @@ interop::Interface GPUDevice::getLimits(Napi::Env e interop::Interface GPUDevice::getAdapterInfo(Napi::Env env) { wgpu::AdapterInfo adapterInfo = {}; + wgpu::AdapterPropertiesSubgroups subgroupsProperties = {}; + adapterInfo.nextInChain = &subgroupsProperties; device_.GetAdapterInfo(&adapterInfo); return interop::GPUAdapterInfo::Create(env, adapterInfo);