# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/firefox/hotfix-wgpu-atomicu64.patch # Copyright (C) 2024 - 2025 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- firefox-143.0/gfx/wgpu_bindings/src/server.rs.vanilla 2025-09-16 11:40:33.753608297 +0200 +++ firefox-143.0/gfx/wgpu_bindings/src/server.rs 2025-09-16 11:41:38.860651845 +0200 @@ -2990,7 +2990,7 @@ self_id: id::QueueId, command_buffers: FfiSlice<'_, id::CommandBufferId>, mut error_buf: ErrorBuffer, -) -> u64 { +) -> usize { let result = global.queue_submit(self_id, command_buffers.as_slice()); match result { --- firefox-142.0/third_party/rust/ash/src/device.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/ash/src/device.rs 2025-08-23 20:28:33.494874018 +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-142.0/third_party/rust/ash/src/extensions/khr/timeline_semaphore.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/ash/src/extensions/khr/timeline_semaphore.rs 2025-08-23 20:28:33.490098173 +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-142.0/third_party/rust/ash/src/extensions_generated.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/ash/src/extensions_generated.rs 2025-08-23 20:28:33.498873793 +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-142.0/third_party/rust/ash/src/tables.rs 2025-08-11 20:04:44.000000000 +0200 +++ firefox-142.0/third_party/rust/ash/src/tables.rs 2025-08-23 20:28:33.499772657 +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-142.0/third_party/rust/ash/src/vk/definitions.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/ash/src/vk/definitions.rs 2025-08-23 20:39:53.723823836 +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 @@ -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 @@ -22012,7 +22012,7 @@ pub s_type: StructureType, pub p_next: *const c_void, pub semaphore: Semaphore, - pub value: u64, + pub value: usize, pub _marker: PhantomData<&'a ()>, } unsafe impl Send for SemaphoreSignalInfo<'_> {} @@ -22039,7 +22039,7 @@ self } #[inline] - pub fn value(mut self, value: u64) -> Self { + pub fn value(mut self, value: usize) -> Self { self.value = value; self } --- firefox-142.0/third_party/rust/ash/src/vk/extensions.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/ash/src/vk/extensions.rs 2025-08-23 20:28:33.493873793 +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-142.0/third_party/rust/wgpu-core/src/command/ray_tracing.rs 2025-08-11 20:04:46.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-core/src/command/ray_tracing.rs 2025-08-23 20:30:50.700677785 +0200 @@ -1,7 +1,7 @@ use alloc::{boxed::Box, sync::Arc, vec::Vec}; use core::{ cmp::max, - num::NonZeroU64, + num::NonZeroUsize, ops::{Deref, Range}, }; @@ -515,7 +515,7 @@ for action in &self.as_actions { match action { AsAction::Build(build) => { - let build_command_index = NonZeroU64::new( + let build_command_index = NonZeroUsize::new( command_index_guard.next_acceleration_structure_build_command_index, ) .unwrap(); --- firefox-142.0/third_party/rust/wgpu-core/src/device/queue.rs 2025-08-11 20:04:46.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-core/src/device/queue.rs 2025-08-23 20:28:33.501072414 +0200 @@ -117,7 +117,7 @@ pub(crate) fn maintain( &self, - submission_index: u64, + submission_index: usize, snatch_guard: &SnatchGuard, ) -> ( SmallVec<[SubmittedWorkDoneClosure; 1]>, --- firefox-142.0/third_party/rust/wgpu-core/src/device/resource.rs 2025-08-11 20:04:46.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-core/src/device/resource.rs 2025-08-23 20:15:29.514931369 +0200 @@ -58,10 +58,7 @@ ENTRYPOINT_FAILURE_ERROR, ZERO_BUFFER_SIZE, }; -#[cfg(supports_64bit_atomics)] -use core::sync::atomic::AtomicU64; -#[cfg(not(supports_64bit_atomics))] -use portable_atomic::AtomicU64; +use core::sync::atomic::AtomicUsize; pub(crate) struct CommandIndices { /// The index of the last command submission that was attempted. @@ -290,7 +287,7 @@ next_acceleration_structure_build_command_index: 1, }, ), - last_successful_submission_index: AtomicU64::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-142.0/third_party/rust/wgpu-core/src/resource.rs 2025-08-11 20:04:46.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-core/src/resource.rs 2025-08-23 20:31:32.843835169 +0200 @@ -3,7 +3,7 @@ borrow::Borrow, fmt, mem::{self, size_of, ManuallyDrop}, - num::NonZeroU64, + num::NonZeroUsize, ops::Range, ptr::NonNull, }; @@ -2019,7 +2019,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, @@ -2170,7 +2170,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. --- firefox-142.0/third_party/rust/wgpu-hal/src/lib.rs 2025-08-11 20:04:46.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-hal/src/lib.rs 2025-08-23 20:25:09.566233288 +0200 @@ -329,11 +329,8 @@ pub type Label<'a> = Option<&'a str>; pub type MemoryRange = Range; -pub type FenceValue = u64; -#[cfg(supports_64bit_atomics)] -pub type AtomicFenceValue = core::sync::atomic::AtomicU64; -#[cfg(not(supports_64bit_atomics))] -pub type AtomicFenceValue = portable_atomic::AtomicU64; +pub type FenceValue = usize; +pub type AtomicFenceValue = core::sync::atomic::AtomicUsize; /// A callback to signal that wgpu is no longer using a resource. #[cfg(any(gles, vulkan))] --- firefox-142.0/third_party/rust/wgpu-hal/src/metal/device.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-hal/src/metal/device.rs 2025-08-23 20:15:01.634933416 +0200 @@ -1504,7 +1504,7 @@ None }; Ok(super::Fence { - completed_value: Arc::new(atomic::AtomicU64::new(0)), + completed_value: Arc::new(atomic::AtomicUsize::new(0)), pending_command_buffers: Vec::new(), shared_event, }) --- firefox-142.0/third_party/rust/wgpu-hal/src/metal/mod.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-hal/src/metal/mod.rs 2025-08-23 20:15:09.851932813 +0200 @@ -896,7 +896,7 @@ #[derive(Debug)] pub struct Fence { - completed_value: Arc, + completed_value: Arc, /// The pending fence values have to be ascending. pending_command_buffers: Vec<(crate::FenceValue, metal::CommandBuffer)>, shared_event: Option, --- firefox-142.0/third_party/rust/wgpu-hal/src/noop/mod.rs 2025-08-11 20:04:46.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-hal/src/noop/mod.rs 2025-08-23 20:15:37.400930790 +0200 @@ -3,10 +3,7 @@ use alloc::{string::String, vec, vec::Vec}; use core::{ptr, sync::atomic::Ordering, time::Duration}; -#[cfg(supports_64bit_atomics)] -use core::sync::atomic::AtomicU64; -#[cfg(not(supports_64bit_atomics))] -use portable_atomic::AtomicU64; +use core::sync::atomic::AtomicUsize; use crate::TlasInstance; @@ -25,7 +22,7 @@ #[derive(Debug)] pub struct Fence { - value: AtomicU64, + value: AtomicUsize, } type DeviceResult = Result; @@ -408,7 +405,7 @@ unsafe fn destroy_query_set(&self, set: Resource) {} unsafe fn create_fence(&self) -> DeviceResult { Ok(Fence { - value: AtomicU64::new(0), + value: AtomicUsize::new(0), }) } unsafe fn destroy_fence(&self, fence: Fence) {} --- firefox-142.0/third_party/rust/wgpu-hal/src/vulkan/mod.rs 2025-08-11 20:04:45.000000000 +0200 +++ firefox-142.0/third_party/rust/wgpu-hal/src/vulkan/mod.rs 2025-08-23 20:41:55.986011359 +0200 @@ -1436,7 +1436,7 @@ &self.device.raw } - pub fn add_signal_semaphore(&self, semaphore: vk::Semaphore, semaphore_value: Option) { + pub fn add_signal_semaphore(&self, semaphore: vk::Semaphore, semaphore_value: Option) { let mut guard = self.signal_semaphores.lock(); if let Some(value) = semaphore_value { guard.push_timeline(semaphore, value); --- firefox-142.0/third_party/rust/wgpu-hal/src/vulkan/semaphore_list.rs.vanilla 2025-08-23 21:07:38.383474237 +0200 +++ firefox-142.0/third_party/rust/wgpu-hal/src/vulkan/semaphore_list.rs 2025-08-23 21:17:56.018248217 +0200 @@ -32,7 +32,7 @@ /// Vulkan ignores these. /// /// [`semaphores`]: Self::semaphores - values: Vec, + values: Vec, } impl SemaphoreList { @@ -78,7 +78,7 @@ /// Add a timeline semaphore to this list, to be signalled with /// `value`. - pub fn push_timeline(&mut self, semaphore: vk::Semaphore, value: u64) { + pub fn push_timeline(&mut self, semaphore: vk::Semaphore, value: usize) { self.pad_values(); self.semaphores.push(semaphore); self.values.push(value); --- firefox-142.0/third_party/rust/ash/src/vk/definitions.rs.vanilla 2025-08-23 21:02:58.803379028 +0200 +++ firefox-142.0/third_party/rust/ash/src/vk/definitions.rs 2025-08-23 21:03:13.727721019 +0200 @@ -22024,7 +22024,7 @@ s_type: Self::STRUCTURE_TYPE, p_next: ::core::ptr::null(), semaphore: Semaphore::default(), - value: u64::default(), + value: usize::default(), _marker: PhantomData, } } --- firefox-142.0/third_party/rust/wgpu-core/src/device/queue.rs.vanilla 2025-08-23 21:18:30.018660273 +0200 +++ firefox-142.0/third_party/rust/wgpu-core/src/device/queue.rs 2025-08-23 21:19:04.663072620 +0200 @@ -2,7 +2,7 @@ use core::{ iter, mem::{self, ManuallyDrop}, - num::NonZeroU64, + num::NonZeroUsize, ptr::NonNull, sync::atomic::Ordering, }; @@ -1495,7 +1495,7 @@ let mut command_indices_lock = device.command_indices.write(); command_indices_lock.next_acceleration_structure_build_command_index += 1; let built_index = - NonZeroU64::new(command_indices_lock.next_acceleration_structure_build_command_index) + NonZeroUsize::new(command_indices_lock.next_acceleration_structure_build_command_index) .unwrap(); let new_blas = Arc::new(Blas { --- firefox-142.0/third_party/rust/wgpu-core/src/device/resource.rs.vanilla 2025-08-23 21:22:11.656111100 +0200 +++ firefox-142.0/third_party/rust/wgpu-core/src/device/resource.rs 2025-08-23 21:22:22.889894954 +0200 @@ -69,7 +69,7 @@ /// /// [`last_successful_submission_index`]: Device::last_successful_submission_index pub(crate) active_submission_index: hal::FenceValue, - pub(crate) next_acceleration_structure_build_command_index: u64, + pub(crate) next_acceleration_structure_build_command_index: usize, } /// Structure describing a logical device. Some members are internally mutable, --- firefox-144.0.2/third_party/rust/wgpu-types/src/lib.rs.vanilla 2025-11-05 11:06:48.828074620 +0100 +++ firefox-144.0.2/third_party/rust/wgpu-types/src/lib.rs 2025-11-05 11:07:03.412410456 +0100 @@ -4566,7 +4566,7 @@ feature = "std", error("Tried to wait using a submission index ({0}) that has not been returned by a successful submission (last successful submission: {1})") )] - WrongSubmissionIndex(u64, u64), + WrongSubmissionIndex(usize, usize), } /// Status of device poll operation.