Skip to content

Restructure sys crate: split bindings per platform/backend, drop Vulkan SDK requirement#23

Merged
aosoft merged 6 commits into
masterfrom
aosoft/improve-sys-crate
May 3, 2026
Merged

Restructure sys crate: split bindings per platform/backend, drop Vulkan SDK requirement#23
aosoft merged 6 commits into
masterfrom
aosoft/improve-sys-crate

Conversation

@aosoft
Copy link
Copy Markdown
Owner

@aosoft aosoft commented May 3, 2026

Summary

  • Split the monolithic plugin_api.rs (~86k lines) into per-platform/backend files (plugin_api_core.rs, plugin_api_apple.rs, plugin_api_vulkan.rs, plugin_api_windows.rs) and replace bindgen.sh / bindgen_metal.sh with separate bindgen_<target>.sh scripts under a new wrappers/ layout.
  • Add minimal Vulkan stubs (wrappers/vulkan_stubs.h) so building the crate no longer requires the Vulkan SDK; the SDK is only needed when regenerating Vulkan bindings. Bundle the Vulkan headers license accordingly.
  • Forward a new vulkan feature from unity-native-plugin to unity-native-plugin-sys, gate D3D11/D3D12 on windows, and drop the unmaintained objc dependency on Apple by regenerating Metal bindings as raw pointers.
  • Trim outdated API notice and backend support table from README.

Test plan

  • cargo build on macOS with --features metal and with --features vulkan
  • cargo build on Windows with --features d3d11,d3d12 and with --features vulkan
  • cargo build on a machine without the Vulkan SDK installed (with vulkan feature) succeeds
  • Regenerating bindings via each bindgen_<target>.sh produces the corresponding plugin_api_*.rs without diff churn

aosoft added 6 commits May 3, 2026 01:14
Generate plugin_api_{core,windows,apple,vulkan}.rs separately so
that:
- Vulkan SDK is only needed when regenerating Vulkan bindings
- Apple build no longer depends on the unmaintained `objc` crate
- D3D / Metal / Vulkan are independently togglable

Adds `vulkan` feature to the sys crate, forwarded from unity-native-plugin. Gates D3D11 / D3D12 modules on `windows`.
Replaces bindgen.sh / bindgen_metal.sh with bindgen_<target>.sh under a new wrappers/ layout.
@aosoft aosoft merged commit 18bb3f3 into master May 3, 2026
3 checks passed
@aosoft aosoft deleted the aosoft/improve-sys-crate branch May 3, 2026 10:04
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.

1 participant