rusticl/program: use write_len_only for CL_PROGRAM_IL
The spec mandates that if the program object isn't created from IL, it should not touch the buffer. Passing an empty slice would achieve that, but it's better to be explicit here. Reviewed-by: @LingMan Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32268>
This commit is contained in:
@@ -48,10 +48,11 @@ unsafe impl CLInfo<cl_program_info> for cl_program {
|
||||
CL_PROGRAM_DEVICES => {
|
||||
v.write_iter::<cl_device_id>(prog.devs.iter().map(|&d| cl_device_id::from_ptr(d)))
|
||||
}
|
||||
CL_PROGRAM_IL => v.write::<&[u8]>(match &prog.src {
|
||||
ProgramSourceType::Il(il) => il.to_bin(),
|
||||
_ => &[],
|
||||
}),
|
||||
CL_PROGRAM_IL => match &prog.src {
|
||||
ProgramSourceType::Il(il) => v.write::<&[u8]>(il.to_bin()),
|
||||
// The spec _requires_ that we don't touch the buffer here.
|
||||
_ => v.write_len_only::<&[u8]>(0),
|
||||
},
|
||||
CL_PROGRAM_KERNEL_NAMES => v.write::<&str>(&prog.build_info().kernels().join(";")),
|
||||
CL_PROGRAM_NUM_DEVICES => v.write::<cl_uint>(prog.devs.len() as cl_uint),
|
||||
CL_PROGRAM_NUM_KERNELS => v.write::<usize>(prog.build_info().kernels().len()),
|
||||
|
||||
Reference in New Issue
Block a user