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