diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs index 060f0f340b8..b24717f5c27 100644 --- a/src/gallium/frontends/rusticl/api/device.rs +++ b/src/gallium/frontends/rusticl/api/device.rs @@ -201,7 +201,7 @@ impl CLInfo for cl_device_id { cl_prop::(dev.screen().device_node_mask().unwrap_or_default()) } CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT => cl_prop::(false), - CL_DEVICE_NUMERIC_VERSION => cl_prop::(dev.cl_version as cl_version), + CL_DEVICE_NUMERIC_VERSION => cl_prop::(dev.cl_version.into()), CL_DEVICE_OPENCL_C_ALL_VERSIONS => cl_prop::<&Vec>(&dev.clc_versions), CL_DEVICE_OPENCL_C_FEATURES => cl_prop::<&Vec>(&dev.clc_features), CL_DEVICE_OPENCL_C_VERSION => { diff --git a/src/gallium/frontends/rusticl/core/version.rs b/src/gallium/frontends/rusticl/core/version.rs index 73ee87482ec..b0df2211f56 100644 --- a/src/gallium/frontends/rusticl/core/version.rs +++ b/src/gallium/frontends/rusticl/core/version.rs @@ -3,15 +3,14 @@ use rusticl_opencl_gen::*; use std::convert::TryFrom; use std::os::raw::c_char; -pub const CL1_0_VER: u32 = mk_cl_version(1, 0, 0); -pub const CL1_1_VER: u32 = mk_cl_version(1, 1, 0); -pub const CL1_2_VER: u32 = mk_cl_version(1, 2, 0); -pub const CL2_0_VER: u32 = mk_cl_version(2, 0, 0); -pub const CL2_1_VER: u32 = mk_cl_version(2, 1, 0); -pub const CL2_2_VER: u32 = mk_cl_version(2, 2, 0); -pub const CL3_0_VER: u32 = mk_cl_version(3, 0, 0); +pub const CL1_0_VER: cl_version = mk_cl_version(1, 0, 0); +pub const CL1_1_VER: cl_version = mk_cl_version(1, 1, 0); +pub const CL1_2_VER: cl_version = mk_cl_version(1, 2, 0); +pub const CL2_0_VER: cl_version = mk_cl_version(2, 0, 0); +pub const CL2_1_VER: cl_version = mk_cl_version(2, 1, 0); +pub const CL2_2_VER: cl_version = mk_cl_version(2, 2, 0); +pub const CL3_0_VER: cl_version = mk_cl_version(3, 0, 0); -#[allow(dead_code)] #[repr(u32)] #[derive(Copy, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)] pub enum CLVersion { @@ -72,10 +71,16 @@ impl CLVersion { } } -impl TryFrom for CLVersion { +impl From for cl_version { + fn from(cl_version: CLVersion) -> Self { + cl_version as Self + } +} + +impl TryFrom for CLVersion { type Error = cl_int; - fn try_from(value: u32) -> Result { + fn try_from(value: cl_version) -> Result { Ok(match value { CL1_0_VER => CLVersion::Cl1_0, CL1_1_VER => CLVersion::Cl1_1,