1 #ifndef __NV40_CONTEXT_H__
2 #define __NV40_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 #include "nv40_state.h"
15 #define NOUVEAU_ERR(fmt, args...) \
16 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
17 #define NOUVEAU_MSG(fmt, args...) \
18 fprintf(stderr, "nouveau: "fmt, ##args);
20 #define NV40_NEW_TEXTURE (1 << 0)
21 #define NV40_NEW_VERTPROG (1 << 1)
22 #define NV40_NEW_FRAGPROG (1 << 2)
23 #define NV40_NEW_ARRAYS (1 << 3)
26 struct pipe_context pipe
;
27 struct nouveau_winsys
*nvws
;
29 struct draw_context
*draw
;
32 struct nouveau_grobj
*curie
;
33 struct nouveau_notifier
*sync
;
37 struct nouveau_notifier
*query
;
38 struct pipe_query_object
**query_objects
;
39 uint num_query_objects
;
43 struct nv40_sampler_state
*tex_sampler
[PIPE_MAX_SAMPLERS
];
44 struct pipe_texture
*tex_miptree
[PIPE_MAX_SAMPLERS
];
48 struct nouveau_resource
*exec_heap
;
49 struct nouveau_resource
*data_heap
;
51 struct nv40_vertex_program
*active
;
53 struct nv40_vertex_program
*current
;
54 struct pipe_buffer_handle
*constant_buf
;
58 struct nv40_fragment_program
*active
;
60 struct nv40_fragment_program
*current
;
61 struct pipe_buffer_handle
*constant_buf
;
64 struct pipe_vertex_buffer vtxbuf
[PIPE_ATTRIB_MAX
];
65 struct pipe_vertex_element vtxelt
[PIPE_ATTRIB_MAX
];
69 extern void nv40_init_state_functions(struct nv40_context
*nv40
);
70 extern void nv40_init_surface_functions(struct nv40_context
*nv40
);
71 extern void nv40_init_miptree_functions(struct nv40_context
*nv40
);
72 extern void nv40_init_query_functions(struct nv40_context
*nv40
);
75 extern struct draw_stage
*nv40_draw_render_stage(struct nv40_context
*nv40
);
78 extern void nv40_vertprog_translate(struct nv40_context
*,
79 struct nv40_vertex_program
*);
80 extern void nv40_vertprog_bind(struct nv40_context
*,
81 struct nv40_vertex_program
*);
84 extern void nv40_fragprog_translate(struct nv40_context
*,
85 struct nv40_fragment_program
*);
86 extern void nv40_fragprog_bind(struct nv40_context
*,
87 struct nv40_fragment_program
*);
89 /* nv40_state.c and friends */
90 extern void nv40_emit_hw_state(struct nv40_context
*nv40
);
91 extern void nv40_state_tex_update(struct nv40_context
*nv40
);
94 extern boolean
nv40_draw_arrays(struct pipe_context
*, unsigned mode
,
95 unsigned start
, unsigned count
);
96 extern boolean
nv40_draw_elements(struct pipe_context
*pipe
,
97 struct pipe_buffer_handle
*indexBuffer
,
99 unsigned mode
, unsigned start
,
101 extern void nv40_vbo_arrays_update(struct nv40_context
*nv40
);
104 extern void nv40_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
105 unsigned clearValue
);