1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2016 Red Hat. 3bf215546Sopenharmony_ci * Copyright © 2016 Bas Nieuwenhuizen 4bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * based in part on anv driver which is: 7bf215546Sopenharmony_ci * Copyright © 2015 Intel Corporation 8bf215546Sopenharmony_ci */ 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci#ifndef TU_PASS_H 11bf215546Sopenharmony_ci#define TU_PASS_H 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_ci#include "tu_common.h" 14bf215546Sopenharmony_ci 15bf215546Sopenharmony_cienum tu_gmem_layout 16bf215546Sopenharmony_ci{ 17bf215546Sopenharmony_ci /* Use all of GMEM for attachments */ 18bf215546Sopenharmony_ci TU_GMEM_LAYOUT_FULL, 19bf215546Sopenharmony_ci /* Avoid using the region of GMEM that the CCU needs */ 20bf215546Sopenharmony_ci TU_GMEM_LAYOUT_AVOID_CCU, 21bf215546Sopenharmony_ci /* Number of layouts we have, also the value set when we don't know the layout in a secondary. */ 22bf215546Sopenharmony_ci TU_GMEM_LAYOUT_COUNT, 23bf215546Sopenharmony_ci}; 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_cistruct tu_subpass_barrier { 26bf215546Sopenharmony_ci VkPipelineStageFlags2 src_stage_mask; 27bf215546Sopenharmony_ci VkPipelineStageFlags2 dst_stage_mask; 28bf215546Sopenharmony_ci VkAccessFlags2 src_access_mask; 29bf215546Sopenharmony_ci VkAccessFlags2 dst_access_mask; 30bf215546Sopenharmony_ci bool incoherent_ccu_color, incoherent_ccu_depth; 31bf215546Sopenharmony_ci}; 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_cistruct tu_subpass_attachment 34bf215546Sopenharmony_ci{ 35bf215546Sopenharmony_ci uint32_t attachment; 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci /* For input attachments, true if it needs to be patched to refer to GMEM 38bf215546Sopenharmony_ci * in GMEM mode. This is false if it hasn't already been written as an 39bf215546Sopenharmony_ci * attachment. 40bf215546Sopenharmony_ci */ 41bf215546Sopenharmony_ci bool patch_input_gmem; 42bf215546Sopenharmony_ci}; 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_cistruct tu_subpass 45bf215546Sopenharmony_ci{ 46bf215546Sopenharmony_ci uint32_t input_count; 47bf215546Sopenharmony_ci uint32_t color_count; 48bf215546Sopenharmony_ci uint32_t resolve_count; 49bf215546Sopenharmony_ci bool resolve_depth_stencil; 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_ci bool feedback_loop_color; 52bf215546Sopenharmony_ci bool feedback_loop_ds; 53bf215546Sopenharmony_ci 54bf215546Sopenharmony_ci /* True if we must invalidate UCHE thanks to a feedback loop. */ 55bf215546Sopenharmony_ci bool feedback_invalidate; 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci /* In other words - framebuffer fetch support */ 58bf215546Sopenharmony_ci bool raster_order_attachment_access; 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci struct tu_subpass_attachment *input_attachments; 61bf215546Sopenharmony_ci struct tu_subpass_attachment *color_attachments; 62bf215546Sopenharmony_ci struct tu_subpass_attachment *resolve_attachments; 63bf215546Sopenharmony_ci struct tu_subpass_attachment depth_stencil_attachment; 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci VkSampleCountFlagBits samples; 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci uint32_t srgb_cntl; 68bf215546Sopenharmony_ci uint32_t multiview_mask; 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_ci struct tu_subpass_barrier start_barrier; 71bf215546Sopenharmony_ci}; 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_cistruct tu_render_pass_attachment 74bf215546Sopenharmony_ci{ 75bf215546Sopenharmony_ci VkFormat format; 76bf215546Sopenharmony_ci uint32_t samples; 77bf215546Sopenharmony_ci uint32_t cpp; 78bf215546Sopenharmony_ci VkImageAspectFlags clear_mask; 79bf215546Sopenharmony_ci uint32_t clear_views; 80bf215546Sopenharmony_ci bool load; 81bf215546Sopenharmony_ci bool store; 82bf215546Sopenharmony_ci bool gmem; 83bf215546Sopenharmony_ci int32_t gmem_offset[TU_GMEM_LAYOUT_COUNT]; 84bf215546Sopenharmony_ci bool will_be_resolved; 85bf215546Sopenharmony_ci /* for D32S8 separate stencil: */ 86bf215546Sopenharmony_ci bool load_stencil; 87bf215546Sopenharmony_ci bool store_stencil; 88bf215546Sopenharmony_ci 89bf215546Sopenharmony_ci bool cond_load_allowed; 90bf215546Sopenharmony_ci bool cond_store_allowed; 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci int32_t gmem_offset_stencil[TU_GMEM_LAYOUT_COUNT]; 93bf215546Sopenharmony_ci}; 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_cistruct tu_render_pass 96bf215546Sopenharmony_ci{ 97bf215546Sopenharmony_ci struct vk_object_base base; 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci uint32_t attachment_count; 100bf215546Sopenharmony_ci uint32_t subpass_count; 101bf215546Sopenharmony_ci uint32_t gmem_pixels[TU_GMEM_LAYOUT_COUNT]; 102bf215546Sopenharmony_ci uint32_t tile_align_w; 103bf215546Sopenharmony_ci 104bf215546Sopenharmony_ci /* memory bandwidth costs (in bytes) for gmem / sysmem rendering */ 105bf215546Sopenharmony_ci uint32_t gmem_bandwidth_per_pixel; 106bf215546Sopenharmony_ci uint32_t sysmem_bandwidth_per_pixel; 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_ci struct tu_subpass_attachment *subpass_attachments; 109bf215546Sopenharmony_ci struct tu_render_pass_attachment *attachments; 110bf215546Sopenharmony_ci struct tu_subpass_barrier end_barrier; 111bf215546Sopenharmony_ci struct tu_subpass subpasses[0]; 112bf215546Sopenharmony_ci}; 113bf215546Sopenharmony_ci 114bf215546Sopenharmony_ciVK_DEFINE_NONDISP_HANDLE_CASTS(tu_render_pass, base, VkRenderPass, 115bf215546Sopenharmony_ci VK_OBJECT_TYPE_RENDER_PASS) 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_civoid tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer, 118bf215546Sopenharmony_ci const VkRenderingInfo *pRenderingInfo); 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_civoid tu_setup_dynamic_inheritance(struct tu_cmd_buffer *cmd_buffer, 121bf215546Sopenharmony_ci const VkCommandBufferInheritanceRenderingInfo *info); 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ciuint32_t 124bf215546Sopenharmony_citu_subpass_get_attachment_to_resolve(const struct tu_subpass *subpass, uint32_t index); 125bf215546Sopenharmony_ci 126bf215546Sopenharmony_ci#endif /* TU_PASS_H */ 127