# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/thunderbird/hotfix-wgpu-atomicu64-comm.patch # Copyright (C) 2024 - 2025 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- firefox-134.0.2/comm/third_party/rust/wgpu-core/src/device/resource.rs.vanilla 2025-01-31 11:24:53.200939943 +0100 +++ firefox-134.0.2/comm/third_party/rust/wgpu-core/src/device/resource.rs 2025-01-31 11:24:58.516939731 +0100 @@ -46,7 +46,7 @@ mem::{self, ManuallyDrop}, num::NonZeroU32, sync::{ - atomic::{AtomicBool, AtomicU64, Ordering}, + atomic::{AtomicBool, AtomicUsize, Ordering}, Arc, OnceLock, Weak, }, }; @@ -280,8 +280,8 @@ zero_buffer: ManuallyDrop::new(zero_buffer), label: desc.label.to_string(), command_allocator, - active_submission_index: AtomicU64::new(0), - last_successful_submission_index: AtomicU64::new(0), + active_submission_index: AtomicUsize::new(0), + last_successful_submission_index: AtomicUsize::new(0), fence: RwLock::new(rank::DEVICE_FENCE, ManuallyDrop::new(fence)), snatchable_lock: unsafe { SnatchLock::new(rank::DEVICE_SNATCHABLE_LOCK) }, valid: AtomicBool::new(true), --- firefox-130.0/comm/third_party/rust/wgpu-hal/src/lib.rs.orig 2024-09-03 13:18:29.730010017 +0200 +++ firefox-130.0/comm/third_party/rust/wgpu-hal/src/lib.rs 2024-09-03 13:30:13.876693816 +0200 @@ -293,8 +293,8 @@ pub type Label<'a> = Option<&'a str>; pub type MemoryRange = Range; -pub type FenceValue = u64; -pub type AtomicFenceValue = std::sync::atomic::AtomicU64; +pub type FenceValue = usize; +pub type AtomicFenceValue = std::sync::atomic::AtomicUsize; /// Drop guard to signal wgpu-hal is no longer using an externally created object. pub type DropGuard = Box; --- firefox-128.0/comm/third_party/rust/ash/src/extensions/khr/timeline_semaphore.rs.vanilla 2024-07-09 14:28:32.931405214 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/extensions/khr/timeline_semaphore.rs 2024-07-09 14:29:05.602402066 +0200 @@ -7,7 +7,7 @@ impl crate::khr::timeline_semaphore::Device { /// #[inline] - pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult { + pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult { let mut value = mem::MaybeUninit::uninit(); (self.fp.get_semaphore_counter_value_khr)(self.handle, semaphore, value.as_mut_ptr()) .assume_init_on_success(value) --- firefox-128.0/comm/third_party/rust/ash/src/vk/definitions.rs.vanilla 2024-07-09 14:31:17.061389400 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/vk/definitions.rs 2024-07-09 14:34:06.172373105 +0200 @@ -12913,9 +12913,9 @@ pub s_type: StructureType, pub p_next: *const c_void, pub wait_semaphore_values_count: u32, - pub p_wait_semaphore_values: *const u64, + pub p_wait_semaphore_values: *const usize, pub signal_semaphore_values_count: u32, - pub p_signal_semaphore_values: *const u64, + pub p_signal_semaphore_values: *const usize, pub _marker: PhantomData<&'a ()>, } unsafe impl Send for D3D12FenceSubmitInfoKHR<'_> {} @@ -12940,13 +12940,13 @@ unsafe impl ExtendsSubmitInfo for D3D12FenceSubmitInfoKHR<'_> {} impl<'a> D3D12FenceSubmitInfoKHR<'a> { #[inline] - pub fn wait_semaphore_values(mut self, wait_semaphore_values: &'a [u64]) -> Self { + pub fn wait_semaphore_values(mut self, wait_semaphore_values: &'a [usize]) -> Self { self.wait_semaphore_values_count = wait_semaphore_values.len() as _; self.p_wait_semaphore_values = wait_semaphore_values.as_ptr(); self } #[inline] - pub fn signal_semaphore_values(mut self, signal_semaphore_values: &'a [u64]) -> Self { + pub fn signal_semaphore_values(mut self, signal_semaphore_values: &'a [usize]) -> Self { self.signal_semaphore_values_count = signal_semaphore_values.len() as _; self.p_signal_semaphore_values = signal_semaphore_values.as_ptr(); self @@ -21911,9 +21911,9 @@ pub s_type: StructureType, pub p_next: *const c_void, pub wait_semaphore_value_count: u32, - pub p_wait_semaphore_values: *const u64, + pub p_wait_semaphore_values: *const usize, pub signal_semaphore_value_count: u32, - pub p_signal_semaphore_values: *const u64, + pub p_signal_semaphore_values: *const usize, pub _marker: PhantomData<&'a ()>, } unsafe impl Send for TimelineSemaphoreSubmitInfo<'_> {} @@ -21939,13 +21939,13 @@ unsafe impl ExtendsBindSparseInfo for TimelineSemaphoreSubmitInfo<'_> {} impl<'a> TimelineSemaphoreSubmitInfo<'a> { #[inline] - pub fn wait_semaphore_values(mut self, wait_semaphore_values: &'a [u64]) -> Self { + pub fn wait_semaphore_values(mut self, wait_semaphore_values: &'a [usize]) -> Self { self.wait_semaphore_value_count = wait_semaphore_values.len() as _; self.p_wait_semaphore_values = wait_semaphore_values.as_ptr(); self } #[inline] - pub fn signal_semaphore_values(mut self, signal_semaphore_values: &'a [u64]) -> Self { + pub fn signal_semaphore_values(mut self, signal_semaphore_values: &'a [usize]) -> Self { self.signal_semaphore_value_count = signal_semaphore_values.len() as _; self.p_signal_semaphore_values = signal_semaphore_values.as_ptr(); self --- firefox-128.0/comm/third_party/rust/ash/src/vk/extensions.rs.vanilla 2024-07-09 14:36:01.436361999 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/vk/extensions.rs 2024-07-09 14:37:29.562353508 +0200 @@ -5945,7 +5945,7 @@ pub type PFN_vkGetSemaphoreCounterValue = unsafe extern "system" fn( device: crate::vk::Device, semaphore: Semaphore, - p_value: *mut u64, + p_value: *mut usize, ) -> Result; #[allow(non_camel_case_types)] pub type PFN_vkWaitSemaphores = unsafe extern "system" fn( --- firefox-128.0/comm/third_party/rust/ash/src/device.rs.vanilla 2024-07-09 14:37:45.857351938 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/device.rs 2024-07-09 14:38:22.375348419 +0200 @@ -676,7 +676,7 @@ /// #[inline] - pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult { + pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult { let mut value = mem::MaybeUninit::uninit(); (self.device_fn_1_2.get_semaphore_counter_value)( self.handle(), --- firefox-128.0/comm/third_party/rust/ash/src/vk/definitions.rs.vanilla 2024-07-09 15:01:16.235216042 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/vk/definitions.rs 2024-07-09 15:03:26.056203534 +0200 @@ -21962,7 +21962,7 @@ pub flags: SemaphoreWaitFlags, pub semaphore_count: u32, pub p_semaphores: *const Semaphore, - pub p_values: *const u64, + pub p_values: *const usize, pub _marker: PhantomData<&'a ()>, } unsafe impl Send for SemaphoreWaitInfo<'_> {} @@ -21997,7 +21997,7 @@ self } #[inline] - pub fn values(mut self, values: &'a [u64]) -> Self { + pub fn values(mut self, values: &'a [usize]) -> Self { self.semaphore_count = values.len() as _; self.p_values = values.as_ptr(); self --- firefox-128.0/comm/third_party/rust/ash/src/extensions_generated.rs.vanilla 2024-07-09 14:49:16.545285387 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/extensions_generated.rs 2024-07-09 14:52:55.543264286 +0200 @@ -14711,7 +14711,7 @@ unsafe extern "system" fn get_semaphore_counter_value_khr( _device: crate::vk::Device, _semaphore: Semaphore, - _p_value: *mut u64, + _p_value: *mut usize, ) -> Result { panic!(concat!( "Unable to load ", --- firefox-128.0/comm/third_party/rust/ash/src/tables.rs.vanilla 2024-07-09 14:54:09.300257179 +0200 +++ firefox-128.0/comm/third_party/rust/ash/src/tables.rs 2024-07-09 14:54:20.596256091 +0200 @@ -3463,7 +3463,7 @@ unsafe extern "system" fn get_semaphore_counter_value( _device: crate::vk::Device, _semaphore: Semaphore, - _p_value: *mut u64, + _p_value: *mut usize, ) -> Result { panic!(concat!( "Unable to load ", --- firefox-135.0/comm/third_party/rust/wgpu-core/src/command/ray_tracing.rs.vanilla 2025-02-04 16:42:17.143353216 +0100 +++ firefox-135.0/comm/third_party/rust/wgpu-core/src/command/ray_tracing.rs 2025-02-04 16:47:45.458340125 +0100 @@ -23,7 +23,7 @@ use hal::BufferUses; use std::{ cmp::max, - num::NonZeroU64, + num::NonZeroUsize, ops::{Deref, Range}, sync::{atomic::Ordering, Arc}, }; @@ -88,7 +88,7 @@ return Err(BuildAccelerationStructureError::MissingFeature); } - let build_command_index = NonZeroU64::new( + let build_command_index = NonZeroUsize::new( device .last_acceleration_structure_build_command_index .fetch_add(1, Ordering::Relaxed), @@ -388,7 +388,7 @@ return Err(BuildAccelerationStructureError::MissingFeature); } - let build_command_index = NonZeroU64::new( + let build_command_index = NonZeroUsize::new( device .last_acceleration_structure_build_command_index .fetch_add(1, Ordering::Relaxed), @@ -872,7 +872,7 @@ fn iter_blas<'a>( blas_iter: impl Iterator>, cmd_buf_data: &mut CommandBufferMutable, - build_command_index: NonZeroU64, + build_command_index: NonZeroUsize, buf_storage: &mut Vec>, hub: &Hub, device: &Device, --- firefox-135.0/comm/third_party/rust/wgpu-core/src/device/resource.rs.vanilla 2025-02-04 16:39:38.337359548 +0100 +++ firefox-135.0/comm/third_party/rust/wgpu-core/src/device/resource.rs 2025-02-04 16:44:55.791346890 +0100 @@ -121,7 +121,7 @@ pub(crate) instance_flags: wgt::InstanceFlags, pub(crate) deferred_destroy: Mutex>, pub(crate) usage_scopes: UsageScopePool, - pub(crate) last_acceleration_structure_build_command_index: AtomicU64, + pub(crate) last_acceleration_structure_build_command_index: AtomicUsize, #[cfg(feature = "indirect-validation")] pub(crate) indirect_validation: Option, // needs to be dropped last @@ -277,8 +277,8 @@ instance_flags, deferred_destroy: Mutex::new(rank::DEVICE_DEFERRED_DESTROY, Vec::new()), usage_scopes: Mutex::new(rank::DEVICE_USAGE_SCOPES, Default::default()), - // By starting at one, we can put the result in a NonZeroU64. - last_acceleration_structure_build_command_index: AtomicU64::new(1), + // By starting at one, we can put the result in a NonZeroUsize. + last_acceleration_structure_build_command_index: AtomicUsize::new(1), #[cfg(feature = "indirect-validation")] indirect_validation, }) --- firefox-135.0/comm/third_party/rust/wgpu-core/src/device/queue.rs.vanilla 2025-02-04 16:50:24.683333777 +0100 +++ firefox-135.0/comm/third_party/rust/wgpu-core/src/device/queue.rs 2025-02-04 16:50:59.192332401 +0100 @@ -112,7 +112,7 @@ pub(crate) fn maintain( &self, - submission_index: u64, + submission_index: usize, snatch_guard: &SnatchGuard, ) -> ( SmallVec<[SubmittedWorkDoneClosure; 1]>, --- firefox-135.0/comm/third_party/rust/wgpu-core/src/ray_tracing.rs.vanilla 2025-02-04 16:51:35.348330959 +0100 +++ firefox-135.0/comm/third_party/rust/wgpu-core/src/ray_tracing.rs 2025-02-04 16:52:10.435329560 +0100 @@ -13,7 +13,7 @@ id::{BlasId, BufferId, TlasId}, resource::CreateBufferError, }; -use std::num::NonZeroU64; +use std::num::NonZeroUsize; use std::sync::Arc; use crate::resource::{Blas, ResourceErrorIdent, Tlas}; @@ -209,14 +209,14 @@ #[derive(Debug, Copy, Clone)] pub(crate) enum BlasActionKind { - Build(NonZeroU64), + Build(NonZeroUsize), Use, } #[derive(Debug, Clone)] pub(crate) enum TlasActionKind { Build { - build_index: NonZeroU64, + build_index: NonZeroUsize, dependencies: Vec>, }, Use, --- firefox-135.0/comm/third_party/rust/wgpu-core/src/resource.rs.vanilla 2025-02-04 17:11:25.241283515 +0100 +++ firefox-135.0/comm/third_party/rust/wgpu-core/src/resource.rs 2025-02-04 17:13:00.043279735 +0100 @@ -21,7 +21,7 @@ use smallvec::SmallVec; use thiserror::Error; -use std::num::NonZeroU64; +use std::num::NonZeroUsize; use std::{ borrow::{Borrow, Cow}, fmt::Debug, @@ -1870,7 +1870,7 @@ pub(crate) sizes: wgt::BlasGeometrySizeDescriptors, pub(crate) flags: wgt::AccelerationStructureFlags, pub(crate) update_mode: wgt::AccelerationStructureUpdateMode, - pub(crate) built_index: RwLock>, + pub(crate) built_index: RwLock>, pub(crate) handle: u64, /// The `label` from the descriptor used to create the resource. pub(crate) label: String, @@ -1950,7 +1950,7 @@ pub(crate) max_instance_count: u32, pub(crate) flags: wgt::AccelerationStructureFlags, pub(crate) update_mode: wgt::AccelerationStructureUpdateMode, - pub(crate) built_index: RwLock>, + pub(crate) built_index: RwLock>, pub(crate) dependencies: RwLock>>, pub(crate) instance_buffer: ManuallyDrop>, /// The `label` from the descriptor used to create the resource.