Skip to content

Commit 84f4cd6

Browse files
authored
Merge pull request #8 from Motphys/upgrade-to-unity-6
Upgrade Unity headers to 6000.0.5f1, add `IUnityMemoryManager.h`, `IUnityEventQueue.h` and `IUnityLog.h` to generated bindings
2 parents 9ddd3cc + 8184673 commit 84f4cd6

File tree

7 files changed

+59178
-25059
lines changed

7 files changed

+59178
-25059
lines changed

unity-native-plugin-sys/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
unity-native-plugin-rs
22
====
33

4-
* based on Unity 2020.3.13f1
5-
* Vulkan SDK 1.2.182.0
6-
* bindgen 0.58.1
4+
* based on Unity 6000.0.5f1
5+
* Vulkan SDK 1.3.268.1
6+
* bindgen 0.69.4
77
* clang version 10.0.0-4ubuntu1

unity-native-plugin-sys/src/plugin_api.rs

Lines changed: 59143 additions & 25047 deletions
Large diffs are not rendered by default.

unity-native-plugin-sys/wrapper.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <cstddef>
33

44
#define UINT32 uint32_t
5+
#define UINT uint32_t
56

67
#include <IUnityGraphics.h>
78
#include <IUnityInterface.h>
@@ -10,6 +11,7 @@ struct ID3D11Device {};
1011
struct ID3D11Resource {};
1112
struct ID3D11RenderTargetView {};
1213
struct ID3D11ShaderResourceView {};
14+
struct IDXGISwapChain {};
1315
#include <IUnityGraphicsD3D11.h>
1416

1517
typedef std::int32_t D3D12_RESOURCE_STATES;
@@ -32,3 +34,8 @@ struct ID3D12CommandQueue {};
3234

3335
#include <IUnityProfiler.h>
3436
#include <IUnityProfilerCallbacks.h>
37+
38+
#include <IUnityMemoryManager.h>
39+
Assert(bool);
40+
#include <IUnityEventQueue.h>
41+
#include <IUnityLog.h>

unity-native-plugin-tester/src/d3d11.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ impl TesterContextGraphicsD3D11 {
9898
TextureFromNativeTexture: Some(texture_from_native_texture),
9999
RTVFromRenderBuffer: Some(rtv_from_render_buffer),
100100
SRVFromNativeTexture: Some(srv_from_native_texture),
101+
GetSwapChain: Some(get_swap_chain),
102+
GetSyncInterval: Some(get_sync_interval),
103+
GetPresentFlags: Some(get_present_flags),
101104
},
102105
srvs_native_texture: std::collections::HashMap::new(),
103106
})
@@ -184,7 +187,8 @@ impl crate::interface::UnityInterfaceBase for TesterContextGraphicsD3D11 {
184187
}
185188

186189
fn get_unity_interface(&self) -> *mut IUnityInterface {
187-
unsafe { std::mem::transmute::<_, _>(&self.interfaces) }
190+
&self.interfaces as *const unity_native_plugin_sys::IUnityGraphicsD3D11
191+
as *mut unity_native_plugin_sys::IUnityInterface
188192
}
189193
}
190194

@@ -254,6 +258,22 @@ extern "system" fn srv_from_native_texture(
254258
}
255259
}
256260

261+
extern "system" fn get_swap_chain() -> *mut IDXGISwapChain {
262+
unsafe {
263+
crate::interface::get_unity_interface::<TesterContextGraphicsD3D11>()
264+
.swap_chain()
265+
.as_raw() as _
266+
}
267+
}
268+
269+
extern "system" fn get_sync_interval() -> u32 {
270+
1
271+
}
272+
273+
extern "system" fn get_present_flags() -> u32 {
274+
0
275+
}
276+
257277
/// Running tests for D3D11.
258278
///
259279
/// * 'TestContextGraphicsD3D11' manages the resources used for testing.

unity-native-plugin/src/enums.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub enum ProfilerMarkerFlag {
1212
VerbosityAdvanced = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityAdvanced as u16,
1313
}
1414

15+
#[allow(dead_code)]
1516
pub struct ProfilerMarkerFlags(u16);
1617

1718
#[repr(u8)]
@@ -194,8 +195,8 @@ pub enum RenderingExtTextureFormat {
194195
D24_UNorm = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatD24_UNorm,
195196
D24_UNorm_S8_UInt = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatD24_UNorm_S8_UInt,
196197
D32_SFloat = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatD32_SFloat,
197-
D32_SFloat_S8_Uint = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatD32_SFloat_S8_Uint,
198-
S8_Uint = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatS8_Uint,
198+
D32_SFloat_S8_UInt = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatD32_SFloat_S8_UInt,
199+
S8_UInt = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatS8_UInt,
199200
RGBA_DXT1_SRGB = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatRGBA_DXT1_SRGB,
200201
RGBA_DXT1_UNorm = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatRGBA_DXT1_UNorm,
201202
RGBA_DXT3_SRGB = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatRGBA_DXT3_SRGB,
@@ -254,9 +255,6 @@ pub enum RenderingExtTextureFormat {
254255
RGBA_ASTC12X12_UNorm =
255256
UnityRenderingExtTextureFormat_kUnityRenderingExtFormatRGBA_ASTC12X12_UNorm,
256257
YUV2 = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatYUV2,
257-
DepthAuto = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatDepthAuto,
258-
ShadowAuto = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatShadowAuto,
259-
VideoAuto = UnityRenderingExtTextureFormat_kUnityRenderingExtFormatVideoAuto,
260258
RGBA_ASTC4X4_UFloat =
261259
UnityRenderingExtTextureFormat_kUnityRenderingExtFormatRGBA_ASTC4X4_UFloat,
262260
RGBA_ASTC5X5_UFloat =
@@ -280,7 +278,6 @@ pub enum ShaderCompilerExtCompilerPlatform {
280278
Unused2 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformUnused2,
281279
Unused3 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformUnused3,
282280
D3D11 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformD3D11,
283-
GLES20 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformGLES20,
284281
Unused6 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformUnused6,
285282
Unused7 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformUnused7,
286283
Unused8 = UnityShaderCompilerExtCompilerPlatform_kUnityShaderCompilerExtCompPlatformUnused8,

unity-native-plugin/src/graphics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub type RenderingEventAndData = unity_native_plugin_sys::UnityRenderingEventAnd
1212
pub enum GfxRenderer {
1313
D3D11 = UnityGfxRenderer_kUnityGfxRendererD3D11,
1414
Null = UnityGfxRenderer_kUnityGfxRendererNull,
15-
OpenGLES20 = UnityGfxRenderer_kUnityGfxRendererOpenGLES20,
1615
OpenGLES30 = UnityGfxRenderer_kUnityGfxRendererOpenGLES30,
1716
PS4 = UnityGfxRenderer_kUnityGfxRendererPS4,
1817
XboxOne = UnityGfxRenderer_kUnityGfxRendererXboxOne,

unity-native-plugin/src/profiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub enum ProfilerMarkerFlag {
5858
AvailabilityEditor = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagAvailabilityEditor as u16,
5959
AvailabilityNonDev = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagAvailabilityNonDev as u16,
6060
Warning = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagWarning as u16,
61-
Counter = UnityProfilerMarkerFlag__kCounter as u16,
61+
Counter = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagCounter as u16,
6262
VerbosityDebug = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityDebug as u16,
6363
VerbosityInternal = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityInternal as u16,
6464
VerbosityAdvanced = UnityProfilerMarkerFlag__kUnityProfilerMarkerFlagVerbosityAdvanced as u16,

0 commit comments

Comments
 (0)