Skip to content

Commit f2d716e

Browse files
committed
Add new interfaces
* log.rs * memory_manager.rs * Update defines * refactor codes
1 parent 72eb581 commit f2d716e

13 files changed

Lines changed: 177 additions & 48 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unity-native-plugin-sample-profiler"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Yasuhiro Taniuchi"]
55
edition = "2018"
66
publish = false
@@ -11,8 +11,8 @@ crate-type = ["cdylib"]
1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212

1313
[dependencies]
14-
unity-native-plugin = { version = "0.5.0", path = "../unity-native-plugin", features = ["profiler_callbacks"] }
15-
unity-native-plugin-sys = { version = "0.5.0", path = "../unity-native-plugin-sys" }
14+
unity-native-plugin = { version = "0.6.0", path = "../unity-native-plugin", features = ["profiler_callbacks"] }
15+
unity-native-plugin-sys = { version = "0.6.0", path = "../unity-native-plugin-sys" }
1616
log = "0.4"
1717
env_logger = "0.8"
1818
flume = "0.10"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unity-native-plugin-sample"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Yasuhiro Taniuchi"]
55
edition = "2018"
66
publish = false
@@ -11,10 +11,10 @@ crate-type = ["cdylib"]
1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212

1313
[dependencies]
14-
unity-native-plugin = { version = "0.5.0", path = "../unity-native-plugin", features = ["d3d11", "d3d12", "profiler"] }
15-
unity-native-plugin-vulkan = { version = "0.5.0", path = "../unity-native-plugin-vulkan" }
14+
unity-native-plugin = { version = "0.6.0", path = "../unity-native-plugin", features = ["d3d11", "d3d12", "profiler"] }
15+
unity-native-plugin-vulkan = { version = "0.6.0", path = "../unity-native-plugin-vulkan" }
1616
winapi = { version = "0.3.9", features = ["winuser", "d3d11", "dxgiformat"] }
1717
wio = "0.2.2"
1818

1919
[dev-dependencies]
20-
unity-native-plugin-tester = { version = "0.5.0", path = "../unity-native-plugin-tester", features = ["d3d11"] }
20+
unity-native-plugin-tester = { version = "0.6.0", path = "../unity-native-plugin-tester", features = ["d3d11"] }

unity-native-plugin-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unity-native-plugin-sys"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Yasuhiro Taniuchi"]
55
edition = "2018"
66
license = "MIT"

unity-native-plugin-tester/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unity-native-plugin-tester"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Yasuhiro Taniuchi"]
55
edition = "2018"
66
license = "MIT"
@@ -25,8 +25,8 @@ d3d11 = []
2525
d3d12 = []
2626

2727
[dependencies]
28-
unity-native-plugin-sys = { version = "0.5.0", path = "../unity-native-plugin-sys" }
29-
unity-native-plugin = { version = "0.5.0", path = "../unity-native-plugin", features = ["d3d11", "d3d12"] }
28+
unity-native-plugin-sys = { version = "0.6.0", path = "../unity-native-plugin-sys" }
29+
unity-native-plugin = { version = "0.6.0", path = "../unity-native-plugin", features = ["d3d11", "d3d12"] }
3030
winapi = { version = "0.3.9", features = ["winuser", "dxgi", "d3d11", "dxgiformat", "dxgitype", "d3dcommon"] }
3131
winit = "0.23.0"
3232
wio = "0.2.2"

unity-native-plugin-vulkan/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unity-native-plugin-vulkan"
3-
version = "0.5.1"
3+
version = "0.6.0"
44
authors = ["Yasuhiro Taniuchi"]
55
license = "MIT"
66
description = "Unity Native Plugin API (Vulkan) for Rust"
@@ -19,6 +19,6 @@ include = [
1919
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2020

2121
[dependencies]
22-
unity-native-plugin = { version = "0.5.0", path = "../unity-native-plugin" }
23-
unity-native-plugin-sys = { version = "0.5.0", path = "../unity-native-plugin-sys" }
24-
ash = "0.33.1"
22+
unity-native-plugin = { version = "0.6.0", path = "../unity-native-plugin" }
23+
unity-native-plugin-sys = { version = "0.6.0", path = "../unity-native-plugin-sys" }
24+
ash = "0.38.0+1.3.281.1"

unity-native-plugin/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unity-native-plugin"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Yasuhiro Taniuchi"]
55
license = "MIT"
66
description = "Unity Native Plugin API for Rust"
@@ -26,4 +26,4 @@ profiler = []
2626
profiler_callbacks = ["profiler"]
2727

