| 1 | #[cfg (feature = "d3d" )] |
| 2 | pub mod d3d; |
| 3 | pub mod ganesh; |
| 4 | #[cfg (feature = "gl" )] |
| 5 | pub mod gl; |
| 6 | mod mutable_texture_state; |
| 7 | mod types; |
| 8 | #[cfg (feature = "vulkan" )] |
| 9 | pub mod vk; |
| 10 | |
| 11 | // Ganesh re-exports (these will probably be conflict with future graphite types) |
| 12 | pub use ganesh::{ |
| 13 | context_options::ContextOptions, images, BackendAPI, BackendFormat, BackendRenderTarget, |
| 14 | BackendTexture, DirectContext, DirectContextId, DriverBugWorkarounds, FlushInfo, |
| 15 | PurgeResourceOptions, RecordingContext, SemaphoresSubmitted, SubmitInfo, SurfaceOrigin, |
| 16 | SyncCpu, YUVABackendTextureInfo, YUVABackendTextures, |
| 17 | }; |
| 18 | |
| 19 | pub use mutable_texture_state::*; |
| 20 | pub use types::*; |
| 21 | |
| 22 | #[cfg (feature = "metal" )] |
| 23 | pub mod mtl { |
| 24 | pub use super::ganesh::mtl::{types::*, BackendContext}; |
| 25 | } |
| 26 | |
| 27 | pub mod surfaces { |
| 28 | #[cfg (feature = "metal" )] |
| 29 | pub use super::ganesh::mtl::surface_metal::*; |
| 30 | pub use super::ganesh::surface_ganesh::*; |
| 31 | } |
| 32 | |
| 33 | pub mod backend_formats { |
| 34 | #[cfg (feature = "gl" )] |
| 35 | pub use super::ganesh::gl::backend_formats::*; |
| 36 | #[cfg (feature = "metal" )] |
| 37 | pub use super::ganesh::mtl::backend_formats::*; |
| 38 | #[cfg (feature = "vulkan" )] |
| 39 | pub use super::ganesh::vk::backend_formats::*; |
| 40 | } |
| 41 | |
| 42 | pub mod backend_textures { |
| 43 | #[cfg (feature = "gl" )] |
| 44 | pub use super::ganesh::gl::backend_textures::*; |
| 45 | #[cfg (feature = "metal" )] |
| 46 | pub use super::ganesh::mtl::backend_textures::*; |
| 47 | #[cfg (feature = "vulkan" )] |
| 48 | pub use super::ganesh::vk::backend_textures::*; |
| 49 | } |
| 50 | |
| 51 | pub mod backend_render_targets { |
| 52 | #[cfg (feature = "gl" )] |
| 53 | pub use super::ganesh::gl::backend_render_targets::*; |
| 54 | #[cfg (feature = "metal" )] |
| 55 | pub use super::ganesh::mtl::backend_render_targets::*; |
| 56 | #[cfg (feature = "vulkan" )] |
| 57 | pub use super::ganesh::vk::backend_render_targets::*; |
| 58 | } |
| 59 | |
| 60 | pub mod direct_contexts { |
| 61 | #[cfg (feature = "gl" )] |
| 62 | pub use super::ganesh::gl::direct_contexts::*; |
| 63 | #[cfg (feature = "metal" )] |
| 64 | pub use super::ganesh::mtl::direct_contexts::*; |
| 65 | #[cfg (feature = "vulkan" )] |
| 66 | pub use super::ganesh::vk::direct_contexts::*; |
| 67 | } |
| 68 | |
| 69 | #[cfg (feature = "gl" )] |
| 70 | pub mod interfaces { |
| 71 | #[cfg (feature = "egl" )] |
| 72 | pub use super::ganesh::gl::make_egl_interface::interfaces::*; |
| 73 | #[cfg (target_os = "ios" )] |
| 74 | pub use super::ganesh::gl::make_ios_interface::interfaces::*; |
| 75 | #[cfg (target_os = "macos" )] |
| 76 | pub use super::ganesh::gl::make_mac_interface::interfaces::*; |
| 77 | #[cfg (target_arch = "wasm32" )] |
| 78 | pub use super::ganesh::gl::make_web_gl_interface::interfaces::*; |
| 79 | #[cfg (target_os = "windows" )] |
| 80 | pub use super::ganesh::gl::make_win_interface::interfaces::*; |
| 81 | } |
| 82 | |
| 83 | #[cfg (test)] |
| 84 | mod tests { |
| 85 | use super::{DirectContext, RecordingContext}; |
| 86 | |
| 87 | #[test ] |
| 88 | fn implicit_deref_conversion_from_direct_context_to_context_to_recording_context() { |
| 89 | fn _recording_context(_context: &RecordingContext) {} |
| 90 | fn _context(context: &DirectContext) { |
| 91 | _recording_context(context) |
| 92 | } |
| 93 | fn _direct_context(context: &DirectContext) { |
| 94 | _context(context) |
| 95 | } |
| 96 | |
| 97 | fn _recording_context_mut(_context: &mut RecordingContext) {} |
| 98 | fn _context_mut(context: &mut DirectContext) { |
| 99 | _recording_context_mut(context) |
| 100 | } |
| 101 | fn _direct_context_mut(context: &mut DirectContext) { |
| 102 | _context_mut(context) |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |