Bug 1939903: Collect WebGPU limits and missing features. r=tjr,webidl,jimb,saschanaz

Differential Revision: https://phabricator.services.mozilla.com/D233197
This commit is contained in:
Fatih Kilic
2025-01-22 23:46:33 +00:00
parent 6da71a1a9e
commit ca38fb13dd
5 changed files with 711 additions and 0 deletions

View File

@@ -380,6 +380,37 @@ static std::string_view ToJsKey(const Limit limit) {
MOZ_CRASH("Bad Limit");
}
uint64_t Adapter::MissingFeatures() const {
uint64_t missingFeatures = 0;
// Turn on all implemented features.
for (const auto feature :
dom::MakeWebIDLEnumeratedRange<dom::GPUFeatureName>()) {
const auto status = FeatureImplementationStatus::fromDomFeature(feature);
switch (status.tag) {
case FeatureImplementationStatusTag::Implemented:
missingFeatures |= status.value.implemented.wgpuBit;
break;
case FeatureImplementationStatusTag::NotImplemented:
break;
}
}
// Turn off features that are supported by the adapter.
for (auto feature : mFeatures->Features()) {
const auto status = FeatureImplementationStatus::fromDomFeature(feature);
switch (status.tag) {
case FeatureImplementationStatusTag::Implemented:
missingFeatures &= ~status.value.implemented.wgpuBit;
break;
case FeatureImplementationStatusTag::NotImplemented:
break;
}
}
return missingFeatures;
}
// -
// String helpers

View File

