[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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate_type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
winit = "0.26"
|
winit = "0.26"
|
||||||
|
|
|
@ -200,9 +200,7 @@ pub async fn run() {
|
||||||
state.update(&renderer.queue, dt);
|
state.update(&renderer.queue, dt);
|
||||||
|
|
||||||
match renderer.render_frame(|view, command| {
|
match renderer.render_frame(|view, command| {
|
||||||
let mut renderable = Arc::clone(&default_state);
|
default_state.render(view, command)
|
||||||
let state = Arc::get_mut(&mut renderable).unwrap();
|
|
||||||
state.render(view, command)
|
|
||||||
}) {
|
}) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
|
Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
|
||||||
|
|
|
@ -282,7 +282,7 @@ impl super::State for DefaultState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(
|
||||||
&mut self,
|
&self,
|
||||||
view: &wgpu::TextureView,
|
view: &wgpu::TextureView,
|
||||||
encoder: &mut wgpu::CommandEncoder,
|
encoder: &mut wgpu::CommandEncoder,
|
||||||
) -> Result<(), wgpu::SurfaceError> {
|
) -> Result<(), wgpu::SurfaceError> {
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub trait State {
|
||||||
fn input(&mut self, event: &Event<()>) -> bool;
|
fn input(&mut self, event: &Event<()>) -> bool;
|
||||||
fn update(&mut self, queue: &Queue, dt: instant::Duration);
|
fn update(&mut self, queue: &Queue, dt: instant::Duration);
|
||||||
fn render(
|
fn render(
|
||||||
&mut self,
|
&self,
|
||||||
view: &TextureView,
|
view: &TextureView,
|
||||||
encoder: &mut CommandEncoder,
|
encoder: &mut CommandEncoder,
|
||||||
) -> Result<(), wgpu::SurfaceError>;
|
) -> Result<(), wgpu::SurfaceError>;
|
||||||
|
|
Loading…
Reference in a new issue