1
0
Fork 0

[GRAPHICS_RENDERER] Crash fix

This commit is contained in:
Florian RICHER 2022-07-26 12:59:08 +02:00
parent dc063f74a1
commit dfe9b1c4fe
4 changed files with 4 additions and 6 deletions

View file

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib", "rlib"]
crate_type = ["dylib"]
[dependencies]
winit = "0.26"

View file

@ -200,9 +200,7 @@ pub async fn run() {
state.update(&renderer.queue, dt);
match renderer.render_frame(|view, command| {
let mut renderable = Arc::clone(&default_state);
let state = Arc::get_mut(&mut renderable).unwrap();
state.render(view, command)
default_state.render(view, command)
}) {
Ok(_) => {}
Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {

View file

@ -282,7 +282,7 @@ impl super::State for DefaultState {
}
fn render(
&mut self,
&self,
view: &wgpu::TextureView,
encoder: &mut wgpu::CommandEncoder,
) -> Result<(), wgpu::SurfaceError> {

View file

@ -14,7 +14,7 @@ pub trait State {
fn input(&mut self, event: &Event<()>) -> bool;
fn update(&mut self, queue: &Queue, dt: instant::Duration);
fn render(
&mut self,
&self,
view: &TextureView,
encoder: &mut CommandEncoder,
) -> Result<(), wgpu::SurfaceError>;