@@ -105,6 +105,7 @@ class Adapter final : public ObjectBase, public ChildOf<Instance> {
const RefPtr<AdapterInfo>& Info() const;
bool IsFallbackAdapter() const;
bool SupportExternalTextureInSwapChain() const;
uint64_t MissingFeatures() const;
nsCString LabelOrId() const {
nsCString ret = this->CLabel();

View File

@@ -120,6 +120,9 @@ interface GPUAdapter {
[Throws]
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
[Func="nsRFPService::IsSystemPrincipalOrAboutFingerprintingProtection"]
readonly attribute unsigned long long missingFeatures;
};
dictionary GPUDeviceDescriptor

View File

@@ -173,6 +173,7 @@ export class UserCharacteristicsPageService {
[browser.ownerGlobal, browser.ownerDocument, true],
],
[this.populateCanvasData, []],
[this.populateWebGPUProperties, [browser.ownerGlobal]],
];
// Bind them to the class and run them in parallel.
// Timeout if any of them takes too long (5 minutes).
@@ -501,6 +502,106 @@ export class UserCharacteristicsPageService {
}
}
async populateWebGPUProperties(window) {
const adapter = await window.navigator.gpu.requestAdapter();
if (!adapter) {
return;
}
Glean.characteristics.wgpuMissingFeatures.set(
adapter.missingFeatures.toString()
);
Glean.characteristics.wgpuMaxtexturedimension1d.set(
adapter.limits.maxTextureDimension1D
);
Glean.characteristics.wgpuMaxtexturedimension2d.set(
adapter.limits.maxTextureDimension2D
);
Glean.characteristics.wgpuMaxtexturedimension3d.set(
adapter.limits.maxTextureDimension3D
);
Glean.characteristics.wgpuMaxtexturearraylayers.set(
adapter.limits.maxTextureArrayLayers
);
Glean.characteristics.wgpuMaxbindgroups.set(adapter.limits.maxBindGroups);
Glean.characteristics.wgpuMaxbindgroupsplusvertexbuffers.set(
adapter.limits.maxBindGroupsPlusVertexBuffers
);
Glean.characteristics.wgpuMaxbindingsperbindgroup.set(
adapter.limits.maxBindingsPerBindGroup
);
Glean.characteristics.wgpuMaxdynamicuniformbuffersperpipelinelayout.set(
adapter.limits.maxDynamicUniformBuffersPerPipelineLayout
);
Glean.characteristics.wgpuMaxdynamicstoragebuffersperpipelinelayout.set(
adapter.limits.maxDynamicStorageBuffersPerPipelineLayout
);
Glean.characteristics.wgpuMaxsampledtexturespershaderstage.set(
adapter.limits.maxSampledTexturesPerShaderStage
);
Glean.characteristics.wgpuMaxsamplerspershaderstage.set(
adapter.limits.maxSamplersPerShaderStage
);
Glean.characteristics.wgpuMaxstoragebufferspershaderstage.set(
adapter.limits.maxStorageBuffersPerShaderStage
);
Glean.characteristics.wgpuMaxstoragetexturespershaderstage.set(
adapter.limits.maxStorageTexturesPerShaderStage
);
Glean.characteristics.wgpuMaxuniformbufferspershaderstage.set(
adapter.limits.maxUniformBuffersPerShaderStage
);
Glean.characteristics.wgpuMaxuniformbufferbindingsize.set(
adapter.limits.maxUniformBufferBindingSize
);
Glean.characteristics.wgpuMaxstoragebufferbindingsize.set(
adapter.limits.maxStorageBufferBindingSize
);
Glean.characteristics.wgpuMinuniformbufferoffsetalignment.set(
adapter.limits.minUniformBufferOffsetAlignment
);
Glean.characteristics.wgpuMinstoragebufferoffsetalignment.set(
adapter.limits.minStorageBufferOffsetAlignment
);
Glean.characteristics.wgpuMaxvertexbuffers.set(
adapter.limits.maxVertexBuffers
);
Glean.characteristics.wgpuMaxbuffersize.set(adapter.limits.maxBufferSize);
Glean.characteristics.wgpuMaxvertexattributes.set(
adapter.limits.maxVertexAttributes
);
Glean.characteristics.wgpuMaxvertexbufferarraystride.set(
adapter.limits.maxVertexBufferArrayStride
);
Glean.characteristics.wgpuMaxinterstageshadervariables.set(
adapter.limits.maxInterStageShaderVariables
);
Glean.characteristics.wgpuMaxcolorattachments.set(
adapter.limits.maxColorAttachments
);
Glean.characteristics.wgpuMaxcolorattachmentbytespersample.set(
adapter.limits.maxColorAttachmentBytesPerSample
);
Glean.characteristics.wgpuMaxcomputeworkgroupstoragesize.set(
adapter.limits.maxComputeWorkgroupStorageSize
);
Glean.characteristics.wgpuMaxcomputeinvocationsperworkgroup.set(
adapter.limits.maxComputeInvocationsPerWorkgroup
);
Glean.characteristics.wgpuMaxcomputeworkgroupsizex.set(
adapter.limits.maxComputeWorkgroupSizeX
);
Glean.characteristics.wgpuMaxcomputeworkgroupsizey.set(
adapter.limits.maxComputeWorkgroupSizeY
);
Glean.characteristics.wgpuMaxcomputeworkgroupsizez.set(
adapter.limits.maxComputeWorkgroupSizeZ
);
Glean.characteristics.wgpuMaxcomputeworkgroupsperdimension.set(
adapter.limits.maxComputeWorkgroupsPerDimension
);
}
async populateMappableData(data) {
// We set data from usercharacteristics.js
// We could do Object.keys(data), but this

View File

@@ -3851,3 +3851,578 @@ characteristics:
expires: never
data_sensitivity:
- technical
wgpu_missing_features:
type: string
description: >
Missing features of WebGPU as a bitset
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c2
expires: never
data_sensitivity:
- technical
wgpu_maxtexturedimension1d:
type: quantity
unit: uint
description: >
WebGPU limit maxTextureDimension1D
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxtexturedimension2d:
type: quantity
unit: uint
description: >
WebGPU limit maxTextureDimension2D
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxtexturedimension3d:
type: quantity
unit: uint
description: >
WebGPU limit maxTextureDimension3D
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxtexturearraylayers:
type: quantity
unit: uint
description: >
WebGPU limit maxTextureArrayLayers
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxbindgroups:
type: quantity
unit: uint
description: >
WebGPU limit maxBindGroups
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxbindgroupsplusvertexbuffers:
type: quantity
unit: uint
description: >
WebGPU limit maxBindGroupsPlusVertexBuffers
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxbindingsperbindgroup:
type: quantity
unit: uint
description: >
WebGPU limit maxBindingsPerBindGroup
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxdynamicuniformbuffersperpipelinelayout:
type: quantity
unit: uint
description: >
WebGPU limit maxDynamicUniformBuffersPerPipelineLayout
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxdynamicstoragebuffersperpipelinelayout:
type: quantity
unit: uint
description: >
WebGPU limit maxDynamicStorageBuffersPerPipelineLayout
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxsampledtexturespershaderstage:
type: quantity
unit: uint
description: >
WebGPU limit maxSampledTexturesPerShaderStage
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxsamplerspershaderstage:
type: quantity
unit: uint
description: >
WebGPU limit maxSamplersPerShaderStage
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxstoragebufferspershaderstage:
type: quantity
unit: uint
description: >
WebGPU limit maxStorageBuffersPerShaderStage
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxstoragetexturespershaderstage:
type: quantity
unit: uint
description: >
WebGPU limit maxStorageTexturesPerShaderStage
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxuniformbufferspershaderstage:
type: quantity
unit: uint
description: >
WebGPU limit maxUniformBuffersPerShaderStage
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxuniformbufferbindingsize:
type: quantity
unit: uint
description: >
WebGPU limit maxUniformBufferBindingSize
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxstoragebufferbindingsize:
type: quantity
unit: uint
description: >
WebGPU limit maxStorageBufferBindingSize
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_minuniformbufferoffsetalignment:
type: quantity
unit: uint
description: >
WebGPU limit minUniformBufferOffsetAlignment
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_minstoragebufferoffsetalignment:
type: quantity
unit: uint
description: >
WebGPU limit minStorageBufferOffsetAlignment
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxvertexbuffers:
type: quantity
unit: uint
description: >
WebGPU limit maxVertexBuffers
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxbuffersize:
type: quantity
unit: uint
description: >
WebGPU limit maxBufferSize
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxvertexattributes:
type: quantity
unit: uint
description: >
WebGPU limit maxVertexAttributes
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxvertexbufferarraystride:
type: quantity
unit: uint
description: >
WebGPU limit maxVertexBufferArrayStride
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxinterstageshadervariables:
type: quantity
unit: uint
description: >
WebGPU limit maxInterStageShaderVariables
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcolorattachments:
type: quantity
unit: uint
description: >
WebGPU limit maxColorAttachments
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcolorattachmentbytespersample:
type: quantity
unit: uint
description: >
WebGPU limit maxColorAttachmentBytesPerSample
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcomputeworkgroupstoragesize:
type: quantity
unit: uint
description: >
WebGPU limit maxComputeWorkgroupStorageSize
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcomputeinvocationsperworkgroup:
type: quantity
unit: uint
description: >
WebGPU limit maxComputeInvocationsPerWorkgroup
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcomputeworkgroupsizex:
type: quantity
unit: uint
description: >
WebGPU limit maxComputeWorkgroupSizeX
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcomputeworkgroupsizey:
type: quantity
unit: uint
description: >
WebGPU limit maxComputeWorkgroupSizeY
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcomputeworkgroupsizez:
type: quantity
unit: uint
description: >
WebGPU limit maxComputeWorkgroupSizeZ
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical
wgpu_maxcomputeworkgroupsperdimension:
type: quantity
unit: uint
description: >
WebGPU limit maxComputeWorkgroupsPerDimension
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1939903#c3
expires: never
data_sensitivity:
- technical