Struct RenderPass

Source
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>

Source

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.

Source

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.

Source

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.

Source

pub fn update_texture( &mut self, device: &Device, queue: &Queue, id: TextureId, image_delta: &ImageDelta, )

Should be called before execute().

Source

pub fn free_texture(&mut self, id: &TextureId)

Source

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.

Source

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.

Source

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.

Source

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().

Auto Trait Implementations§

§

impl<'a> !Freeze for RenderPass<'a>

§

impl<'a> !RefUnwindSafe for RenderPass<'a>

§

impl<'a> Send for RenderPass<'a>

§

impl<'a> Sync for RenderPass<'a>

§

impl<'a> Unpin for RenderPass<'a>

§

impl<'a> !UnwindSafe for RenderPass<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>