pub struct GpuContext {
pub device: Device,
pub queue: Queue,
pub color_texture: Texture,
pub color_view: TextureView,
pub width: u32,
pub height: u32,
}Expand description
An initialised headless GPU context: device, queue, and an offscreen colour texture (plus its view) sized to the requested surface.
No window or swap-chain surface is involved — rendering goes to the
offscreen texture, which can then be read back to CPU memory with
crate::gpu::renderer’s readback path.
Fields§
§device: DeviceThe logical GPU device.
queue: QueueThe command queue for the device.
color_texture: TextureThe offscreen colour texture (RENDER_ATTACHMENT | COPY_SRC).
color_view: TextureViewA default view over color_texture.
width: u32Target width in physical pixels.
height: u32Target height in physical pixels.
Implementations§
Source§impl GpuContext
impl GpuContext
Sourcepub fn headless(width: u32, height: u32) -> Result<Self, UiError>
pub fn headless(width: u32, height: u32) -> Result<Self, UiError>
Initialise a headless GPU context with an offscreen target of
width × height pixels.
§Errors
UiError::Unsupported— no GPU adapter is available (the caller should treat this as “skip”, not a hard failure), or the requested target dimensions are zero.UiError::Backend— the adapter was found but the device request failed.
Auto Trait Implementations§
impl Freeze for GpuContext
impl !RefUnwindSafe for GpuContext
impl Send for GpuContext
impl Sync for GpuContext
impl Unpin for GpuContext
impl UnsafeUnpin for GpuContext
impl !UnwindSafe for GpuContext
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