diff --git a/src/gallium/frontends/rusticl/api/program.rs b/src/gallium/frontends/rusticl/api/program.rs index 37739e8ef18..09e1f3181b4 100644 --- a/src/gallium/frontends/rusticl/api/program.rs +++ b/src/gallium/frontends/rusticl/api/program.rs @@ -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 { diff --git a/src/gallium/frontends/rusticl/core/program.rs b/src/gallium/frontends/rusticl/core/program.rs index e1df01ce6cf..da85ed4aac5 100644 --- a/src/gallium/frontends/rusticl/core/program.rs +++ b/src/gallium/frontends/rusticl/core/program.rs @@ -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, ) -> 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()) }