rusticl/platform: rename _cl_platform_id to Platform

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22280>
This commit is contained in:
Karol Herbst 2023-04-04 01:36:10 +02:00 committed by Marge Bot
parent 11250d7a9e
commit 3e59a2860e

View file

@ -5,13 +5,12 @@ use crate::core::version::*;
use rusticl_opencl_gen::*;
#[repr(C)]
#[allow(non_camel_case_types)]
pub struct _cl_platform_id {
pub struct Platform {
dispatch: &'static cl_icd_dispatch,
pub extensions: [cl_name_version; 2],
}
static PLATFORM: _cl_platform_id = _cl_platform_id {
static PLATFORM: Platform = Platform {
dispatch: &DISPATCH,
extensions: [
mk_cl_version_ext(1, 0, 0, "cl_khr_icd"),
@ -20,16 +19,15 @@ static PLATFORM: _cl_platform_id = _cl_platform_id {
};
pub fn get_platform() -> cl_platform_id {
&PLATFORM as *const crate::core::platform::_cl_platform_id
as *mut ::rusticl_opencl_gen::_cl_platform_id
&PLATFORM as *const Platform as *mut _cl_platform_id
}
pub trait GetPlatformRef {
fn get_ref(&self) -> CLResult<&'static _cl_platform_id>;
fn get_ref(&self) -> CLResult<&'static Platform>;
}
impl GetPlatformRef for cl_platform_id {
fn get_ref(&self) -> CLResult<&'static _cl_platform_id> {
fn get_ref(&self) -> CLResult<&'static Platform> {
if !self.is_null() && *self == get_platform() {
Ok(&PLATFORM)
} else {