Skip to content

Commit 78275e2

Browse files
authored
OffscreenCanvas support in feature matrix (#25421)
Add item for `OffscreenCanvas` support in feature matrix, and update missing `@requires_offscreen_canvas` in browser test. This will automatically set min browser versions when `-sOFFSCREEN_CANVAS` is used, and error our if the users explicitly requests a too-old browser version
1 parent 2c18c95 commit 78275e2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test/test_browser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,6 +2643,7 @@ def test_html5_webgl_create_context2(self):
26432643
self.btest_exit('webgl_create_context2.c')
26442644

26452645
@requires_graphics_hardware
2646+
@requires_offscreen_canvas
26462647
# Verify bug https://github.com/emscripten-core/emscripten/issues/22943: creating a WebGL context with explicit swap control and offscreenCanvas
26472648
@parameterized({
26482649
'offscreencanvas': (['-sOFFSCREENCANVAS_SUPPORT'],),

tools/feature_matrix.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Feature(IntEnum):
3939
PROMISE_ANY = auto()
4040
MEMORY64 = auto()
4141
WORKER_ES6_MODULES = auto()
42+
OFFSCREENCANVAS_SUPPORT = auto()
4243

4344

4445
disable_override_features = set()
@@ -95,6 +96,15 @@ class Feature(IntEnum):
9596
'safari': 150000,
9697
'node': 0, # This is a browser only feature, no requirements on Node.js
9798
},
99+
# OffscreenCanvas feature allows creating canvases that are not connected to
100+
# a visible DOM element, e.g. in a Worker.
101+
# https://caniuse.com/offscreencanvas
102+
Feature.OFFSCREENCANVAS_SUPPORT: {
103+
'chrome': 69,
104+
'firefox': 105,
105+
'safari': 170000,
106+
'node': 0, # This is a browser only feature, no requirements on Node.js
107+
},
98108
}
99109

100110
# Static assertion to check that we actually need each of the above feature flags
@@ -187,3 +197,5 @@ def apply_min_browser_versions():
187197
enable_feature(Feature.WORKER_ES6_MODULES, 'EXPORT_ES6 with -pthread')
188198
if settings.EXPORT_ES6 and settings.WASM_WORKERS:
189199
enable_feature(Feature.WORKER_ES6_MODULES, 'EXPORT_ES6 with -sWASM_WORKERS')
200+
if settings.OFFSCREENCANVAS_SUPPORT:
201+
enable_feature(Feature.OFFSCREENCANVAS_SUPPORT, 'OFFSCREENCANVAS_SUPPORT')

0 commit comments

Comments
 (0)