summaryrefslogtreecommitdiff
path: root/ext/webgpu/01_webgpu.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/webgpu/01_webgpu.js')
-rw-r--r--ext/webgpu/01_webgpu.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js
index 2c30e47f0..36b35072c 100644
--- a/ext/webgpu/01_webgpu.js
+++ b/ext/webgpu/01_webgpu.js
@@ -137,6 +137,8 @@ const _mappingRange = Symbol("[[mapping_range]]");
const _mappedRanges = Symbol("[[mapped_ranges]]");
const _mapMode = Symbol("[[map_mode]]");
const _adapter = Symbol("[[adapter]]");
+const _adapterInfo = Symbol("[[adapterInfo]]");
+const _invalid = Symbol("[[invalid]]");
const _cleanup = Symbol("[[cleanup]]");
const _vendor = Symbol("[[vendor]]");
const _architecture = Symbol("[[architecture]]");
@@ -414,17 +416,18 @@ function createGPUAdapter(inner) {
features: createGPUSupportedFeatures(inner.features),
limits: createGPUSupportedLimits(inner.limits),
};
+ adapter[_adapterInfo] = undefined;
+ adapter[_invalid] = false;
return adapter;
}
-const _invalid = Symbol("[[invalid]]");
class GPUAdapter {
/** @type {InnerGPUAdapter} */
[_adapter];
- /** @type {bool} */
- [_invalid];
/** @type {GPUAdapterInfo | undefined} */
- #adapterInfo;
+ [_adapterInfo];
+ /** @type {boolean} */
+ [_invalid];
/** @returns {GPUSupportedFeatures} */
get features() {
@@ -439,7 +442,7 @@ class GPUAdapter {
/** @returns {boolean} */
get isFallbackAdapter() {
webidl.assertBranded(this, GPUAdapterPrototype);
- return this[_adapter].isFallbackAdapter;
+ return this[_adapter].isFallback;
}
constructor() {
@@ -509,16 +512,16 @@ class GPUAdapter {
get info() {
webidl.assertBranded(this, GPUAdapterPrototype);
+ if (this[_adapterInfo] !== undefined) {
+ return this[_adapterInfo];
+ }
+
if (this[_invalid]) {
throw new TypeError(
"The adapter cannot be reused, as it has been invalidated by a device creation",
);
}
- if (this.#adapterInfo !== undefined) {
- return this.#adapterInfo;
- }
-
const {
vendor,
architecture,
@@ -531,7 +534,7 @@ class GPUAdapter {
adapterInfo[_architecture] = architecture;
adapterInfo[_device] = device;
adapterInfo[_description] = description;
- this.#adapterInfo = adapterInfo;
+ this[_adapterInfo] = adapterInfo;
return adapterInfo;
}
@@ -543,6 +546,7 @@ class GPUAdapter {
keys: [
"features",
"limits",
+ "info",
"isFallbackAdapter",
],
}),
@@ -937,7 +941,6 @@ function GPUObjectBaseMixin(name, type) {
* @property {number | undefined} rid
* @property {GPUSupportedFeatures} features
* @property {GPUSupportedLimits} limits
- * @property {GPUDevice} device
*/
class InnerGPUDevice {