nv50_context.h revision 3250bacd2411d3f1af50135599380b2140238535
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
27struct nv50_blend_stateobj {
28	struct pipe_blend_state pipe;
29	struct nouveau_stateobj *so;
30};
31
32struct nv50_context {
33	struct pipe_context pipe;
34
35	struct nv50_screen *screen;
36	unsigned pctx_id;
37
38	struct draw_context *draw;
39
40	unsigned dirty;
41	struct nv50_blend_stateobj *blend;
42};
43
44static INLINE struct nv50_context *
45nv50_context(struct pipe_context *pipe)
46{
47	return (struct nv50_context *)pipe;
48}
49
50extern void nv50_init_miptree_functions(struct nv50_context *nv50);
51extern void nv50_init_surface_functions(struct nv50_context *nv50);
52extern void nv50_init_state_functions(struct nv50_context *nv50);
53extern void nv50_init_query_functions(struct nv50_context *nv50);
54
55extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen);
56
57/* nv50_draw.c */
58extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
59
60/* nv50_vbo.c */
61extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode,
62				unsigned start, unsigned count);
63extern boolean nv50_draw_elements(struct pipe_context *pipe,
64				  struct pipe_buffer *indexBuffer,
65				  unsigned indexSize,
66				  unsigned mode, unsigned start,
67				  unsigned count);
68
69/* nv50_clear.c */
70extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
71		       unsigned clearValue);
72
73#endif
74