nouveau: include stdio.h and u_inlines.h in all context files since embedded changes
[mesa.git] / src / gallium / drivers / nv10 / nv10_context.h
1 #ifndef __NV10_CONTEXT_H__
2 #define __NV10_CONTEXT_H__
3
4 #include <stdio.h>
5
6 #include "pipe/p_context.h"
7 #include "pipe/p_defines.h"
8 #include "pipe/p_state.h"
9 #include "pipe/p_compiler.h"
10
11 #include "util/u_memory.h"
12 #include "util/u_math.h"
13
14 #include "draw/draw_vertex.h"
15
16 #include "nouveau/nouveau_winsys.h"
17 #include "nouveau/nouveau_gldefs.h"
18 #include "nouveau/nouveau_context.h"
19
20 #include "nv10_state.h"
21
22 #define NOUVEAU_ERR(fmt, args...) \
23 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
24 #define NOUVEAU_MSG(fmt, args...) \
25 fprintf(stderr, "nouveau: "fmt, ##args);
26
27 #define NV10_NEW_VERTPROG (1 << 0)
28 #define NV10_NEW_FRAGPROG (1 << 1)
29 #define NV10_NEW_VTXARRAYS (1 << 2)
30 #define NV10_NEW_BLEND (1 << 3)
31 #define NV10_NEW_BLENDCOL (1 << 4)
32 #define NV10_NEW_RAST (1 << 5)
33 #define NV10_NEW_DSA (1 << 6)
34 #define NV10_NEW_VIEWPORT (1 << 7)
35 #define NV10_NEW_SCISSOR (1 << 8)
36 #define NV10_NEW_FRAMEBUFFER (1 << 9)
37
38 #include "nv10_screen.h"
39
40 struct nv10_context {
41 struct pipe_context pipe;
42
43 struct nouveau_winsys *nvws;
44 struct nv10_screen *screen;
45 unsigned pctx_id;
46
47 struct draw_context *draw;
48
49 uint32_t dirty;
50
51 struct nv10_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
52 struct nv10_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
53 unsigned dirty_samplers;
54 unsigned fp_samplers;
55 unsigned vp_samplers;
56
57 uint32_t rt_enable;
58 struct pipe_buffer *rt[4];
59 struct pipe_buffer *zeta;
60 uint32_t lma_offset;
61
62 struct nv10_blend_state *blend;
63 struct pipe_blend_color *blend_color;
64 struct nv10_rasterizer_state *rast;
65 struct nv10_depth_stencil_alpha_state *dsa;
66 struct pipe_viewport_state *viewport;
67 struct pipe_scissor_state *scissor;
68 struct pipe_framebuffer_state *framebuffer;
69
70 //struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
71 float *constbuf[PIPE_SHADER_TYPES][32][4];
72 unsigned constbuf_nr[PIPE_SHADER_TYPES];
73
74 struct vertex_info vertex_info;
75
76 struct {
77 struct pipe_buffer *buffer;
78 uint32_t format;
79 } tex[2];
80
81 unsigned vb_enable;
82 struct {
83 struct pipe_buffer *buffer;
84 unsigned delta;
85 } vb[16];
86
87 /* struct {
88
89 struct nouveau_resource *exec_heap;
90 struct nouveau_resource *data_heap;
91
92 struct nv10_vertex_program *active;
93
94 struct nv10_vertex_program *current;
95 } vertprog;
96 */
97 struct {
98 struct nv10_fragment_program *active;
99
100 struct nv10_fragment_program *current;
101 struct pipe_buffer *constant_buf;
102 } fragprog;
103
104 struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
105 struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
106 };
107
108 static INLINE struct nv10_context *
109 nv10_context(struct pipe_context *pipe)
110 {
111 return (struct nv10_context *)pipe;
112 }
113
114 extern void nv10_init_state_functions(struct nv10_context *nv10);
115 extern void nv10_init_surface_functions(struct nv10_context *nv10);
116
117 extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen);
118
119 /* nv10_clear.c */
120 extern void nv10_clear(struct pipe_context *pipe, unsigned buffers,
121 const float *rgba, double depth, unsigned stencil);
122
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 void nv10_draw_arrays(struct pipe_context *, unsigned mode,
146 unsigned start, unsigned count);
147 extern void 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