|
1 | 1 | use crate::define_unity_interface;
|
| 2 | +use crate::interface; |
2 | 3 | use std::ffi::c_void;
|
3 | 4 | use unity_native_plugin_sys::*;
|
4 | 5 |
|
@@ -160,7 +161,6 @@ define_unity_interface!(
|
160 | 161 | 0xB18F8B0FF67778C8_u64
|
161 | 162 | );
|
162 | 163 |
|
163 |
| - |
164 | 164 | impl UnityGraphicsD3D12v4 {
|
165 | 165 | pub unsafe fn get_device(&self) -> *mut c_void {
|
166 | 166 | self.get_interface().GetDevice.expect("GetDevice")() as *mut c_void
|
@@ -218,3 +218,63 @@ define_unity_interface!(
|
218 | 218 | 0xF5C8D8A37D37BC42_u64,
|
219 | 219 | 0xB02DFE93B5064A27_u64
|
220 | 220 | );
|
| 221 | + |
| 222 | +impl UnityGraphicsD3D12v5 { |
| 223 | + pub unsafe fn get_device(&self) -> *mut c_void { |
| 224 | + self.get_interface().GetDevice.expect("GetDevice")() as *mut c_void |
| 225 | + } |
| 226 | + |
| 227 | + pub unsafe fn get_frame_fence(&self) -> *mut c_void { |
| 228 | + self.get_interface().GetFrameFence.expect("GetFrameFence")() as *mut c_void |
| 229 | + } |
| 230 | + |
| 231 | + pub fn get_next_frame_fence_value(&self) -> u64 { |
| 232 | + unsafe { |
| 233 | + self.get_interface() |
| 234 | + .GetNextFrameFenceValue |
| 235 | + .expect("GetNextFrameFenceValue")() |
| 236 | + } |
| 237 | + } |
| 238 | + |
| 239 | + pub unsafe fn execute_command_list( |
| 240 | + &self, |
| 241 | + command_list: *mut c_void, |
| 242 | + states: &[ResourceState], |
| 243 | + ) -> u64 { |
| 244 | + self.get_interface() |
| 245 | + .ExecuteCommandList |
| 246 | + .expect("ExecuteCommandList")( |
| 247 | + command_list as *mut ID3D12GraphicsCommandList, |
| 248 | + states.len() as ::std::os::raw::c_int, |
| 249 | + states.as_ptr() as *mut UnityGraphicsD3D12ResourceState, |
| 250 | + ) |
| 251 | + } |
| 252 | + |
| 253 | + pub fn set_physical_video_memory_control_values( |
| 254 | + &self, |
| 255 | + mem_info: &PhysicalVideoMemoryControlValues, |
| 256 | + ) { |
| 257 | + unsafe { |
| 258 | + self.get_interface() |
| 259 | + .SetPhysicalVideoMemoryControlValues |
| 260 | + .expect("SetPhysicalVideoMemoryControlValues")( |
| 261 | + mem_info as *const UnityGraphicsD3D12PhysicalVideoMemoryControlValues, |
| 262 | + ) |
| 263 | + } |
| 264 | + } |
| 265 | + |
| 266 | + pub unsafe fn get_command_queue(&self) -> *mut c_void { |
| 267 | + self.get_interface() |
| 268 | + .GetCommandQueue |
| 269 | + .expect("GetCommandQueue")() as *mut c_void |
| 270 | + } |
| 271 | + |
| 272 | + pub unsafe fn texture_from_render_buffer( |
| 273 | + &self, |
| 274 | + buffer: *mut interface::RenderBuffer, |
| 275 | + ) -> *mut c_void { |
| 276 | + self.get_interface() |
| 277 | + .TextureFromRenderBuffer |
| 278 | + .expect("TextureFromRenderBuffer")(buffer) as *mut c_void |
| 279 | + } |
| 280 | +} |
0 commit comments