pub trait IPlatformGraphics: Send + Sync {
// Required methods
fn uses_shared_context(&self) -> bool;
fn create_context(&self) -> Rc<dyn IPlatformGraphicsContext>;
fn get_shared_context(&self) -> Rc<dyn IPlatformGraphicsContext>;
// Provided method
fn as_feature_provider(&self) -> Option<&dyn IOptionalFeatureProvider> { ... }
}Expand description
Entry point to a platform GPU API (Metal, OpenGL, Vulkan, …).
The object is shared by threads, as in the reference, where the platform
registers one object that the UI thread finds among its services and the
thread that renders asks for its context. It is therefore held in an
Arc and is Send + Sync: the platform creates it on its thread, the
compositor hands a handle to the server side, and either side may clone,
call and drop its handle without the other. An implementation holds only
what two threads may share; what belongs to one thread (a display or a
context that is an Rc) it keeps bound to that thread.
A context it creates is an object of the thread that asked for it.
Required Methods§
Whether the backend renders through one context shared by all surfaces.
Sourcefn create_context(&self) -> Rc<dyn IPlatformGraphicsContext>
fn create_context(&self) -> Rc<dyn IPlatformGraphicsContext>
Creates a new graphics context.
The shared graphics context; only valid when
uses_shared_context is true.
Provided Methods§
Sourcefn as_feature_provider(&self) -> Option<&dyn IOptionalFeatureProvider>
fn as_feature_provider(&self) -> Option<&dyn IOptionalFeatureProvider>
Optional features of the graphics API, if the implementation provides any.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".