Skip to content

Commit

Permalink
Add features list to GPUSupportedFeatures page (#36398)
Browse files Browse the repository at this point in the history
* Add features list to GPUSupportedFeatures page

* Add notes about feature requirements

* Fixes for beaufortfrancois review comments

* Add notes to make it clear which features are not supported yet
  • Loading branch information
chrisdavidmills authored Oct 28, 2024
1 parent ca1fc68 commit 2379747
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ beginComputePass(descriptor)
- `querySet`: The {{domxref("GPUQuerySet")}} that the timestamp will be written to.

> [!NOTE]
> To use timestamp queries, the `timestamp-query` {{domxref("GPUSupportedFeatures", "feature", "", "nocode")}} must be enabled in the {{domxref("GPUDevice")}}.
> The `timestamp-query` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to use timestamp queries.
### Return value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ beginRenderPass(descriptor)
- `querySet`: The {{domxref("GPUQuerySet")}} that the timestamp will be written to.

> [!NOTE]
> To use timestamp queries, the `timestamp-query` {{domxref("GPUSupportedFeatures", "feature", "", "nocode")}} must be enabled in the {{domxref("GPUDevice")}}.
> The `timestamp-query` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to use timestamp queries.
### Color attachment object structure

Expand Down
3 changes: 2 additions & 1 deletion files/en-us/web/api/gpudevice/createqueryset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ createQuerySet(descriptor)

- : Timestamp queries allow applications to write timestamps to a {{domxref("GPUQuerySet")}}. To run a timestamp query, appropriate {{domxref("GPUQuerySet")}}s must be provided inside the value of the `timestampWrites` descriptor property when invoking {{domxref("GPUCommandEncoder.beginRenderPass()")}} to run a render pass, or {{domxref("GPUCommandEncoder.beginComputePass()")}} to run a compute pass. Alternatively, you can run a single timestamp query at any time by invoking {{domxref("GPUCommandEncoder.writeTimeStamp()")}} with an appropriate {{domxref("GPUQuerySet")}} as a parameter.

To use timestamp queries, the `timestamp-query` {{domxref("GPUSupportedFeatures", "feature", "", "nocode")}} must be enabled in the {{domxref("GPUDevice")}}.
> [!NOTE]
> The `timestamp-query` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to use timestamp queries.
### Return value

Expand Down
16 changes: 15 additions & 1 deletion files/en-us/web/api/gpudevice/createrenderpipeline/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,23 @@ The `fragment` object contains an array of objects, each of which can contain th
- `"one"`
- `"one-minus-dst"`
- `"one-minus-src"`
- `"one-minus-src1"`
- `"one-minus-src-alpha"`
- `"one-minus-src1-alpha"`
- `"one-minus-dst-alpha"`
- `"one-minus-constant"`
- `"src"`
- `"src1"`
- `"src-alpha"`
- `"src1-alpha"`
- `"src-alpha-saturated"`
- `"zero"`

If omitted, `dstFactor` defaults to `"zero"`.

> [!NOTE]
> The `dual-source-blending` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for the `src1`, `one-minus-src1`, `src1-alpha`, and `one-minus-src1-alpha` blend factor operations to be used successfully. If not, a {{domxref("GPUValidationError")}} is generated.

- `operation` {{optional_inline}}

- : An enumerated value that defines the algorithm used to combine source and destination blend factors, to calculate the final values written to the target attachment components. Possible values are:
Expand Down Expand Up @@ -250,6 +257,8 @@ The `primitive` object can contain the following properties:

If omitted, `frontFace` defaults to `"ccw"`.

> [!NOTE] > `frontFace` and `cullMode` have no effect on `"point-list"`, `"line-list"`, or `"line-strip"` topologies.

- `stripIndexFormat` {{optional_inline}}

- : An enumerated value that determines the index buffer format and primitive restart value in the case of pipelines with strip topologies (`"line-strip"` or `"triangle-strip"`). The primitive restart value specifies which index value indicates that a new primitive should be started rather than continuing to construct the strip with the prior indexed vertices. Possible values are:
Expand All @@ -272,9 +281,11 @@ The `primitive` object can contain the following properties:
If omitted, `topology` defaults to `"triangle-list"`.

- `unclippedDepth` {{optional_inline}}

- : A boolean. A value of `true` indicates that depth clipping is disabled. If omitted, `unclippedDepth` defaults to `false`. Note that to control depth clipping, the `depth-clip-control` {{domxref("GPUSupportedFeatures", "feature", "", "nocode")}} must be enabled in the {{domxref("GPUDevice")}}.

> **Note:** `frontFace` and `cullMode` have no effect on `"point-list"`, `"line-list"`, or `"line-strip"` topologies.
> [!NOTE]
> The `depth-clip-control` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for the `unclippedDepth` property to be used successfully. If not, a {{domxref("GPUValidationError")}} is generated.

### `vertex` object structure

Expand Down Expand Up @@ -346,6 +357,9 @@ The following criteria must be met when calling **`createRenderPipeline()`**, ot
- `targets.length` is less than or equal to the {{domxref("GPUDevice")}}'s `maxColorAttachments` {{domxref("GPUSupportedLimits", "limit", "", "nocode")}}.
- For each `target`, `writeMask`'s numeric equivalent is less than 16.
- If any of the used blend factor operations use the source alpha channel (for example `"src-alpha-saturated"`), the output has an alpha channel (that is, it must be a `vec4`).
- If the `src1`, `one-minus-src1`, `src1-alpha`, or `one-minus-src1-alpha` blend factor operations are used, the `dual-source-blending` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) is enabled.
- For `primitive` objects:
- If the `unclippedDepth` property is used, the `depth-clip-control` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) is enabled.
## Examples
Expand Down
3 changes: 3 additions & 0 deletions files/en-us/web/api/gpudevice/createsampler/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ createSampler(descriptor)

