mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-22 23:11:30 +11:00
Merge #246
246: Implement `gfxGetPipelineCacheData` r=kvark a=expenses
Based (slightly) on 1d5ee31553/src/amd/vulkan/radv_pipeline_cache.c (L525)
.
Is it not safe enough / too safe?
Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
This commit is contained in:
commit
5c1b75fd01
|
@ -1971,13 +1971,23 @@ pub unsafe extern "C" fn gfxDestroyPipelineCache(
|
|||
}
|
||||
#[inline]
|
||||
pub unsafe extern "C" fn gfxGetPipelineCacheData(
|
||||
_gpu: VkDevice,
|
||||
_pipelineCache: VkPipelineCache,
|
||||
gpu: VkDevice,
|
||||
pipelineCache: VkPipelineCache,
|
||||
pDataSize: *mut usize,
|
||||
_pData: *mut c_void,
|
||||
pData: *mut c_void,
|
||||
) -> VkResult {
|
||||
//TODO: save
|
||||
*pDataSize = 0;
|
||||
let data = match gpu.device.get_pipeline_cache_data(&pipelineCache) {
|
||||
Ok(data) => data,
|
||||
Err(oom) => return map_oom(oom)
|
||||
};
|
||||
|
||||
if pData.is_null() {
|
||||
*pDataSize = data.len();
|
||||
} else {
|
||||
let output = slice::from_raw_parts_mut(pData as *mut u8, *pDataSize);
|
||||
output.copy_from_slice(&data);
|
||||
}
|
||||
|
||||
VkResult::VK_SUCCESS
|
||||
}
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue