Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions LICENSE_VulkanHeaders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Vulkan bindings in `unity-native-plugin-sys` are derived from the Vulkan API definitions published by The Khronos Group Inc.

The Vulkan headers are licensed under the Apache License 2.0. See <https://github.com/KhronosGroup/Vulkan-Headers/blob/main/LICENSE.md> for details.

Copyright © The Khronos Group Inc.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ Unity Native Plugin API for Rust

[LICENSE (MIT)](LICENSE)

## Notice

* Currently supports D3D11, D3D12, Vulkan, Metal
* API is not stable.

## How to use

* Define in Cargo.toml
Expand Down
8 changes: 7 additions & 1 deletion unity-native-plugin-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ keywords = ["unity", "ffi"]
include = [
"**/*.rs",
"Cargo.toml",
"../LICENSE"
"../LICENSE",
"../LICENSE_UnityNativePluginAPI.md",
"../LICENSE_VulkanHeaders.md"
]

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

[features]
default = []
vulkan = []

[dependencies]
2 changes: 0 additions & 2 deletions unity-native-plugin-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ unity-native-plugin-rs
====

* based on Unity 6000.3.8f1
* Vulkan SDK 1.4.309.0
* bindgen 0.72.1
* clang version 14.0.0-1ubuntu1.1
8 changes: 0 additions & 8 deletions unity-native-plugin-sys/bindgen.sh

This file was deleted.

15 changes: 15 additions & 0 deletions unity-native-plugin-sys/bindgen_apple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

bindgen \
--output ./src/plugin_api_apple.rs \
--with-derive-default \
--no-derive-debug \
--allowlist-file ./include/IUnityGraphicsMetal.h \
--blocklist-file ./include/IUnityInterface.h \
--blocklist-file ./include/IUnityGraphics.h \
--blocklist-file ./include/IUnityRenderingExtensions.h \
--blocklist-type "NSBundle|MTLRenderPassDescriptor|INSBundle|IMTLRenderPassDescriptor" \
--raw-line "pub type NSBundle = *mut u8;" \
--raw-line "pub type MTLRenderPassDescriptor = *mut u8;" \
./wrappers/apple.hpp -- -x objective-c++ -I ./include
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_apple.rs && rm ./src/plugin_api_apple.rs.bak
17 changes: 17 additions & 0 deletions unity-native-plugin-sys/bindgen_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

bindgen \
--output ./src/plugin_api_core.rs \
--with-derive-default \
--no-derive-debug \
--allowlist-file ./include/IUnityInterface.h \
--allowlist-file ./include/IUnityGraphics.h \
--allowlist-file ./include/IUnityRenderingExtensions.h \
--allowlist-file ./include/IUnityProfiler.h \
--allowlist-file ./include/IUnityProfilerCallbacks.h \
--allowlist-file ./include/IUnityMemoryManager.h \
--allowlist-file ./include/IUnityEventQueue.h \
--allowlist-file ./include/IUnityLog.h \
--allowlist-file ./include/IUnityShaderCompilerAccess.h \
./wrappers/core.hpp -- -I ./include
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_core.rs && rm ./src/plugin_api_core.rs.bak
10 changes: 0 additions & 10 deletions unity-native-plugin-sys/bindgen_metal.sh

This file was deleted.

12 changes: 12 additions & 0 deletions unity-native-plugin-sys/bindgen_vulkan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

bindgen \
--output ./src/plugin_api_vulkan.rs \
--with-derive-default \
--no-derive-debug \
--allowlist-file ./include/IUnityGraphicsVulkan.h \
--blocklist-file ./include/IUnityInterface.h \
--blocklist-file ./include/IUnityGraphics.h \
--blocklist-file ./include/IUnityRenderingExtensions.h \
./wrappers/vulkan.hpp -- -I ./include -I ./wrappers
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_vulkan.rs && rm ./src/plugin_api_vulkan.rs.bak
13 changes: 13 additions & 0 deletions unity-native-plugin-sys/bindgen_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

bindgen \
--output ./src/plugin_api_windows.rs \
--with-derive-default \
--no-derive-debug \
--allowlist-file ./include/IUnityGraphicsD3D11.h \
--allowlist-file ./include/IUnityGraphicsD3D12.h \
--blocklist-file ./include/IUnityInterface.h \
--blocklist-file ./include/IUnityGraphics.h \
--blocklist-file ./include/IUnityRenderingExtensions.h \
./wrappers/windows.hpp -- -I ./include
sed -i.bak -e "s/extern \"C\"/extern \"system\"/g" ./src/plugin_api_windows.rs && rm ./src/plugin_api_windows.rs.bak
12 changes: 10 additions & 2 deletions unity-native-plugin-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@
#![allow(clippy::pedantic)]
#![allow(unnecessary_transmutes)]
#![allow(unsafe_op_in_unsafe_fn)]
include!("plugin_api.rs");

include!("metal.rs");
include!("plugin_api_core.rs");

#[cfg(windows)]
include!("plugin_api_windows.rs");

#[cfg(target_vendor = "apple")]
include!("plugin_api_apple.rs");

#[cfg(feature = "vulkan")]
include!("plugin_api_vulkan.rs");

impl UnityInterfaceGUID {
pub fn new(
Expand Down
11 changes: 0 additions & 11 deletions unity-native-plugin-sys/src/metal.rs

This file was deleted.

Loading
Loading