If omitted, `magFilter` defaults to `"nearest"`.

> [!NOTE]
> The `float32-filterable` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for `r32float`-, `rg32float`-, and `rgba32float`-[`format`](/en-US/docs/Web/API/GPUDevice/createTexture#format) {{domxref("GPUTexture")}}s to be filterable.
- `minFilter` {{optional_inline}}
- : An enumerated value specifying the sampling behavior when the sample footprint is larger than one texel. Possible and default values are the same as for `magFilter`.
- `mipmapFilter` {{optional_inline}}
Expand Down
6 changes: 6 additions & 0 deletions files/en-us/web/api/gpudevice/createshadermodule/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ createShaderModule(descriptor)

A {{domxref("GPUShaderModule")}} object instance.

### Validation

The following criteria must be met when calling **`createShaderModule()`**, otherwise a {{domxref("GPUValidationError")}} is generated and an invalid {{domxref("GPUShaderModule")}} object is returned:

- If your shader's WGSL code uses the half-precision floating-point type [`f16`](https://gpuweb.github.io/gpuweb/wgsl/#extension-f16), it includes `enable f16;` at the top, and the associated {{domxref("GPUDevice")}} is created with the `shader-f16` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) enabled.

## Examples

In our [basic render demo](https://mdn.github.io/dom-examples/webgpu-render-demo/), our shader module is created using the following code:
Expand Down
14 changes: 14 additions & 0 deletions files/en-us/web/api/gpudevice/createtexture/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ createTexture(descriptor)
`dimension` defaults to `"2d"` if the value is omitted.

- `format`

- : An enumerated value specifying the format of the texture. See the [Texture formats](https://gpuweb.github.io/gpuweb/#enumdef-gputextureformat) section of the specification for all the possible values.

> [!NOTE]
>
> - The `depth32float-stencil8` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to create `depth32float-stencil8`-format {{domxref("GPUTexture")}}s.
> - The `texture-compression-bc` feature needs to be enabled to create two-dimensional BC compressed `GPUTexture`s: `bc1-rgba-unorm`, `bc1-rgba-unorm-srgb`, `bc2-rgba-unorm`, `bc2-rgba-unorm-srgb`, `bc3-rgba-unorm`, `bc3-rgba-unorm-srgb`, `bc4-r-unorm`, `bc4-r-snorm`, `bc5-rg-unorm`, `bc5-rg-snorm`, `bc6h-rgb-ufloat`, `bc6h-rgb-float`, `bc7-rgba-unorm`, and `bc7-rgba-unorm-srgb` formats.
> - The `texture-compression-astc` feature needs to be enabled to create two-dimensional ASTC compressed `GPUTexture`s: `astc-4x4-unorm`, `astc-4x4-unorm-srgb`, `astc-5x4-unorm`, `astc-5x4-unorm-srgb`, `astc-5x5-unorm`, `astc-5x5-unorm-srgb`, `astc-6x5-unorm`, `astc-6x5-unorm-srgb`, `astc-6x6-unorm`, `astc-6x6-unorm-srgb`, `astc-8x5-unorm`, `astc-8x5-unorm-srgb`, `astc-8x6-unorm`, `astc-8x6-unorm-srgb`, `astc-8x8-unorm`, `astc-8x8-unorm-srgb`, `astc-10x5-unorm`, `astc-10x5-unorm-srgb`, `astc-10x6-unorm`, `astc-10x6-unorm-srgb`, `astc-10x8-unorm`, `astc-10x8-unorm-srgb`, `astc-10x10-unorm`, `astc-10x10-unorm-srgb`, `astc-12x10-unorm`, `astc-12x10-unorm-srgb`, and `astc-12x12-unorm``astc-12x12-unorm-srgb` formats.
> - The `texture-compression-etc2` feature needs to be enabled to create two-dimensional ETC2 compressed `GPUTexture`s: `etc2-rgb8unorm`, `etc2-rgb8unorm-srgb`, `etc2-rgb8a1unorm`, `etc2-rgb8a1unorm-srgb`, `etc2-rgba8unorm`, `etc2-rgba8unorm-srgb`, `eac-r11unorm`, `eac-r11snorm`, `eac-rg11unorm`, and `eac-rg11snorm` formats.
- `label` {{optional_inline}}
- : A string providing a label that can be used to identify the object, for example in {{domxref("GPUError")}} messages or console warnings.
- `mipLevelCount` {{optional_inline}}
Expand Down Expand Up @@ -73,6 +82,11 @@ createTexture(descriptor)
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT;
```

> [!NOTE]
>
> - The `bgra8unorm-storage` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to specify `STORAGE_BINDING` usage for a `bgra8unorm`-[`format`](/en-US/docs/Web/API/GPUDevice/createTexture#format) {{domxref("GPUTexture")}}.
> - The `rg11b10ufloat-renderable` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to specify `RENDER_ATTACHMENT` usage for a `rg11b10ufloat`-[`format`](/en-US/docs/Web/API/GPUDevice/createTexture#format) {{domxref("GPUTexture")}}, as well as its blending and multisampling.

- `viewFormats` {{optional_inline}}
- : An array of enumerated values specifying other [texture formats](https://gpuweb.github.io/gpuweb/#enumdef-gputextureformat) permitted when calling {{domxref("GPUTexture.createView()")}} on this texture, in addition to the texture format specified in its `format` value.

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/gpuqueryset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ The **`GPUQuerySet`** interface of the {{domxref("WebGPU API", "WebGPU API", "",

- Occlusion queries are available on render passes to query whether any fragment samples pass all the per-fragment tests for a set of drawing commands (including scissor, sample mask, alpha to coverage, stencil, and depth tests). To run an occlusion query, an appropriate `GPUQuerySet` must be provided as the value of the `occlusionQuerySet` descriptor property when invoking {{domxref("GPUCommandEncoder.beginRenderPass()")}} to run a render pass.

- Timestamp queries allow applications to write timestamps to a `GPUQuerySet`. To run a timestamp query, appropriate `GPUQuerySet`s must be provided inside the value of the `timestampWrites` descriptor property when invoking {{domxref("GPUCommandEncoder.beginRenderPass()")}} to run a render pass, or {{domxref("GPUCommandEncoder.beginComputePass()")}} to run a compute pass. Alternatively, you can run a single timestamp query at any time by invoking {{domxref("GPUCommandEncoder.writeTimeStamp()")}} with an appropriate `GPUQuerySet` as a parameter.
- Timestamp queries allow applications to write timestamps to a `GPUQuerySet`. To run a timestamp query, appropriate `GPUQuerySet`s must be provided inside the value of the `timestampWrites` descriptor property when invoking {{domxref("GPUCommandEncoder.beginRenderPass()")}} to run a render pass, or {{domxref("GPUCommandEncoder.beginComputePass()")}} to run a compute pass.

> [!NOTE]
> To use timestamp queries, the `timestamp-query` {{domxref("GPUSupportedFeatures", "feature", "", "nocode")}} must be enabled in the {{domxref("GPUDevice")}}.
> The `timestamp-query` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to use timestamp queries.
A `GPUQuerySet` object instance is created using the {{domxref("GPUDevice.createQuerySet()")}} method.

Expand Down
3 changes: 3 additions & 0 deletions files/en-us/web/api/gpuqueryset/type/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ An enumerated value. Possible values are:
- `"timestamp"`
- : The `GPUQuerySet` manages timestamp queries.

> [!NOTE]
> The `timestamp-query` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled to use timestamp queries.
## Examples

See the main [`GPUQuerySet`](/en-US/docs/Web/API/GPUQuerySet#examples) page for an example.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ drawIndexedIndirect(indirectBuffer, indirectOffset)
device.queue.writeBuffer(buffer, 0, uint32, 0, uint32.length);
```

> [!NOTE]
> The `indirect-first-instance` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for non-zero `firstInstance` values to be used. If the `indirect-first-instance` feature is not enabled and `firstInstance` is not zero, the `drawIndexedIndirect()` call will be treated as a no-op.

- `indirectOffset`
- : The offset, in bytes, into `indirectBuffer` where the value data begins.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ drawIndirect(indirectBuffer, indirectOffset)
device.queue.writeBuffer(buffer, 0, uint32, 0, uint32.length);
```

> [!NOTE]
> The `indirect-first-instance` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for non-zero `firstInstance` values to be used. If the `indirect-first-instance` feature is not enabled and `firstInstance` is not zero, the `drawIndirect()` call will be treated as a no-op.

- `indirectOffset`
- : The offset, in bytes, into `indirectBuffer` where the value data begins.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ drawIndexedIndirect(indirectBuffer, indirectOffset)
device.queue.writeBuffer(buffer, 0, uint32, 0, uint32.length);
```

The value corresponding to `firstInstance` must be 0, unless the `indirect-first-instance` feature is enabled. If the `indirect-first-instance` feature is not enabled and `firstInstance` is not zero, the `drawIndexedIndirect()` call will be treated as a no-op.
> [!NOTE]
> The `indirect-first-instance` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for non-zero `firstInstance` values to be used. If the `indirect-first-instance` feature is not enabled and `firstInstance` is not zero, the `drawIndexedIndirect()` call will be treated as a no-op.

- `indirectOffset`
- : The offset, in bytes, into `indirectBuffer` where the value data begins.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ drawIndirect(indirectBuffer, indirectOffset)
device.queue.writeBuffer(buffer, 0, uint32, 0, uint32.length);
```

> [!NOTE]
> The `indirect-first-instance` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) needs to be enabled for non-zero `firstInstance` values to be used. If the `indirect-first-instance` feature is not enabled and `firstInstance` is not zero, the `drawIndirect()` call will be treated as a no-op.

- `indirectOffset`
- : The offset, in bytes, into `indirectBuffer` where the value data begins.

Expand Down
Loading

0 comments on commit 2379747

Please sign in to comment.