Skip to content

WebGPU roadmap M7: textures and render pipelines (createTexture, writeTexture, render passes, drawIndexed) #415

Done

Description

@tannevaled

go-webengine's navigator.gpu (M5, #345) covers compute. The next consumer, Quake level 2 in the wasmcontainers playground, draws, and the render half is missing.

Measured: go-wasmcontainers/gpu#66 adds TestBatchRender, run locally on engine v0.45.9 with GPU_E2E_BROWSER=webengine:

error: wasi_webgpu_batch: submit: failed: webgpu: createTexture: Error: syscall/js: Value.Call: property createTexture is not a function, got undefined

The same test passes in Chromium on the Apple GPU and in Firefox, locally and on GitHub's macOS runners: 4096 pixels equal to the CPU, one submit.

What the probe uses, and what go-quake1/engine's gpuworld needs beyond it:

  • Textures: device.createTexture with format r8uint and usages RENDER_ATTACHMENT, TEXTURE_BINDING, COPY_DST and COPY_SRC; texture.createView; queue.writeTexture.
  • Bindings: texture_2d<u32> entries in explicit bind-group layouts (sampleType: "uint"); shaders read them with textureLoad only, no sampler.
  • Render pipelines: createRenderPipeline with an explicit layout, vertex buffers (float32x2; gpuworld also uses float32x3 + uint32 at stride 16, and stride 48 with uint32x4), triangle-list, no depth, and one r8uint color target with an integer vec4<u32> output.
  • Render passes: beginRenderPass (clear and store), setVertexBuffer, setIndexBuffer (uint32), drawIndexed and draw, with firstInstance carrying data.
  • Compute reading a texture: textureLoad on a texture_2d<u32> from a compute shader.
  • Later, for gpuworld's tests: copyTextureToBuffer.

The WGSL→MSL side: vertex and fragment entry points, @builtin(position), @location attributes in and out, and textureLoad on texture2d<uint>.

Acceptance: TestBatchRender of go-wasmcontainers/gpu passes in the go-webengine lane. That lane runs it with -skip TestBatchRender until this lands, and the skip is removed then.

Activity

  1. tannevaled commented on Nov 23, 2026

    @tannevaled
    ContributorAuthor

    M7 is shipped: PR #447 added GPUTexture/GPUTextureView, GPURenderPipeline (via wgslmsl.TranslateRender), GPURenderPassEncoder (beginRenderPass/setVertexBuffer/setIndexBuffer/draw/drawIndexed/end), GPUQueue.writeTexture, and GPUCommandEncoder.copyTextureToBuffer, verified against real Metal hardware with 14 end-to-end tests. An independent review found 8 bugs in the first round; all 8 were fixed with real regression tests (no skip/waiver flags), and the mutsweep push-gate gaps the fixes themselves left were closed for real in a follow-up round (dead guards deleted with reachability proofs, the rest turned into genuine assertions).

    Follow-up PR #448 added the FIDELITY.md round entry and README update. Landing (go-webengine.github.io#26) and docs (go-webengine/docs#20) were updated to describe the full M1-M7 arc, both verified live on their published pages. Released as v0.49.0.

    This closes out the go-wasmcontainers WebGPU-readiness roadmap (M1-M7).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions