From 94bf9a465be518efe105414e2d69f56bd91b5c82 Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Mon, 22 Aug 2022 15:35:24 -0700 Subject: [PATCH] Split into two different error types again --- spec/index.bs | 75 ++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 0626c3e2ce..846ee489b2 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -12871,6 +12871,9 @@ interface GPUError { {{GPUError}} is the base interface for all errors surfaced from {{GPUDevice/popErrorScope()}} and the {{GPUDevice/uncapturederror}} event. +Errors must only be generated for operations that explicitly state the conditions one may +be generated under in their respective algorithms, and the subtype of error that is generated. + Note: {{GPUError}} may gain new subtypes in future versions of this spec. Applications should handle this possibility, using only the error's {{GPUError/message}} when possible, and specializing using `instanceof`. Use `error.constructor.name` when it's necessary to serialize an error (e.g. into @@ -12887,8 +12890,8 @@ JSON, for a debug report). applications and capture information for debug reports, not to be surfaced to end-users. Note: User agents should not include potentially machine-parsable details in this message, - such as free system memory on {{GPUErrorFilter/"internal"}} errors raised due to memory - constraints, or other details about the conditions under which memory was exhausted. + such as free system memory on {{GPUErrorFilter/"out-of-memory"}} or other details about the + conditions under which memory was exhausted. +{{GPUOutOfMemoryError}} is a subtype of {{GPUError}} which indicates that there was not enough free +memory to complete the requested operation. The operation may succeed if attempted again with a +lower memory requirement (like using smaller texture dimensions), or if memory used by other +resources is released first. + +
+ To + generate an out-of-memory error for {{GPUDevice}} |device|, run the following steps: + +
+ [=Content timeline=] steps: + + 1. Let |error| be a new {{GPUOutOfMemoryError}} with an appropriate error message. + 1. [$Dispatch error$] |error| to |device|. +
+
+ + {{GPUInternalError}} is a subtype of {{GPUError}} which indicates than an operation failed for a system or implementation-specific reason even when all validation requirements have been satisfied. -For example, the operation may exceede the capabilities of the implementation in a way not easily +For example, the operation may exceed the capabilities of the implementation in a way not easily captured by the [=supported limits=]. The same operation may succeed on other devices or under difference circumstances. -Internal errors must only be generated for operations that explicitly state the conditions one may -be generated under in their respective algorithms. - -{{GPUInternalErrorReason}} defines possible reasons why a {{GPUInternalError}} occurred, though the -list is not exhaustive: - -
- : "out-of-memory" - :: - Indicate there was not enough free memory to complete the requested operation. The operation - may succeed if attempted again with a lower memory requirement (like using smaller texture - dimensions), or if memory used by other resources is released first. -
- -{{GPUInternalError}} has the following attributes: - -
- : reason - :: - The reason the internal error was generated, if known. If a reason is not known or not - one of the available {{GPUInternalErrorReason}} options, must be `undefined`. -
-
To generate an - internal error with ({{GPUInternalErrorReason}} or undefined) |reason| for {{GPUDevice}} |device|, run - the following steps: + internal error for {{GPUDevice}} |device|, run the following steps:
[=Content timeline=] steps: 1. Let |error| be a new {{GPUInternalError}} with an appropriate error message. - 1. Set |error|.{{GPUInternalError/reason}} to |reason|. 1. [$Dispatch error$] |error| to |device|.
@@ -12991,6 +12987,7 @@ of WebGPU calls, typically for debugging purposes or to make an operation more f