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_screen *ctx = nv10->screen
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 << 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)
35 #include "nv10_screen.h"
38 struct pipe_context pipe
;
40 struct nouveau_winsys
*nvws
;
41 struct nv10_screen
*screen
;
44 struct draw_context
*draw
;
50 struct nv10_sampler_state
*tex_sampler
[PIPE_MAX_SAMPLERS
];
51 struct nv10_miptree
*tex_miptree
[PIPE_MAX_SAMPLERS
];
52 unsigned dirty_samplers
;
57 struct pipe_buffer
*rt
[4];
58 struct pipe_buffer
*zeta
;
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
;
72 struct pipe_buffer
*buffer
;
78 struct pipe_buffer
*buffer
;
84 struct nouveau_resource *exec_heap;
85 struct nouveau_resource *data_heap;
87 struct nv10_vertex_program *active;
89 struct nv10_vertex_program *current;
93 struct nv10_fragment_program
*active
;
95 struct nv10_fragment_program
*current
;
96 struct pipe_buffer
*constant_buf
;
99 struct pipe_vertex_buffer vtxbuf
[PIPE_MAX_ATTRIBS
];
100 struct pipe_vertex_element vtxelt
[PIPE_MAX_ATTRIBS
];
103 static INLINE
struct nv10_context
*
104 nv10_context(struct pipe_context
*pipe
)
106 return (struct nv10_context
*)pipe
;
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
);
113 extern void nv10_screen_init_miptree_functions(struct pipe_screen
*pscreen
);
116 extern void nv10_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
117 unsigned clearValue
);
120 extern struct draw_stage
*nv10_draw_render_stage(struct nv10_context
*nv10
);
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
*);
129 extern void nv10_fragtex_bind(struct nv10_context
*);
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
);
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
);
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
,
145 unsigned prim
, unsigned start
, unsigned count
);