2828
[dependencies]
29-
unity-native-plugin-sys = { version = "0.5.0", path = "../unity-native-plugin-sys" }
29+
unity-native-plugin-sys = { version = "0.6.0", path = "../unity-native-plugin-sys" }

unity-native-plugin/src/d3d11.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,24 @@ impl UnityGraphicsD3D11 {
3939
.SRVFromNativeTexture
4040
.expect("SRVFromNativeTexture")(texture) as ComPtr
4141
}
42+
43+
pub unsafe fn swap_chain(&self) -> ComPtr {
44+
self.interface().GetSwapChain.expect("GetSwapChain")() as ComPtr
45+
}
46+
47+
pub fn sync_interval(&self) -> u32 {
48+
unsafe {
49+
self.interface()
50+
.GetSyncInterval
51+
.expect("GetSyncInterval")()
52+
}
53+
}
54+
55+
pub fn present_flags(&self) -> u32 {
56+
unsafe {
57+
self.interface()
58+
.GetPresentFlags
59+
.expect("GetPresentFlags")()
60+
}
61+
}
4262
}

unity-native-plugin/src/enums.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
11
use unity_native_plugin_sys::*;
22

3-
#[repr(u16)]
4-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
5-
pub enum ProfilerMarkerFlag {
6-
ScriptEnterLeave = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagScriptEnterLeave as u16,
7-
AvailabilityEditor = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagAvailabilityEditor as u16,
8-
AvailabilityNonDev = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagAvailabilityNonDev as u16,
9-
Warning = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagWarning as u16,
10-
VerbosityDebug = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityDebug as u16,
11-
VerbosityInternal = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityInternal as u16,
12-
VerbosityAdvanced = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityAdvanced as u16,
13-
}
14-
15-
#[allow(dead_code)]
16-
pub struct ProfilerMarkerFlags(u16);
17-
18-
#[repr(u8)]
19-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
20-
pub enum ProfilerMarkerDataType {
21-
None = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeNone as u8,
22-
InstanceId = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeInstanceId as u8,
23-
Int32 = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeInt32 as u8,
24-
UInt32 = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeUInt32 as u8,
25-
Int64 = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeInt64 as u8,
26-
UInt64 = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeUInt64 as u8,
27-
Float = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeFloat as u8,
28-
Double = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeDouble as u8,
29-
String = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeString as u8,
30-
String16 = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeString16 as u8,
31-
Blob8 = UnityProfilerMarkerDataType__kUnityProfilerMarkerDataTypeBlob8 as u8,
32-
}
33-
343
#[repr(u32)]
354
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
365
pub enum RenderingExtEventType {

unity-native-plugin/src/graphics.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub type RenderingEventAndData = unity_native_plugin_sys::UnityRenderingEventAnd
1212
pub enum GfxRenderer {
1313
D3D11 = UnityGfxRenderer_kUnityGfxRendererD3D11,
1414
Null = UnityGfxRenderer_kUnityGfxRendererNull,
15+
OpenGLES20 = 8, // OpenGL ES 2.0, removed
1516
OpenGLES30 = UnityGfxRenderer_kUnityGfxRendererOpenGLES30,
1617
PS4 = UnityGfxRenderer_kUnityGfxRendererPS4,
1718
XboxOne = UnityGfxRenderer_kUnityGfxRendererXboxOne,
@@ -21,6 +22,11 @@ pub enum GfxRenderer {
2122
Vulkan = UnityGfxRenderer_kUnityGfxRendererVulkan,
2223
Nvn = UnityGfxRenderer_kUnityGfxRendererNvn,
2324
XboxOneD3D12 = UnityGfxRenderer_kUnityGfxRendererXboxOneD3D12,
25+
GameCoreXboxOne = UnityGfxRenderer_kUnityGfxRendererGameCoreXboxOne,
26+
GameCoreXboxSeries = UnityGfxRenderer_kUnityGfxRendererGameCoreXboxSeries,
27+
PS5 = UnityGfxRenderer_kUnityGfxRendererPS5,
28+
PS5NGGC = UnityGfxRenderer_kUnityGfxRendererPS5NGGC,
29+
ReservedCFE = UnityGfxRenderer_kUnityGfxRendererReservedCFE,
2430
}
2531

2632
#[repr(u32)]

unity-native-plugin/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ pub mod profiler_callbacks;
1313
pub mod enums;
1414
pub mod graphics;
1515
pub mod interface;
16+
pub mod log;
17+
pub mod memory_manager;
18+
1619
pub type IUnityInterfaces = unity_native_plugin_sys::IUnityInterfaces;
1720

1821
#[macro_export]

0 commit comments

Comments
 (0)