Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 84 additions & 16 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,9 @@ interface GPUDevice : EventTarget {

[SameObject] readonly attribute GPUQueue defaultQueue;

GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);

GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
GPUTexture createTexture(GPUTextureDescriptor descriptor);
GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
Expand All @@ -1410,9 +1413,6 @@ interface GPUDevice : EventTarget {
Promise<GPUComputePipeline> createReadyComputePipeline(GPUComputePipelineDescriptor descriptor);
Promise<GPURenderPipeline> createReadyRenderPipeline(GPURenderPipelineDescriptor descriptor);

GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);

GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
};
GPUDevice includes GPUObjectBase;
Expand Down Expand Up @@ -2024,11 +2024,15 @@ GPUTextureView includes GPUObjectBase;
::
The {{GPUTexture}} into which this is a view.

: <dfn>\[[descriptor]]</dfn>
: <dfn>\[[descriptor]]</dfn>, of type {{GPUTextureViewDescriptor}}, read-only
::
The {{GPUTextureViewDescriptor}} describing this texture view.
The descriptor used to create this texture view.

All optional fields of {{GPUTextureViewDescriptor}} are defined.

: <dfn>\[[extent]]</dfn>, of type {{GPUExtent3DDict}}, read-only
::
The extent of this texture view.
</dl>

### Texture View Creation ### {#texture-view-creation}
Expand Down Expand Up @@ -4271,6 +4275,10 @@ GPUCommandBuffer includes GPUObjectBase;
{{GPUCommandBuffer}} has the following internal slots:

<dl dfn-type=attribute dfn-for="GPUCommandBuffer">
: <dfn>\[[queue]]</dfn> of type {{GPUQueue}}.
::
The parent queue, which will be executing the commands.

: <dfn>\[[command_list]]</dfn> of type [=list=]&lt;[=GPU command=]&gt;.
::
A [=list=] of [=GPU commands=] to be executed on the [=Queue timeline=] when this command
Expand Down Expand Up @@ -4337,6 +4345,10 @@ GPUCommandEncoder includes GPUObjectBase;
{{GPUCommandEncoder}} has the following internal slots:

<dl dfn-type=attribute dfn-for="GPUCommandEncoder">
: <dfn>\[[queue]]</dfn> of type {{GPUQueue}}.
::
The parent queue, which will be executing the commands.

: <dfn>\[[command_list]]</dfn> of type [=list=]&lt;[=GPU command=]&gt;.
::
A [=list=] of [=GPU command=] to be executed on the [=Queue timeline=] when the
Expand Down Expand Up @@ -4389,6 +4401,7 @@ which may be one of the following:
<script type=idl>
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
boolean measureExecutionTime = false;
GPUQueue queue;
Comment thread
kvark marked this conversation as resolved.

// TODO: reusability flag?
};
Expand All @@ -4398,6 +4411,10 @@ dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
: <dfn>measureExecutionTime</dfn>
::
Enable measurement of the GPU execution time of the entire command buffer.

: <dfn>queue</dfn>
::
The target queue which will be executing the commands.
Comment thread
kvark marked this conversation as resolved.
</dl>

