pub struct RenderPass<'a> {
pub paint_callback_resources: TypeMap,
pub tex_view_desc: TextureViewDescriptor<'a>,
/* private fields */
}
Expand description
Render pass to render a egui based GUI.
Fields§
§paint_callback_resources: TypeMap
Storage for use by egui::PaintCallback
’s that need to store resources such as render
pipelines that must have the lifetime of the renderpass.
tex_view_desc: TextureViewDescriptor<'a>
Implementations§
Source§impl<'a> RenderPass<'a>
impl<'a> RenderPass<'a>
Sourcepub fn new(
device: &Device,
texture_format: TextureFormat,
msaa_samples: u32,
) -> Self
pub fn new( device: &Device, texture_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: Vec<ClippedPrimitive>,
screen_descriptor: &ScreenDescriptor,
clear_color: Option<Color>,
)
pub fn execute( &self, encoder: &mut CommandEncoder, color_attachment: &TextureView, paint_jobs: Vec<ClippedPrimitive>, screen_descriptor: &ScreenDescriptor, clear_color: Option<Color>, )
Executes the egui render pass.
Sourcepub fn execute_with_renderpass<'rpass>(
&'rpass self,
rpass: &mut RenderPass<'rpass>,
paint_jobs: Vec<ClippedPrimitive>,
screen_descriptor: &ScreenDescriptor,
)
pub fn execute_with_renderpass<'rpass>( &'rpass self, rpass: &mut RenderPass<'rpass>, paint_jobs: Vec<ClippedPrimitive>, screen_descriptor: &ScreenDescriptor, )
Executes the egui render pass onto an existing wgpu renderpass.
Sourcepub fn update_texture(
&mut self,
device: &Device,
queue: &Queue,
id: TextureId,
image_delta: &ImageDelta,
)
pub fn update_texture( &mut self, device: &Device, queue: &Queue, id: TextureId, image_delta: &ImageDelta, )
Should be called before execute()
.
pub fn free_texture(&mut self, id: &TextureId)
Sourcepub fn texture(&self, id: &TextureId) -> Option<&(Option<Texture>, BindGroup)>
pub fn texture(&self, id: &TextureId) -> Option<&(Option<Texture>, BindGroup)>
Get the WGPU texture and bind group associated to a texture that has been allocated by egui.
This could be used by custom paint hooks to render images that have been added through with
egui_extras::RetainedImage
or egui::Context::load_texture
.
Sourcepub fn register_native_texture(
&mut self,
device: &Device,
texture: &TextureView,
texture_filter: FilterMode,
) -> TextureId
pub fn register_native_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 register_native_texture_with_sampler_options(
&mut self,
device: &Device,
texture: &TextureView,
sampler_descriptor: SamplerDescriptor<'_>,
) -> TextureId
pub fn register_native_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_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()
.