gallium: add a pipe_tex2d_from_buf struct

this is more convenient for reuse

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33322>
This commit is contained in:
Mike Blumenkrantz 2025-01-30 14:55:40 -05:00 committed by Marge Bot
parent 8d0d83c629
commit 72849ffbcd
2 changed files with 10 additions and 14 deletions

View file

@ -202,7 +202,7 @@ impl PipeResource {
access: PIPE_IMAGE_ACCESS_TEX2D_FROM_BUFFER as u16 | host_access,
shader_access: shader_access,
u: pipe_image_view__bindgen_ty_1 {
tex2d_from_buf: pipe_image_view__bindgen_ty_1__bindgen_ty_3 {
tex2d_from_buf: pipe_tex2d_from_buf {
offset: 0,
row_stride: app_img_info.row_stride as u16,
width: app_img_info.width as u16,
@ -259,7 +259,7 @@ impl PipeResource {
// write the entire union field because u_sampler_view_default_template might have left it
// in an undefined state.
res.u.tex2d_from_buf = pipe_sampler_view__bindgen_ty_2__bindgen_ty_3 {
res.u.tex2d_from_buf = pipe_tex2d_from_buf {
offset: 0,
row_stride: app_img_info.row_stride as u16,
width: app_img_info.width as u16,

View file

@ -478,6 +478,12 @@ struct pipe_surface
union pipe_surface_desc u;
};
struct pipe_tex2d_from_buf {
unsigned offset; /**< offset in pixels */
uint16_t row_stride; /**< size of the image row_stride in pixels */
uint16_t width; /**< width of image provided by application */
uint16_t height; /**< height of image provided by application */
};
/**
* A view into a texture that can be bound to a shader stage.
@ -508,12 +514,7 @@ struct pipe_sampler_view
unsigned offset; /**< offset in bytes */
unsigned size; /**< size of the readable sub-range in bytes */
} buf;
struct {
unsigned offset; /**< offset in pixels */
uint16_t row_stride; /**< size of the image row_stride in pixels */
uint16_t width; /**< width of image provided by application */
uint16_t height; /**< height of image provided by application */
} tex2d_from_buf; /**< used in cl extension cl_khr_image2d_from_buffer */
struct pipe_tex2d_from_buf tex2d_from_buf; /**< used in cl extension cl_khr_image2d_from_buffer */
} u;
};
@ -544,12 +545,7 @@ struct pipe_image_view
unsigned offset; /**< offset in bytes */
unsigned size; /**< size of the accessible sub-range in bytes */
} buf;
struct {
unsigned offset; /**< offset in pixels */
uint16_t row_stride; /**< size of the image row_stride in pixels */
uint16_t width; /**< width of image provided by application */
uint16_t height; /**< height of image provided by application */
} tex2d_from_buf; /**< used in cl extension cl_khr_image2d_from_buffer */
struct pipe_tex2d_from_buf tex2d_from_buf; /**< used in cl extension cl_khr_image2d_from_buffer */
} u;
};