-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Using rendy on multiple threads at same time causes segfault #151
Comments
Cleanup methods require exclusive access to factory. |
Not sure how related this is, but I also got this while generating meshes and materials. Would something like this run in multiple threads? struct GameState;
impl SimpleState for GameState {
fn on_start(&mut self, state_data: StateData<'_, GameData<'_, '_>>) {
initialize_camera(state_data.world);
for x in -1..2 {
for y in -1..2 {
for z in -1..2 {
initialize_cube(state_data.world, x as f32 * 3.0, y as f32 * 3.0, z as f32 * 3.0);
}
}
}
initialize_light(state_data.world);
}
}
fn initialize_cube(world: &mut World, x: f32, y: f32, z: f32) {
let mesh = world.exec(|loader: AssetLoaderSystemData<'_, Mesh>| {
loader.load_from_data(
Shape::Cube
.generate::<(Vec<Position>, Vec<Normal>, Vec<Tangent>, Vec<TexCoord>)>(None)
.into(),
(),
)
});
let albedo = material_generator::albedo(world, 1.0, 0.0, 0.0, 1.0);
let metallic_roughness = material_generator::metallic_roughness(world, 0.5, 0.5);
let material = material_generator::generate_material(world, albedo, metallic_roughness);
let mut transform = Transform::default();
transform.set_translation_xyz(x, y, z);
world
.create_entity()
.with(mesh)
.with(material)
.with(transform)
.build();
}
// `metallic_roughness` and `generate_material` look similar
pub fn albedo(world: &mut World, red: f32, green: f32, blue: f32, alpha: f32) -> Handle<Texture> {
let albedo = world.exec(|loader: AssetLoaderSystemData<'_, Texture>| {
loader.load_from_data(
load_from_linear_rgba(LinSrgba::new(red, green, blue, alpha)).into(),
(),
)
});
albedo
} |
Hi, I want to ask for an error. I compiled this project, but got this error ⬇
It seems related about this issue, so is there anything for fixing this? |
That's not the actual error, just symptoms of it. If the application
doesn't exit cleanly for whatever reason (a panic most likely) then that
will get printed at the end of the log because the graphics resources
didn't get cleaned up properly.
…On Sun, Aug 23, 2020, 4:47 AM Kaben ***@***.***> wrote:
Hi, I want to ask for an error. I compiled this project
<https://github.com/Temeez/Tiled-Amethyst-Example>, but got this error ⬇
'''
[ERROR][rendy_resource::escape] Terminal must be dropped after all Escapes
[ERROR][rendy_resource::escape] Terminal must be dropped after all Escapes
[ERROR][rendy_resource::escape] Terminal must be dropped after all Escapes
[ERROR][rendy_resource::escape] Terminal must be dropped after all Escapes
[ERROR][rendy_resource::escape] Terminal must be dropped after all Escapes
[ERROR][rendy_resource::escape] Terminal must be dropped after all Escapes
'''
It seems related about this issue, so is there anything for fixing this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#151 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGYXH7QIYYNM5NJAAWF4B3SCD6VVANCNFSM4HPX2UMQ>
.
|
Symptom
Given:
rendy
at the same timeThen sometimes one thread's resource cleanup interferes with the other thread's usage.
Steps to Reproduce
This crate just has 100 test functions with an empty
GraphBuilder
Theory
Multiple threads share a common "memory space" (? I don't understand
rendy
enough). When one is cleaning up, another might be setting up, causingTerminal
to be disposed while someEscape
values are created.Note:
When run single threaded (
cargo test -- --test-threads 1
) with the empty graph, it doesn't segfault.Further evidence that rendy is correctly disposing in the correct order if you follow the serial control flow.
When run single threaded with
RenderTestBundle
, which has the sprites andPresentNode
in the graph, it does segfault.Logs
Environment
master
The text was updated successfully, but these errors were encountered: