Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions web/src/webgpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,20 @@ function tryCreateBuffer(device: GPUDevice, descriptor: GPUBufferDescriptor) {

const buffer = device.createBuffer(descriptor);

device.popErrorScope().then((error) => {if (error) {device.destroy(); console.error(error);}});
device.popErrorScope().then((error) => {if (error) {device.destroy(); console.error(error);}});
device.popErrorScope().then((error) => {if (error) {device.destroy(); console.error(error);}});
// Destroy at most once even if multiple error types fire.
Promise.all([
device.popErrorScope(),
device.popErrorScope(),
device.popErrorScope(),
]).then((errors) => {
const captured = errors.filter((error): error is GPUError => error !== null);
if (captured.length > 0) {
device.destroy();
captured.forEach((error) => console.error(error));
}
}).catch((err) => {
console.error("Failed to pop error scopes:", err);
});
Comment thread
guan404ming marked this conversation as resolved.

return buffer;
}
Expand Down
Loading