rusticl/kernel: add missing preprocessor definitions

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15439>
This commit is contained in:
Karol Herbst
2022-03-17 17:55:34 +01:00
committed by Marge Bot
parent 2ac657d2d0
commit fc30fe2c11
2 changed files with 18 additions and 0 deletions

View File

@@ -58,9 +58,15 @@ struct ProgramDevBuild {
fn prepare_options(options: &str, dev: &Device) -> Vec<CString> {
let mut options = options.to_owned();
if !options.contains("-cl-std=CL") {
options.push_str(" -cl-std=CL");
options.push_str(dev.clc_version.api_str());
}
if !dev.image_supported() {
options.push_str(" -U__IMAGE_SUPPORT__");
}
options.push_str(" -D__OPENCL_VERSION__=");
options.push_str(dev.cl_version.clc_str());
options
.split_whitespace()
.map(|a| match a {

View File

@@ -60,6 +60,18 @@ impl CLVersion {
CLVersion::Cl3_0 => "3.0",
}
}
pub fn clc_str(&self) -> &'static str {
match self {
CLVersion::Cl1_0 => "100",
CLVersion::Cl1_1 => "110",
CLVersion::Cl1_2 => "120",
CLVersion::Cl2_0 => "200",
CLVersion::Cl2_1 => "210",
CLVersion::Cl2_2 => "220",
CLVersion::Cl3_0 => "300",
}
}
}
impl TryFrom<u32> for CLVersion {