rusticl/mem: use helper context for COPY_HOST_PTR buffers

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15439>
This commit is contained in:
Karol Herbst 2022-03-14 19:17:31 +01:00 committed by Marge Bot
parent fe8789e674
commit 3baf270316

View file

@ -73,7 +73,7 @@ impl Mem {
size: usize,
host_ptr: *mut c_void,
) -> CLResult<Arc<Mem>> {
if bit_check(flags, CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR) {
if bit_check(flags, CL_MEM_ALLOC_HOST_PTR) {
println!("host ptr semantics not implemented!");
}
@ -83,6 +83,13 @@ impl Mem {
context.create_buffer(size)
}?;
if bit_check(flags, CL_MEM_COPY_HOST_PTR) {
for (d, r) in &buffer {
d.helper_ctx()
.buffer_subdata(r, 0, host_ptr, size.try_into().unwrap());
}
}
let host_ptr = if bit_check(flags, CL_MEM_USE_HOST_PTR) {
host_ptr
} else {