diff --git a/src/gallium/frontends/rusticl/api/context.rs b/src/gallium/frontends/rusticl/api/context.rs index 951eca4967f..1f1db47ed77 100644 --- a/src/gallium/frontends/rusticl/api/context.rs +++ b/src/gallium/frontends/rusticl/api/context.rs @@ -17,7 +17,6 @@ use rusticl_proc_macros::cl_info_entrypoint; use std::ffi::c_char; use std::ffi::c_void; -use std::mem::transmute; use std::ptr; use std::slice; @@ -191,8 +190,11 @@ fn create_context( } // gl sharing is only supported on devices with an UUID, so we can simply unwrap it - let dev_uuid: [c_char; UUID_SIZE] = - unsafe { transmute(dev.screen().device_uuid().unwrap_or_default()) }; + let dev_uuid: [c_char; UUID_SIZE] = dev + .screen() + .device_uuid() + .unwrap_or_default() + .map(|val| val as c_char); if gl_ctx_manager.interop_dev_info.device_uuid != dev_uuid { // we only support gl_sharing on the same device return Err(CL_INVALID_OPERATION); diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index f1b8671e589..32cccdcb58a 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -30,7 +30,6 @@ use std::convert::TryInto; use std::env; use std::ffi::CStr; use std::fmt::Debug; -use std::mem::transmute; use std::num::NonZeroU64; use std::ops::Deref; use std::os::raw::*; @@ -1421,7 +1420,7 @@ pub fn get_devs_for_type(device_type: cl_device_type) -> Vec<&'static Device> { pub fn get_dev_for_uuid(uuid: [c_char; UUID_SIZE]) -> Option<&'static Device> { devs().iter().find(|d| { - let uuid: [c_uchar; UUID_SIZE] = unsafe { transmute(uuid) }; + let uuid: [c_uchar; UUID_SIZE] = uuid.map(|val| val as c_uchar); uuid == d.screen().device_uuid().unwrap() }) }