rusticl/memory: fallback if allocating linear images fails
Signed-off-by: Karol Herbst <git@karolherbst.de> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
@@ -69,7 +69,7 @@ impl ComputeParam<Vec<u64>> for PipeScreen {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ResourceType {
|
||||
Normal,
|
||||
Staging,
|
||||
|
Reference in New Issue
Block a user