all: warn on unsafe-op-in-unsafe-fn
This commit is contained in:
parent
ce7488aa86
commit
73a6e0d5c2
25 changed files with 435 additions and 340 deletions
|
|
@ -67,7 +67,9 @@ impl VulkanAllocation {
|
|||
) {
|
||||
allocator.total.fetch_sub(self.size);
|
||||
let block = self.block.take().unwrap();
|
||||
do_free(gpu, &device.device, block, self.mem);
|
||||
unsafe {
|
||||
do_free(gpu, &device.device, block, self.mem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -363,12 +365,14 @@ unsafe fn do_free(
|
|||
mut block: MemoryBlock<DeviceMemory>,
|
||||
ptr: Option<*mut u8>,
|
||||
) {
|
||||
let device = AshMemoryDevice::wrap(device);
|
||||
if let Some(_ptr) = ptr {
|
||||
// log::info!("free = {:?} - {:?} ({})", ptr, ptr.add(block.size() as usize), block.size());
|
||||
block.unmap(device);
|
||||
unsafe {
|
||||
let device = AshMemoryDevice::wrap(device);
|
||||
if let Some(_ptr) = ptr {
|
||||
// log::info!("free = {:?} - {:?} ({})", ptr, ptr.add(block.size() as usize), block.size());
|
||||
block.unmap(device);
|
||||
}
|
||||
gpu.dealloc(device, block);
|
||||
}
|
||||
gpu.dealloc(device, block);
|
||||
}
|
||||
|
||||
impl Drop for UnsyncAllocatorStorage {
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ impl Drop for VulkanBoMapping {
|
|||
|
||||
impl MappedBuffer for VulkanBoMapping {
|
||||
unsafe fn data(&self) -> &[u8] {
|
||||
&*self.data
|
||||
unsafe { &*self.data }
|
||||
}
|
||||
|
||||
fn data_ptr(&self) -> *mut u8 {
|
||||
|
|
|
|||
|
|
@ -190,12 +190,12 @@ unsafe extern "system" fn debug_callback(
|
|||
DebugUtilsMessageSeverityFlagsEXT::VERBOSE => Level::Trace,
|
||||
_ => Level::Warn,
|
||||
};
|
||||
let data = &*p_callback_data;
|
||||
let message = Ustr::from_ptr(data.p_message);
|
||||
let data = unsafe { &*p_callback_data };
|
||||
let message = unsafe { Ustr::from_ptr(data.p_message) };
|
||||
let message_id_name = if data.p_message_id_name.is_null() {
|
||||
ustr!("<null>")
|
||||
} else {
|
||||
Ustr::from_ptr(data.p_message_id_name)
|
||||
unsafe { Ustr::from_ptr(data.p_message_id_name) }
|
||||
};
|
||||
log::log!(
|
||||
Level::Info,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue