mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +01:00
rusticl: remove unecessary transmutes around uuids
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
parent
3a203b7019
commit
301afbc313
2 changed files with 6 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue