pub struct SurfaceGpuContext { /* private fields */ }Expand description
Device-bound state that can outlive a native presentation surface.
Keeping the instance and adapter here lets a suspended host discard only
SurfaceAttachment while retaining the device, queue, and pipeline cache.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
assert!(std::mem::size_of::<SurfaceGpuContext>() > 0);Implementations§
Source§impl SurfaceGpuContext
impl SurfaceGpuContext
Sourcepub fn instance(&self) -> &Instance
pub fn instance(&self) -> &Instance
Returns the instance that created the retained adapter and surfaces.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
fn instance(context: &SurfaceGpuContext) -> &wgpu::Instance {
context.instance()
}Sourcepub fn adapter(&self) -> &Adapter
pub fn adapter(&self) -> &Adapter
Returns the adapter selected for the current presentation format.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
fn adapter(context: &SurfaceGpuContext) -> &wgpu::Adapter {
context.adapter()
}Sourcepub fn device(&self) -> &Device
pub fn device(&self) -> &Device
Returns the logical device retained across surface detachments.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
fn device(context: &SurfaceGpuContext) -> &wgpu::Device {
context.device()
}Sourcepub fn queue(&self) -> &Queue
pub fn queue(&self) -> &Queue
Returns the submission queue paired with Self::device.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
fn queue(context: &SurfaceGpuContext) -> &wgpu::Queue {
context.queue()
}Sourcepub fn pipelines(&self) -> &PipelineCache
pub fn pipelines(&self) -> &PipelineCache
Returns pipelines compiled for Self::format.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::{PipelineCache, SurfaceGpuContext};
fn pipelines(context: &SurfaceGpuContext) -> &PipelineCache {
context.pipelines()
}Sourcepub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
Returns the texture format baked into the retained pipeline cache.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
fn format(context: &SurfaceGpuContext) -> wgpu::TextureFormat {
context.format()
}Sourcepub fn adapter_info(&self) -> AdapterInfo
pub fn adapter_info(&self) -> AdapterInfo
Queries descriptive information for the retained adapter.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceGpuContext;
fn name(context: &SurfaceGpuContext) -> String {
context.adapter_info().name
}Auto Trait Implementations§
impl Freeze for SurfaceGpuContext
impl !RefUnwindSafe for SurfaceGpuContext
impl Send for SurfaceGpuContext
impl Sync for SurfaceGpuContext
impl Unpin for SurfaceGpuContext
impl !UnwindSafe for SurfaceGpuContext
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more