1 /* 2 * Copyright © 2016 Red Hat. 3 * Copyright © 2016 Bas Nieuwenhuizen 4 * SPDX-License-Identifier: MIT 5 * 6 * based in part on anv driver which is: 7 * Copyright © 2015 Intel Corporation 8 */ 9 10 #ifndef TU_LRZ_H 11 #define TU_LRZ_H 12 13 #include "tu_common.h" 14 15 enum tu_lrz_force_disable_mask { 16 TU_LRZ_FORCE_DISABLE_LRZ = 1 << 0, 17 TU_LRZ_FORCE_DISABLE_WRITE = 1 << 1, 18 TU_LRZ_READS_DEST = 1 << 2, /* Blend/logicop/colormask, etc */ 19 }; 20 21 enum tu_lrz_direction { 22 TU_LRZ_UNKNOWN, 23 /* Depth func less/less-than: */ 24 TU_LRZ_LESS, 25 /* Depth func greater/greater-than: */ 26 TU_LRZ_GREATER, 27 }; 28 29 struct tu_lrz_state 30 { 31 /* Depth/Stencil image currently on use to do LRZ */ 32 const struct tu_image_view *image_view; 33 VkClearValue depth_clear_value; 34 /* If LRZ is in invalid state we cannot use it until depth is cleared */ 35 bool valid : 1; 36 /* Allows to temporary disable LRZ */ 37 bool enabled : 1; 38 bool fast_clear : 1; 39 bool gpu_dir_tracking : 1; 40 /* Continue using old LRZ state (LOAD_OP_LOAD of depth) */ 41 bool reuse_previous_state : 1; 42 enum tu_lrz_direction prev_direction; 43 }; 44 45 void 46 tu6_emit_lrz(struct tu_cmd_buffer *cmd, struct tu_cs *cs); 47 48 void 49 tu_disable_lrz(struct tu_cmd_buffer *cmd, struct tu_cs *cs, 50 struct tu_image *image); 51 52 void 53 tu_lrz_clear_depth_image(struct tu_cmd_buffer *cmd, 54 struct tu_image *image, 55 const VkClearDepthStencilValue *pDepthStencil, 56 uint32_t rangeCount, 57 const VkImageSubresourceRange *pRanges); 58 59 void 60 tu_lrz_begin_renderpass(struct tu_cmd_buffer *cmd); 61 62 void 63 tu_lrz_begin_resumed_renderpass(struct tu_cmd_buffer *cmd); 64 65 void 66 tu_lrz_begin_secondary_cmdbuf(struct tu_cmd_buffer *cmd); 67 68 void 69 tu_lrz_tiling_begin(struct tu_cmd_buffer *cmd, struct tu_cs *cs); 70 71 void 72 tu_lrz_tiling_end(struct tu_cmd_buffer *cmd, struct tu_cs *cs); 73 74 void 75 tu_lrz_sysmem_begin(struct tu_cmd_buffer *cmd, struct tu_cs *cs); 76 77 void 78 tu_lrz_sysmem_end(struct tu_cmd_buffer *cmd, struct tu_cs *cs); 79 80 void 81 tu_lrz_disable_during_renderpass(struct tu_cmd_buffer *cmd); 82 83 #endif /* TU_LRZ_H */ 84