fix: order of operations on wayland material properties

This commit is contained in:
Nova
2023-02-16 14:03:13 -05:00
parent 23925b4475
commit 8ba199f053
3 changed files with 18 additions and 12 deletions

View File

@@ -170,7 +170,7 @@ fn main() -> Result<()> {
hmd::frame(sk); hmd::frame(sk);
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
wayland.frame(sk); wayland.frame_event(sk);
destroy_queue::clear(); destroy_queue::clear();
if let Some(mouse_pointer) = &mouse_pointer { if let Some(mouse_pointer) = &mouse_pointer {
@@ -206,6 +206,8 @@ fn main() -> Result<()> {
std::thread::sleep(sleep_duration); // to give clients a chance to even update anything before drawing std::thread::sleep(sleep_duration); // to give clients a chance to even update anything before drawing
}); });
} }
#[cfg(feature = "wayland")]
wayland.update(sk);
drawable::draw(sk); drawable::draw(sk);
audio::update(); audio::update();
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]

View File

@@ -155,16 +155,22 @@ impl Wayland {
} }
#[instrument(level = "debug", name = "Wayland frame", skip(self, sk))] #[instrument(level = "debug", name = "Wayland frame", skip(self, sk))]
pub fn frame(&mut self, sk: &StereoKitDraw) { pub fn update(&mut self, sk: &StereoKitDraw) {
for core_surface in CORE_SURFACES.get_valid_contents() { for core_surface in CORE_SURFACES.get_valid_contents() {
let state = self.state.lock(); core_surface.process(sk, &mut self.renderer, &self.log);
let output = state.output.clone();
core_surface.process(sk, &mut self.renderer, output, &self.log);
} }
self.display.lock().flush_clients().unwrap(); self.display.lock().flush_clients().unwrap();
} }
pub fn frame_event(&self, sk: &StereoKitDraw) {
let state = self.state.lock();
for core_surface in CORE_SURFACES.get_valid_contents() {
core_surface.frame(sk, state.output.clone());
}
}
pub fn make_context_current(&self) { pub fn make_context_current(&self) {
unsafe { unsafe {
self.renderer.egl_context().make_current().unwrap(); self.renderer.egl_context().make_current().unwrap();

View File

@@ -103,13 +103,7 @@ impl CoreSurface {
}) })
} }
pub fn process( pub fn process(&self, sk: &StereoKitDraw, renderer: &mut Gles2Renderer, log: &Logger) {
&self,
sk: &StereoKitDraw,
renderer: &mut Gles2Renderer,
output: Output,
log: &Logger,
) {
let Some(wl_surface) = self.wl_surface() else { return }; let Some(wl_surface) = self.wl_surface() else { return };
let sk_tex = self.sk_tex.get_or_init(|| { let sk_tex = self.sk_tex.get_or_init(|| {
@@ -183,6 +177,10 @@ impl CoreSurface {
*mapped_data = Some(new_mapped_data); *mapped_data = Some(new_mapped_data);
}); });
self.apply_surface_materials(); self.apply_surface_materials();
}
pub fn frame(&self, sk: &StereoKitDraw, output: Output) {
let Some(wl_surface) = self.wl_surface() else { return };
send_frames_surface_tree( send_frames_surface_tree(
&wl_surface, &wl_surface,