Skip to content

Commit 04064eb

Browse files
authored
fix: complete gputypes integration with wgpu-native v27 (#4)
* fix: complete gputypes integration with wgpu-native v27 compatibility Conversion layer fixes: - TextureViewDimension values match between gputypes and wgpu-native v27 - Add struct padding for FFI alignment (sampler/texture/storage binding layouts) - Fix VertexFormat, VertexStepMode, TextureSampleType conversions Example fixes: - Use CreatePipelineLayoutSimple in cube, rotating-triangle, mrt, textured-quad - Fix GetModuleHandleW: use kernel32.dll instead of user32.dll (8 examples) - render_bundle: fallback shader without primitive_index (works on all GPUs) Default value fixes: - sampler: MaxAnisotropy >= 1 - texture: SampleCount >= 1, MipLevelCount >= 1 All 11 examples now work on all supported hardware. * docs: update documentation for v0.2.0 gputypes integration CHANGELOG.md: - Document conversion layer and all fixes README.md: - Update wgpu-native version to v27.0.4.0 ROADMAP.md (modernized following GitHub best practices): - Add disclaimer about plans vs commitments - Use phase labels instead of hardcoded dates - Add How to Contribute section - Link to GitHub Issues/Projects for live tracking - Add upstream dependencies tracking examples/README.md: - Update version to 0.2.0 - Add gputypes note * chore: exclude gocyclo/cyclop/funlen for conversion files Conversion functions (toWGPUTextureFormat, fromWGPUTextureFormat, toWGPUVertexFormat) have large switch statements for enum mapping which are inherently high complexity but straightforward. CreateRenderPipeline has high complexity due to wire struct initialization but is a single-purpose function. Exclude convert.go and render_pipeline.go from gocyclo/cyclop/funlen checks since these patterns are acceptable for FFI conversion code.
1 parent c6e8312 commit 04064eb

File tree

22 files changed

+1210
-263
lines changed

22 files changed

+1210
-263
lines changed

.golangci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,18 @@ linters:
7979
linters:
8080
- unused
8181
- revive
82-
# FFI render_pipeline has C struct padding
82+
# Conversion functions have large switch statements - inherently high complexity but straightforward
83+
- path: convert\.go
84+
linters:
85+
- gocyclo
86+
- cyclop
87+
- funlen
88+
# FFI render_pipeline has C struct padding and complex CreateRenderPipeline
8389
- path: render_pipeline\.go
8490
linters:
8591
- unused
92+
- gocyclo
93+
- cyclop
8694
# wgpu.go has procs for future use and long init
8795
- path: wgpu\.go
8896
linters:

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
- Integration with [gogpu ecosystem](https://github.com/gogpu) via gputypes
2121
- Full webgpu.h spec compliance for enum values
22+
- Comprehensive conversion layer (`wgpu/convert.go`) for wgpu-native v27 compatibility
23+
- TextureFormat (~45 formats), VertexFormat (~30 formats)
24+
- VertexStepMode, TextureSampleType, TextureViewDimension, StorageTextureAccess
25+
- Wire structs with correct FFI padding (uint64 flags)
2226

2327
### Fixed
2428

2529
- TextureFormat enum values mismatch (BGRA8Unorm was 0x17, now correct 0x1B)
2630
- Compatibility with gogpu Rust backend
31+
- Struct padding in BindGroupLayout wire structs (sampler, texture, storage)
32+
- PipelineLayout creation in examples (use CreatePipelineLayoutSimple)
33+
- GetModuleHandleW: kernel32.dll instead of user32.dll (all Windows examples)
34+
- Sampler MaxAnisotropy default (wgpu-native requires >= 1)
35+
- Texture SampleCount/MipLevelCount defaults (wgpu-native requires >= 1)
36+
- render_bundle shader: fallback without primitive_index (works on all GPUs)
2737

2838
### Migration Guide
2939

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Pure Go WebGPU bindings using [goffi](https://github.com/go-webgpu/goffi) + [wgp
3838
## Requirements
3939

4040
- Go 1.25+
41-
- wgpu-native v24.0.3.1 ([download](https://github.com/gfx-rs/wgpu-native/releases))
41+
- wgpu-native v27.0.4.0 ([download](https://github.com/gfx-rs/wgpu-native/releases))
4242

4343
## Installation
4444

0 commit comments

Comments
 (0)