1 #ifndef __NV30_CONTEXT_H__
2 #define __NV30_CONTEXT_H__
4 #include "pipe/p_context.h"
5 #include "pipe/p_defines.h"
6 #include "pipe/p_state.h"
8 #include "pipe/draw/draw_vertex.h"
10 #include "pipe/nouveau/nouveau_winsys.h"
11 #include "pipe/nouveau/nouveau_gldefs.h"
13 #define NOUVEAU_PUSH_CONTEXT(ctx) \
14 struct nv30_context *ctx = nv30
15 #include "pipe/nouveau/nouveau_push.h"
17 #include "nv30_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 NV30_NEW_VERTPROG (1 << 1)
25 #define NV30_NEW_FRAGPROG (1 << 2)
26 #define NV30_NEW_ARRAYS (1 << 3)
29 struct pipe_context pipe
;
30 struct nouveau_winsys
*nvws
;
32 struct draw_context
*draw
;
35 struct nouveau_grobj
*rankine
;
36 struct nouveau_notifier
*sync
;
39 struct nouveau_notifier
*query
;
40 struct nouveau_resource
*query_heap
;
44 struct nv30_sampler_state
*tex_sampler
[PIPE_MAX_SAMPLERS
];
45 struct nv30_miptree
*tex_miptree
[PIPE_MAX_SAMPLERS
];
46 unsigned dirty_samplers
;
51 struct pipe_buffer
*rt
[4];
52 struct pipe_buffer
*zeta
;
55 struct pipe_buffer
*buffer
;
61 struct pipe_buffer
*buffer
;
66 struct nouveau_resource
*exec_heap
;
67 struct nouveau_resource
*data_heap
;
69 struct nv30_vertex_program
*active
;
71 struct nv30_vertex_program
*current
;
72 struct pipe_buffer
*constant_buf
;
76 struct nv30_fragment_program
*active
;
78 struct nv30_fragment_program
*current
;
79 struct pipe_buffer
*constant_buf
;
82 struct pipe_vertex_buffer vtxbuf
[PIPE_ATTRIB_MAX
];
83 struct pipe_vertex_element vtxelt
[PIPE_ATTRIB_MAX
];
86 static INLINE
struct nv30_context
*
87 nv30_context(struct pipe_context
*pipe
)
89 return (struct nv30_context
*)pipe
;
92 extern void nv30_init_state_functions(struct nv30_context
*nv30
);
93 extern void nv30_init_surface_functions(struct nv30_context
*nv30
);
94 extern void nv30_init_miptree_functions(struct nv30_context
*nv30
);
95 extern void nv30_init_query_functions(struct nv30_context
*nv30
);
98 extern struct draw_stage
*nv30_draw_render_stage(struct nv30_context
*nv30
);
100 /* nv30_vertprog.c */
101 extern void nv30_vertprog_translate(struct nv30_context
*,
102 struct nv30_vertex_program
*);
103 extern void nv30_vertprog_bind(struct nv30_context
*,
104 struct nv30_vertex_program
*);
105 extern void nv30_vertprog_destroy(struct nv30_context
*,
106 struct nv30_vertex_program
*);
108 /* nv30_fragprog.c */
109 extern void nv30_fragprog_translate(struct nv30_context
*,
110 struct nv30_fragment_program
*);
111 extern void nv30_fragprog_bind(struct nv30_context
*,
112 struct nv30_fragment_program
*);
113 extern void nv30_fragprog_destroy(struct nv30_context
*,
114 struct nv30_fragment_program
*);
117 extern void nv30_fragtex_bind(struct nv30_context
*);
119 /* nv30_state.c and friends */
120 extern void nv30_emit_hw_state(struct nv30_context
*nv30
);
121 extern void nv30_state_tex_update(struct nv30_context
*nv30
);
124 extern boolean
nv30_draw_arrays(struct pipe_context
*, unsigned mode
,
125 unsigned start
, unsigned count
);
126 extern boolean
nv30_draw_elements(struct pipe_context
*pipe
,
127 struct pipe_buffer
*indexBuffer
,
129 unsigned mode
, unsigned start
,
133 extern void nv30_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
134 unsigned clearValue
);