Bug 1955057 - feat(webgpu): add GPUAdapterInfo.isFallbackAdapter r=webgpu-reviewers,webidl,smaug,teoxoy
Differential Revision: https://phabricator.services.mozilla.com/D242390
This commit is contained in:
@@ -21,6 +21,18 @@ namespace mozilla::webgpu {
|
||||
GPU_IMPL_CYCLE_COLLECTION(AdapterInfo, mParent)
|
||||
GPU_IMPL_JS_WRAP(AdapterInfo)
|
||||
|
||||
bool AdapterInfo::IsFallbackAdapter() const {
|
||||
if (GetParentObject()->ShouldResistFingerprinting(
|
||||
RFPTarget::WebGPUIsFallbackAdapter)) {
|
||||
// Always report hardware support for WebGPU.
|
||||
// This behaviour matches with media capabilities API.
|
||||
return false;
|
||||
}
|
||||
|
||||
return mAboutSupportInfo->device_type ==
|
||||
ffi::WGPUDeviceType::WGPUDeviceType_Cpu;
|
||||
}
|
||||
|
||||
void AdapterInfo::GetWgpuName(nsString& s) const {
|
||||
s = mAboutSupportInfo->name;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class AdapterInfo final : public nsWrapperCache, public ChildOf<Adapter> {
|
||||
void GetArchitecture(nsString& s) const { s = nsString(); }
|
||||
void GetDevice(nsString& s) const { s = nsString(); }
|
||||
void GetDescription(nsString& s) const { s = nsString(); }
|
||||
bool IsFallbackAdapter() const;
|
||||
|
||||
// Non-standard field getters; see also TODO BUGZILLA LINK
|
||||
void GetWgpuName(nsString&) const;
|
||||
|
||||
@@ -70,6 +70,7 @@ interface GPUAdapterInfo {
|
||||
readonly attribute DOMString architecture;
|
||||
readonly attribute DOMString device;
|
||||
readonly attribute DOMString description;
|
||||
readonly attribute boolean isFallbackAdapter;
|
||||
|
||||
// Non-standard; see <https://bugzilla.mozilla.org/show_bug.cgi?id=1831994>.
|
||||
[ChromeOnly] readonly attribute DOMString wgpuName;
|
||||
|
||||
Reference in New Issue
Block a user