Debian Codegraph @

src/imagination/pco/pco.h

raw
1 /*
2 * Copyright © 2024 Imagination Technologies Ltd.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef PCO_H
8 #define PCO_H
9
10 /**
11 * \file pco.h
12 *
13 * \brief Main compiler interface header.
14 */
15
16 #include "compiler/nir/nir.h"
17
18 /* Defines. */
19 #define PCO_REG_UNUSED (~0U)
20
21 /* Driver-specific forward-declarations. */
22 struct pvr_device_info;
23
24 /* Compiler-specific forward-declarations. */
25 typedef struct _pco_shader pco_shader;
26 typedef struct _pco_ctx pco_ctx;
27 typedef struct _pco_data pco_data;
28
29 pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx);
30 void pco_ctx_setup_usclib(pco_ctx *ctx, const void *data, unsigned size);
31 void pco_ctx_update_dev_info(pco_ctx *ctx,
32 const struct pvr_device_info *dev_info);
33 const struct spirv_to_nir_options *pco_spirv_options(void);
34 const nir_shader_compiler_options *pco_nir_options(void);
35
36 void pco_preprocess_nir(pco_ctx *ctx, nir_shader *nir);
37 void pco_link_nir(pco_ctx *ctx,
38 nir_shader *producer,
39 nir_shader *consumer,
40 pco_data *producer_data,
41 pco_data *consumer_data);
42 void pco_rev_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer);
43 void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data);
44 void pco_postprocess_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data);
45
46 pco_shader *
47 pco_trans_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data, void *mem_ctx);
48 void pco_process_ir(pco_ctx *ctx, pco_shader *shader);
49 void pco_encode_ir(pco_ctx *ctx, pco_shader *shader);
50
51 pco_data *pco_shader_data(pco_shader *shader);
52
53 unsigned pco_shader_binary_size(pco_shader *shader);
54 const void *pco_shader_binary_data(pco_shader *shader);
55
56 void pco_validate_shader(pco_shader *shader, const char *when);
57
58 void pco_print_shader_stats(pco_shader *shader, FILE *fp);
59 void pco_print_shader(pco_shader *shader, FILE *fp, const char *when);
60 void pco_print_binary(pco_shader *shader, FILE *fp, const char *when);
61
62 #include "compiler/nir/nir_builder.h"
63
64 typedef struct _pco_smp_params {
65 nir_def *tex_state;
66 nir_def *smp_state;
67
68 nir_alu_type dest_type;
69
70 enum glsl_sampler_dim sampler_dim;
71
72 bool nncoords;
73 nir_def *coords;
74 nir_def *array_index;
75
76 nir_def *proj;
77
78 nir_def *lod_bias;
79 nir_def *lod_replace;
80 nir_def *lod_ddx;
81 nir_def *lod_ddy;
82
83 nir_def *addr_lo;
84 nir_def *addr_hi;
85
86 nir_def *offset;
87 nir_def *ms_index;
88
89 nir_def *write_data;
90
91 bool sample_coeffs;
92 bool sample_raw;
93 unsigned sample_components;
94
95 bool int_mode;
96 } pco_smp_params;
97 nir_intrinsic_instr *pco_emit_nir_smp(nir_builder *b, pco_smp_params *params);
98
99 enum pco_pck_format pco_pipe_to_pck_format(enum pipe_format format,
100 bool *scale,
101 bool *roundzero,
102 bool *split);
103 #endif /* PCO_H */