diff --git a/wgpu-hal/src/dx12/mod.rs b/wgpu-hal/src/dx12/mod.rs index b67a15b664..3b92277217 100644 --- a/wgpu-hal/src/dx12/mod.rs +++ b/wgpu-hal/src/dx12/mod.rs @@ -835,7 +835,7 @@ unsafe impl Sync for CommandBuffer {} pub struct Buffer { resource: Direct3D12::ID3D12Resource, size: wgt::BufferAddress, - allocation: Option, + allocation: Option, } unsafe impl Send for Buffer {} @@ -865,7 +865,7 @@ pub struct Texture { size: wgt::Extent3d, mip_level_count: u32, sample_count: u32, - allocation: Option, + allocation: Option, } impl Texture { @@ -984,7 +984,7 @@ enum DynamicBuffer { #[derive(Debug)] struct SamplerIndexBuffer { buffer: Direct3D12::ID3D12Resource, - allocation: Option, + allocation: Option, } #[derive(Debug)] @@ -1121,7 +1121,7 @@ impl crate::DynPipelineCache for PipelineCache {} #[derive(Debug)] pub struct AccelerationStructure { resource: Direct3D12::ID3D12Resource, - allocation: Option, + allocation: Option, } impl crate::DynAccelerationStructure for AccelerationStructure {} diff --git a/wgpu-hal/src/dx12/suballocation.rs b/wgpu-hal/src/dx12/suballocation.rs index ce6097f229..18a316571a 100644 --- a/wgpu-hal/src/dx12/suballocation.rs +++ b/wgpu-hal/src/dx12/suballocation.rs @@ -8,8 +8,8 @@ use windows::Win32::Graphics::Direct3D12; use crate::auxil::dxgi::result::HResult as _; #[derive(Debug)] -pub(crate) struct AllocationWrapper { - pub(crate) allocation: gpu_allocator::d3d12::Allocation, +pub(crate) struct Allocation { + pub(crate) inner: gpu_allocator::d3d12::Allocation, } pub(crate) fn create_allocator( @@ -82,7 +82,7 @@ pub(crate) fn create_buffer_resource( ctx: DeviceAllocationContext, desc: &crate::BufferDescriptor, raw_desc: Direct3D12::D3D12_RESOURCE_DESC, -) -> Result<(Direct3D12::ID3D12Resource, Option), crate::DeviceError> { +) -> Result<(Direct3D12::ID3D12Resource, Option), crate::DeviceError> { let is_cpu_read = desc.usage.contains(wgt::BufferUses::MAP_READ); let is_cpu_write = desc.usage.contains(wgt::BufferUses::MAP_WRITE); @@ -128,14 +128,14 @@ pub(crate) fn create_buffer_resource( ctx.counters.buffer_memory.add(allocation.size() as isize); - Ok((resource, Some(AllocationWrapper { allocation }))) + Ok((resource, Some(Allocation { inner: allocation }))) } pub(crate) fn create_texture_resource( ctx: DeviceAllocationContext, desc: &crate::TextureDescriptor, raw_desc: Direct3D12::D3D12_RESOURCE_DESC, -) -> Result<(Direct3D12::ID3D12Resource, Option), crate::DeviceError> { +) -> Result<(Direct3D12::ID3D12Resource, Option), crate::DeviceError> { // Workaround for Intel Xe drivers if !ctx.shared.private_caps.suballocation_supported { return create_committed_texture_resource(ctx, desc, raw_desc) @@ -172,14 +172,14 @@ pub(crate) fn create_texture_resource( ctx.counters.texture_memory.add(allocation.size() as isize); - Ok((resource, Some(AllocationWrapper { allocation }))) + Ok((resource, Some(Allocation { inner: allocation }))) } pub(crate) fn create_acceleration_structure_resource( ctx: DeviceAllocationContext, desc: &crate::AccelerationStructureDescriptor, raw_desc: Direct3D12::D3D12_RESOURCE_DESC, -) -> Result<(Direct3D12::ID3D12Resource, Option), crate::DeviceError> { +) -> Result<(Direct3D12::ID3D12Resource, Option), crate::DeviceError> { // Workaround for Intel Xe drivers if !ctx.shared.private_caps.suballocation_supported { return create_committed_acceleration_structure_resource(ctx, desc, raw_desc) @@ -219,19 +219,19 @@ pub(crate) fn create_acceleration_structure_resource( .acceleration_structure_memory .add(allocation.size() as isize); - Ok((resource, Some(AllocationWrapper { allocation }))) + Ok((resource, Some(Allocation { inner: allocation }))) } pub(crate) fn free_buffer_allocation( device: &crate::dx12::Device, - allocation: AllocationWrapper, + allocation: Allocation, allocator: &Mutex, ) { device .counters .buffer_memory - .sub(allocation.allocation.size() as isize); - match allocator.lock().free(allocation.allocation) { + .sub(allocation.inner.size() as isize); + match allocator.lock().free(allocation.inner) { Ok(_) => (), // TODO: Don't panic here Err(e) => panic!("Failed to destroy dx12 buffer, {e}"), @@ -240,14 +240,14 @@ pub(crate) fn free_buffer_allocation( pub(crate) fn free_texture_allocation( device: &crate::dx12::Device, - allocation: AllocationWrapper, + allocation: Allocation, allocator: &Mutex, ) { device .counters .texture_memory - .sub(allocation.allocation.size() as isize); - match allocator.lock().free(allocation.allocation) { + .sub(allocation.inner.size() as isize); + match allocator.lock().free(allocation.inner) { Ok(_) => (), // TODO: Don't panic here Err(e) => panic!("Failed to destroy dx12 texture, {e}"), @@ -256,14 +256,14 @@ pub(crate) fn free_texture_allocation( pub(crate) fn free_acceleration_structure_allocation( device: &crate::dx12::Device, - allocation: AllocationWrapper, + allocation: Allocation, allocator: &Mutex, ) { device .counters .acceleration_structure_memory - .sub(allocation.allocation.size() as isize); - match allocator.lock().free(allocation.allocation) { + .sub(allocation.inner.size() as isize); + match allocator.lock().free(allocation.inner) { Ok(_) => (), // TODO: Don't panic here Err(e) => panic!("Failed to destroy dx12 acceleration structure, {e}"),