mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01:00
rusticl/version: use cl_version instead of cl_uint and provide a From impl
Signed-off-by: Karol Herbst <git@karolherbst.de> Reviewed-by: Nora Allen <blackcatgames@protonmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23707>
This commit is contained in:
parent
dce0665705
commit
f969e9a137
2 changed files with 16 additions and 11 deletions
|
|
@ -201,7 +201,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
|
|||
cl_prop::<cl_uint>(dev.screen().device_node_mask().unwrap_or_default())
|
||||
}
|
||||
CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT => cl_prop::<bool>(false),
|
||||
CL_DEVICE_NUMERIC_VERSION => cl_prop::<cl_version>(dev.cl_version as cl_version),
|
||||
CL_DEVICE_NUMERIC_VERSION => cl_prop::<cl_version>(dev.cl_version.into()),
|
||||
CL_DEVICE_OPENCL_C_ALL_VERSIONS => cl_prop::<&Vec<cl_name_version>>(&dev.clc_versions),
|
||||
CL_DEVICE_OPENCL_C_FEATURES => cl_prop::<&Vec<cl_name_version>>(&dev.clc_features),
|
||||
CL_DEVICE_OPENCL_C_VERSION => {
|
||||
|
|
|
|||
|
|
@ -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<u32> for CLVersion {
|
||||
impl From<CLVersion> for cl_version {
|
||||
fn from(cl_version: CLVersion) -> Self {
|
||||
cl_version as Self
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<cl_version> for CLVersion {
|
||||
type Error = cl_int;
|
||||
|
||||
fn try_from(value: u32) -> Result<Self, Self::Error> {
|
||||
fn try_from(value: cl_version) -> Result<Self, Self::Error> {
|
||||
Ok(match value {
|
||||
CL1_0_VER => CLVersion::Cl1_0,
|
||||
CL1_1_VER => CLVersion::Cl1_1,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue