vulkan: pre-heat allocations
This commit is contained in:
parent
872518a87f
commit
47e15c6083
1 changed files with 14 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ use {
|
||||||
gfx_apis::vulkan::{
|
gfx_apis::vulkan::{
|
||||||
VulkanError, device::VulkanDevice, instance::API_VERSION, renderer::VulkanRenderer,
|
VulkanError, device::VulkanDevice, instance::API_VERSION, renderer::VulkanRenderer,
|
||||||
},
|
},
|
||||||
utils::{numcell::NumCell, ptr_ext::MutPtrExt},
|
utils::{numcell::NumCell, page_size::page_size, ptr_ext::MutPtrExt},
|
||||||
},
|
},
|
||||||
ash::{
|
ash::{
|
||||||
Device,
|
Device,
|
||||||
|
|
@ -304,6 +304,19 @@ impl CpuWork for AllocWork {
|
||||||
self.usage,
|
self.usage,
|
||||||
self.map,
|
self.map,
|
||||||
);
|
);
|
||||||
|
if self.usage.contains(UsageFlags::UPLOAD)
|
||||||
|
&& let Ok(r) = &r
|
||||||
|
&& let Some(ptr) = r.ptr
|
||||||
|
{
|
||||||
|
let page_size = page_size() as u64;
|
||||||
|
let mut offset = 0;
|
||||||
|
while offset < r.block.size() {
|
||||||
|
unsafe {
|
||||||
|
*ptr.add(offset as usize) = 0;
|
||||||
|
}
|
||||||
|
offset += page_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
self.res = Some(r);
|
self.res = Some(r);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue