rusticl/program: pass options by reference

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33892>
This commit is contained in:
Karol Herbst 2025-03-05 00:38:43 +01:00 committed by Marge Bot
parent b2f3933c8d
commit e434ce1559
2 changed files with 9 additions and 7 deletions

View file

@ -337,8 +337,9 @@ fn build_program(
// CL_BUILD_PROGRAM_FAILURE if there is a failure to build the program executable. This error
// will be returned if clBuildProgram does not return until the build has completed.
let options = c_string_to_string(options);
for dev in &devs {
res &= p.build(dev, c_string_to_string(options));
res &= p.build(dev, &options);
}
if let Some(cb) = cb_opt {
@ -419,8 +420,9 @@ fn compile_program(
// CL_COMPILE_PROGRAM_FAILURE if there is a failure to compile the program source. This error
// will be returned if clCompileProgram does not return until the compile has completed.
let options = c_string_to_string(options);
for dev in &devs {
res &= p.compile(dev, c_string_to_string(options), &headers);
res &= p.compile(dev, &options, &headers);
}
if let Some(cb) = cb_opt {

View file

@ -552,7 +552,7 @@ impl Program {
.any(|b| b.kernels.values().any(|b| Arc::strong_count(b) > 1))
}
pub fn build(&self, dev: &Device, options: String) -> bool {
pub fn build(&self, dev: &Device, options: &str) -> bool {
let lib = options.contains("-create-library");
let mut info = self.build_info();
if !self.do_compile(dev, options, &Vec::new(), &mut info) {
@ -596,7 +596,7 @@ impl Program {
fn do_compile(
&self,
dev: &Device,
options: String,
options: &str,
headers: &[spirv::CLCHeader],
info: &mut MutexGuard<ProgramBuild>,
) -> bool {
@ -612,7 +612,7 @@ impl Program {
}
}
ProgramSourceType::Src(src) => {
let args = prepare_options(&options, dev);
let args = prepare_options(options, dev);
if Platform::dbg().clc {
let src = src.to_string_lossy();
@ -653,7 +653,7 @@ impl Program {
d.spirv = spirv;
d.log = log;
d.options = options;
options.clone_into(&mut d.options);
if d.spirv.is_some() {
d.status = CL_BUILD_SUCCESS as cl_build_status;
@ -665,7 +665,7 @@ impl Program {
}
}
pub fn compile(&self, dev: &Device, options: String, headers: &[spirv::CLCHeader]) -> bool {
pub fn compile(&self, dev: &Device, options: &str, headers: &[spirv::CLCHeader]) -> bool {
self.do_compile(dev, options, headers, &mut self.build_info())
}