[GRAPHICS_RENDERER] Crash fix
This commit is contained in:
parent
dc063f74a1
commit
dfe9b1c4fe
4 changed files with 4 additions and 6 deletions
|
@ -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"
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -282,7 +282,7 @@ impl super::State for DefaultState {
|
|||
}
|
||||
|
||||
fn render(
|
||||
&mut self,
|
||||
&self,
|
||||
view: &wgpu::TextureView,
|
||||
encoder: &mut wgpu::CommandEncoder,
|
||||
) -> Result<(), wgpu::SurfaceError> {
|
||||
|
|
|
@ -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>;
|
||||
|
|
Loading…
Reference in a new issue