pub struct SurfaceTarget { /* private fields */ }Expand description
GLFWWebGPUBackend’s surface without the window: frames presented to a
wgpu::Surface.
Implementations§
Source§impl SurfaceTarget
impl SurfaceTarget
Sourcepub fn new(
backend: Rc<RendererBackend>,
surface: Surface<'static>,
framebuffer_size: Size,
options: SurfaceOptions,
) -> Result<SurfaceTarget, Error>
pub fn new( backend: Rc<RendererBackend>, surface: Surface<'static>, framebuffer_size: Size, options: SurfaceOptions, ) -> Result<SurfaceTarget, Error>
A target on backend that presents to surface, made with the
instance of the backend’s device, at framebuffer_size physical
pixels. The surface is configured with the device’s surface format,
or with the first of BGRA8 and RGBA8 that the surface supports.
Fails with ErrorKind::Unsupported when the
device’s adapter can’t present to the surface or the surface supports
none of those formats, and with
ErrorKind::InvalidArgument when the device
has neither an adapter to ask nor a surface format.
Sourcepub fn backend(&self) -> &Rc<RendererBackend>
pub fn backend(&self) -> &Rc<RendererBackend>
The backend the target draws on.
Sourcepub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
The format the surface is configured with.
Sourcepub fn resize(&self, size: Size)
pub fn resize(&self, size: Size)
setFramebufferSize(Size): draws the next frame at size physical
pixels.
Sourcepub fn process_events(&self)
pub fn process_events(&self)
processEvents()
Sourcepub fn request_readback(&self)
pub fn request_readback(&self)
Port-only: copy the next presented frame (see take_readback).
Sourcepub fn take_readback(&self) -> Option<PremultipliedImage>
pub fn take_readback(&self) -> Option<PremultipliedImage>
Port-only: the frame copied after request_readback, once presented
and mapped (natively at once; in the browser on a later turn of the
event loop).
Sourcepub fn set_overlay(&self, overlay: Option<Overlay>)
pub fn set_overlay(&self, overlay: Option<Overlay>)
Port-only: draws overlay over each frame from now on, after the map
and before the frame is presented (and read back), or stops with
None.
Trait Implementations§
Source§impl Drop for SurfaceTarget
impl Drop for SurfaceTarget
Source§impl FrameTarget for SurfaceTarget
impl FrameTarget for SurfaceTarget
Source§fn begin_frame(&self) -> Option<Rc<dyn DrawTarget>>
fn begin_frame(&self) -> Option<Rc<dyn DrawTarget>>
Acquires the surface’s next texture, unless the frame has one. A frame without one is skipped: a render pass without a color attachment trips the drawables’ debug assertions.
Source§fn end_frame(&self, encoder: &dyn GfxCommandEncoder) -> Handoff
fn end_frame(&self, encoder: &dyn GfxCommandEncoder) -> Handoff
encoder for the frame, and
hands the frame’s image off.