Skip to content

feat!: v0.5.0 — wgpu-native v29 + full gogpu/wgpu API compatibility#19

Merged
kolkov merged 13 commits into
mainfrom
feat/v0.5.0-wgpu-native-v29
May 26, 2026
Merged

feat!: v0.5.0 — wgpu-native v29 + full gogpu/wgpu API compatibility#19
kolkov merged 13 commits into
mainfrom
feat/v0.5.0-wgpu-native-v29

Conversation

@kolkov
Copy link
Copy Markdown
Contributor

@kolkov kolkov commented May 26, 2026

Summary

Major release: wgpu-native v29 migration + full gogpu/wgpu API compatibility.

  • wgpu-native v27.0.4.0 → v29.0.0.0 — stable webgpu-headers, resolves Track: webgpu-headers upgrade in wgpu-native #3
  • Go-idiomatic public API — string labels, typed pointers, Go slices, (*T, error) returns
  • gogpu/wgpu API parity — drop-in compatible descriptors, method signatures, type aliases
  • 271 ABI verification tests — struct sizes, field offsets, enum values
  • Enterprise documentation — ARCHITECTURE.md, MIGRATION.md, updated README/STABILITY/ROADMAP

Breaking Changes

  • All Create* methods return (*T, error) instead of *T
  • Descriptor structs: Go-idiomatic (no more NextInChain, StringView, uintptr handles)
  • Method renames: GetQueue()Queue(), GetSize()Size(), GetLimits()Limits() etc.
  • Limits returned as value (cached), not (*Limits, error)
  • BindGroupLayoutEntry uses pointer sub-layouts (*BufferBindingLayout etc.)
  • Surface.Configure(device, config) — device as separate arg
  • Surface.GetCurrentTexture() returns (*SurfaceTexture, bool, error) with suboptimal flag
  • Queue.Submit returns (uint64, error) via wgpuQueueSubmitForIndex
  • Buffer.MapAsync returns (*MapPending, error) — truly async
  • Buffer.Unmap() returns error
  • SamplerDescriptor.MaxAnisotropyAnisotropy
  • convert.go: TextureFormat converter removed (gputypes matches v29 natively)

Added

  • Buffer.Map(ctx, mode, offset, size) — context-aware blocking
  • Buffer.MappedRange(offset, size) — type-safe *MappedRange wrapper
  • MapPending type with Status() and Wait(ctx) for async polling
  • ImageCopyTexture, ImageDataLayout, BufferTextureCopy, TextureCopy types
  • Region-based CopyTextureToBuffer/CopyTextureToTexture
  • gputypes type aliases + 186 re-exported constants
  • docs/ARCHITECTURE.md — FFI layer architecture, convert.go rationale
  • MIGRATION.md — v0.4.x → v0.5.0 migration guide

Dependencies

  • wgpu-native: v27.0.4.0 → v29.0.0.0
  • goffi: v0.5.0 (unchanged)
  • gputypes: v0.3.0 (unchanged)

Closes #3

Test plan

  • go build ./... — all platforms (win/linux/mac × amd64/arm64)
  • go vet ./... — clean
  • gofmt — clean
  • go test -run TestABI ./wgpu/... — 271 ABI checks pass
  • go test -run "Mat4|Vec3|StructSizes|CheckInit|WGPUError|Fuzz|NullGuard" ./wgpu/... — all safe tests pass
  • All 12 examples compile
  • CI: GitHub Actions (linux/macos/windows) with v29 binary

kolkov added 10 commits May 26, 2026 13:53
… compat

BREAKING CHANGES:
- wgpu-native v27.0.4.0 -> v29.0.0.0 (stable webgpu-headers)
- All Create* methods now return (*T, error) instead of *T
- Method renames: GetQueue->Queue, GetSize->Size, GetLimits->Limits, etc.
- Limits struct field order fixed (ABI-breaking)
- SupportedLimits, ChainedStructOut, InstanceCapabilities removed
- VertexBufferLayout, PassTimestampWrites struct layouts changed
- SurfaceGetCurrentTextureStatus: OutOfMemory/DeviceLost removed
- InstanceFlag_Default semantic change (0 -> 1<<24)

