Function copy_swapchain_region_to_offscreen

Source
pub fn copy_swapchain_region_to_offscreen(
    device: &Device,
    encoder: &mut CommandEncoder,
    src_texture: &Texture,
    rect: Rect,
    lease: &LeasedOffscreen,
    pool: &OffscreenSurfacePool,
    format: TextureFormat,
)
Expand description

Physical-pixel copy from swapchain texture into a pooled offscreen target.

The origin is floored and clamped nonnegative. Extent is ceiled, forced to at least one pixel, and bounded by the lease dimensions. The caller must ensure the source texture also contains the resulting region and that format matches the lease; wgpu validation reports violations.

ยงExamples

use ailloli_ui_core::Rect;
use ailloli_ui_render_wgpu::{backdrop_capture::copy_swapchain_region_to_offscreen,
    offscreen_pool::{LeasedOffscreen, OffscreenSurfacePool}};
fn copy(device: &wgpu::Device, encoder: &mut wgpu::CommandEncoder,
    source: &wgpu::Texture, lease: &LeasedOffscreen, pool: &OffscreenSurfacePool) {
    copy_swapchain_region_to_offscreen(device, encoder, source,
        Rect::new(0.0, 0.0, 32.0, 32.0), lease, pool,
        wgpu::TextureFormat::Rgba8Unorm);
}