• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 };
19 
20 enum tu_lrz_direction {
21    TU_LRZ_UNKNOWN,
22    /* Depth func less/less-than: */
23    TU_LRZ_LESS,
24    /* Depth func greater/greater-than: */
25    TU_LRZ_GREATER,
26 };
27 
28 struct tu_lrz_state
29 {
30    /* Depth/Stencil image currently on use to do LRZ */
31    const struct tu_image_view *image_view;
32    VkClearValue depth_clear_value;
33    /* If LRZ is in invalid state we cannot use it until depth is cleared */
34    bool valid : 1;
35    /* Allows to temporary disable LRZ */
36    bool enabled : 1;
37    bool fast_clear : 1;
38    bool gpu_dir_tracking : 1;
39    /* Continue using old LRZ state (LOAD_OP_LOAD of depth) */
40    bool reuse_previous_state : 1;
41    enum tu_lrz_direction prev_direction;
42 };
43 
44 void
45 tu6_emit_lrz(struct tu_cmd_buffer *cmd, struct tu_cs *cs);
46 
47 void
48 tu_disable_lrz(struct tu_cmd_buffer *cmd, struct tu_cs *cs,
49                struct tu_image *image);
50 
51 void
52 tu_lrz_clear_depth_image(struct tu_cmd_buffer *cmd,
53                          struct tu_image *image,
54                          const VkClearDepthStencilValue *pDepthStencil,
55                          uint32_t rangeCount,
56                          const VkImageSubresourceRange *pRanges);
57 
58 void
59 tu_lrz_begin_renderpass(struct tu_cmd_buffer *cmd,
60                         const VkClearValue *clear_values);
61 
62 void
63 tu_lrz_begin_resumed_renderpass(struct tu_cmd_buffer *cmd,
64                                 const VkClearValue *clear_values);
65 
66 void
67 tu_lrz_begin_secondary_cmdbuf(struct tu_cmd_buffer *cmd);
68 
69 void
70 tu_lrz_tiling_begin(struct tu_cmd_buffer *cmd, struct tu_cs *cs);
71 
72 void
73 tu_lrz_tiling_end(struct tu_cmd_buffer *cmd, struct tu_cs *cs);
74 
75 void
76 tu_lrz_sysmem_begin(struct tu_cmd_buffer *cmd, struct tu_cs *cs);
77 
78 void
79 tu_lrz_sysmem_end(struct tu_cmd_buffer *cmd, struct tu_cs *cs);
80 
81 void
82 tu_lrz_disable_during_renderpass(struct tu_cmd_buffer *cmd);
83 
84 #endif /* TU_LRZ_H */
85