feat!: v0.5.0 — wgpu-native v29 + full gogpu/wgpu API compatibility#19
Merged
Conversation
… 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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major release: wgpu-native v29 migration + full gogpu/wgpu API compatibility.
(*T, error)returnsBreaking Changes
Create*methods return(*T, error)instead of*TNextInChain,StringView,uintptrhandles)GetQueue()→Queue(),GetSize()→Size(),GetLimits()→Limits()etc.Limitsreturned as value (cached), not(*Limits, error)BindGroupLayoutEntryuses pointer sub-layouts (*BufferBindingLayoutetc.)Surface.Configure(device, config)— device as separate argSurface.GetCurrentTexture()returns(*SurfaceTexture, bool, error)with suboptimal flagQueue.Submitreturns(uint64, error)viawgpuQueueSubmitForIndexBuffer.MapAsyncreturns(*MapPending, error)— truly asyncBuffer.Unmap()returnserrorSamplerDescriptor.MaxAnisotropy→Anisotropyconvert.go: TextureFormat converter removed (gputypes matches v29 natively)Added
Buffer.Map(ctx, mode, offset, size)— context-aware blockingBuffer.MappedRange(offset, size)— type-safe*MappedRangewrapperMapPendingtype withStatus()andWait(ctx)for async pollingImageCopyTexture,ImageDataLayout,BufferTextureCopy,TextureCopytypesCopyTextureToBuffer/CopyTextureToTexturedocs/ARCHITECTURE.md— FFI layer architecture, convert.go rationaleMIGRATION.md— v0.4.x → v0.5.0 migration guideDependencies
Closes #3
Test plan
go build ./...— all platforms (win/linux/mac × amd64/arm64)go vet ./...— cleangofmt— cleango test -run TestABI ./wgpu/...— 271 ABI checks passgo test -run "Mat4|Vec3|StructSizes|CheckInit|WGPUError|Fuzz|NullGuard" ./wgpu/...— all safe tests pass