From 3d1e2b39766eb3604fd7ded07d2a9bed12f2454d Mon Sep 17 00:00:00 2001 From: Ella Stanforth Date: Mon, 13 Oct 2025 11:41:48 +0100 Subject: [PATCH] pvr: move pvr_load_op to pvr_mrt.h Signed-off-by: Ella Stanforth Acked-by: Erik Faye-Lund Part-of: --- src/imagination/vulkan/pvr_mrt.h | 66 +++++++++++++++++++++++++++++++ src/imagination/vulkan/pvr_pass.h | 64 ------------------------------ 2 files changed, 66 insertions(+), 64 deletions(-) diff --git a/src/imagination/vulkan/pvr_mrt.h b/src/imagination/vulkan/pvr_mrt.h index 51c2c2e44df..fb8c03fdae0 100644 --- a/src/imagination/vulkan/pvr_mrt.h +++ b/src/imagination/vulkan/pvr_mrt.h @@ -11,6 +11,8 @@ #include #include +#include "pvr_common.h" + struct pvr_device; /* Specifies the location of render target writes. */ @@ -102,4 +104,68 @@ pvr_destroy_mrt_setup(const struct pvr_device *device, void pvr_init_mrt_desc(VkFormat format, struct usc_mrt_desc *desc); +/* Max render targets for the clears loads state in load op. + * To account for resolve attachments, double the color attachments. + */ +#define PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS (PVR_MAX_COLOR_ATTACHMENTS * 2) + +struct pvr_load_op { + bool is_hw_object; + + struct pvr_suballoc_bo *usc_frag_prog_bo; + uint32_t const_shareds_count; + uint32_t shareds_count; + uint32_t num_tile_buffers; + + struct pvr_pds_upload pds_frag_prog; + + struct pvr_pds_upload pds_tex_state_prog; + uint32_t temps_count; + + union { + const struct pvr_renderpass_hwsetup_render *hw_render; + const struct pvr_render_subpass *subpass; + }; + + /* TODO: We might not need to keep all of this around. Some stuff might just + * be for the compiler to ingest which we can then discard. + */ + struct { + uint16_t rt_clear_mask; + uint16_t rt_load_mask; + + uint16_t unresolved_msaa_mask; + + /* The format to write to the output regs. */ + VkFormat dest_vk_format[PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS]; + +#define PVR_NO_DEPTH_CLEAR_TO_REG (-1) + /* If >= 0, write a depth clear value to the specified pixel output. */ + int32_t depth_clear_to_reg; + + const struct usc_mrt_setup *mrt_setup; + } clears_loads_state; + + uint32_t view_indices[PVR_MAX_MULTIVIEW]; + + uint32_t view_count; +}; + +#define CHECK_MASK_SIZE(_struct_type, _field_name, _nr_bits) \ + static_assert(sizeof(((struct _struct_type *)NULL)->_field_name) * 8 >= \ + _nr_bits, \ + #_field_name " mask of struct " #_struct_type " too small") + +CHECK_MASK_SIZE(pvr_load_op, + clears_loads_state.rt_clear_mask, + PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS); +CHECK_MASK_SIZE(pvr_load_op, + clears_loads_state.rt_load_mask, + PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS); +CHECK_MASK_SIZE(pvr_load_op, + clears_loads_state.unresolved_msaa_mask, + PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS); + +#undef CHECK_MASK_SIZE + #endif diff --git a/src/imagination/vulkan/pvr_pass.h b/src/imagination/vulkan/pvr_pass.h index b7ff78f4fc0..5a3a66f44c9 100644 --- a/src/imagination/vulkan/pvr_pass.h +++ b/src/imagination/vulkan/pvr_pass.h @@ -117,75 +117,11 @@ struct pvr_render_pass { bool multiview_enabled; }; -/* Max render targets for the clears loads state in load op. - * To account for resolve attachments, double the color attachments. - */ -#define PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS (PVR_MAX_COLOR_ATTACHMENTS * 2) - -struct pvr_load_op { - bool is_hw_object; - - struct pvr_suballoc_bo *usc_frag_prog_bo; - uint32_t const_shareds_count; - uint32_t shareds_count; - uint32_t num_tile_buffers; - - struct pvr_pds_upload pds_frag_prog; - - struct pvr_pds_upload pds_tex_state_prog; - uint32_t temps_count; - - union { - const struct pvr_renderpass_hwsetup_render *hw_render; - const struct pvr_render_subpass *subpass; - }; - - /* TODO: We might not need to keep all of this around. Some stuff might just - * be for the compiler to ingest which we can then discard. - */ - struct { - uint16_t rt_clear_mask; - uint16_t rt_load_mask; - - uint16_t unresolved_msaa_mask; - - /* The format to write to the output regs. */ - VkFormat dest_vk_format[PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS]; - -#define PVR_NO_DEPTH_CLEAR_TO_REG (-1) - /* If >= 0, write a depth clear value to the specified pixel output. */ - int32_t depth_clear_to_reg; - - const struct usc_mrt_setup *mrt_setup; - } clears_loads_state; - - uint32_t view_indices[PVR_MAX_MULTIVIEW]; - - uint32_t view_count; -}; - VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_render_pass, base, VkRenderPass, VK_OBJECT_TYPE_RENDER_PASS) -#define CHECK_MASK_SIZE(_struct_type, _field_name, _nr_bits) \ - static_assert(sizeof(((struct _struct_type *)NULL)->_field_name) * 8 >= \ - _nr_bits, \ - #_field_name " mask of struct " #_struct_type " too small") - -CHECK_MASK_SIZE(pvr_load_op, - clears_loads_state.rt_clear_mask, - PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS); -CHECK_MASK_SIZE(pvr_load_op, - clears_loads_state.rt_load_mask, - PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS); -CHECK_MASK_SIZE(pvr_load_op, - clears_loads_state.unresolved_msaa_mask, - PVR_LOAD_OP_CLEARS_LOADS_MAX_RTS); - -#undef CHECK_MASK_SIZE - VkResult pvr_pds_unitex_state_program_create_and_upload( struct pvr_device *device, const VkAllocationCallbacks *allocator,