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

fix vsync option #103

Merged
merged 2 commits into from
Oct 15, 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
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions SOEMAUTDServer/ThirdPartyNotice.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ bit-vec 0.8.0 (Apache-2.0 OR MIT)
https://github.com/contain-rs/bit-vec
---------------------------------------------------------

bitfield-struct 0.9.1 (MIT)
bitfield-struct 0.9.2 (MIT)
https://github.com/wrenger/bitfield-struct-rs.git
---------------------------------------------------------

Expand Down Expand Up @@ -380,7 +380,7 @@ httpdate 1.0.3 (Apache-2.0 OR MIT)
https://github.com/pyfisch/httpdate
---------------------------------------------------------

hyper 1.4.1 (MIT)
hyper 1.5.0 (MIT)
https://github.com/hyperium/hyper
---------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions TwinCATAUTDServerLightweight/ThirdPartyNotice.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bit-vec 0.8.0 (Apache-2.0 OR MIT)
https://github.com/contain-rs/bit-vec
---------------------------------------------------------

bitfield-struct 0.9.1 (MIT)
bitfield-struct 0.9.2 (MIT)
https://github.com/wrenger/bitfield-struct-rs.git
---------------------------------------------------------

Expand Down Expand Up @@ -350,7 +350,7 @@ httpdate 1.0.3 (Apache-2.0 OR MIT)
https://github.com/pyfisch/httpdate
---------------------------------------------------------

hyper 1.4.1 (MIT)
hyper 1.5.0 (MIT)
https://github.com/hyperium/hyper
---------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions simulator/ThirdPartyNotice.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bit-vec 0.8.0 (Apache-2.0 OR MIT)
https://github.com/contain-rs/bit-vec
---------------------------------------------------------

bitfield-struct 0.9.1 (MIT)
bitfield-struct 0.9.2 (MIT)
https://github.com/wrenger/bitfield-struct-rs.git
---------------------------------------------------------

Expand Down Expand Up @@ -574,7 +574,7 @@ httpdate 1.0.3 (Apache-2.0 OR MIT)
https://github.com/pyfisch/httpdate
---------------------------------------------------------

hyper 1.4.1 (MIT)
hyper 1.5.0 (MIT)
https://github.com/hyperium/hyper
---------------------------------------------------------

Expand Down
5 changes: 3 additions & 2 deletions simulator/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use autd3_derive::Builder;
use winit::window::Window;

use crate::{error::SimulatorError, surface::SurfaceWrapper};
use crate::{error::SimulatorError, surface::SurfaceWrapper, State};

#[derive(Builder)]
pub struct Context {
Expand All @@ -17,6 +17,7 @@ pub struct Context {

impl Context {
pub async fn init(
state: &State,
surface: &mut SurfaceWrapper,
window: Arc<Window>,
) -> Result<Self, SimulatorError> {
Expand Down Expand Up @@ -51,7 +52,7 @@ impl Context {
)
.await?;

surface.configure(window);
surface.configure(state, window);

Ok(Self {
_instance: instance,
Expand Down
2 changes: 1 addition & 1 deletion simulator/src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Simulator {
.build(&event_loop)?,
);
let mut surface = SurfaceWrapper::new();
let context = Context::init(&mut surface, window.clone()).await?;
let context = Context::init(&state, &mut surface, window.clone()).await?;
let renderer = Renderer::new(&state, &context, &surface, window.clone())?;
let server = ServerWrapper::new(state.port, state.lightweight, state.lightweight_port);
Ok(Self {
Expand Down
6 changes: 3 additions & 3 deletions simulator/src/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use autd3_derive::Builder;
use winit::{dpi::PhysicalSize, window::Window};

use crate::{context::Context, error::SimulatorError};
use crate::{context::Context, error::SimulatorError, State};

#[derive(Builder)]
pub struct SurfaceWrapper {
Expand Down Expand Up @@ -36,9 +36,9 @@ impl SurfaceWrapper {
Ok(())
}

pub fn configure(&mut self, window: Arc<Window>) {
pub fn configure(&mut self, state: &State, window: Arc<Window>) {
let size = window.inner_size();
self.config = Some(Self::surface_configuration(&size, true));
self.config = Some(Self::surface_configuration(&size, state.vsync));
}

pub fn resize(&mut self, context: &Context, size: &PhysicalSize<u32>) {
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/ThirdPartyNotice.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ bit-vec 0.8.0 (Apache-2.0 OR MIT)
https://github.com/contain-rs/bit-vec
---------------------------------------------------------

bitfield-struct 0.9.1 (MIT)
bitfield-struct 0.9.2 (MIT)
https://github.com/wrenger/bitfield-struct-rs.git
---------------------------------------------------------

Expand Down Expand Up @@ -763,7 +763,7 @@ httpdate 1.0.3 (Apache-2.0 OR MIT)
https://github.com/pyfisch/httpdate
---------------------------------------------------------

hyper 1.4.1 (MIT)
hyper 1.5.0 (MIT)
https://github.com/hyperium/hyper
---------------------------------------------------------

Expand Down Expand Up @@ -1609,7 +1609,7 @@ tao-macros 0.1.3 (Apache-2.0 OR MIT)
https://github.com/tauri-apps/tao
---------------------------------------------------------

tauri 2.0.3 (Apache-2.0 OR MIT)
tauri 2.0.4 (Apache-2.0 OR MIT)
https://github.com/tauri-apps/tauri
---------------------------------------------------------

Expand Down Expand Up @@ -1645,7 +1645,7 @@ tauri-runtime 2.1.0 (Apache-2.0 OR MIT)
https://github.com/tauri-apps/tauri
---------------------------------------------------------

tauri-runtime-wry 2.1.0 (Apache-2.0 OR MIT)
tauri-runtime-wry 2.1.1 (Apache-2.0 OR MIT)
https://github.com/tauri-apps/tauri
---------------------------------------------------------

Expand Down