Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ rustflags = [
"-Wclippy::map_err_ignore",
"-Wclippy::map_flatten",
"-Wclippy::map_unwrap_or",
"-Wclippy::match_on_vec_items",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: lint `clippy::match_on_vec_items` has been removed: `clippy::indexing_slicing` covers indexing and slicing on `Vec<_>`
  |
  = note: requested on the command line with `-W clippy::match_on_vec_items`
  = note: `#[warn(renamed_and_removed_lints)]` on by default

warning: `gpu-allocator` (lib) generated 1 warning

Fwiw.

"-Wclippy::match_same_arms",
"-Wclippy::match_wild_err_arm",
"-Wclippy::match_wildcard_for_single_variants",
Expand Down
9 changes: 3 additions & 6 deletions examples/d3d12-buffer-winrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option<ID3D12Device> {
let adapter1 = match unsafe { dxgi_factory.EnumAdapters1(idx) } {
Ok(a) => a,
Err(e) if e.code() == DXGI_ERROR_NOT_FOUND => break,
Err(e) => panic!("{:?}", e),
Err(e) => panic!("{e:?}"),
};
let adapter4: IDXGIAdapter4 = adapter1.cast().unwrap();

Expand All @@ -58,18 +58,15 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option<ID3D12Device> {
let mut device = None;
match unsafe { D3D12CreateDevice(&adapter4, feature_level, &mut device) } {
Ok(()) => {
info!("Using D3D12 feature level: {}", feature_level_name);
info!("Using D3D12 feature level: {feature_level_name}");
Some(device.unwrap())
}
Err(e) if e.code() == E_NOINTERFACE => {
error!("ID3D12Device interface not supported");
None
}
Err(e) => {
info!(
"D3D12 feature level {} not supported: {}",
feature_level_name, e
);
info!("D3D12 feature level {feature_level_name} not supported: {e}");
None
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/d3d12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ impl MemoryBlock {
match hr {
Err(e) if e.code() == E_OUTOFMEMORY => Err(AllocationError::OutOfMemory),
Err(e) => Err(AllocationError::Internal(format!(
"ID3D12Device::CreateHeap failed: {}",
e
"ID3D12Device::CreateHeap failed: {e}"
))),
Ok(()) => heap.ok_or_else(|| {
AllocationError::Internal(
Expand Down Expand Up @@ -523,7 +522,7 @@ impl Allocator {
)
}
.map_err(|e| {
AllocationError::Internal(format!("ID3D12Device::CheckFeatureSupport failed: {}", e))
AllocationError::Internal(format!("ID3D12Device::CheckFeatureSupport failed: {e}"))
})?;

let is_heap_tier1 = options.ResourceHeapTier == D3D12_RESOURCE_HEAP_TIER_1;
Expand Down Expand Up @@ -629,7 +628,7 @@ impl Allocator {
);
if self.debug_settings.log_stack_traces {
let backtrace = Backtrace::force_capture();
debug!("Allocation stack trace: {}", backtrace);
debug!("Allocation stack trace: {backtrace}");
}
}

Expand Down Expand Up @@ -658,10 +657,10 @@ impl Allocator {
pub fn free(&mut self, allocation: Allocation) -> Result<()> {
if self.debug_settings.log_frees {
let name = allocation.name.as_deref().unwrap_or("<null>");
debug!("Freeing `{}`.", name);
debug!("Freeing `{name}`.");
if self.debug_settings.log_stack_traces {
let backtrace = Backtrace::force_capture();
debug!("Free stack trace: {}", backtrace);
debug!("Free stack trace: {backtrace}");
}
}

Expand Down Expand Up @@ -845,8 +844,7 @@ impl Allocator {
)));
}
return Err(AllocationError::Internal(format!(
"ID3D12Device::CreateCommittedResource failed: {}",
e
"ID3D12Device::CreateCommittedResource failed: {e}"
)));
}

Expand Down Expand Up @@ -961,8 +959,7 @@ impl Allocator {
)));
}
return Err(AllocationError::Internal(format!(
"ID3D12Device::CreatePlacedResource failed: {}",
e
"ID3D12Device::CreatePlacedResource failed: {e}"
)));
}

Expand Down
4 changes: 2 additions & 2 deletions src/d3d12/visualizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ impl AllocatorVisualizer {
"total committed resource allocations: {} KiB",
mem_type.committed_allocations.total_size
));
ui.label(format!("block count: {}", active_block_count));
ui.label(format!("block count: {active_block_count}"));

for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() {
let Some(block) = block else { continue };

ui.collapsing(format!("Block: {}", block_idx), |ui| {
ui.collapsing(format!("Block: {block_idx}"), |ui| {
ui.label(format!("size: {} KiB", block.size / 1024));
ui.label(format!(
"allocated: {} KiB",
Expand Down
6 changes: 3 additions & 3 deletions src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ impl Allocator {
);
if self.debug_settings.log_stack_traces {
let backtrace = Backtrace::force_capture();
debug!("Allocation stack trace: {}", backtrace);
debug!("Allocation stack trace: {backtrace}");
}
}

Expand All @@ -520,10 +520,10 @@ impl Allocator {
pub fn free(&mut self, allocation: &Allocation) -> Result<()> {
if self.debug_settings.log_frees {
let name = allocation.name.as_deref().unwrap_or("<null>");
debug!("Freeing `{}`.", name);
debug!("Freeing `{name}`.");
if self.debug_settings.log_stack_traces {
let backtrace = Backtrace::force_capture();
debug!("Free stack trace: {}", backtrace);
debug!("Free stack trace: {backtrace}");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/metal/visualizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ impl AllocatorVisualizer {
ui.label(format!("memory type index: {}", mem_type.memory_type_index));
ui.label(format!("total block size: {} KiB", total_block_size / 1024));
ui.label(format!("total allocated: {} KiB", total_allocated / 1024));
ui.label(format!("block count: {}", active_block_count));
ui.label(format!("block count: {active_block_count}"));

for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() {
let Some(block) = block else { continue };

ui.collapsing(format!("Block: {}", block_idx), |ui| {
ui.collapsing(format!("Block: {block_idx}"), |ui| {
ui.label(format!("size: {} KiB", block.size / 1024));
ui.label(format!(
"allocated: {} KiB",
Expand Down
2 changes: 1 addition & 1 deletion src/visualizer/memory_chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub(crate) fn render_memory_chunks_ui<'a>(
chunk.allocation_type.as_str()
));
if let Some(name) = &chunk.name {
ui.label(format!("name: {}", name));
ui.label(format!("name: {name}"));
}
if settings.show_backtraces
&& chunk.backtrace.status() == BacktraceStatus::Captured
Expand Down
9 changes: 4 additions & 5 deletions src/vulkan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ impl MemoryBlock {
unsafe { device.allocate_memory(&alloc_info, None) }.map_err(|e| match e {
vk::Result::ERROR_OUT_OF_DEVICE_MEMORY => AllocationError::OutOfMemory,
e => AllocationError::Internal(format!(
"Unexpected error in vkAllocateMemory: {:?}",
e
"Unexpected error in vkAllocateMemory: {e:?}"
)),
})?
};
Expand Down Expand Up @@ -783,7 +782,7 @@ impl Allocator {
);
if self.debug_settings.log_stack_traces {
let backtrace = Backtrace::force_capture();
debug!("Allocation stack trace: {}", backtrace);
debug!("Allocation stack trace: {backtrace}");
}
}

Expand Down Expand Up @@ -871,10 +870,10 @@ impl Allocator {
pub fn free(&mut self, allocation: Allocation) -> Result<()> {
if self.debug_settings.log_frees {
let name = allocation.name.as_deref().unwrap_or("<null>");
debug!("Freeing `{}`.", name);
debug!("Freeing `{name}`.");
if self.debug_settings.log_stack_traces {
let backtrace = Backtrace::force_capture();
debug!("Free stack trace: {}", backtrace);
debug!("Free stack trace: {backtrace}");
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/vulkan/visualizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl AllocatorVisualizer {
format!("Memory Heaps ({} heaps)", alloc.memory_heaps.len()),
|ui| {
for (i, heap) in alloc.memory_heaps.iter().enumerate() {
ui.collapsing(format!("Heap: {}", i), |ui| {
ui.collapsing(format!("Heap: {i}"), |ui| {
ui.label(format!("flags: {:?}", heap.flags));
ui.label(format!(
"size: {} MiB",
Expand Down Expand Up @@ -90,12 +90,12 @@ impl AllocatorVisualizer {
ui.label(format!("heap index: {}", mem_type.heap_index));
ui.label(format!("total block size: {} KiB", total_block_size / 1024));
ui.label(format!("total allocated: {} KiB", total_allocated / 1024));
ui.label(format!("block count: {}", active_block_count));
ui.label(format!("block count: {active_block_count}"));

for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() {
let Some(block) = block else { continue };

ui.collapsing(format!("Block: {}", block_idx), |ui| {
ui.collapsing(format!("Block: {block_idx}"), |ui| {
use ash::vk::Handle;

ui.label(format!("size: {} KiB", block.size / 1024));
Expand Down
Loading