diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index a2f96f821e5..3d3c81247cc 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -375,13 +375,27 @@ impl Mem { }; let texture = if parent.is_none() { - Some(context.create_texture( + let mut texture = context.create_texture( &image_desc, image_format, host_ptr, bit_check(flags, CL_MEM_COPY_HOST_PTR), res_type, - )?) + ); + + // if we error allocating a Staging resource, just try with normal as + // `CL_MEM_ALLOC_HOST_PTR` is just a performance hint. + if res_type == ResourceType::Staging && texture.is_err() { + texture = context.create_texture( + &image_desc, + image_format, + host_ptr, + bit_check(flags, CL_MEM_COPY_HOST_PTR), + ResourceType::Normal, + ) + } + + Some(texture?) } else { None }; diff --git a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs index 0937e93db82..1450283f2d9 100644 --- a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs +++ b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs @@ -69,7 +69,7 @@ impl ComputeParam> for PipeScreen { } } -#[derive(Clone, Copy)] +#[derive(Clone, Copy, PartialEq, Eq)] pub enum ResourceType { Normal, Staging,