StarArawn / harmony

A modern 3D/2D game engine that uses wgpu.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPUResourceManager already borrowed as mutable

berylraven opened this issue · comments

Greetings! I've been following this project for a bit and think it has great potential.
I might want to start contributing a bit when I have time.

After PBR check-in I now get a panic on hello-cube and benchmark.
hello-pipeline has no issues when run.

thread 'main' panicked at 'called Result::unwrap() on an Err value: "resource already borrowed as mutable: alloc::boxed::Box"'

The panic occurs during unwrap of GPUResourceManager in brdf.rs:15.

backtrace:

12: core::option::expect_none_failed
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src\libcore\option.rs:1211
13: core::result::Result<legion_core::borrow::RefMut<alloc::boxed::Box>, alloc::string::String>::unwrap<legion_core::borrow::RefMut<alloc::boxed::Box>,alloc::string::String>
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550\src\libcore\result.rs:1003
14: legion_core::borrow::AtomicRefCell<alloc::boxed::Box>::get_mut
at \git\checkouts\legion-6fbc02e8da0bdce7\bd441f4\legion_core\src\borrow.rs:124
15: legion_systems::resource::Resources::get_mutharmony::graphics::resources::gpu_resource_manager::GPUResourceManager
at \git\checkouts\legion-6fbc02e8da0bdce7\bd441f4\legion_systems\src\resource.rs:245
16: harmony::graphics::pipelines::brdf::create
at .\src\graphics\pipelines\brdf.rs:15
17: harmony::graphics::resources::probe::Probe::new
at .\src\graphics\resources\probe.rs:118
18: harmony::graphics::resources::probe_manager::ProbeManager::create
at .\src\graphics\resources\probe_manager.rs:23
19: harmony::scene::entities::probe::create
at .\src\scene\entities\probe.rs:12
20: hello_cube::{{impl}}::load
at .\examples\hello-cube.rs:114
21: harmony::application::Application::load<hello_cube::AppState>
at .\src\application.rs:196
22: hello_cube::main
at .\examples\hello-cube.rs:191

OS: Windows 10
rust 1.43

commented

@berylraven
Thanks for the issue report! A lot of times we are testing using --release, because it's much faster. I let this issue slip through because I didn't test in debug mode. It should be fixed now let me know if you have any additional problems!