<dl dfn-type=method dfn-for=GPUDevice>
Expand All @@ -4410,12 +4427,21 @@ dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {

**Arguments:**
<pre class=argumentdef for="GPUDevice/createCommandEncoder(descriptor)">
descriptor: Description of the {{GPUCommandEncoder}} to create.
|descriptor|: Description of the {{GPUCommandEncoder}} to create.
</pre>

**Returns:** {{GPUCommandEncoder}}

Issue: Describe {{GPUDevice/createCommandEncoder()}} algorithm steps.
Issue the following steps on the [=Device timeline=] of |this|:
<div class=device-timeline>
1. Let |e| be a new {{GPUCommandEncoder}} object.
1. Set |e|.{{GPUCommandEncoder/[[command_list]]}} to an empty list.
1. Set |e|.{{GPUCommandEncoder/[[state]]}} to {{encoder state/open}}.
1. Set |e|.{{GPUCommandEncoder/[[debug_group_stack]]}} to an empty list.
1. Set |e|.{{GPUCommandEncoder/[[queue]]}} to |descriptor|.{{GPUCommandEncoderDescriptor/queue}},
if it's not `null`, or otherwise to |this|.{{GPUDevice/defaultQueue}}.
1. Return |e|.
</div>
</div>
</dl>

Expand Down Expand Up @@ -4458,6 +4484,12 @@ dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
are considered to be used as [=internal usage/attachment-read=] for the duration of the render pass.
1. Else, the [=texture subresource=] seen by |depthStencilAttachment|.{{GPURenderPassDepthStencilAttachmentDescriptor/attachment}}
is considered to be used as [=internal usage/attachment=] for the duration of the render pass.
1. Let |p| be a new {{GPURenderPassEncoder}} object.
1. Set |p|.{{GPURenderPassEncoder/[[attachment_size]]}} to {{GPUTextureView/[[extent]]}}
of any non-`null` attachment.
1. Set |p|.{{GPURenderPassEncoder/[[queue]]}} to |this|.{{GPUCommandEncoder/[[queue]]}}.
1. Return |p|.

</div>

Issue: specify the behavior of read-only depth/stencil
Expand Down Expand Up @@ -5095,6 +5127,7 @@ command encoder can no longer be used.
</div>

1. Set |this|.{{GPUCommandEncoder/[[state]]}} to {{encoder state/closed}}.
1. Let |commandBuffer|.{{GPUCommandBuffer/[[queue]]}} be |this|.{{GPUCommandEncoder/[[queue]]}}.
1. Let |commandBuffer|.{{GPUCommandBuffer/[[command_list]]}} be a [=list/clone=]
of |this|.{{GPUCommandEncoder/[[command_list]]}}.
</div>
Expand Down Expand Up @@ -5641,6 +5674,10 @@ GPURenderPassEncoder includes GPURenderEncoderBase;
{{GPURenderPassEncoder}} has the following internal slots:

<dl dfn-type=attribute dfn-for="GPURenderPassEncoder">
: <dfn>\[[queue]]</dfn> of type {{GPUQueue}}.
::
The queue owning {{GPUCommandEncoder}}, which contains the pass.

: <dfn>\[[attachment_size]]</dfn>
::
Set to the following extents:
Expand Down Expand Up @@ -5700,12 +5737,10 @@ dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
1. |this|.{{GPURenderPassDescriptor/depthStencilAttachment}} must meet the [$GPURenderPassDepthStencilAttachmentDescriptor/GPURenderPassDepthStencilAttachmentDescriptor Valid Usage$] rules.

1. Each {{GPURenderPassColorAttachmentDescriptor/attachment}} in |this|.{{GPURenderPassDescriptor/colorAttachments}}
and |this|.{{GPURenderPassDescriptor/depthStencilAttachment}}.{{GPURenderPassDepthStencilAttachmentDescriptor/attachment}},
if present, must have all have the same {{GPUTexture/[[sampleCount]]}}.

1. The dimensions of the [=subresource=]s seen by each {{GPURenderPassColorAttachmentDescriptor/attachment}} in |this|.{{GPURenderPassDescriptor/colorAttachments}}
and |this|.{{GPURenderPassDescriptor/depthStencilAttachment}}.{{GPURenderPassDepthStencilAttachmentDescriptor/attachment}},
if present, must match.
and |this|.{{GPURenderPassDescriptor/depthStencilAttachment}}.{{GPURenderPassDepthStencilAttachmentDescriptor/attachment}}
if present:
- must have all the same {{GPUTextureView/[[texture]]}}.{{GPUTexture/[[sampleCount]]}}.
- must have all the same {{GPUTextureView/[[extent]]}}.

Issue: Define <dfn for=>maximum color attachments</dfn>

Expand Down Expand Up @@ -6352,15 +6387,21 @@ attachments used by this encoder.
{{GPURenderBundle}}s are executed, the command buffer state is unchanged.

<div algorithm="GPURenderPassEncoder.executeBundles">
**Called on:** {{GPURenderPassEncoder}} this.
**Called on:** {{GPURenderPassEncoder}} |this|.

**Arguments:**
<pre class=argumentdef for="GPURenderPassEncoder/executeBundles(bundles)">
bundles: List of render bundles to execute.
|bundles|: List of render bundles to execute.
</pre>

**Returns:** {{undefined}}

If any of the following conditions are unsatisfied, generate a validation error and stop.
<div class=validusage>
- For each |bundle| in |bundles|,
|bundle|.{{GPURenderBundle/[[queue]]}} is |this|.{{GPURenderPassEncoder/[[queue]]}}.
</div>

Issue: Describe {{GPURenderPassEncoder/executeBundles()}} algorithm steps.
</div>
</dl>
Expand Down Expand Up @@ -6406,6 +6447,14 @@ interface GPURenderBundle {
GPURenderBundle includes GPUObjectBase;
</script>

{{GPURenderBundle}} has the following internal slots:

<dl dfn-type=attribute dfn-for="GPURenderBundle">
: <dfn>\[[queue]]</dfn> of type {{GPUQueue}}.
::
The parent queue, which will be executing the commands.
</dl>

### Creation ### {#render-bundle-creation}

<script type=idl>
Expand All @@ -6428,7 +6477,7 @@ GPURenderBundleEncoder includes GPURenderEncoderBase;
Creates a {{GPURenderBundleEncoder}}.

<div algorithm=GPUDevice.createRenderBundleEncoder>
**Called on:** {{GPUDevice}} this.
**Called on:** {{GPUQueue}} this.

**Arguments:**
<pre class=argumentdef for="GPUDevice/createRenderBundleEncoder(descriptor)">
Expand All @@ -6441,13 +6490,22 @@ GPURenderBundleEncoder includes GPURenderEncoderBase;
</div>
</dl>

{{GPURenderBundleEncoder}} has the following internal slots:

<dl dfn-type=attribute dfn-for="GPURenderBundleEncoder">
: <dfn>\[[queue]]</dfn> of type {{GPUQueue}}.
::
The parent queue, which will be executing the commands.
</dl>

### Encoding ### {#render-bundle-encoding}

<script type=idl>
dictionary GPURenderBundleEncoderDescriptor : GPUObjectDescriptorBase {
required sequence<GPUTextureFormat> colorFormats;
GPUTextureFormat depthStencilFormat;
GPUSize32 sampleCount = 1;
GPUQueue queue;
Comment thread
kvark marked this conversation as resolved.
Outdated
};
</script>

Expand Down Expand Up @@ -6501,6 +6559,14 @@ interface GPUQueue {
GPUQueue includes GPUObjectBase;
</script>

{{GPUQueue}} has the following internal slots:

<dl dfn-type=attribute dfn-for="GPUQueue">
: <dfn>\[[device]]</dfn>, of type {{GPUDevice}}
::
The parent device of this queue.
Comment thread
kvark marked this conversation as resolved.
Outdated
</dl>

{{GPUQueue}} has the following methods:

<dl dfn-type=method dfn-for=GPUQueue>
Expand Down Expand Up @@ -6666,6 +6732,8 @@ GPUQueue includes GPUObjectBase;
<div class=validusage>
- Every {{GPUBuffer}} referenced in any element of |commandBuffers| is in the
`"unmapped"` [=buffer state=].
- For every {{GPUCommandBuffer}} |commandBuffer| in |commandBuffers|,
|commandBuffer|.{{GPUCommandBuffer/[[queue]]}} is |this|.
</div>

1. Issue the following steps on the [=Queue timeline=] of |this|:
Expand Down