rusticl/mem: properly handle buffers
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10505
Fixes: 2645003bdc ("rusticl: Create CL mem objects from GL")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27385>
(cherry picked from commit 117291332c6f30c7759dcd3f70459a6d8e2b153e)
This commit is contained in:
parent
c206849335
commit
277c905b41
3 changed files with 12 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<GLMemProps> {
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue