Two small vulkan changes (#8001)

This commit is contained in:
Andy Leiserson 2025-07-25 11:16:57 -07:00 committed by GitHub
parent d8b7e81a02
commit bf86ac3489
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -1175,13 +1175,14 @@ impl PhysicalDeviceProperties {
None => (0, 0, 0, 0), None => (0, 0, 0, 0),
}; };
// Prevent very large buffers on mesa and most android devices. // Prevent very large buffers on mesa and most android devices, and in all cases
// don't risk confusing JS by exceeding the range of a double.
let is_nvidia = self.properties.vendor_id == crate::auxil::db::nvidia::VENDOR; let is_nvidia = self.properties.vendor_id == crate::auxil::db::nvidia::VENDOR;
let max_buffer_size = let max_buffer_size =
if (cfg!(target_os = "linux") || cfg!(target_os = "android")) && !is_nvidia { if (cfg!(target_os = "linux") || cfg!(target_os = "android")) && !is_nvidia {
i32::MAX as u64 i32::MAX as u64
} else { } else {
u64::MAX 1u64 << 52
}; };
let mut max_binding_array_elements = 0; let mut max_binding_array_elements = 0;

View File

@ -236,7 +236,7 @@ impl super::DeviceShared {
&self, &self,
buffer: &'a super::Buffer, buffer: &'a super::Buffer,
ranges: I, ranges: I,
) -> Option<impl 'a + Iterator<Item = vk::MappedMemoryRange>> { ) -> Option<impl 'a + Iterator<Item = vk::MappedMemoryRange<'a>>> {
let block = buffer.block.as_ref()?.lock(); let block = buffer.block.as_ref()?.lock();
let mask = self.private_caps.non_coherent_map_mask; let mask = self.private_caps.non_coherent_map_mask;
Some(ranges.map(move |range| { Some(ranges.map(move |range| {