发布时间:2025 年 11 月 19 日
纹理组件混色
现在,当着色器访问纹理的红色、绿色、蓝色和 Alpha 通道时,可以重新排列或替换这些颜色分量。
当 GPUAdapter 中提供 "texture-component-swizzle" 功能时,请求具有此功能的 GPUDevice,并通过调用 createView() 并使用新的 swizzle 选项来创建 GPUTextureView。此值是一个长度为 4 的字符串,每个字符分别对应于视图的红色、绿色、蓝色和 Alpha 分量。每个字符可以是:
"r":从纹理的红色通道获取值。"g":从纹理的绿色通道获取其值。"b":从纹理的蓝色通道获取其值。"a":从纹理的 Alpha 通道获取其值。"0":强制将其值设为 0。"1":强制将其值设为 1。
请参阅以下代码段和 chromestatus 条目。
const adapter = await navigator.gpu.requestAdapter();
if (!adapter.features.has("texture-component-swizzle")) {
throw new Error("Texture component swizzle support is not available");
}
// Explicitly request texture component swizzle support.
const device = await adapter.requestDevice({
requiredFeatures: ["texture-component-swizzle"],
});
// ... Assuming myTexture is a GPUTexture with a single red channel.
// Map the view's red, green, blue components to myTexture's red channel
// and force the view's alpha component to 1 so that the shader sees it as
// a grayscale image.
const view = myTexture.createView({ swizzle: "rrr1" });
// Send the appropriate commands to the GPU...
移除 bgra8unorm 只读存储纹理使用情况
正如之前宣布的那样,现在已移除将 "bgra8unorm" 格式与只读存储纹理搭配使用的功能。WebGPU 规范明确禁止这样做,而 Chrome 之前允许这样做是一个 bug,因为此格式仅用于写入访问,且不可移植。请参阅问题 427681156。
“黎明”更新
修复了在 Vulkan 中清除 3D 纹理时引发的验证错误。请参阅问题 443950688
这仅涵盖了部分重要亮点。查看详尽的提交列表。
WebGPU 的新变化
WebGPU 新变化系列中涵盖的所有内容。
Chrome 143
Chrome 142
Chrome 141
Chrome 140
- 设备请求会消耗适配器
- 使用纹理视图时使用纹理的简写形式
- WGSL textureSampleLevel 支持一维纹理
- 弃用 bgra8unorm 只读存储纹理用法
- 移除了 GPUAdapter isFallbackAdapter 属性
- Dawn 更新
Chrome 139
Chrome 138
Chrome 137
- 使用纹理视图进行 externalTexture 绑定
- 复制缓冲区,但不指定偏移量和大小
- 使用指向原子变量的指针的 WGSL workgroupUniformLoad
- GPUAdapterInfo powerPreference 属性
- 移除 GPURequestAdapterOptions compatibilityMode 属性
- Dawn 更新
Chrome 136
Chrome 135
- 允许创建具有 null bind 组布局的流水线布局
- 允许视口超出渲染目标边界
- 更轻松地访问 Android 上的实验性兼容性模式
- 移除 maxInterStageShaderComponents 限制
- Dawn 更新
Chrome 134
Chrome 133
- 新增了 unorm8x4-bgra 和 1 分量顶点格式
- 允许请求具有未定义值的未知限制
- WGSL 对齐规则变更
- 使用 discard 获得的 WGSL 性能提升
- 针对外部纹理使用 VideoFrame displaySize
- 使用 copyExternalImageToTexture 处理具有非默认方向的图片
- 改善开发者体验
- 启用与 featureLevel 的兼容模式
- 清理实验性子群组功能
- 弃用 maxInterStageShaderComponents 限制
- Dawn 更新
Chrome 132
- 纹理视图使用情况
- 32 位浮点纹理混合
- GPUDevice adapterInfo 属性
- 以无效格式配置画布上下文时抛出 JavaScript 错误
- 纹理过滤采样器限制
- 扩展子群组实验
- 改善开发者体验
- 对 16 位归一化纹理格式的实验性支持
- Dawn 更新
Chrome 131
- WGSL 中的剪裁距离
- GPUCanvasContext getConfiguration()
- 点和线图元不得具有深度偏移
- 子群组的包含性扫描内置函数
- 对多重绘制间接的实验性支持
- 着色器模块编译选项“严格数学”
- 移除 GPUAdapter requestAdapterInfo()
- Dawn 更新
Chrome 130
Chrome 129
Chrome 128
Chrome 127
Chrome 126
Chrome 125
Chrome 124
Chrome 123
Chrome 122
Chrome 121
- 在 Android 上支持 WebGPU
- 在 Windows 上使用 DXC 而不是 FXC 进行着色器编译
- 计算和渲染通道中的时间戳查询
- 着色器模块的默认入口点
- 支持将 display-p3 用作 GPUExternalTexture 色彩空间
- 内存堆信息
- Dawn 更新
Chrome 120
Chrome 119
Chrome 118
Chrome 117
Chrome 116
- WebCodecs 集成
- 由 GPUAdapter
requestDevice()返回的丢失设备 - 在调用
importExternalTexture()时保持视频播放流畅 - 规范一致性
- 改善开发者体验
- Dawn 更新
Chrome 115
Chrome 114
Chrome 113
- 在
importExternalTexture()中使用 WebCodecs VideoFrame 来源