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"
12 #include "nv40_state.h"
14 #define NOUVEAU_ERR(fmt, args...) \
15 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
16 #define NOUVEAU_MSG(fmt, args...) \
17 fprintf(stderr, "nouveau: "fmt, ##args);
19 #define NV40_NEW_TEXTURE (1 << 0)
20 #define NV40_NEW_VERTPROG (1 << 1)
21 #define NV40_NEW_FRAGPROG (1 << 2)
22 #define NV40_NEW_ARRAYS (1 << 3)
25 struct pipe_context pipe
;
26 struct nouveau_winsys
*nvws
;
28 struct draw_context
*draw
;
31 struct nouveau_grobj
*curie
;
32 struct nouveau_notifier
*sync
;
36 struct nouveau_notifier
*query
;
37 struct pipe_query_object
**query_objects
;
38 uint num_query_objects
;
42 struct nv40_sampler_state
*tex_sampler
[PIPE_MAX_SAMPLERS
];
43 struct pipe_mipmap_tree
*tex_miptree
[PIPE_MAX_SAMPLERS
];
47 struct nouveau_resource
*exec_heap
;
48 struct nouveau_resource
*data_heap
;
50 struct nv40_vertex_program
*active
;
52 struct nv40_vertex_program
*current
;
53 struct pipe_buffer_handle
*constant_buf
;
57 struct nv40_fragment_program
*active
;
59 struct nv40_fragment_program
*current
;
60 struct pipe_buffer_handle
*constant_buf
;
63 struct pipe_vertex_buffer vtxbuf
[PIPE_ATTRIB_MAX
];
64 struct pipe_vertex_element vtxelt
[PIPE_ATTRIB_MAX
];
68 extern void nv40_init_region_functions(struct nv40_context
*nv40
);
69 extern void nv40_init_surface_functions(struct nv40_context
*nv40
);
70 extern void nv40_init_state_functions(struct nv40_context
*nv40
);
73 extern struct draw_stage
*nv40_draw_render_stage(struct nv40_context
*nv40
);
76 extern boolean
nv40_miptree_layout(struct pipe_context
*,
77 struct pipe_mipmap_tree
*);
80 extern void nv40_vertprog_translate(struct nv40_context
*,
81 struct nv40_vertex_program
*);
82 extern void nv40_vertprog_bind(struct nv40_context
*,
83 struct nv40_vertex_program
*);
86 extern void nv40_fragprog_translate(struct nv40_context
*,
87 struct nv40_fragment_program
*);
88 extern void nv40_fragprog_bind(struct nv40_context
*,
89 struct nv40_fragment_program
*);
91 /* nv40_state.c and friends */
92 extern void nv40_emit_hw_state(struct nv40_context
*nv40
);
93 extern void nv40_state_tex_update(struct nv40_context
*nv40
);
96 extern boolean
nv40_draw_arrays(struct pipe_context
*, unsigned mode
,
97 unsigned start
, unsigned count
);
98 extern boolean
nv40_draw_elements(struct pipe_context
*pipe
,
99 struct pipe_buffer_handle
*indexBuffer
,
101 unsigned mode
, unsigned start
,
103 extern void nv40_vbo_arrays_update(struct nv40_context
*nv40
);
106 extern void nv40_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
107 unsigned clearValue
);
110 extern void nv40_query_begin(struct pipe_context
*, struct pipe_query_object
*);
111 extern void nv40_query_end(struct pipe_context
*, struct pipe_query_object
*);
112 extern void nv40_query_wait(struct pipe_context
*, struct pipe_query_object
*);