From 72849ffbcd612dac86bf950baf07b3bf4baa6370 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 30 Jan 2025 14:55:40 -0500 Subject: [PATCH] gallium: add a pipe_tex2d_from_buf struct this is more convenient for reuse Reviewed-by: Karol Herbst Part-of: --- .../frontends/rusticl/mesa/pipe/resource.rs | 4 ++-- src/gallium/include/pipe/p_state.h | 20 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/gallium/frontends/rusticl/mesa/pipe/resource.rs b/src/gallium/frontends/rusticl/mesa/pipe/resource.rs index 7d3be624c42..eb7b3346761 100644 --- a/src/gallium/frontends/rusticl/mesa/pipe/resource.rs +++ b/src/gallium/frontends/rusticl/mesa/pipe/resource.rs @@ -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, diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index ea0b8a98d20..01b18bdd750 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -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; };