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
(cherry picked from commit 90d83f4c30
)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:

committed by
Dylan Baker

parent
0e7cf6c7b5
commit
6ea2997555
@@ -1664,7 +1664,7 @@
|
||||
"description": "rusticl/kernel: fix image_size of 1D buffer images",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
@@ -1414,11 +1414,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)
|
||||
@@ -1427,11 +1430,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)
|
||||
};
|
||||
|
||||
@@ -1518,7 +1522,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()
|
||||
|
@@ -432,9 +432,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()(
|
||||
|
@@ -124,6 +124,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);
|
||||
@@ -140,7 +141,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 {
|
||||
@@ -182,6 +183,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();
|
||||
@@ -198,7 +200,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