If an object is successfully created, it is valid at that moment. An internal object may be invalid. It may become invalid during its lifetime, but it will never become valid again.
如果成功创建了一个对象,则该对象此时有效。内部对象可能无效。它可能在其生命周期内失效,并且永远不会再次生效。
Invalid objects result from a number of situations, including:
If there is an error in the creation of an object, it is immediately invalid. This can happen, for example, if the object descriptor doesn’t describe a valid object, or if there is not enough memory to allocate a resource.
If an object is explicitly destroyed (e.g. GPUBuffer.destroy()), it becomes invalid.
If the device that owns an object is lost, the object becomes invalid.
无效对象由多种情况造成,包括:
如果在创建对象时出错,则该对象立即无效。例如,如果对象描述符没有描述有效的对象,或者没有足够的内存来分配资源,就会发生这种情况。
如果对象被显式销毁(例如GPUBuffer.destroy()),则该对象将无效。
如果拥有对象的设备丢失,该对象将无效。
To determine if a given GPUObjectBase object is valid to use with a targetObject, run the following steps:
1.If any of the following conditions are unsatisfied return false:
object is valid
object.[[device]] is valid.
object.[[device]] is targetObject.[[device]].
2.Return true.
要确定给定的GPUObjectBase对象是否可与targetObject一起使用,请运行以下步骤:
1.如果以下任一条件不满足,则返回false:
对象是有效的
object.[[device]]是有效的
object.[[device]]是targetObject.[[device]].
2.返回true.