Phase 1: v29 enums, procs, struct layouts
Phase 2: convert.go refactor (6 identity converters removed)
Phase 3: API redesign (error returns, method names, gputypes aliases)
Tests: 271 enterprise ABI verification checks
- CI: wgpu-native v27.0.4.0 -> v29.0.0.0, add TestABI to safe filter
- UPSTREAM.md: v29.0.0.0, stable webgpu-headers commit SHA
- CHANGELOG.md: v0.5.0 entry with all breaking changes
- Rename MapAsyncStatusInstanceDropped -> MapAsyncStatusCallbackCancelled
- Remove MapAsyncStatusUnknown (not in v29 spec)
- Add procSupportedFeaturesFreeMembers call in Device.Features()
- Found by enterprise validation agent
- README.md: v29, type aliases, updated architecture diagram
- docs/ARCHITECTURE.md: FFI layers, convert.go rationale, gputypes relationship
- MIGRATION.md: v0.4.x -> v0.5.0 guide with before/after examples
- STABILITY.md: updated method names, v0.5.0 breaking release note
- ROADMAP.md: v29 migration done, next goals
- CONTRIBUTING.md: v29, new FFI function pattern, testing tiers
Two-layer architecture: public Go-idiomatic structs + unexported wire structs.
Public API now uses string labels, typed pointers, Go slices, Go bool.
Wire structs (C-layout) hidden from users, conversion inside Create* methods.

Migrated descriptors:
- BufferDescriptor, TextureDescriptor, TextureViewDescriptor
- SamplerDescriptor, ShaderModuleDescriptor
- BindGroupDescriptor, BindGroupEntry, BindGroupLayoutDescriptor
- PipelineLayoutDescriptor, ComputePipelineDescriptor
- RenderPassDescriptor, ComputePassDescriptor
- CommandEncoderDescriptor, RenderBundleEncoderDescriptor
- SurfaceConfiguration, QuerySetDescriptor

All examples and tests updated for new API.
…y corruption)

Was passing (FeatureCount, Features) as two separate args.
Must pass pointer to SupportedFeatures struct (matching adapter.go pattern).
Found by independent code quality review agent.
Remaining 17 API mismatches resolved:
- InstanceDescriptor: Go-idiomatic {Backends, Flags}
- RequestAdapterOptions: Go-idiomatic {PowerPreference, ForceFallbackAdapter, CompatibleSurface}
- DeviceDescriptor: Go-idiomatic {Label, RequiredFeatures, RequiredLimits}
- SamplerDescriptor: MaxAnisotropy -> Anisotropy
- Queue.Submit: returns error
- Queue.WriteBuffer/WriteTexture: return error
- CommandEncoder.Finish: variadic (no required args)
- Surface.Configure(device, config) error: device as separate arg
- Surface.GetCurrentTexture: returns (*T, bool, error) with suboptimal flag
- Surface.Present(texture): takes texture arg, returns error
- BeginRenderPass/CreateQuerySet: pass desc.Label to native
- ShaderModuleDescriptorGo alias + CreateShaderModuleFromDesc

2 items deferred by design:
- Limits return type (*Limits, error) vs value (FFI needs NextInChain)
- BindGroupLayoutEntry struct layout (incompatible sub-struct approach)
…ry gputypes alias

- Limits: cached at RequestAdapter/RequestDevice, returned as value (no pointer, no error)
- BindGroupLayoutEntry: pointer sub-layouts (*BufferBindingLayout, etc.) matching gputypes
- Wire structs preserved for FFI, ABI tests passing
- All examples updated for pointer sub-layouts syntax
…dex + Copy regions

Complete gogpu/wgpu API parity for buffer mapping, queue submit, and copy operations:

Buffer mapping:
- Buffer.Map(ctx, mode, offset, size) — context-aware blocking
- Buffer.MapAsync(mode, offset, size) (*MapPending, error) — truly async
- Buffer.MappedRange(offset, size) (*MappedRange, error) — type-safe access
- Buffer.Unmap() error — matches gogpu/wgpu
- Buffer stores *Device reference for internal polling

Queue:
- Queue.Submit returns (uint64, error) via wgpuQueueSubmitForIndex

Copy operations:
- CopyTextureToBuffer(src, dst, []BufferTextureCopy) — region-based
- CopyTextureToTexture(src, dst, []TextureCopy) — region-based
- ImageCopyTexture, ImageDataLayout, BufferTextureCopy, TextureCopy types
- Raw wire-level methods preserved as CopyTextureToBufferRaw etc.

All examples and tests updated.
Cross-platform build verified:
- windows/amd64 ✓
- linux/amd64 ✓
- linux/arm64 ✓
- darwin/amd64 ✓
- darwin/arm64 ✓
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

kolkov added 3 commits May 27, 2026 00:28
- CHANGELOG.md: complete v0.5.0 breaking changes + additions
- MIGRATION.md: 7 new before/after sections, 19-point checklist
- README.md: Buffer mapping, Queue index, Copy regions in features
- ROADMAP.md: Buffer mapping + Copy regions marked done
- STABILITY.md: Map/MapPending/MappedRange, Limits value return
- docs/ARCHITECTURE.md: Buffer mapping architecture, Limits caching, wire struct pattern
@kolkov kolkov merged commit 36e2d05 into main May 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track: webgpu-headers upgrade in wgpu-native

1 participant