Desktop: Directly upload frame buffer (#2930)

* Upload frame buffer directly to gpu texture

* Disable cef GPU acceleration to prevent crashes

* Cleanup code

* Address review comments

---------

Co-authored-by: Timon Schelling <me@timon.zip>
This commit is contained in:
Dennis Kobert
2025-07-25 14:04:46 +02:00
committed by GitHub
co-authored by Timon Schelling
parent 735d58a647
commit a52ee70e4c
7 changed files with 150 additions and 158 deletions
+5 -4
View File
@@ -9,7 +9,7 @@ mod cef;
use cef::{Setup, WindowSize};
mod render;
use render::FrameBuffer;
use render::WgpuContext;
mod app;
use app::WinitApp;
@@ -18,7 +18,7 @@ mod dirs;
#[derive(Debug)]
pub(crate) enum CustomEvent {
UiUpdate(FrameBuffer),
UiUpdate(wgpu::Texture),
ScheduleBrowserWork(Instant),
}
@@ -38,7 +38,8 @@ fn main() {
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy())) {
let wgpu_context = futures::executor::block_on(WgpuContext::new());
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy(), wgpu_context.clone())) {
Ok(c) => c,
Err(cef::InitError::InitializationFailed) => {
tracing::error!("Cef initialization failed");
@@ -48,7 +49,7 @@ fn main() {
tracing::info!("Cef initialized successfully");
let mut winit_app = WinitApp::new(cef_context, window_size_sender, event_loop.create_proxy());
let mut winit_app = WinitApp::new(cef_context, window_size_sender, wgpu_context);
event_loop.run_app(&mut winit_app).unwrap();
}