mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
rusticl: drop CLProp implementation for String
Route the data to the implementation for &str instead. It works just as fine. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23652>
This commit is contained in:
parent
f1461c5a77
commit
cf43a74c79
3 changed files with 7 additions and 15 deletions
|
|
@ -178,7 +178,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
|
|||
CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE => {
|
||||
cl_prop::<cl_uint>(size_of::<cl_ulong16>() as cl_uint)
|
||||
}
|
||||
CL_DEVICE_NAME => cl_prop(dev.screen().name()),
|
||||
CL_DEVICE_NAME => cl_prop::<&str>(&dev.screen().name()),
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR => cl_prop::<cl_uint>(1),
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE => {
|
||||
cl_prop::<cl_uint>(if dev.doubles_supported() { 1 } else { 0 })
|
||||
|
|
@ -227,7 +227,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
|
|||
CL_DEVICE_PROFILING_TIMER_RESOLUTION => cl_prop::<usize>(0),
|
||||
CL_DEVICE_OPENCL_C_FEATURES => cl_prop::<&Vec<cl_name_version>>(&dev.clc_features),
|
||||
CL_DEVICE_OPENCL_C_VERSION => {
|
||||
cl_prop::<String>(format!("OpenCL C {} ", dev.clc_version.api_str()))
|
||||
cl_prop::<&str>(&format!("OpenCL C {} ", dev.clc_version.api_str()))
|
||||
}
|
||||
CL_DEVICE_OPENCL_C_ALL_VERSIONS => cl_prop::<&Vec<cl_name_version>>(&dev.clc_versions),
|
||||
CL_DEVICE_PROFILE => cl_prop(if dev.embedded {
|
||||
|
|
@ -262,9 +262,9 @@ impl CLInfo<cl_device_info> for cl_device_id {
|
|||
CL_DEVICE_UUID_KHR => cl_prop::<[cl_uchar; CL_UUID_SIZE_KHR as usize]>(
|
||||
dev.screen().device_uuid().unwrap_or_default(),
|
||||
),
|
||||
CL_DEVICE_VENDOR => cl_prop(dev.screen().device_vendor()),
|
||||
CL_DEVICE_VENDOR => cl_prop::<&str>(&dev.screen().device_vendor()),
|
||||
CL_DEVICE_VENDOR_ID => cl_prop::<cl_uint>(dev.vendor_id()),
|
||||
CL_DEVICE_VERSION => cl_prop::<String>(format!("OpenCL {} ", dev.cl_version.api_str())),
|
||||
CL_DEVICE_VERSION => cl_prop::<&str>(&format!("OpenCL {} ", dev.cl_version.api_str())),
|
||||
CL_DRIVER_UUID_KHR => cl_prop::<[cl_char; CL_UUID_SIZE_KHR as usize]>(
|
||||
dev.screen().driver_uuid().unwrap_or_default(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl CLInfo<cl_program_info> for cl_program {
|
|||
ProgramSourceType::Il(il) => il.to_bin().to_vec(),
|
||||
_ => Vec::new(),
|
||||
},
|
||||
CL_PROGRAM_KERNEL_NAMES => cl_prop::<String>(prog.kernels().join(";")),
|
||||
CL_PROGRAM_KERNEL_NAMES => cl_prop::<&str>(&*prog.kernels().join(";")),
|
||||
CL_PROGRAM_NUM_DEVICES => cl_prop::<cl_uint>(prog.devs.len() as cl_uint),
|
||||
CL_PROGRAM_NUM_KERNELS => cl_prop::<usize>(prog.kernels().len()),
|
||||
CL_PROGRAM_REFERENCE_COUNT => cl_prop::<cl_uint>(self.refcnt()?),
|
||||
|
|
@ -72,8 +72,8 @@ impl CLInfoObj<cl_program_build_info, cl_device_id> for cl_program {
|
|||
Ok(match q {
|
||||
CL_PROGRAM_BINARY_TYPE => cl_prop::<cl_program_binary_type>(prog.bin_type(&dev)),
|
||||
CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE => cl_prop::<usize>(0),
|
||||
CL_PROGRAM_BUILD_LOG => cl_prop::<String>(prog.log(&dev)),
|
||||
CL_PROGRAM_BUILD_OPTIONS => cl_prop::<String>(prog.options(&dev)),
|
||||
CL_PROGRAM_BUILD_LOG => cl_prop::<&str>(&prog.log(&dev)),
|
||||
CL_PROGRAM_BUILD_OPTIONS => cl_prop::<&str>(&prog.options(&dev)),
|
||||
CL_PROGRAM_BUILD_STATUS => cl_prop::<cl_build_status>(prog.status(&dev)),
|
||||
// CL_INVALID_VALUE if param_name is not one of the supported values
|
||||
_ => return Err(CL_INVALID_VALUE),
|
||||
|
|
|
|||
|
|
@ -135,14 +135,6 @@ impl CLProp for bool {
|
|||
}
|
||||
}
|
||||
|
||||
impl CLProp for String {
|
||||
fn cl_vec(&self) -> Vec<u8> {
|
||||
let mut c = self.clone();
|
||||
c.push('\0');
|
||||
c.into_bytes()
|
||||
}
|
||||
}
|
||||
|
||||
impl CLProp for &str {
|
||||
fn cl_vec(&self) -> Vec<u8> {
|
||||
CString::new(*self)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue