diff --git a/src/gallium/frontends/rusticl/api/program.rs b/src/gallium/frontends/rusticl/api/program.rs index 488ddd9411c..5c4ecc5d61f 100644 --- a/src/gallium/frontends/rusticl/api/program.rs +++ b/src/gallium/frontends/rusticl/api/program.rs @@ -48,10 +48,11 @@ unsafe impl CLInfo for cl_program { CL_PROGRAM_DEVICES => { v.write_iter::(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::(prog.devs.len() as cl_uint), CL_PROGRAM_NUM_KERNELS => v.write::(prog.build_info().kernels().len()),