Struct GlContext
pub struct GlContext { /* private fields */ }
Available on crate feature
dep_miniquad
only.Implementations§
Trait Implementations§
§impl RenderingBackend for GlContext
impl RenderingBackend for GlContext
§fn buffer_size(&mut self, buffer: BufferId) -> usize ⓘ
fn buffer_size(&mut self, buffer: BufferId) -> usize ⓘ
Size of buffer in bytes
§fn delete_buffer(&mut self, buffer: BufferId)
fn delete_buffer(&mut self, buffer: BufferId)
Delete GPU buffer, leaving handle unmodified.
More high-level code on top of miniquad probably is going to call this in Drop implementation of some more RAII buffer object.
There is no protection against using deleted textures later. However its not an UB in OpenGl and thats why this function is not marked as unsafe
§fn apply_viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
fn apply_viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
Set a new viewport rectangle. Should be applied after begin_pass.
§fn apply_scissor_rect(&mut self, x: i32, y: i32, w: i32, h: i32)
fn apply_scissor_rect(&mut self, x: i32, y: i32, w: i32, h: i32)
Set a new scissor rectangle. Should be applied after begin_pass.
fn info(&self) -> ContextInfo
§fn new_shader(
&mut self,
shader: ShaderSource<'_>,
meta: ShaderMeta,
) -> Result<ShaderId, ShaderError> ⓘ
fn new_shader( &mut self, shader: ShaderSource<'_>, meta: ShaderMeta, ) -> Result<ShaderId, ShaderError> ⓘ
For metal context’s ShaderSource should contain MSL source string, for GL - glsl.
If in doubt, most OpenGL contexts support “#version 100” glsl shaders.
So far miniquad never encountered where it can create a rendering context, but
version 100
shaders are not supported. Read morefn new_texture( &mut self, access: TextureAccess, source: TextureSource<'_>, params: TextureParams, ) -> TextureId
§fn delete_texture(&mut self, texture: TextureId)
fn delete_texture(&mut self, texture: TextureId)
Delete GPU texture, leaving handle unmodified. Read more
§fn delete_shader(&mut self, program: ShaderId)
fn delete_shader(&mut self, program: ShaderId)
Delete GPU program, leaving handle unmodified. Read more
fn delete_pipeline(&mut self, pipeline: Pipeline)
fn texture_set_wrap( &mut self, texture: TextureId, wrap_x: TextureWrap, wrap_y: TextureWrap, )
fn texture_set_min_filter( &mut self, texture: TextureId, filter: FilterMode, mipmap_filter: MipmapFilterMode, )
fn texture_set_mag_filter(&mut self, texture: TextureId, filter: FilterMode)
fn texture_resize( &mut self, texture: TextureId, width: u32, height: u32, source: Option<&[u8]>, )
fn texture_read_pixels(&mut self, texture: TextureId, source: &mut [u8])
§fn texture_generate_mipmaps(&mut self, texture: TextureId)
fn texture_generate_mipmaps(&mut self, texture: TextureId)
Metal-specific note: if texture was created without
params.generate_mipmaps
generate_mipmaps
will do nothing. Read morefn texture_update_part( &mut self, texture: TextureId, x_offset: i32, y_offset: i32, width: i32, height: i32, source: &[u8], )
fn texture_params(&self, texture: TextureId) -> TextureParams
§unsafe fn texture_raw_id(&self, texture: TextureId) -> RawId
unsafe fn texture_raw_id(&self, texture: TextureId) -> RawId
Get OpenGL’s GLuint texture ID or metals ObjcId
§fn new_render_pass_mrt(
&mut self,
color_img: &[TextureId],
resolve_img: Option<&[TextureId]>,
depth_img: Option<TextureId>,
) -> RenderPass
fn new_render_pass_mrt( &mut self, color_img: &[TextureId], resolve_img: Option<&[TextureId]>, depth_img: Option<TextureId>, ) -> RenderPass
Same as “new_render_pass”, but allows multiple color attachments.
if
resolve_img
is set, MSAA-resolve operation will happen in end_render_pass
this operation require color_img
to have sample_count > 1,resolve_img have
sample_count == 1, and color_img.len() should be equal to resolve_img.len() Read more§fn render_pass_color_attachments(&self, render_pass: RenderPass) -> &[TextureId] ⓘ
fn render_pass_color_attachments(&self, render_pass: RenderPass) -> &[TextureId] ⓘ
For depth-only render pass returns empty slice.
fn delete_render_pass(&mut self, render_pass: RenderPass)
fn new_pipeline( &mut self, buffer_layout: &[BufferLayout], attributes: &[VertexAttribute], shader: ShaderId, params: PipelineParams, ) -> Pipeline
fn apply_pipeline(&mut self, pipeline: &Pipeline)
§fn new_buffer(
&mut self,
type_: BufferType,
usage: BufferUsage,
data: BufferSource<'_>,
) -> BufferId
fn new_buffer( &mut self, type_: BufferType, usage: BufferUsage, data: BufferSource<'_>, ) -> BufferId
Create a buffer resource object. Read more
fn buffer_update(&mut self, buffer: BufferId, data: BufferSource<'_>)
fn apply_bindings_from_slice( &mut self, vertex_buffers: &[BufferId], index_buffer: BufferId, textures: &[TextureId], )
fn apply_uniforms_from_bytes(&mut self, uniform_ptr: *const u8, size: usize)
fn clear( &mut self, color: Option<(f32, f32, f32, f32)>, depth: Option<f32>, stencil: Option<i32>, )
§fn begin_default_pass(&mut self, action: PassAction)
fn begin_default_pass(&mut self, action: PassAction)
start rendering to the default frame buffer
§fn begin_pass(&mut self, pass: Option<RenderPass>, action: PassAction)
fn begin_pass(&mut self, pass: Option<RenderPass>, action: PassAction)
start rendering to an offscreen framebuffer
fn end_render_pass(&mut self)
fn commit_frame(&mut self)
§fn draw(&self, base_element: i32, num_elements: i32, num_instances: i32)
fn draw(&self, base_element: i32, num_elements: i32, num_instances: i32)
Draw elements using currently applied bindings and pipeline. Read more
fn new_render_texture(&mut self, params: TextureParams) -> TextureId
fn new_texture_from_data_and_format( &mut self, bytes: &[u8], params: TextureParams, ) -> TextureId
fn new_texture_from_rgba8( &mut self, width: u16, height: u16, bytes: &[u8], ) -> TextureId
fn texture_size(&self, texture: TextureId) -> (u32, u32) ⓘ
§fn texture_update(&mut self, texture: TextureId, bytes: &[u8])
fn texture_update(&mut self, texture: TextureId, bytes: &[u8])
Update whole texture content
bytes should be width * height * 4 size - non rgba8 textures are not supported yet anyway
fn texture_set_filter( &mut self, texture: TextureId, filter: FilterMode, mipmap_filter: MipmapFilterMode, )
fn new_render_pass( &mut self, color_img: TextureId, depth_img: Option<TextureId>, ) -> RenderPass
§fn render_pass_texture(&self, render_pass: RenderPass) -> TextureId
fn render_pass_texture(&self, render_pass: RenderPass) -> TextureId
panics for depth-only or multiple color attachment render pass
This function is, mostly, legacy. Using “render_pass_color_attachments”
is recommended instead.
fn apply_bindings(&mut self, bindings: &Bindings)
fn apply_uniforms(&mut self, uniforms: UniformsSource<'_>)
Auto Trait Implementations§
impl Freeze for GlContext
impl RefUnwindSafe for GlContext
impl Send for GlContext
impl Sync for GlContext
impl Unpin for GlContext
impl UnwindSafe for GlContext
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Returns the alignment of this type in bytes.
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
Source§fn mem_align_of_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> usize ⓘ
Returns the alignment of the pointed-to value in bytes. Read more
Source§fn mem_size_of_val(&self) -> usize ⓘ
fn mem_size_of_val(&self) -> usize ⓘ
Returns the size of the pointed-to value in bytes. Read more
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
Returns the layout of the type.
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out
indicating that a T
is niched.