Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / gallium / drivers / nv50 / nv50_context.h
1 #ifndef __NV50_CONTEXT_H__
2 #define __NV50_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 nv50_screen *ctx = nv50->screen
15 #include "nouveau/nouveau_push.h"
16
17 #include "nv50_state.h"
18 #include "nv50_screen.h"
19
20 #define NOUVEAU_ERR(fmt, args...) \
21 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
22 #define NOUVEAU_MSG(fmt, args...) \
23 fprintf(stderr, "nouveau: "fmt, ##args);
24
25 #define NV50_NEW_BLEND (1 << 0)
26 #define NV50_NEW_ZSA (1 << 1)
27 #define NV50_NEW_BLEND_COLOUR (1 << 2)
28 #define NV50_NEW_STIPPLE (1 << 3)
29 #define NV50_NEW_SCISSOR (1 << 4)
30 #define NV50_NEW_VIEWPORT (1 << 5)
31 #define NV50_NEW_RASTERIZER (1 << 6)
32 #define NV50_NEW_FRAMEBUFFER (1 << 7)
33
34 struct nv50_blend_stateobj {
35 struct pipe_blend_state pipe;
36 struct nouveau_stateobj *so;
37 };
38
39 struct nv50_zsa_stateobj {
40 struct pipe_depth_stencil_alpha_state pipe;
41 struct nouveau_stateobj *so;
42 };
43
44 struct nv50_rasterizer_stateobj {
45 struct pipe_rasterizer_state pipe;
46 struct nouveau_stateobj *so;
47 };
48
49 struct nv50_context {
50 struct pipe_context pipe;
51
52 struct nv50_screen *screen;
53 unsigned pctx_id;
54
55 struct draw_context *draw;
56
57 unsigned dirty;
58 struct nv50_blend_stateobj *blend;
59 struct nv50_zsa_stateobj *zsa;
60 struct nv50_rasterizer_stateobj *rasterizer;
61 struct pipe_blend_color blend_colour;
62 struct pipe_poly_stipple stipple;
63 struct pipe_scissor_state scissor;
64 struct pipe_viewport_state viewport;
65 struct pipe_framebuffer_state framebuffer;
66 };
67
68 static INLINE struct nv50_context *
69 nv50_context(struct pipe_context *pipe)
70 {
71 return (struct nv50_context *)pipe;
72 }
73
74 extern void nv50_init_miptree_functions(struct nv50_context *nv50);
75 extern void nv50_init_surface_functions(struct nv50_context *nv50);
76 extern void nv50_init_state_functions(struct nv50_context *nv50);
77 extern void nv50_init_query_functions(struct nv50_context *nv50);
78
79 extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen);
80
81 /* nv50_draw.c */
82 extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
83
84 /* nv50_vbo.c */
85 extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode,
86 unsigned start, unsigned count);
87 extern boolean nv50_draw_elements(struct pipe_context *pipe,
88 struct pipe_buffer *indexBuffer,
89 unsigned indexSize,
90 unsigned mode, unsigned start,
91 unsigned count);
92
93 /* nv50_clear.c */
94 extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
95 unsigned clearValue);
96
97 extern boolean nv50_state_validate(struct nv50_context *nv50);
98
99 #endif