diff --git a/src/gallium/frontends/rusticl/api/context.rs b/src/gallium/frontends/rusticl/api/context.rs index f547d853d5c..da74b7ddc17 100644 --- a/src/gallium/frontends/rusticl/api/context.rs +++ b/src/gallium/frontends/rusticl/api/context.rs @@ -78,7 +78,7 @@ pub fn get_gl_context_info_khr( // CL_INVALID_PROPERTY [...] if the same property name is specified more than once. // SAFETY: properties is a 0 terminated array by spec. - let props = unsafe { Properties::from_ptr(properties) }.ok_or(CL_INVALID_PROPERTY)?; + let props = unsafe { Properties::new(properties) }.ok_or(CL_INVALID_PROPERTY)?; for (&key, &val) in props.iter() { match key as u32 { // CL_INVALID_PLATFORM [...] if platform value specified in properties is not a valid platform. @@ -141,7 +141,7 @@ fn create_context( // CL_INVALID_PROPERTY [...] if the same property name is specified more than once. // SAFETY: properties is a 0 terminated array by spec. - let props = unsafe { Properties::from_ptr(properties) }.ok_or(CL_INVALID_PROPERTY)?; + let props = unsafe { Properties::new(properties) }.ok_or(CL_INVALID_PROPERTY)?; for (&key, &val) in props.iter() { match key as u32 { // CL_INVALID_PLATFORM [...] if platform value specified in properties is not a valid platform. diff --git a/src/gallium/frontends/rusticl/api/memory.rs b/src/gallium/frontends/rusticl/api/memory.rs index 85859e0aec0..1828050552f 100644 --- a/src/gallium/frontends/rusticl/api/memory.rs +++ b/src/gallium/frontends/rusticl/api/memory.rs @@ -296,7 +296,7 @@ fn create_buffer_with_properties( } // CL_INVALID_PROPERTY [...] if the same property name is specified more than once. - let props = unsafe { Properties::from_ptr(properties) }.ok_or(CL_INVALID_PROPERTY)?; + let props = unsafe { Properties::new(properties) }.ok_or(CL_INVALID_PROPERTY)?; // CL_INVALID_PROPERTY if a property name in properties is not a supported property name, if // the value specified for a supported property name is not valid, or if the same property name @@ -801,7 +801,7 @@ fn create_image_with_properties( .ok_or(CL_IMAGE_FORMAT_NOT_SUPPORTED)?; // CL_INVALID_PROPERTY [...] if the same property name is specified more than once. - let props = unsafe { Properties::from_ptr(properties) }.ok_or(CL_INVALID_PROPERTY)?; + let props = unsafe { Properties::new(properties) }.ok_or(CL_INVALID_PROPERTY)?; // CL_INVALID_PROPERTY if a property name in properties is not a supported property name, if // the value specified for a supported property name is not valid, or if the same property name @@ -1014,7 +1014,7 @@ fn create_sampler_with_properties( // CL_INVALID_VALUE if the same property name is specified more than once. // SAFETY: sampler_properties is a 0 terminated array by spec. let sampler_properties = - unsafe { Properties::from_ptr(sampler_properties) }.ok_or(CL_INVALID_VALUE)?; + unsafe { Properties::new(sampler_properties) }.ok_or(CL_INVALID_VALUE)?; for (&key, &val) in sampler_properties.iter() { match key as u32 { CL_SAMPLER_ADDRESSING_MODE => addressing_mode = val as u32, diff --git a/src/gallium/frontends/rusticl/api/queue.rs b/src/gallium/frontends/rusticl/api/queue.rs index 3455fde742a..bf032666de1 100644 --- a/src/gallium/frontends/rusticl/api/queue.rs +++ b/src/gallium/frontends/rusticl/api/queue.rs @@ -131,7 +131,7 @@ fn create_command_queue_with_properties( let mut queue_properties = cl_command_queue_properties::default(); // SAFETY: properties is a 0 terminated array by spec. - let properties = unsafe { Properties::from_ptr(properties) }.ok_or(CL_INVALID_PROPERTY)?; + let properties = unsafe { Properties::new(properties) }.ok_or(CL_INVALID_PROPERTY)?; for (k, v) in properties.iter() { match *k as cl_uint { CL_QUEUE_PROPERTIES => queue_properties = *v, diff --git a/src/gallium/frontends/rusticl/util/properties.rs b/src/gallium/frontends/rusticl/util/properties.rs index 6423b8ac5f2..ef484078b55 100644 --- a/src/gallium/frontends/rusticl/util/properties.rs +++ b/src/gallium/frontends/rusticl/util/properties.rs @@ -16,7 +16,7 @@ impl Properties { /// /// Besides `p` being valid to be dereferenced, it also needs to point to a `T::default()` /// terminated array of `T`. - pub unsafe fn from_ptr(mut p: *const T) -> Option + pub unsafe fn new(mut p: *const T) -> Option where T: Copy + Default + PartialEq, {