Skip to content

Commit 1968938

Browse files
authored
Silence fill error when effect not ready (#505)
Prevent side-effect error "GPU fill dispatch buffer operation bind group not found" when an effect is not ready, generally due to a shader error.
1 parent e24d32b commit 1968938

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/render/mod.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4955,11 +4955,7 @@ impl EffectBindGroups {
49554955
// array<EffectMetadata>;
49564956
BindGroupEntry {
49574957
binding: 0,
4958-
resource: BindingResource::Buffer(BufferBinding {
4959-
buffer: effect_metadata_buffer,
4960-
offset: 0,
4961-
size: None,
4962-
}),
4958+
resource: effect_metadata_buffer.as_entire_binding(),
49634959
},
49644960
);
49654961
if let Some(consume_event_buffers) = consume_event_buffers.as_ref() {
@@ -5066,11 +5062,7 @@ impl EffectBindGroups {
50665062
// array<EffectMetadata>;
50675063
entries.push(BindGroupEntry {
50685064
binding: 0,
5069-
resource: BindingResource::Buffer(BufferBinding {
5070-
buffer: effect_metadata_buffer,
5071-
offset: 0,
5072-
size: None,
5073-
}),
5065+
resource: effect_metadata_buffer.as_entire_binding(),
50745066
});
50755067
if emits_gpu_spawn_events {
50765068
let child_info_buffer = child_info_buffer.unwrap();
@@ -5766,7 +5758,12 @@ pub(crate) fn queue_effects(
57665758
/// indirect dispatch args of its init pass based on the number of GPU events
57675759
/// emitted in the previous frame and stored in its event buffer.
57685760
pub fn queue_init_indirect_workgroup_update(
5769-
q_cached_effects: Query<(Entity, &CachedChildInfo, &CachedEffectEvents)>,
5761+
q_cached_effects: Query<(
5762+
Entity,
5763+
&CachedChildInfo,
5764+
&CachedEffectEvents,
5765+
&CachedReadyState,
5766+
)>,
57705767
mut init_fill_dispatch_queue: ResMut<InitFillDispatchQueue>,
57715768
) {
57725769
debug_assert_eq!(
@@ -5778,7 +5775,14 @@ pub fn queue_init_indirect_workgroup_update(
57785775
// Schedule some GPU buffer operation to update the number of workgroups to
57795776
// dispatch during the indirect init pass of this effect based on the number of
57805777
// GPU spawn events written in its buffer.
5781-
for (entity, cached_child_info, cached_effect_events) in &q_cached_effects {
5778+
for (entity, cached_child_info, cached_effect_events, cached_ready_state) in &q_cached_effects {
5779+
if !cached_ready_state.is_ready() {
5780+
trace!(
5781+
"[Effect {:?}] Skipping init_fill_dispatch.enqueue() because effect is not ready.",
5782+
entity
5783+
);
5784+
continue;
5785+
}
57825786
let init_indirect_dispatch_index = cached_effect_events.init_indirect_dispatch_index;
57835787
let global_child_index = cached_child_info.global_child_index;
57845788
trace!(

0 commit comments

Comments
 (0)