Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update egui with less wgpu lifetimes #7509

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30"
[[package]]
name = "ecolor"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"bytemuck",
"emath",
Expand All @@ -1787,7 +1787,7 @@ dependencies = [
[[package]]
name = "eframe"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"ahash",
"bytemuck",
Expand Down Expand Up @@ -1824,7 +1824,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"accesskit",
"ahash",
Expand All @@ -1841,7 +1841,7 @@ dependencies = [
[[package]]
name = "egui-wgpu"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -1860,7 +1860,7 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"accesskit_winit",
"ahash",
Expand Down Expand Up @@ -1900,7 +1900,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"ahash",
"egui",
Expand All @@ -1916,7 +1916,7 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"ahash",
"bytemuck",
Expand Down Expand Up @@ -1945,7 +1945,7 @@ dependencies = [
[[package]]
name = "egui_table"
version = "0.28.1"
source = "git+https://github.com/rerun-io/egui_table.git?rev=c76473b244f03a7c67fbbbff9def6fc86c1ca4ea#c76473b244f03a7c67fbbbff9def6fc86c1ca4ea"
source = "git+https://github.com/rerun-io/egui_table.git?rev=15be049a4eac3b9f87aa758505ebe46fd76dcef6#15be049a4eac3b9f87aa758505ebe46fd76dcef6"
dependencies = [
"egui",
"serde",
Expand Down Expand Up @@ -1989,7 +1989,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "emath"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"bytemuck",
"serde",
Expand Down Expand Up @@ -2090,7 +2090,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"
dependencies = [
"ab_glyph",
"ahash",
Expand All @@ -2109,7 +2109,7 @@ dependencies = [
[[package]]
name = "epaint_default_fonts"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=e0f0b7f47f4094967530214aec060b9f1ce5954e#e0f0b7f47f4094967530214aec060b9f1ce5954e"
source = "git+https://github.com/emilk/egui.git?rev=f97f85089df5e936999d5b7280e2e93e2958fac8#f97f85089df5e936999d5b7280e2e93e2958fac8"

[[package]]
name = "equivalent"
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,12 @@ missing_errors_doc = "allow"
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

ecolor = { git = "https://github.com/emilk/egui.git", rev = "e0f0b7f47f4094967530214aec060b9f1ce5954e" } # egui master 2024-09-19
eframe = { git = "https://github.com/emilk/egui.git", rev = "e0f0b7f47f4094967530214aec060b9f1ce5954e" } # egui master 2024-09-19
egui = { git = "https://github.com/emilk/egui.git", rev = "e0f0b7f47f4094967530214aec060b9f1ce5954e" } # egui master 2024-09-19
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "e0f0b7f47f4094967530214aec060b9f1ce5954e" } # egui master 2024-09-19
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "e0f0b7f47f4094967530214aec060b9f1ce5954e" } # egui master 2024-09-19
emath = { git = "https://github.com/emilk/egui.git", rev = "e0f0b7f47f4094967530214aec060b9f1ce5954e" } # egui master 2024-09-19
ecolor = { git = "https://github.com/emilk/egui.git", rev = "f97f85089df5e936999d5b7280e2e93e2958fac8" } # egui master 2024-09-25
eframe = { git = "https://github.com/emilk/egui.git", rev = "f97f85089df5e936999d5b7280e2e93e2958fac8" } # egui master 2024-09-25
egui = { git = "https://github.com/emilk/egui.git", rev = "f97f85089df5e936999d5b7280e2e93e2958fac8" } # egui master 2024-09-25
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "f97f85089df5e936999d5b7280e2e93e2958fac8" } # egui master 2024-09-25
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "f97f85089df5e936999d5b7280e2e93e2958fac8" } # egui master 2024-09-25
emath = { git = "https://github.com/emilk/egui.git", rev = "f97f85089df5e936999d5b7280e2e93e2958fac8" } # egui master 2024-09-25

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
Expand Down
18 changes: 1 addition & 17 deletions crates/viewer/re_renderer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
global_bindings::GlobalBindings,
renderer::Renderer,
resource_managers::{MeshManager, TextureManager2D},
wgpu_resources::{GpuRenderPipelinePoolMoveAccessor, WgpuResourcePools},
wgpu_resources::WgpuResourcePools,
FileServer, RecommendedFileResolver,
};

Expand Down Expand Up @@ -224,7 +224,6 @@ impl RenderContext {

let active_frame = ActiveFrameContext {
before_view_builder_encoder: Mutex::new(FrameGlobalCommandEncoder::new(&device)),
pinned_render_pipelines: None,
frame_index: STARTUP_FRAME_IDX,
top_level_error_scope,
};
Expand Down Expand Up @@ -341,13 +340,6 @@ This means, either a call to RenderContext::before_submit was omitted, or the pr
// Map all read staging buffers.
self.gpu_readback_belt.get_mut().after_queue_submit();

// Give back moved render pipelines to the pool if any were moved out.
if let Some(moved_render_pipelines) = self.active_frame.pinned_render_pipelines.take() {
self.gpu_resources
.render_pipelines
.return_resources(moved_render_pipelines);
}

// Close previous' frame error scope.
if let Some(top_level_error_scope) = self.active_frame.top_level_error_scope.take() {
let frame_index_for_uncaptured_errors = self.frame_index_for_uncaptured_errors.clone();
Expand All @@ -373,7 +365,6 @@ This means, either a call to RenderContext::before_submit was omitted, or the pr
// New active frame!
self.active_frame = ActiveFrameContext {
before_view_builder_encoder: Mutex::new(FrameGlobalCommandEncoder::new(&self.device)),
pinned_render_pipelines: None,
frame_index: self.active_frame.frame_index.wrapping_add(1),
top_level_error_scope: Some(WgpuErrorScope::start(&self.device)),
};
Expand Down Expand Up @@ -524,13 +515,6 @@ pub struct ActiveFrameContext {
/// (i.e. typically in [`crate::renderer::DrawData`] creation!)
pub before_view_builder_encoder: Mutex<FrameGlobalCommandEncoder>,

/// Render pipelines that were moved out of the resource pool.
///
/// Will be moved back to the resource pool at the start of the frame.
/// This is needed for accessing the render pipelines without keeping a reference
/// to the resource pool lock during the lifetime of a render pass.
pub pinned_render_pipelines: Option<GpuRenderPipelinePoolMoveAccessor>,

/// Index of this frame. Is incremented for every render frame.
///
/// Keep in mind that all operations on WebGPU are asynchronous:
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/queueable_draw_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ pub enum QueueableDrawDataError {
UnexpectedDrawDataType(&'static str),
}

type DrawFn = dyn for<'a, 'b> Fn(
type DrawFn = dyn for<'pipelines, 'encoder> Fn(
&Renderers,
&'b GpuRenderPipelinePoolAccessor<'b>,
&GpuRenderPipelinePoolAccessor<'pipelines>,
DrawPhase,
&'a mut wgpu::RenderPass<'b>,
&'b dyn std::any::Any,
&mut wgpu::RenderPass<'encoder>,
&dyn std::any::Any,
) -> Result<(), QueueableDrawDataError>
+ Sync
+ Send;
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ impl Renderer for Compositor {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a CompositorDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &CompositorDrawData,
) -> Result<(), DrawError> {
let pipeline_handle = match phase {
DrawPhase::Compositing => self.render_pipeline_regular,
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/debug_overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ impl Renderer for DebugOverlayRenderer {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
_phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a DebugOverlayDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &DebugOverlayDrawData,
) -> Result<(), DrawError> {
let pipeline = render_pipelines.get(self.render_pipeline)?;

Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/depth_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,12 @@ impl Renderer for DepthCloudRenderer {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError> {
re_tracing::profile_function!();
if draw_data.instances.is_empty() {
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/generic_skybox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ impl Renderer for GenericSkybox {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
_phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError> {
re_tracing::profile_function!();

Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,12 +744,12 @@ impl Renderer for LineRenderer {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError> {
let (pipeline_handle, bind_group_all_lines) = match phase {
DrawPhase::OutlineMask => (
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/mesh_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ impl Renderer for MeshRenderer {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError> {
re_tracing::profile_function!();

Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ pub trait Renderer {
// TODO(andreas): Some Renderers need to create their own passes, need something like this for that.

/// Called once per phase given by [`Renderer::participated_phases`].
fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError>;

/// Combination of flags indicating in which phases [`Renderer::draw`] should be called.
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/point_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,12 @@ impl Renderer for PointCloudRenderer {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError> {
let (pipeline_handle, bind_group_all_points) = match phase {
DrawPhase::OutlineMask => (
Expand Down
8 changes: 4 additions & 4 deletions crates/viewer/re_renderer/src/renderer/rectangles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,12 @@ impl Renderer for RectangleRenderer {
}
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
draw_data: &'a Self::RendererDrawData,
pass: &mut wgpu::RenderPass<'_>,
draw_data: &Self::RendererDrawData,
) -> Result<(), DrawError> {
re_tracing::profile_function!();
if draw_data.instances.is_empty() {
Expand Down
6 changes: 3 additions & 3 deletions crates/viewer/re_renderer/src/renderer/test_triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ impl Renderer for TestTriangle {
Self { render_pipeline }
}

fn draw<'a>(
fn draw(
&self,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
_phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
pass: &mut wgpu::RenderPass<'_>,
_draw_data: &TestTriangleDrawData,
) -> Result<(), DrawError> {
let pipeline = render_pipelines.get(self.render_pipeline)?;
Expand Down
18 changes: 7 additions & 11 deletions crates/viewer/re_renderer/src/view_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,12 @@ impl ViewBuilder {
self.setup.resolution_in_pixel
}

fn draw_phase<'a>(
&'a self,
fn draw_phase(
&self,
renderers: &Renderers,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
render_pipelines: &GpuRenderPipelinePoolAccessor<'_>,
phase: DrawPhase,
pass: &mut wgpu::RenderPass<'a>,
pass: &mut wgpu::RenderPass<'_>,
) {
re_tracing::profile_function!();

Expand Down Expand Up @@ -764,18 +764,14 @@ impl ViewBuilder {
///
/// The bound surface(s) on the `RenderPass` are expected to be the same format as specified on `Context` creation.
/// `screen_position` specifies where on the output pass the view is placed.
pub fn composite<'a>(
&'a self,
ctx: &RenderContext,
render_pipelines: &'a GpuRenderPipelinePoolAccessor<'a>,
pass: &mut wgpu::RenderPass<'a>,
) {
pub fn composite(&self, ctx: &RenderContext, pass: &mut wgpu::RenderPass<'_>) {
re_tracing::profile_function!();

pass.set_bind_group(0, &self.setup.bind_group_0, &[]);

self.draw_phase(
&ctx.read_lock_renderers(),
render_pipelines,
&ctx.gpu_resources.render_pipelines.resources(),
DrawPhase::Compositing,
pass,
);
Expand Down
Loading
Loading