@wasi-gfx/js-webgpu 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/webgpu.js +13 -3
- package/package.json +1 -1
package/dist/webgpu.js
CHANGED
|
@@ -774,9 +774,19 @@ export class GPUDevice extends EventTarget {
|
|
|
774
774
|
this[inner].setLabel(value);
|
|
775
775
|
}
|
|
776
776
|
get lost() {
|
|
777
|
-
if (!this.#lost)
|
|
778
|
-
|
|
779
|
-
|
|
777
|
+
if (!this.#lost) {
|
|
778
|
+
// The generated types declare `lost()` as `PromiseLike`, but componentize-qjs returns a non-thenable future reader (`.read()` yields the value). So read it only if it isn't thenable.
|
|
779
|
+
// See https://github.com/bytecodealliance/jco/issues/2532
|
|
780
|
+
const lost = this[inner].lost();
|
|
781
|
+
let info;
|
|
782
|
+
if ('then' in lost && typeof lost.then === 'function') {
|
|
783
|
+
info = Promise.resolve(lost);
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
info = lost.read();
|
|
787
|
+
}
|
|
788
|
+
this.#lost = info.then(info => new GPUDeviceLostInfo(key, info));
|
|
789
|
+
}
|
|
780
790
|
return this.#lost;
|
|
781
791
|
}
|
|
782
792
|
get features() {
|