Skip to content

v0.35.2

Choose a tag to compare

@kolkov kolkov released this 19 Nov 20:09
· 27 commits to main since this release

v0.35.2 — a PATCH on top of v0.35.1.

Two closures. The concurrent-Release guard class: every publicly reachable resource wrapper — fourteen types across the native, rust and browser builds, the pooled MappedRange/MapPending included — now guards its destroy with a compare-and-swap, proven per type by a concurrent-release test and its own mutation probe, with the thread-safety contract written down in the package docs. And the software backend's per-draw full-target allocation: one raster pipeline per pass, lazily allocated targets — per-draw bytes 7,510,088 → 134,180 (−98.21%) on the text-rendering shape, 3.44× faster, with a caller's depth attachment never dropped by the reuse. naga v0.22.6 rides along; the downstream gate proved its writers byte-identical for every existing shader (1240 comparisons, zero deltas).

Fixed

  • Concurrent Release() could double-destroy a resource: Sampler, Texture, TextureView, QuerySet,
    ShaderModule, Fence, Buffer, BindGroup, BindGroupLayout, PipelineLayout, RenderPipeline,
    ComputePipeline, and the pooled MappedRange and MapPending handles guarded their destroy (or their return
    to the pool) with a check-then-set plain bool — or, for the pooled handles, had no guard at all — so two
    goroutines calling Release() at the same time could both run it: a HAL object destroyed twice, a reference
    dropped twice, or one pooled handle put into the pool twice and handed to two owners. Every one of these types
    now uses the heap-allocated atomic.Bool compare-and-swap Buffer already used, on every build where the type
    exists (native, rust, browser; QuerySet is native-only); the pinned zero-value contract is unchanged (a no-op
    for most wrappers, a panic for Sampler, BindGroupLayout, PipelineLayout, ShaderModule and Fence).
    Each type is proven by a concurrent-release test that counts HAL destroys, reference drops or pool returns, and
    each has its own mutation probe that makes its test fail with the double-destroy signature. The Device
    error-scope manager is documented as constructor-initialized (the nil-safe lazy path remains only for
    zero-value devices).

Changed

  • naga v0.22.6 (from v0.22.5). The subgroup-IR track: ballot-bit ops, clustered collective forms (with the
    ClusterSize field), five ballot-mask builtin values, and the ballot-mask synthesis now written in MSL, HLSL and
    DXIL, plus the elect MissingCapabilities fix. Additive IR only — nothing in wgpu constructs the new forms. The
    downstream gate proved the writers byte-identical for every existing shader (310-file corpus × four targets:
    1240 comparisons, zero byte and zero acceptance deltas), so no shader compiles differently.

Performance

  • The software backend allocates its render targets lazily and reuses one raster pipeline per pass. Every draw
    built a fresh raster.NewPipeline and allocated a full-size color and depth buffer — 7,372,800 B per draw at
    720p — although both targets are dead when the draw routes a real color attachment and the pipeline has no depth
    state; a 512-draw frame allocated 3.84 GB for nothing. One raster pipeline now belongs to the render pass and is
    reset per draw, and each target is allocated only when something reads or writes it: the standalone color path,
    a depth test or write, or a caller's depth attachment — and a caller's depth attachment is never dropped by the
    reuse. Measured on the text-rendering shape (512 draws of 16×16 quads into 1280×720): per-draw bytes
    7,510,088 → 134,180 (−98.21%) and 3.44× faster; the fullscreen textured blit drops 7.31 MB per draw. The
    per-pixel interpreter allocations are unchanged — they are the next lever, not addressed here.