Issue: https://github.com/gpuweb/gpuweb/issues/3250
Proposal written and proposed by Kai, based on in-depth discussion with editors (Brandon/Myles/Kai) and more input from Brandon.
(Names are all placeholders.)
[[errorTarget]]
, which (roughly speaking) has type GPUDevice?
.
createView()
, for example, does not have to move.GPURootDevice
. (I have long expected we would want this - I just didn't realize it was a breaking change.)
uncapturederror
EventTarget
object for the device (GPURootDevice
) and it's never possible to duplicate or transfer it. This approach is chosen so [[errorTarget]]
can be nullable.[[errorTarget]]
is null
. Errors that happen on this object get sent straight to uncapturederror
. To get them to go to an error target, you have to "clone" the object and specify an errorTarget
to use.GPUDevice
is the error target and can never have a null error target.
Changes:
GPURootDevice
subclass of GPUDevice
. Move EventTarget
to GPURootDevice
. Return GPURootDevice
from requestDevice()
.GPURootDevice : GPUDevice, EventTarget
).Editorial changes:
GPUObjectBase
gets an internal slot [[errorTarget]]
, pointing to a "device client" (a thing which can send operations to a device).this
inherits this.[[errorTarget]]
.(GPUObjectBase)this
, which passes them through [[errorTarget]]
and forwards uncaptured errors to uncapturederror
.Notes:
[[errorTarget]]
. No significant implementation work is needed at this stage.Changes:
object.withErrorTarget(GPUDevice errorTarget)
, which gives you a new JS object with the same underlying object and the provided [[errorTarget]]
.
GPUDevice
and GPURootDevice
don't have these.GPUDevice.withNewErrorTracker()
which returns a new GPUDevice
with a new "device client" with an empty error state tracker.Changes:
[[errorTarget]]
nullable.
[[errorTarget]]
send errors directly to uncapturederror
.[[errorTarget]]
. To associate them with an error target, the receiver must call withErrorTarget()
.
GPUDevice
or GPURootDevice
is sent, you receive a GPUReceivedDevice
. To get a GPUDevice
from it, you must choose either .withNewErrorTracker()
or .withSharedErrorTracker()
. (These can be called multiple times.)
GPURootDevice
from it (that object is tied to the original thread).[[errorTarget]]
points to the same device "client" or a new one.Note:
withSharedErrorTracker()
. This also eliminates a need in the actual native API to use thread-local storage to track which error scope state to target.New independent queue objects behave the same way as other objects.