nv30: remove unused sprite flipping parameter
[mesa.git] / src / gallium / drivers / nouveau / nv30 / nv30_context.h
1 #ifndef __NV30_CONTEXT_H__
2 #define __NV30_CONTEXT_H__
3
4 #include "pipe/p_format.h"
5 #include "util/u_blitter.h"
6
7 #include "nv30/nv30_screen.h"
8 #include "nv30/nv30_state.h"
9
10 #include "nouveau_context.h"
11
12 #define BUFCTX_FB 0
13 #define BUFCTX_VTXTMP 1
14 #define BUFCTX_VTXBUF 2
15 #define BUFCTX_IDXBUF 3
16 #define BUFCTX_VERTTEX(n) (4 + (n))
17 #define BUFCTX_FRAGPROG 8
18 #define BUFCTX_FRAGTEX(n) (9 + (n))
19
20 #define NV30_NEW_BLEND (1 << 0)
21 #define NV30_NEW_RASTERIZER (1 << 1)
22 #define NV30_NEW_ZSA (1 << 2)
23 #define NV30_NEW_VERTPROG (1 << 3)
24 #define NV30_NEW_VERTCONST (1 << 4)
25 #define NV30_NEW_FRAGPROG (1 << 5)
26 #define NV30_NEW_FRAGCONST (1 << 6)
27 #define NV30_NEW_BLEND_COLOUR (1 << 7)
28 #define NV30_NEW_STENCIL_REF (1 << 8)
29 #define NV30_NEW_CLIP (1 << 9)
30 #define NV30_NEW_SAMPLE_MASK (1 << 10)
31 #define NV30_NEW_FRAMEBUFFER (1 << 11)
32 #define NV30_NEW_STIPPLE (1 << 12)
33 #define NV30_NEW_SCISSOR (1 << 13)
34 #define NV30_NEW_VIEWPORT (1 << 14)
35 #define NV30_NEW_ARRAYS (1 << 15)
36 #define NV30_NEW_VERTEX (1 << 16)
37 #define NV30_NEW_CONSTBUF (1 << 17)
38 #define NV30_NEW_FRAGTEX (1 << 18)
39 #define NV30_NEW_VERTTEX (1 << 19)
40 #define NV30_NEW_SWTNL (1 << 31)
41 #define NV30_NEW_ALL 0x000fffff
42
43 struct nv30_context {
44 struct nouveau_context base;
45 struct nv30_screen *screen;
46 struct blitter_context *blitter;
47
48 struct nouveau_bufctx *bufctx;
49
50 struct {
51 unsigned rt_enable;
52 unsigned scissor_off;
53 unsigned num_vtxelts;
54 boolean prim_restart;
55 struct nv30_fragprog *fragprog;
56 } state;
57
58 uint32_t dirty;
59
60 struct draw_context *draw;
61 uint32_t draw_flags;
62 uint32_t draw_dirty;
63
64 struct nv30_blend_stateobj *blend;
65 struct nv30_rasterizer_stateobj *rast;
66 struct nv30_zsa_stateobj *zsa;
67 struct nv30_vertex_stateobj *vertex;
68
69 struct {
70 unsigned filter;
71 unsigned aniso;
72 } config;
73
74 struct {
75 struct nv30_vertprog *program;
76
77 struct pipe_resource *constbuf;
78 unsigned constbuf_nr;
79
80 struct pipe_sampler_view *textures[PIPE_MAX_SAMPLERS];
81 unsigned num_textures;
82 struct nv30_sampler_state *samplers[PIPE_MAX_SAMPLERS];
83 unsigned num_samplers;
84 unsigned dirty_samplers;
85 } vertprog;
86
87 struct {
88 struct nv30_fragprog *program;
89
90 struct pipe_resource *constbuf;
91 unsigned constbuf_nr;
92
93 struct pipe_sampler_view *textures[PIPE_MAX_SAMPLERS];
94 unsigned num_textures;
95 struct nv30_sampler_state *samplers[PIPE_MAX_SAMPLERS];
96 unsigned num_samplers;
97 unsigned dirty_samplers;
98 } fragprog;
99
100 struct pipe_framebuffer_state framebuffer;
101 struct pipe_blend_color blend_colour;
102 struct pipe_stencil_ref stencil_ref;
103 struct pipe_poly_stipple stipple;
104 struct pipe_scissor_state scissor;
105 struct pipe_viewport_state viewport;
106 struct pipe_clip_state clip;
107
108 unsigned sample_mask;
109
110 struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
111 unsigned num_vtxbufs;
112 struct pipe_index_buffer idxbuf;
113 uint32_t vbo_fifo;
114 uint32_t vbo_user;
115 unsigned vbo_min_index;
116 unsigned vbo_max_index;
117 boolean vbo_push_hint;
118
119 struct nouveau_heap *blit_vp;
120 struct pipe_resource *blit_fp;
121
122 struct pipe_query *render_cond_query;
123 unsigned render_cond_mode;
124 boolean render_cond_cond;
125
126 /*XXX: nvfx state, DO NOT USE EVER OUTSIDE "STOLEN" NVFX code */
127 unsigned is_nv4x;
128 };
129
130 static INLINE struct nv30_context *
131 nv30_context(struct pipe_context *pipe)
132 {
133 return (struct nv30_context *)pipe;
134 }
135
136 struct pipe_context *
137 nv30_context_create(struct pipe_screen *pscreen, void *priv);
138
139 void
140 nv30_vbo_init(struct pipe_context *pipe);
141
142 void
143 nv30_vbo_validate(struct nv30_context *nv30);
144
145 void
146 nv30_query_init(struct pipe_context *pipe);
147
148 void
149 nv30_state_init(struct pipe_context *pipe);
150
151 void
152 nv30_clear_init(struct pipe_context *pipe);
153
154 void
155 nv30_vertprog_init(struct pipe_context *pipe);
156
157 void
158 nv30_vertprog_validate(struct nv30_context *nv30);
159
160 void
161 nv30_fragprog_init(struct pipe_context *pipe);
162
163 void
164 nv30_fragprog_validate(struct nv30_context *nv30);
165
166 void
167 nv30_texture_init(struct pipe_context *pipe);
168
169 void
170 nv30_texture_validate(struct nv30_context *nv30);
171
172 void
173 nv30_fragtex_init(struct pipe_context *pipe);
174
175 void
176 nv30_fragtex_validate(struct nv30_context *nv30);
177
178 void
179 nv40_verttex_init(struct pipe_context *pipe);
180
181 void
182 nv40_verttex_validate(struct nv30_context *nv30);
183
184 void
185 nv30_fragtex_sampler_states_bind(struct pipe_context *pipe,
186 unsigned nr, void **hwcso);
187
188 void
189 nv40_verttex_sampler_states_bind(struct pipe_context *pipe,
190 unsigned nr, void **hwcso);
191
192 void
193 nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr,
194 struct pipe_sampler_view **views);
195
196 void
197 nv30_fragtex_set_sampler_views(struct pipe_context *pipe,
198 unsigned nr, struct pipe_sampler_view **views);
199
200 void
201 nv30_push_vbo(struct nv30_context *nv30, const struct pipe_draw_info *info);
202
203 void
204 nv30_draw_init(struct pipe_context *pipe);
205
206 void
207 nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info);
208
209 boolean
210 nv30_state_validate(struct nv30_context *nv30, boolean hwtnl);
211
212 void
213 nv30_state_release(struct nv30_context *nv30);
214
215 //XXX: needed to make it build, clean this up!
216 void
217 _nvfx_fragprog_translate(struct nv30_context *nvfx, struct nv30_fragprog *fp);
218
219 boolean
220 _nvfx_vertprog_translate(struct nv30_context *nv30, struct nv30_vertprog *vp);
221
222 #ifdef NV30_3D_VERTEX_BEGIN_END
223 #define NV30_PRIM_GL_CASE(n) \
224 case PIPE_PRIM_##n: return NV30_3D_VERTEX_BEGIN_END_##n
225
226 static INLINE unsigned
227 nv30_prim_gl(unsigned prim)
228 {
229 switch (prim) {
230 NV30_PRIM_GL_CASE(POINTS);
231 NV30_PRIM_GL_CASE(LINES);
232 NV30_PRIM_GL_CASE(LINE_LOOP);
233 NV30_PRIM_GL_CASE(LINE_STRIP);
234 NV30_PRIM_GL_CASE(TRIANGLES);
235 NV30_PRIM_GL_CASE(TRIANGLE_STRIP);
236 NV30_PRIM_GL_CASE(TRIANGLE_FAN);
237 NV30_PRIM_GL_CASE(QUADS);
238 NV30_PRIM_GL_CASE(QUAD_STRIP);
239 NV30_PRIM_GL_CASE(POLYGON);
240 default:
241 return NV30_3D_VERTEX_BEGIN_END_POINTS;
242 break;
243 }
244 }
245 #endif
246
247 #endif