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
31extern "C" {
32#endif
33
34struct d3d12_shader;
35struct d3d12_image_format_conversion_info;
36enum d3d12_state_var;
37
38nir_ssa_def *
39d3d12_get_state_var(nir_builder *b,
40                    enum d3d12_state_var var_enum,
41                    const char *var_name,
42                    const struct glsl_type *var_type,
43                    nir_variable **out_var);
44
45nir_ssa_def *
46d3d12_get_state_var(nir_builder *b,
47                    enum d3d12_state_var var_enum,
48                    const char *var_name,
49                    const struct glsl_type *var_type,
50                    nir_variable **out_var);
51
52bool
53d3d12_lower_point_sprite(nir_shader *shader,
54                         bool sprite_origin_lower_left,
55                         bool point_size_per_vertex,
56                         unsigned point_coord_enable,
57                         uint64_t next_inputs_read);
58
59bool
60d3d12_lower_state_vars(struct nir_shader *s, struct d3d12_shader *shader);
61
62void
63d3d12_lower_yflip(nir_shader *s);
64
65void
66d3d12_forward_front_face(nir_shader *nir);
67
68void
69d3d12_lower_depth_range(nir_shader *nir);
70
71bool
72d3d12_lower_load_draw_params(nir_shader *nir);
73
74bool
75d3d12_lower_load_patch_vertices_in(nir_shader *nir);
76
77bool
78d3d12_lower_compute_state_vars(nir_shader *nir);
79
80void
81d3d12_lower_uint_cast(nir_shader *nir, bool is_signed);
82
83void
84d3d12_add_missing_dual_src_target(struct nir_shader *s,
85                                  unsigned missing_mask);
86
87bool
88d3d12_fix_io_uint_type(struct nir_shader *s, uint64_t in_mask, uint64_t out_mask);
89
90void
91d3d12_nir_invert_depth(nir_shader *s, unsigned viewport_mask, bool clip_halfz);
92
93bool
94nir_lower_packed_ubo_loads(struct nir_shader *nir);
95
96void
97d3d12_lower_primitive_id(nir_shader *shader);
98
99void
100d3d12_lower_triangle_strip(nir_shader *shader);
101
102bool
103d3d12_lower_image_casts(nir_shader *s, struct d3d12_image_format_conversion_info *info);
104
105bool
106d3d12_lower_sample_pos(nir_shader *s);
107
108bool
109d3d12_disable_multisampling(nir_shader *s);
110
111bool
112d3d12_split_multistream_varyings(nir_shader *s);
113
114void
115d3d12_write_0_to_new_varying(nir_shader *s, nir_variable *var);
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif // D3D12_NIR_PASSES_H
122