nouveau: PIPE_ATTRIB_MAX -> PIPE_MAX_ATTRIBS
[mesa.git] / src / gallium / drivers / nv10 / nv10_context.h
1 #ifndef __NV10_CONTEXT_H__
2 #define __NV10_CONTEXT_H__
3
4 #include "pipe/p_context.h"
5 #include "pipe/p_defines.h"
6 #include "pipe/p_state.h"
7
8 #include "draw/draw_vertex.h"
9
10 #include "nouveau/nouveau_winsys.h"
11 #include "nouveau/nouveau_gldefs.h"
12
13 #define NOUVEAU_PUSH_CONTEXT(ctx) \
14 struct nv10_screen *ctx = nv10->screen
15 #include "nouveau/nouveau_push.h"
16
17 #include "nv10_state.h"
18
19 #define NOUVEAU_ERR(fmt, args...) \
20 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
21 #define NOUVEAU_MSG(fmt, args...) \
22 fprintf(stderr, "nouveau: "fmt, ##args);
23
24 #define NV10_NEW_VERTPROG (1 << 0)
25 #define NV10_NEW_FRAGPROG (1 << 1)
26 #define NV10_NEW_VTXARRAYS (1 << 2)
27 #define NV10_NEW_BLEND (1 << 3)
28 #define NV10_NEW_BLENDCOL (1 << 4)
29 #define NV10_NEW_RAST (1 << 5)
30 #define NV10_NEW_DSA (1 << 6)
31 #define NV10_NEW_VIEWPORT (1 << 7)
32 #define NV10_NEW_SCISSOR (1 << 8)
33 #define NV10_NEW_FRAMEBUFFER (1 << 9)
34
35 #include "nv10_screen.h"
36
37 struct nv10_context {
38 struct pipe_context pipe;
39
40 struct nouveau_winsys *nvws;
41 struct nv10_screen *screen;
42 unsigned pctx_id;
43
44 struct draw_context *draw;
45
46 int chipset;
47
48 uint32_t dirty;
49
50 struct nv10_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
51 struct nv10_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
52 unsigned dirty_samplers;
53 unsigned fp_samplers;
54 unsigned vp_samplers;
55
56 uint32_t rt_enable;
57 struct pipe_buffer *rt[4];
58 struct pipe_buffer *zeta;
59 uint32_t lma_offset;
60
61 struct nv10_blend_state *blend;
62 struct pipe_blend_color *blend_color;
63 struct nv10_rasterizer_state *rast;
64 struct nv10_depth_stencil_alpha_state *dsa;
65 struct pipe_viewport_state *viewport;
66 struct pipe_scissor_state *scissor;
67 struct pipe_framebuffer_state *framebuffer;
68 struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
69 struct vertex_info vertex_info;
70
71 struct {
72 struct pipe_buffer *buffer;
73 uint32_t format;
74 } tex[2];
75
76 unsigned vb_enable;
77 struct {
78 struct pipe_buffer *buffer;
79 unsigned delta;
80 } vb[16];
81
82 /* struct {
83
84 struct nouveau_resource *exec_heap;
85 struct nouveau_resource *data_heap;
86
87 struct nv10_vertex_program *active;
88
89 struct nv10_vertex_program *current;
90 } vertprog;
91 */
92 struct {
93 struct nv10_fragment_program *active;
94
95 struct nv10_fragment_program *current;
96 struct pipe_buffer *constant_buf;
97 } fragprog;
98
99 struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
100 struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
101 };
102
103 static INLINE struct nv10_context *
104 nv10_context(struct pipe_context *pipe)
105 {
106 return (struct nv10_context *)pipe;
107 }
108
109 extern void nv10_init_state_functions(struct nv10_context *nv10);
110 extern void nv10_init_surface_functions(struct nv10_context *nv10);
111 extern void nv10_init_miptree_functions(struct nv10_context *nv10);
112
113 extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen);
114
115 /* nv10_clear.c */
116 extern void nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps,
117 unsigned clearValue);
118
119 /* nv10_draw.c */
120 extern struct draw_stage *nv10_draw_render_stage(struct nv10_context *nv10);
121
122 /* nv10_fragprog.c */
123 extern void nv10_fragprog_bind(struct nv10_context *,
124 struct nv10_fragment_program *);
125 extern void nv10_fragprog_destroy(struct nv10_context *,
126 struct nv10_fragment_program *);
127
128 /* nv10_fragtex.c */
129 extern void nv10_fragtex_bind(struct nv10_context *);
130
131 /* nv10_prim_vbuf.c */
132 struct draw_stage *nv10_draw_vbuf_stage( struct nv10_context *nv10 );
133 extern void nv10_vtxbuf_bind(struct nv10_context* nv10);
134
135 /* nv10_state.c and friends */
136 extern void nv10_emit_hw_state(struct nv10_context *nv10);
137 extern void nv10_state_tex_update(struct nv10_context *nv10);
138
139 /* nv10_vbo.c */
140 extern boolean nv10_draw_arrays(struct pipe_context *, unsigned mode,
141 unsigned start, unsigned count);
142 extern boolean nv10_draw_elements( struct pipe_context *pipe,
143 struct pipe_buffer *indexBuffer,
144 unsigned indexSize,
145 unsigned prim, unsigned start, unsigned count);
146
147
148 #endif