发布时间:2025 年 3 月 26 日
允许创建具有 null 绑定组布局的流水线布局
之前,创建空绑定组布局需要添加零绑定的绑定组,这很不方便。现在,创建流水线布局时允许使用 null 绑定组布局,并且系统会忽略此类布局,因此不再需要执行此操作。这应该会简化开发工作。
例如,您可能希望创建一个仅使用绑定组布局 0 和 2 的流水线。您可以将绑定组布局 1 分配给 fragment 数据,将绑定组布局 2 分配给顶点数据,然后无需 fragment 着色器即可进行渲染。请参阅问题 377836524。
const bgl0 = myDevice.createBindGroupLayout({ entries: myGlobalEntries });
const bgl1 = myDevice.createBindGroupLayout({ entries: myFragmentEntries });
const bgl2 = myDevice.createBindGroupLayout({ entries: myVertexEntries });
// Create a pipeline layout that will be used to render without a fragment shader.
const myPipelineLayout = myDevice.createPipelineLayout({
bindGroupLayouts: [bgl0, null, bgl2],
});
允许视口超出渲染目标边界
放宽了对视口验证的要求,允许视口超出渲染目标边界。这对于绘制可能延伸到当前视口之外的界面等 2D 元素尤其有用。请参阅问题 390162929。
const passEncoder = myCommandEncoder.beginRenderPass({
colorAttachments: [
{
view: myColorTexture.createView(),
loadOp: "clear",
storeOp: "store",
},
],
});
// Set a viewport that extends past the render target's bounds by 8 pixels
// in all directions.
passEncoder.setViewport(
/*x=*/ -8,
/*y=*/ -8,
/*width=*/ myColorTexture.width + 16,
/*height=*/ myColorTexture.height + 16,
/*minDepth=*/ 0,
/*maxDepth=*/ 1,
);
// Draw geometry and complete the render pass as usual.
更轻松地在 Android 上访问实验性兼容性模式
现在,只需使用 chrome://flags/#enable-unsafe-webgpu
标志即可在 Android 上启用实验性 WebGPU 兼容模式所需的所有功能。这样一来,您就可以使用 featureLevel: "compatibility"
选项在兼容模式下请求 GPUAdapter,甚至可以在不支持 Vulkan 的设备上访问 OpenGL ES 后端。请参阅以下示例和问题 dawn:389876644。
// Request a GPUAdapter in compatibility mode.
const adapter = await navigator.gpu.requestAdapter({ featureLevel: "compatibility" });

移除 maxInterStageShaderComponents 限制
正如之前所宣布的,由于多种因素,我们移除了 maxInterStageShaderComponents 限制:
- 与
maxInterStageShaderVariables
的冗余:此限制已达到类似目的,即控制着着色器阶段之间传递的数据量。 - 细微的差异:虽然这两个限额的计算方式略有不同,但这些差异很小,可以在
maxInterStageShaderVariables
限额内有效管理。 - 简化:移除
maxInterStageShaderComponents
可简化着色器接口并降低开发者的复杂性。这样一来,他们就可以专注于名称更恰当、更全面的maxInterStageShaderVariables
,而无需管理两个细微差别很大的单独限制。
请参阅移除意向和问题 364338810。
Dawn 更新
现在无法再使用过滤采样器对深度纹理进行采样。请注意,深度纹理只能与非过滤或比较采样器搭配使用。请参阅问题 379788112。
WGPURequiredLimits
和 WGPUSupportedLimits
结构已扁平化为 WGPULimits
。请参阅问题 374263404。
以下结构体已重命名。请参阅问题 42240793。
WGPUImageCopyBuffer
现为WGPUTexelCopyBufferInfo
WGPUImageCopyTexture
现在为WGPUTexelCopyTextureInfo
WGPUTextureDataLayout
现为WGPUTexelCopyBufferLayout
已将 subgroupMinSize
和 subgroupMaxSize
成员添加到 WGPUAdapterInfo
结构体。请参阅 webgpu-headers PR。
现在,当您使用 DAWN_TRACE_FILE_BASE
环境变量运行程序时,可以跟踪 Metal 中的 Dawn API 使用情况,该环境变量会保存一个 .gputrace 文件,该文件稍后可以加载到 Xcode 的 Metal 调试器中。请参阅 Debugging Dawn 文档。
这仅涵盖了部分重要亮点。查看详尽的提交列表。
WebGPU 的新变化
WebGPU 新变化系列中涵盖的所有内容的列表。
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()
- 点和线图元不得具有深度偏移
- 子群组的包含性扫描内置函数
- 对多重绘制间接调用的实验性支持
- 着色器模块编译选项 strict math
- 移除 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 来源