mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-09 23:08:18 +02:00
rusticl/program: construct __OPENCL_VERSION__ inside CompileOptions::get_clang_args
Reviewed-by: @LingMan Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42021>
This commit is contained in:
parent
73b3d81a48
commit
1e41c73cf5
2 changed files with 15 additions and 13 deletions
|
|
@ -14,6 +14,7 @@ use mesa_rust::compiler::clc::*;
|
|||
use mesa_rust::compiler::nir::*;
|
||||
use mesa_rust::util::disk_cache::*;
|
||||
use mesa_rust_gen::*;
|
||||
use mesa_rust_util::string::CStrExt;
|
||||
use mesa_rust_util::string::CStringExt;
|
||||
use mesa_rust_util::string::Join;
|
||||
use rusticl_llvm_gen::*;
|
||||
|
|
@ -311,8 +312,6 @@ impl CompileOptions {
|
|||
options.push_str(" -cl-std=CL");
|
||||
options.push_str(dev.clc_version.api_str());
|
||||
}
|
||||
options.push_str(" -D__OPENCL_VERSION__=");
|
||||
options.push_str(dev.cl_version.clc_str());
|
||||
|
||||
let mut res = Vec::new();
|
||||
|
||||
|
|
@ -366,8 +365,10 @@ impl CompileOptions {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_clang_args(&self, _dev: &Device) -> Vec<CString> {
|
||||
self.clang_args.clone()
|
||||
fn get_clang_args(&self, dev: &Device) -> Vec<CString> {
|
||||
let mut args = self.clang_args.clone();
|
||||
args.push(c"-D__OPENCL_VERSION__=".concat(dev.cl_version.clc_str()));
|
||||
args
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
use rusticl_opencl_gen::*;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::ffi::CStr;
|
||||
use std::os::raw::c_char;
|
||||
|
||||
pub const CL1_0_VER: cl_version = mk_cl_version(1, 0, 0);
|
||||
|
|
@ -64,16 +65,16 @@ impl CLVersion {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn clc_str(&self) -> &'static str {
|
||||
pub fn clc_str(&self) -> &'static CStr {
|
||||
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",
|
||||
CLVersion::Cl3_1 => "310",
|
||||
CLVersion::Cl1_0 => c"100",
|
||||
CLVersion::Cl1_1 => c"110",
|
||||
CLVersion::Cl1_2 => c"120",
|
||||
CLVersion::Cl2_0 => c"200",
|
||||
CLVersion::Cl2_1 => c"210",
|
||||
CLVersion::Cl2_2 => c"220",
|
||||
CLVersion::Cl3_0 => c"300",
|
||||
CLVersion::Cl3_1 => c"310",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue