Skip to content

Commit b805bf2

Browse files
Bug 1972486 - chore(webgpu): enable on Windows by default r=webgpu-reviewers,webidl,smaug,jimb
Make IDL available in all contexts. Limit adapters to content, dedicated workers, and shared workers; basically everything but service workers, which is blocked on bug 1942431. Differential Revision: https://phabricator.services.mozilla.com/D253924
1 parent a364f4f commit b805bf2

9 files changed

Lines changed: 108 additions & 14 deletions

File tree

dom/tests/mochitest/general/test_interfaces.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,84 +470,124 @@ let interfaceNamesInGlobalScope = [
470470
{ name: "FragmentDirective", insecureContext: true },
471471
// IMPORTANT: Do not change this list without review from a DOM peer!
472472
{ name: "GPU", earlyBetaOrEarlier: true },
473+
{ name: "GPU", windows: true },
473474
// IMPORTANT: Do not change this list without review from a DOM peer!
474475
{ name: "GPUAdapter", earlyBetaOrEarlier: true },
476+
{ name: "GPUAdapter", windows: true },
475477
// IMPORTANT: Do not change this list without review from a DOM peer!
476478
{ name: "GPUAdapterInfo", earlyBetaOrEarlier: true },
479+
{ name: "GPUAdapterInfo", windows: true },
477480
// IMPORTANT: Do not change this list without review from a DOM peer!
478481
{ name: "GPUBindGroup", earlyBetaOrEarlier: true },
482+
{ name: "GPUBindGroup", windows: true },
479483
// IMPORTANT: Do not change this list without review from a DOM peer!
480484
{ name: "GPUBindGroupLayout", earlyBetaOrEarlier: true },
485+
{ name: "GPUBindGroupLayout", windows: true },
481486
// IMPORTANT: Do not change this list without review from a DOM peer!
482487
{ name: "GPUBuffer", earlyBetaOrEarlier: true },
488+
{ name: "GPUBuffer", windows: true },
483489
// IMPORTANT: Do not change this list without review from a DOM peer!
484490
{ name: "GPUBufferUsage", earlyBetaOrEarlier: true },
491+
{ name: "GPUBufferUsage", windows: true },
485492
// IMPORTANT: Do not change this list without review from a DOM peer!
486493
{ name: "GPUCanvasContext", earlyBetaOrEarlier: true },
494+
{ name: "GPUCanvasContext", windows: true },
487495
// IMPORTANT: Do not change this list without review from a DOM peer!
488496
{ name: "GPUColorWrite", earlyBetaOrEarlier: true },
497+
{ name: "GPUColorWrite", windows: true },
489498
// IMPORTANT: Do not change this list without review from a DOM peer!
490499
{ name: "GPUCommandBuffer", earlyBetaOrEarlier: true },
500+
{ name: "GPUCommandBuffer", windows: true },
491501
// IMPORTANT: Do not change this list without review from a DOM peer!
492502
{ name: "GPUCommandEncoder", earlyBetaOrEarlier: true },
503+
{ name: "GPUCommandEncoder", windows: true },
493504
// IMPORTANT: Do not change this list without review from a DOM peer!
494505
{ name: "GPUCompilationInfo", earlyBetaOrEarlier: true },
506+
{ name: "GPUCompilationInfo", windows: true },
495507
// IMPORTANT: Do not change this list without review from a DOM peer!
496508
{ name: "GPUCompilationMessage", earlyBetaOrEarlier: true },
509+
{ name: "GPUCompilationMessage", windows: true },
497510
// IMPORTANT: Do not change this list without review from a DOM peer!
498511
{ name: "GPUComputePassEncoder", earlyBetaOrEarlier: true },
512+
{ name: "GPUComputePassEncoder", windows: true },
499513
// IMPORTANT: Do not change this list without review from a DOM peer!
500514
{ name: "GPUComputePipeline", earlyBetaOrEarlier: true },
515+
{ name: "GPUComputePipeline", windows: true },
501516
// IMPORTANT: Do not change this list without review from a DOM peer!
502517
{ name: "GPUDevice", earlyBetaOrEarlier: true },
518+
{ name: "GPUDevice", windows: true },
503519
// IMPORTANT: Do not change this list without review from a DOM peer!
504520
{ name: "GPUDeviceLostInfo", earlyBetaOrEarlier: true },
521+
{ name: "GPUDeviceLostInfo", windows: true },
505522
// IMPORTANT: Do not change this list without review from a DOM peer!
506523
{ name: "GPUError", earlyBetaOrEarlier: true },
524+
{ name: "GPUError", windows: true },
507525
// IMPORTANT: Do not change this list without review from a DOM peer!
508526
{ name: "GPUExternalTexture", earlyBetaOrEarlier: true },
527+
{ name: "GPUExternalTexture", windows: true },
509528
// IMPORTANT: Do not change this list without review from a DOM peer!
510529
{ name: "GPUInternalError", earlyBetaOrEarlier: true },
530+
{ name: "GPUInternalError", windows: true },
511531
// IMPORTANT: Do not change this list without review from a DOM peer!
512532
{ name: "GPUMapMode", earlyBetaOrEarlier: true },
533+
{ name: "GPUMapMode", windows: true },
513534
// IMPORTANT: Do not change this list without review from a DOM peer!
514535
{ name: "GPUOutOfMemoryError", earlyBetaOrEarlier: true },
536+
{ name: "GPUOutOfMemoryError", windows: true },
515537
// IMPORTANT: Do not change this list without review from a DOM peer!
516538
{ name: "GPUPipelineError", earlyBetaOrEarlier: true },
539+
{ name: "GPUPipelineError", windows: true },
517540
// IMPORTANT: Do not change this list without review from a DOM peer!
518541
{ name: "GPUPipelineLayout", earlyBetaOrEarlier: true },
542+
{ name: "GPUPipelineLayout", windows: true },
519543
// IMPORTANT: Do not change this list without review from a DOM peer!
520544
{ name: "GPUQuerySet", earlyBetaOrEarlier: true },
545+
{ name: "GPUQuerySet", windows: true },
521546
// IMPORTANT: Do not change this list without review from a DOM peer!
522547
{ name: "GPUQueue", earlyBetaOrEarlier: true },
548+
{ name: "GPUQueue", windows: true },
523549
// IMPORTANT: Do not change this list without review from a DOM peer!
524550
{ name: "GPURenderBundle", earlyBetaOrEarlier: true },
551+
{ name: "GPURenderBundle", windows: true },
525552
// IMPORTANT: Do not change this list without review from a DOM peer!
526553
{ name: "GPURenderBundleEncoder", earlyBetaOrEarlier: true },
554+
{ name: "GPURenderBundleEncoder", windows: true },
527555
// IMPORTANT: Do not change this list without review from a DOM peer!
528556
{ name: "GPURenderPassEncoder", earlyBetaOrEarlier: true },
557+
{ name: "GPURenderPassEncoder", windows: true },
529558
// IMPORTANT: Do not change this list without review from a DOM peer!
530559
{ name: "GPURenderPipeline", earlyBetaOrEarlier: true },
560+
{ name: "GPURenderPipeline", windows: true },
531561
// IMPORTANT: Do not change this list without review from a DOM peer!
532562
{ name: "GPUSampler", earlyBetaOrEarlier: true },
563+
{ name: "GPUSampler", windows: true },
533564
// IMPORTANT: Do not change this list without review from a DOM peer!
534565
{ name: "GPUShaderModule", earlyBetaOrEarlier: true },
566+
{ name: "GPUShaderModule", windows: true },
535567
// IMPORTANT: Do not change this list without review from a DOM peer!
536568
{ name: "GPUShaderStage", earlyBetaOrEarlier: true },
569+
{ name: "GPUShaderStage", windows: true },
537570
// IMPORTANT: Do not change this list without review from a DOM peer!
538571
{ name: "GPUSupportedFeatures", earlyBetaOrEarlier: true },
572+
{ name: "GPUSupportedFeatures", windows: true },
539573
// IMPORTANT: Do not change this list without review from a DOM peer!
540574
{ name: "GPUSupportedLimits", earlyBetaOrEarlier: true },
575+
{ name: "GPUSupportedLimits", windows: true },
541576
// IMPORTANT: Do not change this list without review from a DOM peer!
542577
{ name: "GPUTexture", earlyBetaOrEarlier: true },
578+
{ name: "GPUTexture", windows: true },
543579
// IMPORTANT: Do not change this list without review from a DOM peer!
544580
{ name: "GPUTextureUsage", earlyBetaOrEarlier: true },
581+
{ name: "GPUTextureUsage", windows: true },
545582
// IMPORTANT: Do not change this list without review from a DOM peer!
546583
{ name: "GPUTextureView", earlyBetaOrEarlier: true },
584+
{ name: "GPUTextureView", windows: true },
547585
// IMPORTANT: Do not change this list without review from a DOM peer!
548586
{ name: "GPUUncapturedErrorEvent", earlyBetaOrEarlier: true },
587+
{ name: "GPUUncapturedErrorEvent", windows: true },
549588
// IMPORTANT: Do not change this list without review from a DOM peer!
550589
{ name: "GPUValidationError", earlyBetaOrEarlier: true },
590+
{ name: "GPUValidationError", windows: true },
551591
// IMPORTANT: Do not change this list without review from a DOM peer!
552592
{ name: "GainNode", insecureContext: true },
553593
// IMPORTANT: Do not change this list without review from a DOM peer!
@@ -1478,6 +1518,7 @@ let interfaceNamesInGlobalScope = [
14781518
{ name: "VisualViewport", insecureContext: true },
14791519
// IMPORTANT: Do not change this list without review from a DOM peer!
14801520
{ name: "WGSLLanguageFeatures", earlyBetaOrEarlier: true },
1521+
{ name: "WGSLLanguageFeatures", windows: true },
14811522
// IMPORTANT: Do not change this list without review from a DOM peer!
14821523
{ name: "WakeLock" },
14831524
// IMPORTANT: Do not change this list without review from a DOM peer!

dom/webgpu/Instance.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ already_AddRefed<dom::Promise> Instance::RequestAdapter(
117117
};
118118

119119
#ifndef EARLY_BETA_OR_EARLIER
120-
rejectIf(true, "WebGPU is not yet available in Release or late Beta builds.");
120+
# ifndef XP_WIN
121+
rejectIf(true,
122+
"WebGPU is only available on Windows, and in Nightly and Early Beta "
123+
"builds on other platforms.");
124+
# endif
121125

122126
// NOTE: Deliberately left after the above check so that we only enter
123127
// here if it's removed. Above is a more informative diagnostic, while the

dom/webgpu/tests/mochitest/mochitest-disabled.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ subsuite = "webgpu"
33

44
# This file's tests should run when WebGPU is disabled by the logic in
55
# `gfxPlatform::InitWebGPUConfig`.
6-
#
7-
# This condition should be the exact complement of the `run-if` condition
8-
# in `mochitest.toml`.
9-
run-if = ["!(nightly_build || (os == 'win' && early_beta_or_earlier))"]
10-
11-
# `test-verify` jobs don't guarantee a GPU, so skip them.
12-
skip-if = ["verify"]
6+
skip-if = [
7+
# This condition should be the exact complement of the `run-if` condition
8+
# in `mochitest.toml`.
9+
"nightly_build",
10+
"os == 'win'",
11+
# `test-verify` jobs don't guarantee a GPU, so skip them.
12+
"verify"
13+
]
1314

1415
# Even if the pref were enabled, WebGPU is only available in secure contexts.
1516
#

dom/webgpu/tests/mochitest/mochitest-no-pref.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
subsuite = "webgpu"
33
# This file's tests should run when 'modules/libpref/init/StaticPrefList.yaml'
44
# defaults the 'dom.webgpu.enabled' pref to true.
5-
run-if = ["!early_beta_or_earlier"]
5+
run-if = ["!early_beta_or_earlier && os != 'win'"]
66
skip-if = ["verify"] # `test-verify` jobs don't guarantee a GPU, so skip them.
77

88
# Even if the pref were enabled, WebGPU is only available in secure contexts.

dom/webgpu/tests/mochitest/mochitest.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ subsuite = "webgpu"
66
#
77
# This condition should be the exact complement of the `run-if`
88
# condition in `mochitest-disabled.html`.
9-
run-if = ["nightly_build || (os == 'win' && early_beta_or_earlier)"]
9+
run-if = [
10+
"nightly_build",
11+
"os == 'win'",
12+
]
1013

1114
# `test-verify` jobs don't guarantee a GPU, so skip them.
1215
skip-if = ["verify"]

dom/workers/test/navigator_worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var supportedProps = [
1212
{ name: "appVersion", insecureContext: true },
1313
{ name: "globalPrivacyControl", insecureContext: true },
1414
{ name: "gpu", earlyBetaOrEarlier: true },
15+
{ name: "gpu", windows: true },
1516
{ name: "platform", insecureContext: true },
1617
{ name: "product", insecureContext: true },
1718
{ name: "userAgent", insecureContext: true },

dom/workers/test/test_worker_interfaces.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,84 +237,124 @@ let interfaceNamesInGlobalScope = [
237237
{ name: "FormData", insecureContext: true },
238238
// IMPORTANT: Do not change this list without review from a DOM peer!
239239
{ name: "GPU", earlyBetaOrEarlier: true },
240+
{ name: "GPU", windows: true },
240241
// IMPORTANT: Do not change this list without review from a DOM peer!
241242
{ name: "GPUAdapter", earlyBetaOrEarlier: true },
243+
{ name: "GPUAdapter", windows: true },
242244
// IMPORTANT: Do not change this list without review from a DOM peer!
243245
{ name: "GPUAdapterInfo", earlyBetaOrEarlier: true },
246+
{ name: "GPUAdapterInfo", windows: true },
244247
// IMPORTANT: Do not change this list without review from a DOM peer!
245248
{ name: "GPUBindGroup", earlyBetaOrEarlier: true },
249+
{ name: "GPUBindGroup", windows: true },
246250
// IMPORTANT: Do not change this list without review from a DOM peer!
247251
{ name: "GPUBindGroupLayout", earlyBetaOrEarlier: true },
252+
{ name: "GPUBindGroupLayout", windows: true },
248253
// IMPORTANT: Do not change this list without review from a DOM peer!
249254
{ name: "GPUBuffer", earlyBetaOrEarlier: true },
255+
{ name: "GPUBuffer", windows: true },
250256
// IMPORTANT: Do not change this list without review from a DOM peer!
251257
{ name: "GPUBufferUsage", earlyBetaOrEarlier: true },
258+
{ name: "GPUBufferUsage", windows: true },
252259
// IMPORTANT: Do not change this list without review from a DOM peer!
253260
{ name: "GPUCanvasContext", earlyBetaOrEarlier: true },
261+
{ name: "GPUCanvasContext", windows: true },
254262
// IMPORTANT: Do not change this list without review from a DOM peer!
255263
{ name: "GPUColorWrite", earlyBetaOrEarlier: true },
264+
{ name: "GPUColorWrite", windows: true },
256265
// IMPORTANT: Do not change this list without review from a DOM peer!
257266
{ name: "GPUCommandBuffer", earlyBetaOrEarlier: true },
267+
{ name: "GPUCommandBuffer", windows: true },
258268
// IMPORTANT: Do not change this list without review from a DOM peer!
259269
{ name: "GPUCommandEncoder", earlyBetaOrEarlier: true },
270+
{ name: "GPUCommandEncoder", windows: true },
260271
// IMPORTANT: Do not change this list without review from a DOM peer!
261272
{ name: "GPUCompilationInfo", earlyBetaOrEarlier: true },
273+
{ name: "GPUCompilationInfo", windows: true },
262274
// IMPORTANT: Do not change this list without review from a DOM peer!
263275
{ name: "GPUCompilationMessage", earlyBetaOrEarlier: true },
276+
{ name: "GPUCompilationMessage", windows: true },
264277
// IMPORTANT: Do not change this list without review from a DOM peer!
265278
{ name: "GPUComputePassEncoder", earlyBetaOrEarlier: true },
279+
{ name: "GPUComputePassEncoder", windows: true },
266280
// IMPORTANT: Do not change this list without review from a DOM peer!
267281
{ name: "GPUComputePipeline", earlyBetaOrEarlier: true },
282+
{ name: "GPUComputePipeline", windows: true },
268283
// IMPORTANT: Do not change this list without review from a DOM peer!
269284
{ name: "GPUDevice", earlyBetaOrEarlier: true },
285+
{ name: "GPUDevice", windows: true },
270286
// IMPORTANT: Do not change this list without review from a DOM peer!
271287
{ name: "GPUDeviceLostInfo", earlyBetaOrEarlier: true },
288+
{ name: "GPUDeviceLostInfo", windows: true },
272289
// IMPORTANT: Do not change this list without review from a DOM peer!
273290
{ name: "GPUError", earlyBetaOrEarlier: true },
291+
{ name: "GPUError", windows: true },
274292
// IMPORTANT: Do not change this list without review from a DOM peer!
275293
{ name: "GPUExternalTexture", earlyBetaOrEarlier: true },
294+
{ name: "GPUExternalTexture", windows: true },
276295
// IMPORTANT: Do not change this list without review from a DOM peer!
277296
{ name: "GPUInternalError", earlyBetaOrEarlier: true },
297+
{ name: "GPUInternalError", windows: true },
278298
// IMPORTANT: Do not change this list without review from a DOM peer!
279299
{ name: "GPUMapMode", earlyBetaOrEarlier: true },
300+
{ name: "GPUMapMode", windows: true },
280301
// IMPORTANT: Do not change this list without review from a DOM peer!
281302
{ name: "GPUOutOfMemoryError", earlyBetaOrEarlier: true },
303+
{ name: "GPUOutOfMemoryError", windows: true },
282304
// IMPORTANT: Do not change this list without review from a DOM peer!
283305
{ name: "GPUPipelineError", earlyBetaOrEarlier: true },
306+
{ name: "GPUPipelineError", windows: true },
284307
// IMPORTANT: Do not change this list without review from a DOM peer!
285308
{ name: "GPUPipelineLayout", earlyBetaOrEarlier: true },
309+
{ name: "GPUPipelineLayout", windows: true },
286310
// IMPORTANT: Do not change this list without review from a DOM peer!
287311
{ name: "GPUQuerySet", earlyBetaOrEarlier: true },
312+
{ name: "GPUQuerySet", windows: true },
288313
// IMPORTANT: Do not change this list without review from a DOM peer!
289314
{ name: "GPUQueue", earlyBetaOrEarlier: true },
315+
{ name: "GPUQueue", windows: true },
290316
// IMPORTANT: Do not change this list without review from a DOM peer!
291317
{ name: "GPURenderBundle", earlyBetaOrEarlier: true },
318+
{ name: "GPURenderBundle", windows: true },
292319
// IMPORTANT: Do not change this list without review from a DOM peer!
293320
{ name: "GPURenderBundleEncoder", earlyBetaOrEarlier: true },
321+
{ name: "GPURenderBundleEncoder", windows: true },
294322
// IMPORTANT: Do not change this list without review from a DOM peer!
295323
{ name: "GPURenderPassEncoder", earlyBetaOrEarlier: true },
324+
{ name: "GPURenderPassEncoder", windows: true },
296325
// IMPORTANT: Do not change this list without review from a DOM peer!
297326
{ name: "GPURenderPipeline", earlyBetaOrEarlier: true },
327+
{ name: "GPURenderPipeline", windows: true },
298328
// IMPORTANT: Do not change this list without review from a DOM peer!
299329
{ name: "GPUSampler", earlyBetaOrEarlier: true },
330+
{ name: "GPUSampler", windows: true },
300331
// IMPORTANT: Do not change this list without review from a DOM peer!
301332
{ name: "GPUShaderModule", earlyBetaOrEarlier: true },
333+
{ name: "GPUShaderModule", windows: true },
302334
// IMPORTANT: Do not change this list without review from a DOM peer!
303335
{ name: "GPUShaderStage", earlyBetaOrEarlier: true },
336+
{ name: "GPUShaderStage", windows: true },
304337
// IMPORTANT: Do not change this list without review from a DOM peer!
305338
{ name: "GPUSupportedFeatures", earlyBetaOrEarlier: true },
339+
{ name: "GPUSupportedFeatures", windows: true },
306340
// IMPORTANT: Do not change this list without review from a DOM peer!
307341
{ name: "GPUSupportedLimits", earlyBetaOrEarlier: true },
342+
{ name: "GPUSupportedLimits", windows: true },
308343
// IMPORTANT: Do not change this list without review from a DOM peer!
309344
{ name: "GPUTexture", earlyBetaOrEarlier: true },
345+
{ name: "GPUTexture", windows: true },
310346
// IMPORTANT: Do not change this list without review from a DOM peer!
311347
{ name: "GPUTextureUsage", earlyBetaOrEarlier: true },
348+
{ name: "GPUTextureUsage", windows: true },
312349
// IMPORTANT: Do not change this list without review from a DOM peer!
313350
{ name: "GPUTextureView", earlyBetaOrEarlier: true },
351+
{ name: "GPUTextureView", windows: true },
314352
// IMPORTANT: Do not change this list without review from a DOM peer!
315353
{ name: "GPUUncapturedErrorEvent", earlyBetaOrEarlier: true },
354+
{ name: "GPUUncapturedErrorEvent", windows: true },
316355
// IMPORTANT: Do not change this list without review from a DOM peer!
317356
{ name: "GPUValidationError", earlyBetaOrEarlier: true },
357+
{ name: "GPUValidationError", windows: true },
318358
// IMPORTANT: Do not change this list without review from a DOM peer!
319359
{ name: "Headers", insecureContext: true },
320360
// IMPORTANT: Do not change this list without review from a DOM peer!
@@ -477,6 +517,7 @@ let interfaceNamesInGlobalScope = [
477517
{ name: "VideoFrame", insecureContext: true },
478518
// IMPORTANT: Do not change this list without review from a DOM peer!
479519
{ name: "WGSLLanguageFeatures", earlyBetaOrEarlier: true },
520+
{ name: "WGSLLanguageFeatures", windows: true },
480521
// IMPORTANT: Do not change this list without review from a DOM peer!
481522
{ name: "WebGL2RenderingContext", insecureContext: true },
482523
// IMPORTANT: Do not change this list without review from a DOM peer!

gfx/thebes/gfxPlatform.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,12 +3293,11 @@ void gfxPlatform::InitWebGPUConfig() {
32933293

32943294
// When this condition changes, be sure to update the `run-if`
32953295
// conditions in `dom/webgpu/tests/mochitest/*.toml` accordingly.
3296-
#if !(defined(NIGHTLY_BUILD) || \
3297-
(defined(XP_WIN) && defined(EARLY_BETA_OR_EARLIER)))
3296+
#if !(defined(NIGHTLY_BUILD) || defined(XP_WIN))
32983297
feature.ForceDisable(
32993298
FeatureStatus::Blocked,
3300-
"WebGPU cannot be enabled unless in Nightly, or Early Beta on Windows.",
3301-
"WEBGPU_DISABLE_RELEASE_OR_NON_WINDOWS_EARLY_BETA"_ns);
3299+
"WebGPU cannot be enabled unless in Nightly or on Windows.",
3300+
"WEBGPU_DISABLE_RELEASE_OR_NON_WINDOWS"_ns);
33023301
#endif
33033302

33043303
gfxVars::SetAllowWebGPU(feature.IsEnabled());

modules/libpref/init/StaticPrefList.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5506,7 +5506,11 @@
55065506
# Is support for the Web GPU API enabled?
55075507
- name: dom.webgpu.enabled
55085508
type: RelaxedAtomicBool
5509+
#ifdef XP_WIN
5510+
value: true
5511+
#else
55095512
value: @IS_EARLY_BETA_OR_EARLIER@
5513+
#endif
55105514
mirror: always
55115515

55125516
# Is support for the Web GPU API enabled on service workers?

0 commit comments

Comments
 (0)