aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv30/nv30_state.h
blob: e27e16fae824648c3dd894392461972cf5c26210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#ifndef __NV30_STATE_H__
#define __NV30_STATE_H__

#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h"
#include "util/u_dynarray.h"

#define NV30_QUERY_ZCULL_0 (PIPE_QUERY_TYPES + 0)
#define NV30_QUERY_ZCULL_1 (PIPE_QUERY_TYPES + 1)
#define NV30_QUERY_ZCULL_2 (PIPE_QUERY_TYPES + 2)
#define NV30_QUERY_ZCULL_3 (PIPE_QUERY_TYPES + 3)

#define SB_DATA(so, u)        (so)->data[(so)->size++] = (u)
#define SB_MTHD30(so, mthd, size)                                          \
   SB_DATA((so), ((size) << 18) | (7 << 13) | NV30_3D_##mthd)
#define SB_MTHD40(so, mthd, size)                                          \
   SB_DATA((so), ((size) << 18) | (7 << 13) | NV40_3D_##mthd)

struct nv30_blend_stateobj {
   struct pipe_blend_state pipe;
   unsigned data[16];
   unsigned size;
};

struct nv30_rasterizer_stateobj {
   struct pipe_rasterizer_state pipe;
   unsigned data[32];
   unsigned size;
};

struct nv30_zsa_stateobj {
   struct pipe_depth_stencil_alpha_state pipe;
   unsigned data[32];
   unsigned size;
};

struct nv30_sampler_state {
   struct pipe_sampler_state pipe;
   unsigned fmt;
   unsigned wrap;
   unsigned en;
   unsigned filt;
   unsigned bcol;
   /* 4.8 */
   unsigned min_lod;
   unsigned max_lod;
};

struct nv30_sampler_view {
   struct pipe_sampler_view pipe;
   unsigned fmt;
   unsigned swz;
   unsigned filt;
   unsigned filt_mask;
   unsigned wrap;
   unsigned wrap_mask;
   unsigned npot_size0;
   unsigned npot_size1;
   /* 4.8 */
   unsigned base_lod;
   unsigned high_lod;
};

struct nv30_shader_reloc {
   unsigned location;
   int target;
};

struct nv30_vertprog_exec {
   uint32_t data[4];
};

struct nv30_vertprog_data {
   int index; /* immediates == -1 */
   float value[4];
};

struct nv30_vertprog {
   struct pipe_shader_state pipe;
   struct tgsi_shader_info info;

   struct draw_vertex_shader *draw;
   boolean translated;
   unsigned enabled_ucps;
   uint16_t texcoord[10];

   struct util_dynarray branch_relocs;
   struct nv30_vertprog_exec *insns;
   unsigned nr_insns;

   struct util_dynarray const_relocs;
   struct nv30_vertprog_data *consts;
   unsigned nr_consts;

   struct nouveau_heap *exec;
   struct nouveau_heap *data;
   uint32_t ir;
   uint32_t or;
   void *nvfx;
};

struct nv30_fragprog_data {
   unsigned offset;
   unsigned index;
};

struct nv30_fragprog {
   struct pipe_shader_state pipe;
   struct tgsi_shader_info info;

   struct draw_fragment_shader *draw;
   boolean translated;

   uint32_t *insn;
   unsigned insn_len;

   uint16_t texcoord[10];
   struct nv30_fragprog_data *consts;
   unsigned nr_consts;

   struct pipe_resource *buffer;
   uint32_t vp_or; /* appended to VP_RESULT_EN */
   uint32_t fp_control;
   uint32_t point_sprite_control;
   uint32_t coord_conventions;
   uint32_t texcoords;
   uint32_t rt_enable;
};

struct nv30_vertex_element {
   unsigned state;
};

struct nv30_vertex_stateobj {
   struct pipe_vertex_element pipe[PIPE_MAX_ATTRIBS];
   struct translate *translate;
   bool need_conversion;
   unsigned num_elements;
   unsigned vtx_size;
   unsigned vtx_per_packet_max;
   struct nv30_vertex_element element[];
};

#endif