diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index f8546758891..260e162ab30 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -923,7 +923,7 @@ impl Device { } pub fn global_mem_size(&self) -> cl_ulong { - if let Some(memory_info) = self.screen().query_memory_info() { + if let Some(memory_info) = self.screen.query_memory_info() { let memory: cl_ulong = if memory_info.total_device_memory != 0 { memory_info.total_device_memory.into() } else { diff --git a/src/gallium/frontends/rusticl/core/kernel.rs b/src/gallium/frontends/rusticl/core/kernel.rs index f863b94167a..1a778738a97 100644 --- a/src/gallium/frontends/rusticl/core/kernel.rs +++ b/src/gallium/frontends/rusticl/core/kernel.rs @@ -527,11 +527,10 @@ impl_cl_type_trait!(cl_kernel, Kernel, CL_INVALID_KERNEL); fn create_kernel_arr(vals: &[usize], val: T) -> CLResult<[T; 3]> where T: std::convert::TryFrom + Copy, - >::Error: std::fmt::Debug, { let mut res = [val; 3]; for (i, v) in vals.iter().enumerate() { - res[i] = (*v).try_into().ok().ok_or(CL_OUT_OF_RESOURCES)?; + res[i] = (*v).try_into().or(Err(CL_OUT_OF_RESOURCES))?; } Ok(res) diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index 2afbe9a08b6..d6ab7ec15ad 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -959,14 +959,15 @@ impl MemBase { let (shadow_map, texture) = if is_cube_map_face(export_in.target) { let shadow = create_shadow_slice(&imported_gl_tex, image_format)?; - let mut res_map = HashMap::new(); - shadow + let res_map = shadow .iter() - .map(|(k, v)| { - let gl_res = Arc::clone(imported_gl_tex.get(k).unwrap()); - res_map.insert(Arc::clone(v), gl_res); + .map(|(dev, resource)| { + ( + Arc::clone(resource), + Arc::clone(imported_gl_tex.get(dev).unwrap()), + ) }) - .for_each(drop); + .collect(); (Some(res_map), shadow) } else { diff --git a/src/gallium/frontends/rusticl/core/program.rs b/src/gallium/frontends/rusticl/core/program.rs index cc7969e2528..d6da0ba325a 100644 --- a/src/gallium/frontends/rusticl/core/program.rs +++ b/src/gallium/frontends/rusticl/core/program.rs @@ -479,15 +479,17 @@ impl Program { // we need to precalculate the size pub fn bin_sizes(&self) -> Vec { let lock = self.build_info(); - let mut res = Vec::new(); - for d in &self.devs { - let info = lock.dev_build(d); - res.push(info.spirv.as_ref().map_or(0, |s| { - s.to_bin().len() + d.screen().name().to_bytes().len() + BIN_HEADER_SIZE - })); - } - res + self.devs + .iter() + .map(|&device| { + let info = lock.dev_build(device); + + info.spirv.as_ref().map_or(0, |s| { + s.to_bin().len() + device.screen().name().to_bytes().len() + BIN_HEADER_SIZE + }) + }) + .collect() } pub fn binaries(&self, ptrs: &[*mut u8]) -> CLResult<()> {