// We need to max out the adapter limits related to texture dimensions to more reliably cause an // OOM error when asked for it, so set that on the device now. const device = await this.requestDeviceTracked(adapter, {
requiredLimits: {
maxTextureDimension2D: adapter.limits.maxTextureDimension2D,
maxTextureArrayLayers: adapter.limits.maxTextureArrayLayers,
},
}); assert(device !== null); this._device = device;
}
/** *Generatesanerrorofthegivenfiltertype.Fornow,theerrorsaregeneratedbycallinga *knowncode-pathtocausetheerror.Thiscanbeupdatedinthefutureshouldtherebeamore *directwaytoinjecterrors.
*/
generateError(filter: GPUErrorFilter): void { switch (filter) { case'out-of-memory': this.trackForCleanup( this.device.createTexture({ // One of the largest formats. With the base limits, the texture will be 256 GiB.
format: 'rgba32float',
usage: GPUTextureUsage.COPY_DST,
size: [ this.device.limits.maxTextureDimension2D, this.device.limits.maxTextureDimension2D, this.device.limits.maxTextureArrayLayers,
],
})
); break; case'validation': // Generating a validation error by passing in an invalid usage when creating a buffer. this.trackForCleanup( this.device.createBuffer({
size: 1024,
usage: 0xffff, // Invalid GPUBufferUsage
})
); break;
} // MAINTENANCE_TODO: This is a workaround for Chromium not flushing. Remove when not needed. this.device.queue.submit([]);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.