xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/nouveau/nvc0/nvc0_program.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 
2 #ifndef __NVC0_PROGRAM_H__
3 #define __NVC0_PROGRAM_H__
4 
5 #include "pipe/p_state.h"
6 
7 #define NVC0_CAP_MAX_PROGRAM_TEMPS 128
8 struct nir_shader;
9 
10 
11 struct nvc0_transform_feedback_state {
12    uint32_t stride[4];
13    uint8_t stream[4];
14    uint8_t varying_count[4];
15    uint8_t varying_index[4][128];
16 };
17 
18 
19 #define GF100_SHADER_HEADER_SIZE (20 * 4)
20 #define TU102_SHADER_HEADER_SIZE (32 * 4)
21 #define NVC0_MAX_SHADER_HEADER_SIZE TU102_SHADER_HEADER_SIZE
22 
23 struct nvc0_program {
24    struct nir_shader *nir;
25    struct pipe_stream_output_info stream_output;
26 
27    uint8_t type;
28    bool translated;
29    bool need_tls;
30    uint8_t num_gprs;
31 
32    uint32_t *code;
33    unsigned code_base;
34    unsigned code_size;
35    unsigned parm_size; /* size of non-bindable uniforms (c0[]) */
36 
37    uint32_t hdr[NVC0_MAX_SHADER_HEADER_SIZE/4];
38    uint32_t flags[2];
39 
40    struct {
41       uint32_t clip_mode; /* clip/cull selection */
42       uint8_t clip_enable; /* mask of defined clip planes */
43       uint8_t cull_enable; /* mask of defined cull distances */
44       uint8_t num_ucps; /* also set to max if ClipDistance is used */
45       uint8_t edgeflag; /* attribute index of edgeflag input */
46       bool need_vertex_id;
47       bool need_draw_parameters;
48       bool layer_viewport_relative; /* also applies go gp and tp */
49    } vp;
50    struct {
51       uint8_t early_z;
52       uint8_t colors;
53       uint8_t color_interp[2];
54       bool sample_mask_in;
55       bool force_persample_interp;
56       bool flatshade;
57       bool reads_framebuffer;
58       bool post_depth_coverage;
59       bool msaa;
60    } fp;
61    struct {
62       uint32_t tess_mode; /* ~0 if defined by the other stage */
63    } tp;
64    struct {
65       uint32_t smem_size; /* shared memory (TGSI LOCAL resource) size */
66    } cp;
67    uint8_t num_barriers;
68 
69    void *relocs;
70    void *fixups;
71 
72    struct nvc0_transform_feedback_state *tfb;
73 
74    struct nouveau_heap *mem;
75 };
76 
77 void
78 nvc0_program_sp_start_id(struct nvc0_context *, int, struct nvc0_program *);
79 #endif
80