mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 22:41:07 +01:00
refactor(core): Rename used_*_ranges to *_init_actions
This commit is contained in:
1 parent
22bea009e6
commit
d1e15bc3d3
4 files changed
+22
-22
No files matched your search
@@ -1252,8 +1252,8 @@ pub struct BindGroup {
|
||||
pub(crate) label: String,
|
||||
pub(crate) tracking_data: TrackingData,
|
||||
pub(crate) used: BindGroupStates,
|
||||
pub(crate) used_buffer_ranges: Vec<BufferInitTrackerAction>,
|
||||
pub(crate) used_texture_ranges: Vec<TextureInitTrackerAction>,
|
||||
pub(crate) buffer_init_actions: Vec<BufferInitTrackerAction>,
|
||||
pub(crate) texture_init_actions: Vec<TextureInitTrackerAction>,
|
||||
/// INVARIANT: Sorted by binding index order.
|
||||
pub(crate) dynamic_binding_info: Vec<BindGroupDynamicBindingData>,
|
||||
/// Actual binding sizes for buffers that don't have `min_binding_size`
|
||||
@@ -1279,10 +1279,10 @@ impl BindGroup {
|
||||
) -> Result<&'a dyn hal::DynBindGroup, DestroyedResourceError> {
|
||||
// Clippy insist on writing it this way. The idea is to return None
|
||||
// if any of the raw buffer is not valid anymore.
|
||||
for buffer in &self.used_buffer_ranges {
|
||||
for buffer in &self.buffer_init_actions {
|
||||
buffer.buffer.try_raw(guard)?;
|
||||
}
|
||||
for texture in &self.used_texture_ranges {
|
||||
for texture in &self.texture_init_actions {
|
||||
texture.texture.try_raw(guard)?;
|
||||
}
|
||||
|
||||
|
||||
@@ -1499,9 +1499,9 @@ impl State {
|
||||
self.commands
|
||||
.extend(entries.map(|(i, bind_group, dynamic_offsets)| {
|
||||
self.buffer_memory_init_actions
|
||||
.extend_from_slice(&bind_group.used_buffer_ranges);
|
||||
.extend_from_slice(&bind_group.buffer_init_actions);
|
||||
self.texture_memory_init_actions
|
||||
.extend_from_slice(&bind_group.used_texture_ranges);
|
||||
.extend_from_slice(&bind_group.texture_init_actions);
|
||||
|
||||
self.flat_dynamic_offsets.extend_from_slice(dynamic_offsets);
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ pub(super) fn flush_bindings_helper(state: &mut PassState) -> Result<(), Destroy
|
||||
|
||||
for (i, bind_group, dynamic_offsets) in entries {
|
||||
state.base.buffer_memory_init_actions.extend(
|
||||
bind_group.used_buffer_ranges.iter().filter_map(|action| {
|
||||
bind_group.buffer_init_actions.iter().filter_map(|action| {
|
||||
action
|
||||
.buffer
|
||||
.initialization_status
|
||||
@@ -156,7 +156,7 @@ pub(super) fn flush_bindings_helper(state: &mut PassState) -> Result<(), Destroy
|
||||
.check_action(action)
|
||||
}),
|
||||
);
|
||||
for action in bind_group.used_texture_ranges.iter() {
|
||||
for action in bind_group.texture_init_actions.iter() {
|
||||
state.pending_discard_init_fixups.extend(
|
||||
state
|
||||
.base
|
||||
|
||||
@@ -2874,7 +2874,7 @@ impl Device {
|
||||
bb: &'a binding_model::ResolvedBufferBinding,
|
||||
binding: u32,
|
||||
decl: &wgt::BindGroupLayoutEntry,
|
||||
used_buffer_ranges: &mut Vec<BufferInitTrackerAction>,
|
||||
buffer_init_actions: &mut Vec<BufferInitTrackerAction>,
|
||||
dynamic_binding_info: &mut Vec<binding_model::BindGroupDynamicBindingData>,
|
||||
late_buffer_binding_sizes: &mut FastHashMap<u32, wgt::BufferSize>,
|
||||
used: &mut BindGroupStates,
|
||||
@@ -2999,7 +2999,7 @@ impl Device {
|
||||
binding_model::buffer_binding_type_bounds_check_alignment(&self.alignments, binding_ty);
|
||||
let visible_size = align_to(bind_size, bounds_check_alignment);
|
||||
|
||||
used_buffer_ranges.extend(buffer.initialization_status.read().create_action(
|
||||
buffer_init_actions.extend(buffer.initialization_status.read().create_action(
|
||||
buffer,
|
||||
bb.offset..bb.offset + visible_size,
|
||||
MemoryInitKind::NeedsInitializedMemory,
|
||||
@@ -3063,7 +3063,7 @@ impl Device {
|
||||
decl: &wgt::BindGroupLayoutEntry,
|
||||
view: &'a Arc<TextureView>,
|
||||
used: &mut BindGroupStates,
|
||||
used_texture_ranges: &mut Vec<TextureInitTrackerAction>,
|
||||
texture_init_actions: &mut Vec<TextureInitTrackerAction>,
|
||||
snatch_guard: &'a SnatchGuard<'a>,
|
||||
) -> Result<hal::TextureBinding<'a, dyn hal::DynTextureView>, CreateBindGroupError> {
|
||||
view.same_device(self)?;
|
||||
@@ -3079,7 +3079,7 @@ impl Device {
|
||||
|
||||
let texture = &view.parent;
|
||||
|
||||
used_texture_ranges.push(TextureInitTrackerAction {
|
||||
texture_init_actions.push(TextureInitTrackerAction {
|
||||
texture: texture.clone(),
|
||||
range: TextureInitRange {
|
||||
mip_range: view.desc.range.mip_range(texture.desc.mip_level_count),
|
||||
@@ -3277,8 +3277,8 @@ impl Device {
|
||||
// fill out the descriptors
|
||||
let mut used = BindGroupStates::new();
|
||||
|
||||
let mut used_buffer_ranges = Vec::new();
|
||||
let mut used_texture_ranges = Vec::new();
|
||||
let mut buffer_init_actions = Vec::new();
|
||||
let mut texture_init_actions = Vec::new();
|
||||
let mut hal_entries = Vec::with_capacity(desc.entries.len());
|
||||
let mut hal_buffers = Vec::new();
|
||||
let mut hal_samplers = Vec::new();
|
||||
@@ -3299,7 +3299,7 @@ impl Device {
|
||||
bb,
|
||||
binding,
|
||||
decl,
|
||||
&mut used_buffer_ranges,
|
||||
&mut buffer_init_actions,
|
||||
&mut dynamic_binding_info,
|
||||
&mut late_buffer_binding_sizes,
|
||||
&mut used,
|
||||
@@ -3320,7 +3320,7 @@ impl Device {
|
||||
bb,
|
||||
binding,
|
||||
decl,
|
||||
&mut used_buffer_ranges,
|
||||
&mut buffer_init_actions,
|
||||
&mut dynamic_binding_info,
|
||||
&mut late_buffer_binding_sizes,
|
||||
&mut used,
|
||||
@@ -3370,7 +3370,7 @@ impl Device {
|
||||
decl,
|
||||
view,
|
||||
&mut used,
|
||||
&mut used_texture_ranges,
|
||||
&mut texture_init_actions,
|
||||
&snatch_guard,
|
||||
)?;
|
||||
let res_index = hal_textures.len();
|
||||
@@ -3389,7 +3389,7 @@ impl Device {
|
||||
decl,
|
||||
view,
|
||||
&mut used,
|
||||
&mut used_texture_ranges,
|
||||
&mut texture_init_actions,
|
||||
&snatch_guard,
|
||||
)?;
|
||||
|
||||
@@ -3490,8 +3490,8 @@ impl Device {
|
||||
label: desc.label.to_string(),
|
||||
tracking_data: TrackingData::new(self.tracker_indices.bind_groups.clone()),
|
||||
used,
|
||||
used_buffer_ranges,
|
||||
used_texture_ranges,
|
||||
buffer_init_actions,
|
||||
texture_init_actions,
|
||||
dynamic_binding_info,
|
||||
late_buffer_binding_infos,
|
||||
};
|
||||
@@ -3499,11 +3499,11 @@ impl Device {
|
||||
let bind_group = Arc::new(bind_group);
|
||||
|
||||
let weak_ref = Arc::downgrade(&bind_group);
|
||||
for range in &bind_group.used_texture_ranges {
|
||||
for range in &bind_group.texture_init_actions {
|
||||
let mut bind_groups = range.texture.bind_groups.lock();
|
||||
bind_groups.push(weak_ref.clone());
|
||||
}
|
||||
for range in &bind_group.used_buffer_ranges {
|
||||
for range in &bind_group.buffer_init_actions {
|
||||
let mut bind_groups = range.buffer.bind_groups.lock();
|
||||
bind_groups.push(weak_ref.clone());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user