#![allow(clippy::missing_safety_doc)]
pub use opencl_sys::cl_d3d10::*;
pub use opencl_sys::{
CL_INVALID_VALUE, CL_SUCCESS, cl_context, cl_int, cl_mem_flags, cl_mem_object_type, cl_uint,
};
#[allow(unused_imports)]
use libc::c_void;
#[allow(unused_imports)]
use std::ptr;
#[cfg(any(feature = "cl_khr_d3d10_sharing", feature = "dynamic"))]
pub unsafe fn get_supported_d3d10_texture_formats_intel(
context: cl_context,
flags: cl_mem_flags,
image_type: cl_mem_object_type,
) -> Result<Vec<cl_uint>, cl_int> {
let mut count: cl_uint = 0;
let status: cl_int = cl_call!(cl_icd::clGetSupportedD3D10TextureFormatsINTEL(
context,
flags,
image_type,
0,
ptr::null_mut(),
&raw mut count,
));
if CL_SUCCESS != status {
Err(status)
} else if 0 < count {
let len = count as usize;
let mut ids: Vec<cl_uint> = Vec::with_capacity(len);
let status: cl_int = cl_call!(cl_d3d10::clGetSupportedD3D10TextureFormatsINTEL(
context,
flags,
image_type,
count,
ids.as_mut_ptr(),
ptr::null_mut(),
));
if CL_SUCCESS == status {
Ok(ids)
} else {
Err(status)
}
} else {
Ok(Vec::default())
}
}