rusticl/kernel: fix image_size of 1D buffer images
We can't use the size of the backing resource, but have to rather specify how much of the buffer resource are used for the 1Dbuffer image. Cc: mesa-stable Reviewed-by: @LingMan Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32903>
This commit is contained in:
@@ -1416,11 +1416,14 @@ impl Kernel {
|
||||
};
|
||||
|
||||
let format = image.pipe_format;
|
||||
let size =
|
||||
image.size.try_into().map_err(|_| CL_OUT_OF_RESOURCES)?;
|
||||
let (formats, orders) = if api_arg.kind == KernelArgType::Image {
|
||||
iviews.push(res.pipe_image_view(
|
||||
format,
|
||||
false,
|
||||
image.pipe_image_host_access(),
|
||||
size,
|
||||
app_img_info.as_ref(),
|
||||
));
|
||||
(&mut img_formats, &mut img_orders)
|
||||
@@ -1429,11 +1432,12 @@ impl Kernel {
|
||||
format,
|
||||
true,
|
||||
image.pipe_image_host_access(),
|
||||
size,
|
||||
app_img_info.as_ref(),
|
||||
));
|
||||
(&mut img_formats, &mut img_orders)
|
||||
} else {
|
||||
sviews.push((res.clone(), format, app_img_info));
|
||||
sviews.push((res.clone(), format, size, app_img_info));
|
||||
(&mut tex_formats, &mut tex_orders)
|
||||
};
|
||||
|
||||
@@ -1520,7 +1524,7 @@ impl Kernel {
|
||||
|
||||
let mut sviews: Vec<_> = sviews
|
||||
.iter()
|
||||
.map(|(s, f, aii)| ctx.create_sampler_view(s, *f, aii.as_ref()))
|
||||
.map(|(s, f, size, aii)| ctx.create_sampler_view(s, *f, *size, aii.as_ref()))
|
||||
.collect();
|
||||
let samplers: Vec<_> = samplers
|
||||
.iter()
|
||||
|
@@ -423,9 +423,10 @@ impl PipeContext {
|
||||
&self,
|
||||
res: &PipeResource,
|
||||
format: pipe_format,
|
||||
size: u32,
|
||||
app_img_info: Option<&AppImgInfo>,
|
||||
) -> *mut pipe_sampler_view {
|
||||
let template = res.pipe_sampler_view_template(format, app_img_info);
|
||||
let template = res.pipe_sampler_view_template(format, size, app_img_info);
|
||||
|
||||
unsafe {
|
||||
let s_view = self.pipe.as_ref().create_sampler_view.unwrap()(
|
||||
|
@@ -126,6 +126,7 @@ impl PipeResource {
|
||||
format: pipe_format,
|
||||
read_write: bool,
|
||||
host_access: u16,
|
||||
size: u32,
|
||||
app_img_info: Option<&AppImgInfo>,
|
||||
) -> PipeImageView {
|
||||
let pipe = PipeResource::as_ref(self);
|
||||
@@ -142,7 +143,7 @@ impl PipeResource {
|
||||
pipe_image_view__bindgen_ty_1 {
|
||||
buf: pipe_image_view__bindgen_ty_1__bindgen_ty_2 {
|
||||
offset: 0,
|
||||
size: pipe.width0,
|
||||
size: size,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
@@ -184,6 +185,7 @@ impl PipeResource {
|
||||
pub fn pipe_sampler_view_template(
|
||||
&self,
|
||||
format: pipe_format,
|
||||
size: u32,
|
||||
app_img_info: Option<&AppImgInfo>,
|
||||
) -> pipe_sampler_view {
|
||||
let mut res = pipe_sampler_view::default();
|
||||
@@ -200,7 +202,7 @@ impl PipeResource {
|
||||
res.set_is_tex2d_from_buf(true);
|
||||
} else if res.target() == pipe_texture_target::PIPE_BUFFER {
|
||||
res.u.buf.offset = 0;
|
||||
res.u.buf.size = self.as_ref().width0;
|
||||
res.u.buf.size = size;
|
||||
}
|
||||
|
||||
res
|
||||
|
Reference in New Issue
Block a user