pub struct GpuContext {
pub adapter: GpuAdapter,
pub device: GpuDevice,
}Expand description
Overarching GPU Context coordinating adapter discovery, device acquisition, and queue lifecycle.
Fields§
§adapter: GpuAdapter§device: GpuDeviceImplementations§
Source§impl GpuContext
impl GpuContext
Sourcepub fn new(
width: u32,
height: u32,
format: SwapchainFormat,
) -> Result<Self, PresentError>
pub fn new( width: u32, height: u32, format: SwapchainFormat, ) -> Result<Self, PresentError>
Discovers system GPU adapter and initializes logical device and presentation queue.
Sourcepub fn create_offscreen_surface(
&self,
width: u32,
height: u32,
format: SwapchainFormat,
) -> GpuOffscreenSurface
pub fn create_offscreen_surface( &self, width: u32, height: u32, format: SwapchainFormat, ) -> GpuOffscreenSurface
Creates an offscreen render surface for headless CI testing or server-side rendering.
Sourcepub fn render_to_texture(
&mut self,
list: &DisplayList,
target: &mut GpuTextureHandle,
damage: Option<Rect>,
) -> Result<Vec<u8>, PresentError>
pub fn render_to_texture( &mut self, list: &DisplayList, target: &mut GpuTextureHandle, damage: Option<Rect>, ) -> Result<Vec<u8>, PresentError>
Renders a DisplayList into a target texture and returns the readback pixel buffer.
Auto Trait Implementations§
impl Forget for GpuContext
impl Freeze for GpuContext
impl Move 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