ferroui_base/platform/
i_external_objects_render_interface_context_feature.rs1use super::{IBitmapImpl, IPlatformHandle, PlatformGraphicsDrmFormat, PlatformGraphicsExternalImageProperties};
2use crate::rendering::composition::{CompositionGpuImportedImageSynchronizationCapabilities, ICompositionImportableSharedGpuContextImage};
3use std::rc::Rc;
4use std::sync::Arc;
5
6pub trait IExternalObjectsRenderInterfaceContextFeature {
9 fn supported_image_handle_types(&self) -> Vec<String>;
11
12 fn supported_semaphore_types(&self) -> Vec<String>;
14
15 fn supported_dma_buf_formats(&self) -> Option<Vec<PlatformGraphicsDrmFormat>> {
19 None
20 }
21
22 fn import_image(
23 &self,
24 handle: Rc<dyn IPlatformHandle>,
25 properties: PlatformGraphicsExternalImageProperties,
26 ) -> Rc<dyn IPlatformRenderInterfaceImportedImage>;
27
28 fn import_shared_image(
32 &self,
33 image: Arc<dyn ICompositionImportableSharedGpuContextImage>,
34 ) -> Rc<dyn IPlatformRenderInterfaceImportedImage>;
35
36 fn import_semaphore(&self, handle: Rc<dyn IPlatformHandle>) -> Rc<dyn IPlatformRenderInterfaceImportedSemaphore>;
37
38 fn get_synchronization_capabilities(&self, image_handle_type: &str)
39 -> CompositionGpuImportedImageSynchronizationCapabilities;
40
41 fn device_uuid(&self) -> Option<Vec<u8>>;
42
43 fn device_luid(&self) -> Option<Vec<u8>>;
44}
45
46pub trait IExternalObjectsHandleWrapRenderInterfaceContextFeature {
59 fn wrap_image_handle_on_any_thread(
60 &self,
61 handle: &Rc<dyn IPlatformHandle>,
62 properties: PlatformGraphicsExternalImageProperties,
63 ) -> Option<Rc<dyn IExternalObjectsWrappedGpuHandle>>;
64
65 fn wrap_semaphore_handle_on_any_thread(
66 &self,
67 handle: &Rc<dyn IPlatformHandle>,
68 ) -> Option<Rc<dyn IExternalObjectsWrappedGpuHandle>>;
69}
70
71pub trait IExternalObjectsWrappedGpuHandle: IPlatformHandle {
74 fn dispose(&self);
75
76 fn as_platform_handle(self: Rc<Self>) -> Rc<dyn IPlatformHandle>;
78}
79
80pub trait IPlatformRenderInterfaceImportedObject {
82 fn dispose(&self);
83}
84
85pub trait IPlatformRenderInterfaceImportedImage: IPlatformRenderInterfaceImportedObject {
87 fn snapshot_with_keyed_mutex(&self, acquire_index: u32, release_index: u32) -> std::sync::Arc<crate::platform::SharedBitmapImpl>;
88
89 fn snapshot_with_semaphores(
90 &self,
91 wait_for_semaphore: &Rc<dyn IPlatformRenderInterfaceImportedSemaphore>,
92 signal_semaphore: &Rc<dyn IPlatformRenderInterfaceImportedSemaphore>,
93 ) -> std::sync::Arc<crate::platform::SharedBitmapImpl>;
94
95 fn snapshot_with_timeline_semaphores(
96 &self,
97 wait_for_semaphore: &Rc<dyn IPlatformRenderInterfaceImportedSemaphore>,
98 wait_for_value: u64,
99 signal_semaphore: &Rc<dyn IPlatformRenderInterfaceImportedSemaphore>,
100 signal_value: u64,
101 ) -> std::sync::Arc<crate::platform::SharedBitmapImpl>;
102
103 fn snapshot_with_automatic_sync(&self) -> std::sync::Arc<crate::platform::SharedBitmapImpl>;
104}
105
106pub trait IPlatformRenderInterfaceImportedSemaphore: IPlatformRenderInterfaceImportedObject {
108 fn as_any(&self) -> &dyn std::any::Any;
111}