Skip to content

Commit 18bb3f3

Browse files
authored
Merge pull request #23 from aosoft/aosoft/improve-sys-crate
Restructure sys crate: split bindings per platform/backend, drop Vulkan SDK requirement
2 parents abff83f + b88ff22 commit 18bb3f3

24 files changed

Lines changed: 3649 additions & 86872 deletions

LICENSE_VulkanHeaders.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The Vulkan bindings in `unity-native-plugin-sys` are derived from the Vulkan API definitions published by The Khronos Group Inc.
2+
3+
The Vulkan headers are licensed under the Apache License 2.0. See <https://github.com/KhronosGroup/Vulkan-Headers/blob/main/LICENSE.md> for details.
4+
5+
Copyright © The Khronos Group Inc.

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ Unity Native Plugin API for Rust
33

44
[LICENSE (MIT)](LICENSE)
55

6-
## Notice
7-
8-
* Currently supports D3D11, D3D12, Vulkan, Metal
9-
* API is not stable.
10-
116
## How to use
127

138
* Define in Cargo.toml

unity-native-plugin-sys/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ keywords = ["unity", "ffi"]
1313
include = [
1414
"**/*.rs",
1515
"Cargo.toml",
16-
"../LICENSE"
16+
"../LICENSE",
17+
"../LICENSE_UnityNativePluginAPI.md",
18+
"../LICENSE_VulkanHeaders.md"
1719
]
1820

1921
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2022

23+
[features]
24+
default = []
25+
vulkan = []
26+
2127
[dependencies]

unity-native-plugin-sys/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ unity-native-plugin-rs
22
====
33

44
* based on Unity 6000.3.8f1
5-
* Vulkan SDK 1.4.309.0
65
* bindgen 0.72.1
7-
* clang version 14.0.0-1ubuntu1.1

unity-native-plugin-sys/bindgen.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
bindgen \
4+
--output ./src/plugin_api_apple.rs \
5+
--with-derive-default \
6+
--no-derive-debug \
7+
--allowlist-file ./include/IUnityGraphicsMetal.h \
8+
--blocklist-file ./include/IUnityInterface.h \
9+
--blocklist-file ./include/IUnityGraphics.h \
10+
--blocklist-file ./include/IUnityRenderingExtensions.h \
11+
--blocklist-type "NSBundle|MTLRenderPassDescriptor|INSBundle|IMTLRenderPassDescriptor" \
12+
--raw-line "pub type NSBundle = *mut u8;" \
13+
--raw-line "pub type MTLRenderPassDescriptor = *mut u8;" \
14+
./wrappers/apple.hpp -- -x objective-c++ -I ./include
15+
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_apple.rs && rm ./src/plugin_api_apple.rs.bak
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
bindgen \
4+
--output ./src/plugin_api_core.rs \
5+
--with-derive-default \
6+
--no-derive-debug \
7+
--allowlist-file ./include/IUnityInterface.h \
8+
--allowlist-file ./include/IUnityGraphics.h \
9+
--allowlist-file ./include/IUnityRenderingExtensions.h \
10+
--allowlist-file ./include/IUnityProfiler.h \
11+
--allowlist-file ./include/IUnityProfilerCallbacks.h \
12+
--allowlist-file ./include/IUnityMemoryManager.h \
13+
--allowlist-file ./include/IUnityEventQueue.h \
14+
--allowlist-file ./include/IUnityLog.h \
15+
--allowlist-file ./include/IUnityShaderCompilerAccess.h \
16+
./wrappers/core.hpp -- -I ./include
17+
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_core.rs && rm ./src/plugin_api_core.rs.bak

unity-native-plugin-sys/bindgen_metal.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
bindgen \
4+
--output ./src/plugin_api_vulkan.rs \
5+
--with-derive-default \
6+
--no-derive-debug \
7+
--allowlist-file ./include/IUnityGraphicsVulkan.h \
8+
--blocklist-file ./include/IUnityInterface.h \
9+
--blocklist-file ./include/IUnityGraphics.h \
10+
--blocklist-file ./include/IUnityRenderingExtensions.h \
11+
./wrappers/vulkan.hpp -- -I ./include -I ./wrappers
12+
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_vulkan.rs && rm ./src/plugin_api_vulkan.rs.bak
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
bindgen \
4+
--output ./src/plugin_api_windows.rs \
5+
--with-derive-default \
6+
--no-derive-debug \
7+
--allowlist-file ./include/IUnityGraphicsD3D11.h \
8+
--allowlist-file ./include/IUnityGraphicsD3D12.h \
9+
--blocklist-file ./include/IUnityInterface.h \
10+
--blocklist-file ./include/IUnityGraphics.h \
11+
--blocklist-file ./include/IUnityRenderingExtensions.h \
12+
./wrappers/windows.hpp -- -I ./include
13+
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_windows.rs && rm ./src/plugin_api_windows.rs.bak

0 commit comments

Comments
 (0)