• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2023 Alyssa Rosenzweig
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #pragma once
7 
8 #include <stdbool.h>
9 #include <stdint.h>
10 #include "nir.h"
11 #include "shader_enums.h"
12 
13 enum mesa_prim;
14 
15 struct agx_lower_output_to_var_state {
16    struct nir_variable *outputs[NUM_TOTAL_VARYING_SLOTS];
17 };
18 
19 bool agx_lower_output_to_var(struct nir_builder *b, struct nir_instr *instr,
20                              void *data);
21 
22 struct nir_def *agx_load_per_vertex_input(struct nir_builder *b,
23                                           nir_intrinsic_instr *intr,
24                                           struct nir_def *vertex);
25 
26 nir_def *agx_nir_load_vertex_id(struct nir_builder *b, nir_def *id,
27                                 unsigned index_size_B);
28 
29 bool agx_nir_lower_sw_vs(struct nir_shader *s, unsigned index_size_B);
30 
31 bool agx_nir_lower_vs_before_gs(struct nir_shader *vs,
32                                 const struct nir_shader *libagx);
33 
34 bool agx_nir_lower_gs(struct nir_shader *gs, const struct nir_shader *libagx,
35                       bool rasterizer_discard, struct nir_shader **gs_count,
36                       struct nir_shader **gs_copy, struct nir_shader **pre_gs,
37                       enum mesa_prim *out_mode, unsigned *out_count_words);
38 
39 bool agx_nir_lower_tcs(struct nir_shader *tcs, const struct nir_shader *libagx);
40 
41 bool agx_nir_lower_tes(struct nir_shader *tes, const struct nir_shader *libagx,
42                        bool to_hw_vs);
43 
44 uint64_t agx_tcs_per_vertex_outputs(const struct nir_shader *nir);
45 
46 unsigned agx_tcs_output_stride(const struct nir_shader *nir);
47