summaryrefslogtreecommitdiff
path: root/ext/webgpu/01_webgpu.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-01-27 23:10:09 +0530
committerGitHub <noreply@github.com>2024-01-27 23:10:09 +0530
commitcc0a3721275398a5b081ba5ee8e13fa2410ada04 (patch)
tree338e611ff68ca02fcc8a92de7774f1e5df639478 /ext/webgpu/01_webgpu.js
parentbde2028d837cba3511df86ef7c67ee21eeb1ea0e (diff)
feat(unstable): implement `navigator.gpu.getPreferredCanvasFormat()` (#22149)
Diffstat (limited to 'ext/webgpu/01_webgpu.js')
-rw-r--r--ext/webgpu/01_webgpu.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js
index db0dc9264..55ca9c382 100644
--- a/ext/webgpu/01_webgpu.js
+++ b/ext/webgpu/01_webgpu.js
@@ -344,6 +344,16 @@ class GPU {
}
}
+ getPreferredCanvasFormat() {
+ // Same as Gecko.
+ //
+ // https://github.com/mozilla/gecko-dev/blob/b75080bb8b11844d18cb5f9ac6e68a866ef8e243/dom/webgpu/Instance.h#L42-L47
+ if (core.build.os == "android") {
+ return "rgba8unorm";
+ }
+ return "bgra8unorm";
+ }
+
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
return `${this.constructor.name} ${inspect({}, inspectOptions)}`;
}