pub struct Resources<'a> { /* private fields */ }Expand description
The renderer’s GPU resources, as a layer’s hooks make and read them: the
vertex and index buffers and the textures of its meshes, the meshes it
draws (mesh), and the targets its draws draw into
(target). What it makes stays while the layer keeps a
handle to it, and the buffers and textures while a mesh reads them.
Implementations§
Source§impl<'a> Resources<'a>
impl<'a> Resources<'a>
Sourcepub fn target(
&mut self,
size: Size,
type_: TextureChannelDataType,
clear: Rgba,
) -> Target
pub fn target( &mut self, size: Size, type_: TextureChannelDataType, clear: Rgba, ) -> Target
A target of size, whose texture’s channels are of type_, or of
the type the backend draws into for it, and which clears to clear
before its draws. Its texture is sampled linearly and clamped to its
edges.
Sourcepub fn vertices<V: Pod>(&mut self, vertices: &[V]) -> VertexBuffer
pub fn vertices<V: Pod>(&mut self, vertices: &[V]) -> VertexBuffer
A buffer of a copy of vertices, which the first draw that reads it
uploads.
Sourcepub fn dynamic_vertices<V: Pod>(&mut self, vertices: &[V]) -> VertexBuffer
pub fn dynamic_vertices<V: Pod>(&mut self, vertices: &[V]) -> VertexBuffer
A buffer of a copy of vertices, as vertices
makes it, that update_vertices replaces
often: it keeps the vertices’ storage for the next update.
Sourcepub fn update_vertices<V: Pod>(
&mut self,
buffer: &VertexBuffer,
vertices: &[V],
) -> bool
pub fn update_vertices<V: Pod>( &mut self, buffer: &VertexBuffer, vertices: &[V], ) -> bool
Replaces the vertices of buffer, of the type V, with a copy of
vertices, as many, which the next draw that reads them uploads.
Returns false, leaving them be, for another number of vertices.
Sourcepub fn indexes(&mut self, indexes: &[u16]) -> IndexBuffer
pub fn indexes(&mut self, indexes: &[u16]) -> IndexBuffer
A buffer of a copy of indexes, which the first draw that reads it
uploads.
Sourcepub fn quad_indexes(&mut self) -> IndexBuffer
pub fn quad_indexes(&mut self) -> IndexBuffer
The indexes of as many quads as 16-bit indexes reach, four vertices apart, two triangles each, which every mesh that draws such quads shares.
Sourcepub fn texture(
&mut self,
format: TextureFormat,
sampler: SamplerState,
) -> Texture
pub fn texture( &mut self, format: TextureFormat, sampler: SamplerState, ) -> Texture
A texture of format, sampled as sampler says, which
write_texture makes and fills.
Sourcepub fn image_texture(
&mut self,
image: Rc<PremultipliedImage>,
sampler: SamplerState,
) -> Texture
pub fn image_texture( &mut self, image: Rc<PremultipliedImage>, sampler: SamplerState, ) -> Texture
A texture of image, sampled as sampler says, which the first draw
that binds it uploads.
Sourcepub fn set_image(&mut self, texture: &Texture, image: Rc<PremultipliedImage>)
pub fn set_image(&mut self, texture: &Texture, image: Rc<PremultipliedImage>)
Makes image what texture holds, which the next draw that binds it
uploads.
Sourcepub fn write_texture(
&mut self,
texture: &Texture,
data: &[u8],
size: Size,
) -> Result<(), GpuError>
pub fn write_texture( &mut self, texture: &Texture, data: &[u8], size: Size, ) -> Result<(), GpuError>
Writes data, the texels of an image of size in rows from the top,
to the whole of texture, first making it of that size.
Sourcepub fn set_sampler(&mut self, texture: &Texture, sampler: SamplerState)
pub fn set_sampler(&mut self, texture: &Texture, sampler: SamplerState)
Samples texture as sampler says, where a mesh doesn’t say
otherwise (Mesh::set_sampler).
Sourcepub fn texture_size(&self, texture: &Texture) -> Size
pub fn texture_size(&self, texture: &Texture) -> Size
The size of texture, empty before it has one.
Sourcepub fn shader_key(
&mut self,
program: &'static Program,
uniforms: Uniforms,
projection: ProjectionVariant,
) -> ShaderKey
pub fn shader_key( &mut self, program: &'static Program, uniforms: Uniforms, projection: ProjectionVariant, ) -> ShaderKey
The key of the variant of program that reads its properties of
uniforms from their uniforms, for projection, at the frame’s
pixel ratio.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Resources<'a>
impl<'a> !Send for Resources<'a>
impl<'a> !Sync for Resources<'a>
impl<'a> !UnwindSafe for Resources<'a>
impl<'a> Forget for Resources<'a>
impl<'a> Freeze for Resources<'a>
impl<'a> Move for Resources<'a>
impl<'a> Unpin for Resources<'a>
impl<'a> UnsafeUnpin for Resources<'a>
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.