Struct egui_render_wgpu::WgpuBackend
source · pub struct WgpuBackend {
pub instance: Arc<Instance>,
pub adapter: Arc<Adapter>,
pub device: Arc<Device>,
pub queue: Arc<Queue>,
pub painter: EguiPainter,
pub surface_manager: SurfaceManager,
pub command_encoders: Vec<CommandEncoder>,
}Expand description
This provides a Gfx backend for egui using wgpu as the backend
If you are making your own wgpu integration, then you can reuse the EguiPainter instead which contains only egui render specific data.
Fields§
§instance: Arc<Instance>wgpu instance
adapter: Arc<Adapter>wgpu adapter
device: Arc<Device>wgpu device.
queue: Arc<Queue>wgpu queue. if you have commands that you would like to submit, instead push them into Self::command_encoders
painter: EguiPaintercontains egui specific wgpu data like textures or buffers or pipelines etc..
surface_manager: SurfaceManager§command_encoders: Vec<CommandEncoder>this is where we store our command encoders. we will create one during the prepare_frame fn.
users can just use this. or create new encoders, and push them into this vec.
wgpu::Queue::submit is very expensive, so we will submit ALL command encoders at the same time during the present_frame method
just before presenting the swapchain image (surface texture).
Implementations§
source§impl WgpuBackend
impl WgpuBackend
pub async fn new_async( window_backend: &mut impl WindowBackend, config: <Self as GfxBackend>::Configuration ) -> Self
Trait Implementations§
source§impl Drop for WgpuBackend
impl Drop for WgpuBackend
source§impl GfxBackend for WgpuBackend
impl GfxBackend for WgpuBackend
§type Configuration = WgpuConfig
type Configuration = WgpuConfig
source§fn new(
window_backend: &mut impl WindowBackend,
config: Self::Configuration
) -> Self
fn new( window_backend: &mut impl WindowBackend, config: Self::Configuration ) -> Self
WindowBackend trait provides the backend config, which can be used by the renderer to check
for compatibility. Read moresource§fn resume(&mut self, window_backend: &mut impl WindowBackend)
fn resume(&mut self, window_backend: &mut impl WindowBackend)
Surface before entering the event loop.
when this fn is called, we can create a new surface (swapchain) for the window.
doesn’t apply on other platforms.source§fn prepare_frame(&mut self, window_backend: &mut impl WindowBackend)
fn prepare_frame(&mut self, window_backend: &mut impl WindowBackend)
WindowBackend::get_live_physical_size_framebuffer fn to resize your swapchain if it is out of date.source§fn render_egui(
&mut self,
meshes: Vec<ClippedPrimitive>,
textures_delta: TexturesDelta,
logical_screen_size: [f32; 2]
)
fn render_egui( &mut self, meshes: Vec<ClippedPrimitive>, textures_delta: TexturesDelta, logical_screen_size: [f32; 2] )
source§fn present(&mut self, _window_backend: &mut impl WindowBackend)
fn present(&mut self, _window_backend: &mut impl WindowBackend)
WindowBackend::swap_buffers.
on wgpu / vulkan, renderer might submit commands to queues, present swapchain image etc..source§fn resize_framebuffer(&mut self, window_backend: &mut impl WindowBackend)
fn resize_framebuffer(&mut self, window_backend: &mut impl WindowBackend)
source§fn suspend(&mut self, _window_backend: &mut impl WindowBackend)
fn suspend(&mut self, _window_backend: &mut impl WindowBackend)
Surface and recreate during resume event. Read more