Struct egui_wgpu_backend::RenderPass
source · pub struct RenderPass { /* private fields */ }
Expand description
RenderPass to render a egui based GUI.
Implementations§
source§impl RenderPass
impl RenderPass
sourcepub fn new(
device: &Device,
output_format: TextureFormat,
msaa_samples: u32
) -> Self
pub fn new( device: &Device, output_format: TextureFormat, msaa_samples: u32 ) -> Self
Creates a new render pass to render a egui UI.
If the format passed is not a *Srgb format, the shader will automatically convert to sRGB colors in the shader.
sourcepub fn execute(
&self,
encoder: &mut CommandEncoder,
color_attachment: &TextureView,
paint_jobs: &[ClippedPrimitive],
screen_descriptor: &ScreenDescriptor,
clear_color: Option<Color>
) -> Result<(), BackendError>
pub fn execute( &self, encoder: &mut CommandEncoder, color_attachment: &TextureView, paint_jobs: &[ClippedPrimitive], screen_descriptor: &ScreenDescriptor, clear_color: Option<Color> ) -> Result<(), BackendError>
Executes the egui render pass. When clear_color
is not None, the output target will get cleared with clear_color before writing to it.
sourcepub fn execute_with_renderpass<'rpass>(
&'rpass self,
rpass: &mut RenderPass<'rpass>,
paint_jobs: &[ClippedPrimitive],
screen_descriptor: &ScreenDescriptor
) -> Result<(), BackendError>
pub fn execute_with_renderpass<'rpass>( &'rpass self, rpass: &mut RenderPass<'rpass>, paint_jobs: &[ClippedPrimitive], screen_descriptor: &ScreenDescriptor ) -> Result<(), BackendError>
Executes the egui render pass onto an existing wgpu renderpass.
sourcepub fn add_textures(
&mut self,
device: &Device,
queue: &Queue,
textures: &TexturesDelta
) -> Result<(), BackendError>
pub fn add_textures( &mut self, device: &Device, queue: &Queue, textures: &TexturesDelta ) -> Result<(), BackendError>
Updates the texture used by egui for the fonts etc. Should be called before execute()
.
sourcepub fn remove_textures(
&mut self,
textures: TexturesDelta
) -> Result<(), BackendError>
pub fn remove_textures( &mut self, textures: TexturesDelta ) -> Result<(), BackendError>
Remove the textures egui no longer needs. Should be called after execute()
sourcepub fn egui_texture_from_wgpu_texture(
&mut self,
device: &Device,
texture: &TextureView,
texture_filter: FilterMode
) -> TextureId
pub fn egui_texture_from_wgpu_texture( &mut self, device: &Device, texture: &TextureView, texture_filter: FilterMode ) -> TextureId
Registers a wgpu::Texture
with a egui::TextureId
.
This enables the application to reference the texture inside an image ui element.
This effectively enables off-screen rendering inside the egui UI. Texture must have
the texture format TextureFormat::Rgba8UnormSrgb
and
Texture usage TextureUsage::SAMPLED
.
sourcepub fn update_egui_texture_from_wgpu_texture(
&mut self,
device: &Device,
texture: &TextureView,
texture_filter: FilterMode,
id: TextureId
) -> Result<(), BackendError>
pub fn update_egui_texture_from_wgpu_texture( &mut self, device: &Device, texture: &TextureView, texture_filter: FilterMode, id: TextureId ) -> Result<(), BackendError>
Registers a wgpu::Texture
with an existing egui::TextureId
.
This enables applications to reuse TextureId
s.
sourcepub fn egui_texture_from_wgpu_texture_with_sampler_options(
&mut self,
device: &Device,
texture: &TextureView,
sampler_descriptor: SamplerDescriptor<'_>
) -> TextureId
pub fn egui_texture_from_wgpu_texture_with_sampler_options( &mut self, device: &Device, texture: &TextureView, sampler_descriptor: SamplerDescriptor<'_> ) -> TextureId
Registers a wgpu::Texture
with a egui::TextureId
while also accepting custom
wgpu::SamplerDescriptor
options.
This allows applications to specify individual minification/magnification filters as well as custom mipmap and tiling options.
The Texture
must have the format TextureFormat::Rgba8UnormSrgb
and usage
TextureUsage::SAMPLED
. Any compare function supplied in the SamplerDescriptor
will be
ignored.
sourcepub fn update_egui_texture_from_wgpu_texture_with_sampler_options(
&mut self,
device: &Device,
texture: &TextureView,
sampler_descriptor: SamplerDescriptor<'_>,
id: TextureId
) -> Result<(), BackendError>
pub fn update_egui_texture_from_wgpu_texture_with_sampler_options( &mut self, device: &Device, texture: &TextureView, sampler_descriptor: SamplerDescriptor<'_>, id: TextureId ) -> Result<(), BackendError>
Registers a wgpu::Texture
with an existing egui::TextureId
while also accepting custom
wgpu::SamplerDescriptor
options.
This allows applications to reuse TextureId
s created with custom sampler options.
sourcepub fn update_buffers(
&mut self,
device: &Device,
queue: &Queue,
paint_jobs: &[ClippedPrimitive],
screen_descriptor: &ScreenDescriptor
)
pub fn update_buffers( &mut self, device: &Device, queue: &Queue, paint_jobs: &[ClippedPrimitive], screen_descriptor: &ScreenDescriptor )
Uploads the uniform, vertex and index data used by the render pass.
Should be called before execute()
.