Skip to content

v0.3.6

Choose a tag to compare

@dyike dyike released this 21 Oct 00:25
· 12 commits to main since this release
7f8a239

Debounce idle GPU reclamation, pool small Metal stores, and add shared images.

  • gio/app (macOS, iOS): idle GPU reclamation is debounced. gpu.Idle runs 250 ms after the window last presented a frame, and on macOS gpu.Trim plus the drawable shrink run after 1 s. The timer is set once and moved, not recreated per frame, so a window redrawn by external Invalidate calls no longer marks textures volatile and rebuilds GPU state every frame (textureSetVolatile alone was about 12% of Mirage's CPU samples). Other contexts still call gpu.Idle directly.
  • gio/gpu/internal/metal: Go-memory stores of buffers up to 4 KiB, the ones set*Bytes builds every rebuilt path from, are pooled by power-of-two class, at most 256 per class and emptied by Trim. A 60 Hz session allocated megabytes of them a second.
  • gio/op/paint, gio/gpu, gio/internal/dirty: NewSharedImageOp(src, mu) is a mutable image its owner writes outside the frame. The renderer takes mu only while reading src (texture creation, or the upload of changed areas once the version moved), and unchanged images never take it. A remote desktop client can draw tiles cut from its decoder framebuffer with SubImage instead of copying them (about 60 MB for a 5K screen).
  • maximumDrawableCount stays at 3: TestMetalResizeWindow stalled in 3 of 3 runs with 2.

All three patches are listed in third_party/README.md and carry their own tests.

Validation: gofmt, vet, module tests, the offline component check and CGO_ENABLED=0 GOOS=windows go build ./... from a clean checkout. TestEveryModuleIsListed reads untracked draft modules in the gitignored work/ directory and passes without it.

本版让空闲 GPU 回收改为防抖、池化 Metal 的小 buffer 存储,并新增可跨帧写入的共享图像。三个补丁都带自己的测试,记录在 third_party/README.md。

Compare: v0.3.5...v0.3.6