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