mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 06:28:12 +08:00
Desktop: Implement GPU accelerated offscreen rendering and improve rendering efficency (#3056)
* WIP accelerade offscreen canvas implementation * Implement vulkan dmabuf import * Add fps printing * Add feature gates * Forgot to add file * Experimental windows support * Cast ptr to isize * Remove testing chrome://flags url * Experimental macos support for texture import * Cleanup code and improve latency / frame pacing * Add path for importing textures on windows through dx12 * Update doc comment * Import textures through metal on macos * Review cleanup --------- Co-authored-by: Timon Schelling <me@timon.zip>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Timon Schelling
parent
97978c2491
commit
e56f858ced
+3
-17
@@ -1,5 +1,6 @@
|
||||
use std::process::exit;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::time::Instant;
|
||||
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use winit::event_loop::EventLoop;
|
||||
|
||||
@@ -16,7 +17,7 @@ use app::WinitApp;
|
||||
mod dirs;
|
||||
|
||||
use graphite_desktop_wrapper::messages::DesktopWrapperMessage;
|
||||
use graphite_desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext};
|
||||
use graphite_desktop_wrapper::{NodeGraphExecutionResult, WgpuContext};
|
||||
|
||||
pub(crate) enum CustomEvent {
|
||||
UiUpdate(wgpu::Texture),
|
||||
@@ -56,21 +57,6 @@ fn main() {
|
||||
|
||||
tracing::info!("Cef initialized successfully");
|
||||
|
||||
let rendering_loop_proxy = event_loop.create_proxy();
|
||||
let target_fps = 60;
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
let last_render = Instant::now();
|
||||
|
||||
let result = futures::executor::block_on(DesktopWrapper::execute_node_graph());
|
||||
let _ = rendering_loop_proxy.send_event(CustomEvent::NodeGraphExecutionResult(result));
|
||||
|
||||
let frame_time = Duration::from_secs_f32((target_fps as f32).recip());
|
||||
let sleep = last_render + frame_time - Instant::now();
|
||||
std::thread::sleep(sleep);
|
||||
}
|
||||
});
|
||||
|
||||
let mut winit_app = WinitApp::new(cef_context, window_size_sender, wgpu_context, event_loop.create_proxy());
|
||||
|
||||
event_loop.run_app(&mut winit_app).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user