1 #ifndef __NV10_CONTEXT_H__
2 #define __NV10_CONTEXT_H__
4 #include "pipe/p_context.h"
5 #include "pipe/p_defines.h"
6 #include "pipe/p_state.h"
8 #include "draw/draw_vertex.h"
10 #include "nouveau/nouveau_winsys.h"
11 #include "nouveau/nouveau_gldefs.h"
13 #define NOUVEAU_PUSH_CONTEXT(ctx) \
14 struct nv10_context *ctx = nv10
15 #include "nouveau/nouveau_push.h"
17 #include "nv10_state.h"
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);
24 #define NV10_NEW_VERTPROG (1 << 1)
25 #define NV10_NEW_FRAGPROG (1 << 2)
26 #define NV10_NEW_ARRAYS (1 << 3)
27 #define NV10_NEW_VBO (1 << 4)
30 struct pipe_context pipe
;
31 struct nouveau_winsys
*nvws
;
33 struct draw_context
*draw
;
36 struct nouveau_grobj
*celsius
;
37 struct nouveau_notifier
*sync
;
41 struct nv10_sampler_state
*tex_sampler
[PIPE_MAX_SAMPLERS
];
42 struct nv10_miptree
*tex_miptree
[PIPE_MAX_SAMPLERS
];
43 unsigned dirty_samplers
;
48 struct pipe_buffer
*rt
[4];
49 struct pipe_buffer
*zeta
;
52 struct pipe_buffer
*buffer
;
58 struct pipe_buffer
*buffer
;
62 struct vertex_info vertex_info
;
65 struct nouveau_resource
*exec_heap
;
66 struct nouveau_resource
*data_heap
;
68 struct nv10_vertex_program
*active
;
70 struct nv10_vertex_program
*current
;
71 struct pipe_buffer
*constant_buf
;
75 struct nv10_fragment_program
*active
;
77 struct nv10_fragment_program
*current
;
78 struct pipe_buffer
*constant_buf
;
81 struct pipe_vertex_buffer vtxbuf
[PIPE_ATTRIB_MAX
];
82 struct pipe_vertex_element vtxelt
[PIPE_ATTRIB_MAX
];
85 static INLINE
struct nv10_context
*
86 nv10_context(struct pipe_context
*pipe
)
88 return (struct nv10_context
*)pipe
;
91 extern void nv10_init_state_functions(struct nv10_context
*nv10
);
92 extern void nv10_init_surface_functions(struct nv10_context
*nv10
);
93 extern void nv10_init_miptree_functions(struct pipe_screen
*screen
);
96 extern void nv10_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
100 extern struct draw_stage
*nv10_draw_render_stage(struct nv10_context
*nv10
);
102 /* nv10_fragprog.c */
103 extern void nv10_fragprog_bind(struct nv10_context
*,
104 struct nv10_fragment_program
*);
105 extern void nv10_fragprog_destroy(struct nv10_context
*,
106 struct nv10_fragment_program
*);
109 extern void nv10_fragtex_bind(struct nv10_context
*);
111 /* nv10_prim_vbuf.c */
112 struct draw_stage
*nv10_draw_vbuf_stage( struct nv10_context
*nv10
);
114 /* nv10_state.c and friends */
115 extern void nv10_emit_hw_state(struct nv10_context
*nv10
);
116 extern void nv10_state_tex_update(struct nv10_context
*nv10
);
119 extern boolean
nv10_draw_arrays(struct pipe_context
*, unsigned mode
,
120 unsigned start
, unsigned count
);
121 extern boolean
nv10_draw_elements( struct pipe_context
*pipe
,
122 struct pipe_buffer
*indexBuffer
,
124 unsigned prim
, unsigned start
, unsigned count
);