[−][src]Struct web_glitz::image::renderbuffer::Renderbuffer
Stores a single 2-dimensional image, optimized for use as a [RenderTarget] attachment.
Unlike a [Texture2D], which can also hold a single 2-dimensional image, a Renderbuffer cannot be sampled. However, a Renderbuffer is optimized for use as a render target attachment, whereas a [Texture2D] may not be. A Renderbuffer is therefor the best choice for a [RenderTarget] attachment that never needs to be sampled.
See RenderingContext::create_renderbuffer and [RenderingContext::create_multisample_renderbuffer] for details on how a Renderbuffer is created for single-sample and multisample image data respectively.
Example
The following example creates a Renderbuffer and uses it as the color attachment in a render pass, which clears a central square to blue pixels:
use web_glitz::image::Region2D; use web_glitz::image::format::RGB8; use web_glitz::image::renderbuffer::RenderbufferDescriptor; use web_glitz::rendering::{LoadOp, RenderTargetDescriptor, StoreOp}; let mut renderbuffer = context.create_renderbuffer(&RenderbufferDescriptor { format: RGB8, width: 256, height: 256 }); let mut render_target = context.create_render_target( RenderTargetDescriptor::new() .attach_color_float( &mut renderbuffer, LoadOp::Load, StoreOp::Store ) ); let render_pass = render_target.create_render_pass(|framebuffer| { framebuffer.color.0.clear_command([0.0, 0.0, 1.0, 0.0], Region2D::Area((64, 64), 128, 128)) }); context.submit(render_pass);
Implementations
impl<F> Renderbuffer<F>
[src]
pub fn width(&self) -> u32
[src]
The width of this Renderbuffer.
pub fn height(&self) -> u32
[src]
The height of this Renderbuffer.
impl<F> Renderbuffer<Multisample<F>> where
F: Multisamplable,
[src]
F: Multisamplable,
pub fn samples(&self) -> u8
[src]
Returns the number of samples this Renderbuffer stores for its image data.
Trait Implementations
impl<F> AsAttachment for Renderbuffer<F> where
F: RenderbufferFormat + 'static,
[src]
F: RenderbufferFormat + 'static,
type Format = F
The type of image storage format the image is stored in.
fn as_attachment(&mut self) -> Attachment<'_, Self::Format>
[src]
impl<F> AsMultisampleAttachment for Renderbuffer<Multisample<F>> where
F: RenderbufferFormat + Multisamplable + 'static,
[src]
F: RenderbufferFormat + Multisamplable + 'static,
type SampleFormat = F
The type of image storage format the image is stored in.
fn as_multisample_attachment(
&mut self
) -> MultisampleAttachment<'_, Self::SampleFormat>
[src]
&mut self
) -> MultisampleAttachment<'_, Self::SampleFormat>
impl<F> AttachColorFloat for Renderbuffer<F> where
F: RenderbufferFormat + FloatRenderable + 'static,
[src]
F: RenderbufferFormat + FloatRenderable + 'static,
impl<F> AttachColorInteger for Renderbuffer<F> where
F: RenderbufferFormat + IntegerRenderable + 'static,
[src]
F: RenderbufferFormat + IntegerRenderable + 'static,
impl<F> AttachColorUnsignedInteger for Renderbuffer<F> where
F: RenderbufferFormat + UnsignedIntegerRenderable + 'static,
[src]
F: RenderbufferFormat + UnsignedIntegerRenderable + 'static,
impl<F> AttachDepth for Renderbuffer<F> where
F: RenderbufferFormat + DepthRenderable + 'static,
[src]
F: RenderbufferFormat + DepthRenderable + 'static,
impl<F> AttachDepthStencil for Renderbuffer<F> where
F: RenderbufferFormat + DepthStencilRenderable + 'static,
[src]
F: RenderbufferFormat + DepthStencilRenderable + 'static,
impl<F> AttachMultisampleColorFloat for Renderbuffer<Multisample<F>> where
F: RenderbufferFormat + Multisamplable + FloatRenderable + 'static,
[src]
F: RenderbufferFormat + Multisamplable + FloatRenderable + 'static,
impl<F> AttachMultisampleDepth for Renderbuffer<Multisample<F>> where
F: RenderbufferFormat + Multisamplable + DepthRenderable + 'static,
[src]
F: RenderbufferFormat + Multisamplable + DepthRenderable + 'static,
impl<F> AttachMultisampleDepthStencil for Renderbuffer<Multisample<F>> where
F: RenderbufferFormat + Multisamplable + DepthStencilRenderable + 'static,
[src]
F: RenderbufferFormat + Multisamplable + DepthStencilRenderable + 'static,
impl<F> AttachStencil for Renderbuffer<F> where
F: RenderbufferFormat + StencilRenderable + 'static,
[src]
F: RenderbufferFormat + StencilRenderable + 'static,
impl<F> BlitSource for Renderbuffer<F> where
F: RenderbufferFormat + 'static,
[src]
F: RenderbufferFormat + 'static,
type Format = F
The image storage format used by the source image.
fn descriptor(&self) -> BlitSourceDescriptor
[src]
impl<F> Hash for Renderbuffer<F>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<F> PartialEq<Renderbuffer<F>> for Renderbuffer<F>
[src]
impl<F> ResolveSource for Renderbuffer<Multisample<F>> where
F: RenderbufferFormat + Multisamplable + 'static,
[src]
F: RenderbufferFormat + Multisamplable + 'static,
type Format = F
The image storage format used by the source image.
fn descriptor(&self) -> ResolveSourceDescriptor
[src]
Auto Trait Implementations
impl<F> !RefUnwindSafe for Renderbuffer<F>
impl<F> !Send for Renderbuffer<F>
impl<F> !Sync for Renderbuffer<F>
impl<F> Unpin for Renderbuffer<F> where
F: Unpin,
F: Unpin,
impl<F> !UnwindSafe for Renderbuffer<F>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static,
[src]
D: Borrow<T> + 'static,
T: Copy + 'static,
pub fn into_buffer<Rc>(Self, &Rc, BufferId, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static,
[src]
Rc: RenderingContext + Clone + 'static,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,