3.1.1. Dot Syntax
In this specification, the . (“dot”) syntax, common in programming languages, is used. The phrasing “Foo.Bar” means “the Bar member of the value (or interface) Foo.”
在本规范中,使用编程语言中常见的(“点”)语法。短语”Foo.Bar”表示”对象(或接口)Foo的Bar成员”
The ?. (“optional chaining”) syntax, adopted from JavaScript, is also used. The phrasing “Foo?.Bar” means “if Foo is null or undefined, Foo; otherwise, Foo.Bar”.
采纳自JavaScript的”?.”语法同样被使用。”Foo?.Bar”表示”如果Foo为null或undefined,则为undefined;否则,Foo.Bar”。
For example, where buffer is a GPUBuffer, buffer?.[[device]].[[adapter]] means “if buffer is null or undefined, then undefined, otherwise, the [[adapter]] internal slot of the [[device]] internal slot of buffer.
例如,buffer是一个GPUBuffer对象,buffer?.[[device]].[[adapter]]表示”如果buffer为null或undefined,则为undefined,否则buffer的内部插槽[[device]]的内部插槽[[adapter]]”
3.1.2. Internal Objects
An internal object is a conceptual, non-exposed WebGPU object. Internal objects track the state of an API object and hold any underlying implementation. If the state of a particular internal object can change in parallel from multiple agents, those changes are always atomic with respect to all agents.
内部对象是概念性的、未公开的WebGPU对象。内部对象跟踪API对象的状态并保存任何底层实现。如果特定内部对象的状态可以从多个代理并行更改,那么这些更改对于所有代理来说都是原子性的。
Note: An “agent” refers to a JavaScript “thread” (i.e. main thread, or Web Worker).
注:”agent”是指JavaScript”线程”(即主线程或Web工作线程)。
3.1.3. WebGPU Interfaces
A WebGPU interface is an exposed interface which encapsulates an internal object. It provides the interface through which the internal object’s state is changed.
WebGPU接口是封装内部对象的公开接口。它提供用于更改内部对象状态的接口。
As a matter of convention, if a WebGPU interface is referred to as invalid, it means that the internal object it encapsulates is invalid.
按照惯例,如果WebGPU接口被援引为无效,则意味着它封装的内部对象无效。
Any interface which includes GPUObjectBase is a WebGPU interface.
任何包含GPUObjectBase的接口都是WebGPU接口。
1 | interface mixin GPUObjectBase { |
GPUObjectBase has the following attributes:
GPUObjectBase具有以下属性:
label, of type USVString, nullable
A label which can be used by development tools (such as error/warning messages, browser developer tools, or platform debugging utilities) to identify the underlying internal object to the developer. It has no specified format, and therefore cannot be reliably machine-parsed.
In any given situation, the user agent may or may not choose to use this label.
label, USVString类型,可为空
开发工具(如错误/警告消息、浏览器开发工具或平台调试实用程序)可以使用的标签,用于向开发人员标识底层内部对象。它没有指定的格式,因此无法可靠地进行机器分析。
在任何给定的情况下,用户代理都可能或可能不选择使用此标签。
GPUObjectBase has the following internal slots:
[[device]], of type device, readonly
An internal slot holding the device which owns the internal object.
[[device]], 类型device, 只读
一个内部插槽持有拥有内部对象的设备
3.1.4. Object Descriptors
An object descriptor holds the information needed to create an object, which is typically done via one of the create* methods of GPUDevice.
对象描述符保存创建对象所需的信息,这通常通过GPUDevice的create*方法之一完成。
1 | dictionary GPUObjectDescriptorBase { |
GPUObjectDescriptorBase has the following members:
label, of type USVString
The initial value of GPUObjectBase.label.
GPUObjectDescriptorBase有如下成员:
label, USVString类型
GPUObjectBase.label的初始值。