add support for IUnityProfilerCallbacks and IUnityProfilerCallbacksV2 with feature flags
tested on macOS 11.4 & unity 2020.4 LTS
Notes
Implementation is not optimized for performance (for example using Box<Box<dyn FnMut(...)>>, but it's not terribly slow.
GetInterface is not working on my environment (not sure why) but GetInterfaceSplit works so I changed to use it.
updated bindings are generated with unity 2020.4 LTS + Vulkan sdk 1.2.183. I'm not sure if it works on Windows. Should we move bindgen to build.rs for platform portability?
I assume unity plugin interface to be thread-safe, so I added unsafe impl {Send/Sync} for the interface to make life easier with profiler callback interfaces. As there's no documentation about thread-safety of the interfaces so it might be unsafe :(.
I think it is generally OK, but I would like to make some changes.
The code generated by bindgen has a large difference in the header part, so I re-generated it.
I think that using build.rs to run bindgen at compile time can be hard to set up in some cases, and I don't plan to change to that at this time.
Fixed a build error in d3d12.rs. Unity's PluginAPI seems to have changed.
I moved the profiler_callbacks::v2 module to profiler_callbacks because I think it is too deep in the hierarchy. d3d12.rs has a similar definition of the extended interface.
IUnityProfilerCallbacks
andIUnityProfilerCallbacksV2
with feature flagsNotes
Box<Box<dyn FnMut(...)>>
, but it's not terribly slow.GetInterface
is not working on my environment (not sure why) butGetInterfaceSplit
works so I changed to use it.build.rs
for platform portability?unsafe impl {Send/Sync}
for the interface to make life easier with profiler callback interfaces. As there's no documentation about thread-safety of the interfaces so it might be unsafe :(.