1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2016 Red Hat
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21bf215546Sopenharmony_ci * SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#ifndef ST_NIR_H
25bf215546Sopenharmony_ci#define ST_NIR_H
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci#include "st_context.h"
28bf215546Sopenharmony_ci#include "compiler/shader_enums.h"
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#ifdef __cplusplus
31bf215546Sopenharmony_ciextern "C" {
32bf215546Sopenharmony_ci#endif
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_cistruct nir_shader;
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_civoid st_nir_lower_builtin(struct nir_shader *shader);
37bf215546Sopenharmony_civoid st_nir_lower_tex_src_plane(struct nir_shader *shader, unsigned free_slots,
38bf215546Sopenharmony_ci                                unsigned lower_2plane, unsigned lower_3plane);
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_civoid st_nir_lower_wpos_ytransform(struct nir_shader *nir,
41bf215546Sopenharmony_ci                                  struct gl_program *prog,
42bf215546Sopenharmony_ci                                  struct pipe_screen *pscreen);
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_cichar *st_finalize_nir(struct st_context *st, struct gl_program *prog,
45bf215546Sopenharmony_ci                      struct gl_shader_program *shader_program,
46bf215546Sopenharmony_ci                      struct nir_shader *nir, bool finalize_by_driver,
47bf215546Sopenharmony_ci                      bool is_before_variants);
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_cibool
50bf215546Sopenharmony_cist_link_nir(struct gl_context *ctx,
51bf215546Sopenharmony_ci            struct gl_shader_program *shader_program);
52bf215546Sopenharmony_ci
53bf215546Sopenharmony_civoid st_nir_assign_vs_in_locations(struct nir_shader *nir);
54bf215546Sopenharmony_civoid st_nir_assign_varying_locations(struct st_context *st,
55bf215546Sopenharmony_ci                                     struct nir_shader *nir);
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_civoid st_nir_lower_samplers(struct pipe_screen *screen, struct nir_shader *nir,
58bf215546Sopenharmony_ci                           struct gl_shader_program *shader_program,
59bf215546Sopenharmony_ci                           struct gl_program *prog);
60bf215546Sopenharmony_civoid st_nir_lower_uniforms(struct st_context *st, struct nir_shader *nir);
61bf215546Sopenharmony_ci
62bf215546Sopenharmony_cistruct pipe_shader_state *
63bf215546Sopenharmony_cist_nir_finish_builtin_shader(struct st_context *st,
64bf215546Sopenharmony_ci                             struct nir_shader *nir);
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_cistruct pipe_shader_state *
67bf215546Sopenharmony_cist_nir_make_passthrough_shader(struct st_context *st,
68bf215546Sopenharmony_ci                               const char *shader_name,
69bf215546Sopenharmony_ci                               gl_shader_stage stage,
70bf215546Sopenharmony_ci                               unsigned num_vars,
71bf215546Sopenharmony_ci                               unsigned *input_locations,
72bf215546Sopenharmony_ci                               unsigned *output_locations,
73bf215546Sopenharmony_ci                               unsigned *interpolation_modes,
74bf215546Sopenharmony_ci                               unsigned sysval_mask);
75bf215546Sopenharmony_civoid
76bf215546Sopenharmony_cist_nir_add_point_size(struct nir_shader *nir);
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_cistruct pipe_shader_state *
79bf215546Sopenharmony_cist_nir_make_clearcolor_shader(struct st_context *st);
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci#ifdef __cplusplus
82bf215546Sopenharmony_ci}
83bf215546Sopenharmony_ci#endif
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_ci#endif /* ST_NIR_H */
86