diff --git a/.pick_status.json b/.pick_status.json index 1e2892f67e9..cee435de385 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -734,7 +734,7 @@ "description": "rusticl/mem: properly handle buffers", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "2645003bdc527b5dc046366fce5e65b44b27334f", "notes": null diff --git a/src/gallium/frontends/rusticl/core/gl.rs b/src/gallium/frontends/rusticl/core/gl.rs index 09c40ba7f9e..7a8c14ec4d0 100644 --- a/src/gallium/frontends/rusticl/core/gl.rs +++ b/src/gallium/frontends/rusticl/core/gl.rs @@ -326,6 +326,7 @@ pub struct GLMemProps { pub height: u16, pub depth: u16, pub width: u32, + pub offset: u32, pub array_size: u16, pub pixel_size: u8, pub stride: u32, @@ -349,7 +350,7 @@ pub struct GLExportManager { impl GLExportManager { pub fn get_gl_mem_props(&self) -> CLResult { let pixel_size = if self.is_gl_buffer() { - 0 + 1 } else { format_from_gl(self.export_out.internal_format) .ok_or(CL_OUT_OF_HOST_MEMORY)? @@ -361,6 +362,7 @@ impl GLExportManager { let mut depth = self.export_out.depth as u16; let mut width = self.export_out.width; let mut array_size = 1; + let mut offset = 0; // some fixups match self.export_in.target { @@ -376,6 +378,7 @@ impl GLExportManager { GL_ARRAY_BUFFER => { array_size = 1; width = self.export_out.buf_size as u32; + offset = self.export_out.buf_offset as u32; height = 1; depth = 1; } @@ -389,6 +392,7 @@ impl GLExportManager { height: height, depth: depth, width: width, + offset: offset, array_size: array_size, pixel_size: pixel_size, stride: self.export_out.stride, diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index fc5887e5155..daf71e724b5 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -501,6 +501,11 @@ impl Mem { ..Default::default() }; + // it's kinda not supported, but we want to know if anything actually hits this as it's + // certainly not tested by the CL CTS. + if mem_type != CL_MEM_OBJECT_BUFFER { + assert_eq!(gl_mem_props.offset, 0); + } Ok(Arc::new(Self { base: CLObjectBase::new(), context: context, @@ -508,7 +513,7 @@ impl Mem { mem_type: mem_type, flags: flags, size: gl_mem_props.size(), - offset: 0, + offset: gl_mem_props.offset as usize, host_ptr: ptr::null_mut(), image_format: image_format, pipe_format: pipe_format,