pub struct GlGraphicsServer {
pub gl: Context,
/* private fields */
}
Fields§
§gl: Context
Implementations§
Source§impl GlGraphicsServer
impl GlGraphicsServer
pub fn new( vsync: bool, msaa_sample_count: Option<u8>, window_target: &EventLoopWindowTarget<()>, window_builder: WindowBuilder, ) -> Result<(Window, Rc<dyn GraphicsServer>), FrameworkError>
pub fn weak(&self) -> Weak<GlGraphicsServer>
pub fn gl_kind(&self) -> GlKind
pub fn free_texture_unit(&self) -> Option<u32>
Trait Implementations§
Source§impl GraphicsServer for GlGraphicsServer
impl GraphicsServer for GlGraphicsServer
Source§fn create_buffer(
&self,
size: usize,
buffer_kind: BufferKind,
buffer_usage: BufferUsage,
) -> Result<Box<dyn Buffer>, FrameworkError>
fn create_buffer( &self, size: usize, buffer_kind: BufferKind, buffer_usage: BufferUsage, ) -> Result<Box<dyn Buffer>, FrameworkError>
Creates a GPU buffer with the given size and kind. Usage is a hint to the video driver
that allows to perform some potential performance optimizations.
Source§fn create_texture(
&self,
desc: GpuTextureDescriptor<'_>,
) -> Result<Rc<RefCell<dyn GpuTexture>>, FrameworkError>
fn create_texture( &self, desc: GpuTextureDescriptor<'_>, ) -> Result<Rc<RefCell<dyn GpuTexture>>, FrameworkError>
Creates a new GPU texture using the given descriptor.
Source§fn create_frame_buffer(
&self,
depth_attachment: Option<Attachment>,
color_attachments: Vec<Attachment>,
) -> Result<Box<dyn FrameBuffer>, FrameworkError>
fn create_frame_buffer( &self, depth_attachment: Option<Attachment>, color_attachments: Vec<Attachment>, ) -> Result<Box<dyn FrameBuffer>, FrameworkError>
Creates a new frame buffer using the given depth and color attachments. Depth attachment
not exist, but there must be at least one color attachment of a format that supports rendering.
Source§fn back_buffer(&self) -> Box<dyn FrameBuffer>
fn back_buffer(&self) -> Box<dyn FrameBuffer>
Creates a frame buffer that “connected” to the final image that will be displayed to the
screen.
Source§fn create_query(&self) -> Result<Box<dyn Query>, FrameworkError>
fn create_query(&self) -> Result<Box<dyn Query>, FrameworkError>
Creates a new GPU query, that can perform asynchronous data fetching from GPU. Usually it
is used to create occlusion queries.
Source§fn create_program(
&self,
name: &str,
vertex_source: &str,
fragment_source: &str,
) -> Result<Box<dyn GpuProgram>, FrameworkError>
fn create_program( &self, name: &str, vertex_source: &str, fragment_source: &str, ) -> Result<Box<dyn GpuProgram>, FrameworkError>
Creates a new named GPU program using a pair of vertex and fragment shaders. The name could
be used for debugging purposes.
Source§fn create_program_with_properties(
&self,
name: &str,
vertex_source: &str,
fragment_source: &str,
properties: &[ShaderResourceDefinition],
) -> Result<Box<dyn GpuProgram>, FrameworkError>
fn create_program_with_properties( &self, name: &str, vertex_source: &str, fragment_source: &str, properties: &[ShaderResourceDefinition], ) -> Result<Box<dyn GpuProgram>, FrameworkError>
Almost the same as
Self::create_program
, but accepts additional array of resource
definitions. The implementation of graphics server will generate proper resource bindings
in the shader code for you.Source§fn create_async_read_buffer(
&self,
pixel_size: usize,
pixel_count: usize,
) -> Result<Box<dyn AsyncReadBuffer>, FrameworkError>
fn create_async_read_buffer( &self, pixel_size: usize, pixel_count: usize, ) -> Result<Box<dyn AsyncReadBuffer>, FrameworkError>
Creates a new read-back buffer, that can be used to obtain texture data from GPU. It can be
used to read rendering result from GPU to CPU memory and save the result to disk.
Source§fn create_geometry_buffer(
&self,
desc: GeometryBufferDescriptor<'_>,
) -> Result<Box<dyn GeometryBuffer>, FrameworkError>
fn create_geometry_buffer( &self, desc: GeometryBufferDescriptor<'_>, ) -> Result<Box<dyn GeometryBuffer>, FrameworkError>
Creates a new geometry buffer, which consists of one or more vertex buffers and only one
element buffer. Geometry buffer could be considered as a complex mesh storage allocated on
GPU.
Source§fn weak(self: Rc<GlGraphicsServer>) -> Weak<dyn GraphicsServer>
fn weak(self: Rc<GlGraphicsServer>) -> Weak<dyn GraphicsServer>
Creates a weak reference to the shared graphics server.
Source§fn flush(&self)
fn flush(&self)
Sends all scheduled GPU command buffers for execution on GPU without waiting for a certain
threshold.
Source§fn finish(&self)
fn finish(&self)
Waits until all the scheduled GPU commands are fully executed. This is blocking operation, and
it blocks the current thread until all the commands are fully executed.
Source§fn invalidate_resource_bindings_cache(&self)
fn invalidate_resource_bindings_cache(&self)
Unbinds the all bound resources from the graphics pipeline.
Source§fn pipeline_statistics(&self) -> PipelineStatistics
fn pipeline_statistics(&self) -> PipelineStatistics
Returns GPU pipeline statistics. See
PipelineStatistics
for more info.Source§fn swap_buffers(&self) -> Result<(), FrameworkError>
fn swap_buffers(&self) -> Result<(), FrameworkError>
Swaps the front and back buffers and thus presenting the final image on screen. There could
be more than two buffers, and it is up to the graphics server implementation to choose the
right amount, but it can’t be less than two.
Source§fn set_frame_size(&self, new_size: (u32, u32))
fn set_frame_size(&self, new_size: (u32, u32))
Notifies the graphics server that the size of the back buffer has changed. It has very limited
use and there are very few platforms (Linux with Wayland mostly) that needs this function to
be called.
Source§fn capabilities(&self) -> ServerCapabilities
fn capabilities(&self) -> ServerCapabilities
Returns current capabilities of the graphics server. See
ServerCapabilities
for more info.Source§fn set_polygon_fill_mode(
&self,
polygon_face: PolygonFace,
polygon_fill_mode: PolygonFillMode,
)
fn set_polygon_fill_mode( &self, polygon_face: PolygonFace, polygon_fill_mode: PolygonFillMode, )
Sets current polygon fill mode. See
PolygonFace
and PolygonFillMode
docs for more info.Source§fn create_2d_render_target(
&self,
pixel_kind: PixelKind,
width: usize,
height: usize,
) -> Result<Rc<RefCell<dyn GpuTexture>>, FrameworkError>
fn create_2d_render_target( &self, pixel_kind: PixelKind, width: usize, height: usize, ) -> Result<Rc<RefCell<dyn GpuTexture>>, FrameworkError>
A shortcut for
Self::create_texture
, that creates a rectangular texture with the given
size and pixel kind.Auto Trait Implementations§
impl !Freeze for GlGraphicsServer
impl !RefUnwindSafe for GlGraphicsServer
impl !Send for GlGraphicsServer
impl !Sync for GlGraphicsServer
impl Unpin for GlGraphicsServer
impl !UnwindSafe for GlGraphicsServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts self reference as a reference to
Any
. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts self reference as a reference to
Any
. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.