pub struct GpuOffscreenSurface {
pub width: u32,
pub height: u32,
pub format: SwapchainFormat,
pub color_texture: GpuTextureHandle,
pub depth_texture: GpuTextureHandle,
pub pipeline: GpuPresentationPipeline,
}Expand description
Hardware offscreen render target surface for headless CI testing, server-side rendering, and image generation.
Fields§
§width: u32§height: u32§format: SwapchainFormat§color_texture: GpuTextureHandle§depth_texture: GpuTextureHandle§pipeline: GpuPresentationPipelineImplementations§
Source§impl GpuOffscreenSurface
impl GpuOffscreenSurface
Sourcepub fn new(
device: &GpuDevice,
width: u32,
height: u32,
format: SwapchainFormat,
) -> Self
pub fn new( device: &GpuDevice, width: u32, height: u32, format: SwapchainFormat, ) -> Self
Creates a new offscreen GPU surface with color and 32-bit floating point depth attachments.
Sourcepub fn render_display_list(
&mut self,
device: &mut GpuDevice,
list: &DisplayList,
damage: Option<Rect>,
) -> Result<usize, PresentError>
pub fn render_display_list( &mut self, device: &mut GpuDevice, list: &DisplayList, damage: Option<Rect>, ) -> Result<usize, PresentError>
Renders a DisplayList into this offscreen surface.
Sourcepub fn read_pixels(&self) -> &[u8] ⓘ
pub fn read_pixels(&self) -> &[u8] ⓘ
Returns a direct slice of the rendered color pixels.
Sourcepub fn read_pixels_to_vec(&self) -> Vec<u8> ⓘ
pub fn read_pixels_to_vec(&self) -> Vec<u8> ⓘ
Reads back color buffer pixels into a new vector.
Sourcepub fn read_depth_to_vec(&self) -> Vec<f32>
pub fn read_depth_to_vec(&self) -> Vec<f32>
Reads back 32-bit floating-point depth buffer values.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GpuOffscreenSurface
impl Forget for GpuOffscreenSurface
impl Move for GpuOffscreenSurface
impl RefUnwindSafe for GpuOffscreenSurface
impl Send for GpuOffscreenSurface
impl Sync for GpuOffscreenSurface
impl Unpin for GpuOffscreenSurface
impl UnsafeUnpin for GpuOffscreenSurface
impl UnwindSafe for GpuOffscreenSurface
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