← Back to release summary

WebGPU: Texture component swizzle

Category
Graphics
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

WPT details: WebGPU/WGSL have a conformance test suite (https://github.com/gpuweb/cts) that is regularly pulled into Chromium and part of the testing of Dawn/Tint in Chromium. While the CTS can be embedded in WPT, the WebGPU team opted to keep it separate in Chromium testing to use a customized harness for robustness and performance. All the tests about this feature in WebGPU CTS can be found at https://github.com/gpuweb/cts/pull/4427

Summary

Functionality added to the WebGPU spec after its first shipment in a browser. Allows GPUTextureViews to rearrange or replace the color components from texture's red/green/blue/alpha channels when accessed by a shader.

Motivation

The texture component swizzle optional feature allows for efficient, flexible, and robust texture sampling in WebGPU, enabling developers to optimize performance, correct component ordering mismatches, and reuse shader code across various texture formats. https://github.com/gpuweb/gpuweb/pull/5361

Standards & signals

Ecosystem

Explainers: https://github.com/gpuweb/gpuweb/blob/main/proposals/texture-component-swizzle.md

View on chromestatus.com