1 | use skia_bindings as sb; |
2 | use std::ptr; |
3 | |
4 | pub use skia_bindings::GrBackendApi as BackendAPI; |
5 | variant_name!(BackendAPI::OpenGL); |
6 | |
7 | pub use skia_bindings::GrSurfaceOrigin as SurfaceOrigin; |
8 | variant_name!(SurfaceOrigin::BottomLeft); |
9 | |
10 | // Note: BackendState is in gl/types.rs/ |
11 | |
12 | #[repr (C)] |
13 | #[allow (dead_code)] |
14 | #[derive (Debug)] |
15 | pub struct FlushInfo { |
16 | // TODO: wrap access to the following fields in a safe way: |
17 | num_semaphores: usize, |
18 | signal_semaphores: *mut sb::GrBackendSemaphore, |
19 | finished_proc: sb::GrGpuFinishedProc, |
20 | finished_context: sb::GrGpuFinishedContext, |
21 | submitted_proc: sb::GrGpuSubmittedProc, |
22 | submitted_context: sb::GrGpuSubmittedContext, |
23 | } |
24 | |
25 | impl Default for FlushInfo { |
26 | fn default() -> Self { |
27 | Self { |
28 | num_semaphores: 0, |
29 | signal_semaphores: ptr::null_mut(), |
30 | finished_proc: None, |
31 | finished_context: ptr::null_mut(), |
32 | submitted_proc: None, |
33 | submitted_context: ptr::null_mut(), |
34 | } |
35 | } |
36 | } |
37 | |
38 | native_transmutable!(sb::GrFlushInfo, FlushInfo, flush_info_layout); |
39 | |
40 | pub use sb::GrSemaphoresSubmitted as SemaphoresSubmitted; |
41 | variant_name!(SemaphoresSubmitted::Yes); |
42 | |
43 | pub use sb::GrPurgeResourceOptions as PurgeResourceOptions; |
44 | variant_name!(PurgeResourceOptions::AllResources); |
45 | |
46 | pub use sb::GrSyncCpu as SyncCpu; |
47 | variant_name!(SyncCpu::Yes); |
48 | |