Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Investigate support for WebGPU Immediates (push constants)

已关闭
#8,917 0 条评论 2 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@mvaligursky 已经在做这个了。

开始于 2026年6月17日。

评估

这个 Issue 还没有评估数据。

描述

area: graphics enhancement
Feature

Investigate Immediates (a.k.a. push/root constants), shipped in Chrome 149/150.

Immediates let you pass small, frequently-changing data directly to a shader without creating a GPU buffer or bind group. The values are injected straight into the pass encoder, avoiding a memory write and a bind-group lookup per update.

API surface:

  • WGSL — declare via the immediate address space:
    var<immediate> color: vec4f;
    
  • JS — set before a draw call:
    passEncoder.setImmediates(/*rangeOffset=*/0, new Float32Array([1, 0, 0, 1]));
    passEncoder.draw(3);
    
  • Pipeline layout — layout: 'auto' infers immediateSize from the WGSL module; explicit layouts declare it.
  • Capability detection — navigator.gpu.wgslLanguageFeatures.has('immediate_address_space').
Benefit
  • Reduce CPU overhead for per-draw data that changes every draw call (object IDs, small per-draw transforms/params) by skipping uniform-buffer writes and bind-group rebinds.
  • A potential fast path for the kind of redundant state churn discussed in #7656 / #7880, where WebGPU's per-draw binding cost lags WebGL2.
Notes
  • Chrome 149/150 only at the moment; WebGPU-only with no WebGL2 equivalent, so it requires capability detection and a graceful fallback to uniform buffers.
  • Strictly for small values — large arrays, complex lighting structures, and big matrices should stay in uniform/storage buffers (push-constant size budget is small).
  • Requires plumbing the immediate address space through shader generation and the WebGPU pipeline-layout/draw path.
  • Ref: https://developer.chrome.com/blog/new-in-webgpu-149-150#immediates
主要语言
JavaScript
星标
17.2k
派生
2k
平均合并
6 小时 39 分钟
30 天内合并 PR
222

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

playcanvas/engine 的其他 Issue

查看 playcanvas/engine 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。