1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! impeller-rs: a tessellation-based 2D vector renderer.
//!
//! ```no_run
//! use impeller::{BackendPreference, Canvas, Color, Context, Extent2D, Paint, PixelFormat, Rect};
//!
//! let mut ctx = Context::new(BackendPreference::Auto)?;
//! let size = Extent2D::new(256, 256);
//! let mut surface = ctx.create_surface(size, PixelFormat::Rgba8Unorm)?;
//!
//! let mut canvas = Canvas::new(size);
//! canvas.clear(Color::WHITE);
//! canvas.draw_rect(Rect::new(32.0, 32.0, 224.0, 224.0), &Paint::fill(Color::rgba8(0, 120, 220, 255)))?;
//!
//! ctx.draw(&mut surface, &canvas.finish())?;
//! let pixels = ctx.read(&mut surface)?;
//! ctx.destroy_surface(surface);
//! # Ok::<(), impeller::Error>(())
//! ```
//!
//! Which backend runs is decided when the context is created, not when the
//! binary is built, so one image can boot on a board with a working Vulkan
//! driver and on one where only GLES is usable.
//!
//! Code above the backend branches on [`Context::capabilities`] rather than on
//! which backend it got. A device that cannot export a fence is the same
//! problem whichever API it speaks, and asking which backend it is gets both
//! cases wrong.
pub use ;
pub use ;
// The drawing API, so an application depends on this crate alone.
pub use ;
pub use ;
/// Draw a recording into a texture this crate did not create.
///
/// [`Context::draw`] covers the case where the target came from
/// [`Context::create_surface`], and that is the ordinary one. This is the other:
/// a swapchain hands out its own images, and drawing into one means naming a
/// texture the caller got from somewhere else. Without this the presentation
/// path re-exported above reached a swapchain and then had nothing to draw into
/// its images with, which is a window a caller can open and not fill.
pub use ;
/// Direct scanout to a display, with no compositor.
pub use impeller_present_drm as drm;
/// The Vulkan backend itself.
///
/// Re-exported because [`Context`] already exposes it: `Context::Vulkan` is a
/// public variant holding a `VulkanContext`, so the type was part of this
/// crate's surface whether or not it could be named. Without this a caller
/// could match the variant and use what came out by inference, but could not
/// write its type down -- so no function of theirs could take one, and reaching
/// the swapchain meant depending on the backend crate separately and matching
/// its version by hand.
pub use impeller_hal_vulkan as vulkan;
/// The GLES backend, re-exported for the same reason.
pub use impeller_hal_gles as gles;
/// A Vulkan WSI swapchain, for drawing into a window system's surface.
///
/// This was a feature name that enabled nothing for as long as it existed:
/// `present-wsi` was in the default set and gated no dependency, and the crate
/// implementing it was not one. So the facade's default build advertised a
/// presentation path it had no route to, and a caller wanting a window had to
/// reach past this crate to `impeller-present-vk` -- which the playground does,
/// and which was the visible symptom nobody read as one.
pub use impeller_present_vk as wsi;
/// An EGL window surface, which is the GLES backend's way to the same place.
pub use impeller_present_egl as egl;
/// Presentation targets and format negotiation.
pub use impeller_present as present;