Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.28.10] - 2026-05-26

### Fixed

- **Core: pre-allocate trackedRefs slices in pass encoders** — `BeginComputePass`,
`BeginRenderPass`, and `CreateCommandEncoder` now pre-allocate `trackedRefs` with
capacity 64. Previously Phase 2 tracking (v0.28.8) used bare `append()` starting
from nil, causing O(log N) reallocations and abandoned backing arrays for GC. With
10K dispatches × 4 buffers per step, each encoder accumulated 40K pointer entries via
17 doublings. Pre-allocation eliminates all intermediate backing arrays.

## [0.28.9] - 2026-05-26

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

---

## Current State: v0.28.9
## Current State: v0.28.10

✅ **All 5 HAL backends complete** (~127K LOC)
✅ **Three-layer WebGPU stack** — wgpu API → wgpu/core → wgpu/hal
Expand Down Expand Up @@ -151,6 +151,7 @@

| Version | Date | Highlights |
|---------|------|------------|
| **v0.28.10** | 2026-05 | Core: pre-allocate trackedRefs in pass encoders (ML OOM fix). |
| **v0.28.9** | 2026-05 | Core: refcount-driven Buffer destruction via onZero (Rust Drop parity). Eliminates Phase 1 stale index risk. |
| **v0.28.8** | 2026-05 | Core: Clone buffer ResourceRefs in SetBindGroup — prevents use-after-free (Rust wgpu parity). |
| **v0.28.7** | 2026-05 | Core: deferred GLES enumeration in RequestAdapter (adapter name fix). |
Expand Down
7 changes: 6 additions & 1 deletion device_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,12 @@ func (d *Device) CreateCommandEncoder(desc *CommandEncoderDescriptor) (*CommandE
return nil, err
}

return &CommandEncoder{core: coreEncoder, device: d, halEncoder: halEnc}, nil
return &CommandEncoder{
core: coreEncoder,
device: d,
halEncoder: halEnc,
trackedRefs: make([]*core.ResourceRef, 0, 64),
}, nil
}

// Fallback: no pool available (e.g., non-HAL device). Use core's built-in
Expand Down
12 changes: 10 additions & 2 deletions encoder_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ func (e *CommandEncoder) BeginRenderPass(desc *RenderPassDescriptor) (*RenderPas
return nil, err
}

return &RenderPassEncoder{core: corePass, encoder: e}, nil
return &RenderPassEncoder{
core: corePass,
encoder: e,
trackedRefs: make([]*core.ResourceRef, 0, 64),
}, nil
}

// BeginComputePass begins a compute pass.
Expand All @@ -139,7 +143,11 @@ func (e *CommandEncoder) BeginComputePass(desc *ComputePassDescriptor) (*Compute
return nil, err
}

return &ComputePassEncoder{core: corePass, encoder: e}, nil
return &ComputePassEncoder{
core: corePass,
encoder: e,
trackedRefs: make([]*core.ResourceRef, 0, 64),
}, nil
}

// CopyBufferToBuffer copies data between buffers.
Expand Down
Loading