Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions files/en-us/web/api/gpusupportedfeatures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The following additional features are defined in WebGPU. Bear in mind that the e
| `rg11b10ufloat-renderable` | When enabled, allows `RENDER_ATTACHMENT` [`usage`](/en-US/docs/Web/API/GPUDevice/createTexture#usage) of `rg11b10ufloat`-[`format`](/en-US/docs/Web/API/GPUDevice/createTexture#format) {{domxref("GPUTexture")}}s, as well as their blending and multisampling. |
| `shader-f16` | When enabled, allows the use of the half-precision floating-point type [`f16`](https://gpuweb.github.io/gpuweb/wgsl/#extension-f16) in WGSL. |
| `subgroups` | When enabled, allows the use of [subgroups](https://gpuweb.github.io/gpuweb/wgsl/#extension-subgroups) in WGSL. Subgroups enable SIMD-level parallelism, allowing threads in a workgroup to communicate and execute collective math operations such as calculating a sum of numbers, and offering an efficient method for cross-thread data sharing. Note that the {{domxref("GPUAdapterInfo.subgroupMinSize", "subgroupMinSize")}} and {{domxref("GPUAdapterInfo.subgroupMaxSize", "subgroupMaxSize")}} properties can be useful to check if, for example, you have a hardcoded algorithm that requires a subgroup of a certain size. You can use f16 values with subgroups when you request a GPUDevice with both the `shader-f16` and `subgroups` features. |
| `texture-component-swizzle` | When enabled, allows the [`swizzle`](/en-US/docs/Web/API/GPUTexture/createView#swizzle) property to be set when calling `GPUTexture.createView()`. This feature allows a texture's red, green, blue, and alpha channel values to be rearranged or replaced in a texture view when accessed by a shader. |
| `texture-compression-bc` | When enabled, allows creation of two-dimensional BC compressed textures. If `texture-compression-bc` is enabled, the following values can be used for the [`format`](/en-US/docs/Web/API/GPUDevice/createTexture#format) property of the {{domxref("GPUDevice.createTexture", "createTexture()")}} descriptor when creating a {{domxref("GPUTexture")}}: `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`. |
| `texture-compression-bc-sliced-3d` | When enabled, allows creation of three-dimensional BC compressed textures. If `texture-compression-bc-sliced-3d` is enabled, `texture-compression-bc` must also be enabled, as it enables the BC texture formats to be used (see `texture-compression-bc`, above) in the first two dimensions. `texture-compression-bc-sliced-3d` enables those same textures to be used in the third dimension. |
| `texture-compression-astc` | When enabled, allows creation of two-dimensional ASTC compressed textures. If `texture-compression-astc` is enabled, the following values can be used for the [`format`](/en-US/docs/Web/API/GPUDevice/createTexture#format) property of the {{domxref("GPUDevice.createTexture", "createTexture()")}} descriptor when creating a {{domxref("GPUTexture")}}: `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`. |
Expand Down
20 changes: 20 additions & 0 deletions files/en-us/web/api/gputexture/createview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@ createView(descriptor)

If `mipLevelCount` is omitted, it will be given a value of {{domxref("GPUTexture.mipLevelCount")}} - `baseMipLevel`.

- `swizzle` {{optional_inline}}
- : A string containing four characters. The position of each character maps to the texture view's red, green, blue, and alpha channel values, respectively. The value of each character specifies the value each of those channels will take when the view is accessed by a shader. Possible values are:
- `r`
- : The texture's red channel value.
- `g`
- : The texture's green channel value.
- `b`
- : The texture's blue channel value.
- `a`
- : The texture's alpha channel value.
- `0`
- : Enforces a value of `0`.
- `1`
- : Enforces a value of `1`.

For example, `swizzle: "grba"` would result in the texture's red and green channel values being swapped when a shader accesses the view. Texture component swizzle allows developers to optimize performance, correct component ordering mismatches, and reuse shader code across various texture formats when sampling textures.

> [!NOTE]
> To use the `swizzle` property, you must enable the `texture-component-swizzle` [feature](/en-US/docs/Web/API/GPUSupportedFeatures) in your {{domxref("GPUDevice")}} by specifying it in the `requiredFeatures` array of the {{domxref("GPUAdapter.requestDevice()")}} descriptor. If this feature is not enabled, the `swizzle` property will have no effect.

- `usage` {{optional_inline}}
- : A set of {{glossary("bitwise flags")}} representing a subset of the source texture's usage flags (available in the {{domxref("GPUTexture.usage")}} property) that are compatible with the chosen view format. This can be used to restrict the allowed view usage in cases where the view format is incompatible with certain usages. The available usage flags are listed in the [`GPUTexture.usage` value table](/en-US/docs/Web/API/GPUTexture/usage#value).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,4 +484,4 @@ We will revisit the other functionality offered by this shorthand when we take a

## Next steps

If you've been working along the [grid guides](/en-US/docs/Web/CSS/Guides/Grid_layout#guides), you should be in a position to create grid layouts using [line-based placement](/en-US/docs/Web/CSS/Guides/Grid_layout/Line-based_placement) or [named areas](/en-US/docs/Web/CSS/Guides/Grid_layout/Named_grid_lines). Now let's take a look at creating [grid layouts using named grid lines](/en-US/docs/Web/CSS/Guides/Grid_layout/Named_grid_lines).
If you've been working along the [grid guides](/en-US/docs/Web/CSS/Guides/Grid_layout#guides), you should be in a position to create grid layouts using [line-based placement](/en-US/docs/Web/CSS/Guides/Grid_layout/Line-based_placement) or named template areas. Now let's take a look at creating [grid layouts using named grid lines](/en-US/docs/Web/CSS/Guides/Grid_layout/Named_grid_lines).
Loading