fix: group conflicting Transform queries in ParamSet to fix B0001 panic
resize_offscreen declared two Query<&mut Transform> params (FullscreenQuad and UpscaleQuad filters). Bevy's conflict checker does not treat With<T> filters as disjoint access — both queries declare write access to the same component, so the app panicked at startup with error[B0001]. Merge the two queries into a ParamSet (borrowed one at a time) and move them to the end of the parameter list per the Params convention.
This commit is contained in:
parent
aadd0c62e1
commit
22489f50da
@ -145,10 +145,15 @@ fn resize_offscreen(
|
|||||||
mut images: ResMut<Assets<Image>>,
|
mut images: ResMut<Assets<Image>>,
|
||||||
params: Res<crate::params::BlackHoleParams>,
|
params: Res<crate::params::BlackHoleParams>,
|
||||||
target: Query<&OffscreenTarget>,
|
target: Query<&OffscreenTarget>,
|
||||||
mut bh_quad: Query<&mut Transform, With<FullscreenQuad>>,
|
|
||||||
mut up_quad: Query<&mut Transform, With<UpscaleQuad>>,
|
|
||||||
window: Query<&Window>,
|
window: Query<&Window>,
|
||||||
mut resized: MessageReader<bevy::window::WindowResized>,
|
mut resized: MessageReader<bevy::window::WindowResized>,
|
||||||
|
// Both queries borrow `&mut Transform`. Bevy's conflict checker does not
|
||||||
|
// treat `With<T>` filters as disjoint access, so two such Query params would
|
||||||
|
// trip B0001 — they must be grouped in a ParamSet (borrowed one at a time).
|
||||||
|
mut quads: ParamSet<(
|
||||||
|
Query<&mut Transform, With<FullscreenQuad>>,
|
||||||
|
Query<&mut Transform, With<UpscaleQuad>>,
|
||||||
|
)>,
|
||||||
) {
|
) {
|
||||||
if resized.read().next().is_none() {
|
if resized.read().next().is_none() {
|
||||||
return;
|
return;
|
||||||
@ -164,10 +169,10 @@ fn resize_offscreen(
|
|||||||
// insert is harmless — it'll succeed on the next WindowResized.
|
// insert is harmless — it'll succeed on the next WindowResized.
|
||||||
let _ = images.insert(handle.0.id(), img);
|
let _ = images.insert(handle.0.id(), img);
|
||||||
}
|
}
|
||||||
for mut t in &mut bh_quad {
|
for mut t in &mut quads.p0() {
|
||||||
t.scale = Vec3::new(w as f32 / 2.0, h as f32 / 2.0, 1.0);
|
t.scale = Vec3::new(w as f32 / 2.0, h as f32 / 2.0, 1.0);
|
||||||
}
|
}
|
||||||
for mut t in &mut up_quad {
|
for mut t in &mut quads.p1() {
|
||||||
t.scale = Vec3::new(win.width() / 2.0, win.height() / 2.0, 1.0);
|
t.scale = Vec3::new(win.width() / 2.0, win.height() / 2.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user