From 3baf2703161288169e4466dc308869903ee39682 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 14 Mar 2022 19:17:31 +0100 Subject: [PATCH] rusticl/mem: use helper context for COPY_HOST_PTR buffers Signed-off-by: Karol Herbst Acked-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/core/memory.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index fff35e1b15d..3de93c146c5 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -73,7 +73,7 @@ impl Mem { size: usize, host_ptr: *mut c_void, ) -> CLResult> { - 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 {