-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add get_pipeline_cache_data #166
Conversation
I think we should just return a
I am not sure when you would want to only partially retrieve the pipeline cache. @Ralith Any thoughts? |
@MaikKlein I have updated the PR according to your advice. I can squash the commits if you want. |
ash/src/device.rs
Outdated
pipeline_cache: vk::PipelineCache, | ||
) -> VkResult<Vec<u8>> { | ||
let data_size: *mut usize = mem::uninitialized(); | ||
let data: *mut c_void = mem::uninitialized(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should initialize them explicitly to a null ptr.
ash/src/device.rs
Outdated
); | ||
|
||
match err_code { | ||
vk::Result::SUCCESS => Ok(Vec::from_raw_parts(data as _, *data_size, *data_size)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to allocate the buffer to data
yourself. You can do this with Vec::with_capacity
and set_len
. And you need to call get_pipeline_cache_data
two times to get the size, and then to fill the buffer.
ash/src/device.rs
Outdated
@@ -1281,27 +1281,25 @@ pub trait DeviceV1_0 { | |||
pipeline_cache: vk::PipelineCache, | |||
) -> VkResult<Vec<u8>> { | |||
let data_size: *mut usize = ptr::null_mut(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I overlooked that the first time. You probably want to allocate that on the stack like let mut data_size = 0
and then write to it with &mut data_size
36c6037
to
fa83016
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've been wanting this!
@MaikKlein any chance of releasing a version with this? |
@kvark Oh I can't believe I haven't pushed a new version. I fix up a few PRs and I publish a new version later today. |
This change is