xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/d3d12/d3d12_nir_passes.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © Microsoft Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * on the rights to use, copy, modify, merge, publish, distribute, sub
8  * license, and/or sell copies of the Software, and to permit persons to whom
9  * the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21  * USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef D3D12_NIR_PASSES_H
25 #define D3D12_NIR_PASSES_H
26 
27 #include "nir.h"
28 #include "nir_builder.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct d3d12_shader;
35 struct d3d12_image_format_conversion_info;
36 struct d3d12_image_format_conversion_info_arr;
37 enum d3d12_state_var;
38 
39 nir_def *
40 d3d12_get_state_var(nir_builder *b,
41                     enum d3d12_state_var var_enum,
42                     const char *var_name,
43                     const struct glsl_type *var_type,
44                     nir_variable **out_var);
45 
46 nir_def *
47 d3d12_get_state_var(nir_builder *b,
48                     enum d3d12_state_var var_enum,
49                     const char *var_name,
50                     const struct glsl_type *var_type,
51                     nir_variable **out_var);
52 
53 bool
54 d3d12_lower_point_sprite(nir_shader *shader,
55                          bool sprite_origin_lower_left,
56                          bool point_size_per_vertex,
57                          unsigned point_coord_enable,
58                          uint64_t next_inputs_read);
59 
60 bool
61 d3d12_lower_state_vars(struct nir_shader *s, struct d3d12_shader *shader);
62 
63 void
64 d3d12_lower_yflip(nir_shader *s);
65 
66 void
67 d3d12_lower_depth_range(nir_shader *nir);
68 
69 bool
70 d3d12_lower_load_draw_params(nir_shader *nir);
71 
72 bool
73 d3d12_lower_load_patch_vertices_in(nir_shader *nir);
74 
75 bool
76 d3d12_lower_compute_state_vars(nir_shader *nir);
77 
78 void
79 d3d12_lower_uint_cast(nir_shader *nir, bool is_signed);
80 
81 void
82 d3d12_add_missing_dual_src_target(struct nir_shader *s,
83                                   unsigned missing_mask);
84 
85 bool
86 d3d12_fix_io_uint_type(struct nir_shader *s, uint64_t in_mask, uint64_t out_mask);
87 
88 void
89 d3d12_nir_invert_depth(nir_shader *s, unsigned viewport_mask, bool clip_halfz);
90 
91 void
92 d3d12_lower_primitive_id(nir_shader *shader);
93 
94 void
95 d3d12_lower_triangle_strip(nir_shader *shader);
96 
97 bool
98 d3d12_lower_image_casts(nir_shader *s, struct d3d12_image_format_conversion_info_arr *info);
99 
100 bool
101 d3d12_disable_multisampling(nir_shader *s);
102 
103 bool
104 d3d12_split_needed_varyings(nir_shader *s);
105 
106 void
107 d3d12_write_0_to_new_varying(nir_shader *s, nir_variable *var);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif // D3D12_NIR_PASSES_H
114