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 #define NOUVEAU_PUSH_CONTEXT(ctx) \
14 struct nv40_context *ctx = nv40
15 #include "pipe/nouveau/nouveau_push.h"
17 #include "nv40_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 NV40_NEW_VERTPROG (1 << 1)
25 #define NV40_NEW_FRAGPROG (1 << 2)
26 #define NV40_NEW_ARRAYS (1 << 3)
29 struct pipe_context pipe
;
30 struct nouveau_winsys
*nvws
;
32 struct draw_context
*draw
;
35 struct nouveau_grobj
*curie
;
36 struct nouveau_notifier
*sync
;
39 struct nouveau_notifier
*query
;
40 struct nouveau_resource
*query_heap
;
44 struct nv40_sampler_state
*tex_sampler
[PIPE_MAX_SAMPLERS
];
45 struct nv40_miptree
*tex_miptree
[PIPE_MAX_SAMPLERS
];
46 unsigned dirty_samplers
;
51 struct pipe_buffer_handle
*rt
[4];
52 struct pipe_buffer_handle
*zeta
;
55 struct pipe_buffer_handle
*buffer
;
61 struct pipe_buffer_handle
*buffer
;
66 struct nouveau_resource
*exec_heap
;
67 struct nouveau_resource
*data_heap
;
69 struct nv40_vertex_program
*active
;
71 struct nv40_vertex_program
*current
;
72 struct pipe_buffer_handle
*constant_buf
;
76 struct nv40_fragment_program
*active
;
78 struct nv40_fragment_program
*current
;
79 struct pipe_buffer_handle
*constant_buf
;
82 struct pipe_vertex_buffer vtxbuf
[PIPE_ATTRIB_MAX
];
83 struct pipe_vertex_element vtxelt
[PIPE_ATTRIB_MAX
];
86 static inline struct nv40_context
*
87 nv40_context(struct pipe_context
*pipe
)
89 return (struct nv40_context
*)pipe
;
92 extern void nv40_init_state_functions(struct nv40_context
*nv40
);
93 extern void nv40_init_surface_functions(struct nv40_context
*nv40
);
94 extern void nv40_init_miptree_functions(struct nv40_context
*nv40
);
95 extern void nv40_init_query_functions(struct nv40_context
*nv40
);
98 extern struct draw_stage
*nv40_draw_render_stage(struct nv40_context
*nv40
);
100 /* nv40_vertprog.c */
101 extern void nv40_vertprog_translate(struct nv40_context
*,
102 struct nv40_vertex_program
*);
103 extern void nv40_vertprog_bind(struct nv40_context
*,
104 struct nv40_vertex_program
*);
105 extern void nv40_vertprog_destroy(struct nv40_context
*,
106 struct nv40_vertex_program
*);
108 /* nv40_fragprog.c */
109 extern void nv40_fragprog_translate(struct nv40_context
*,
110 struct nv40_fragment_program
*);
111 extern void nv40_fragprog_bind(struct nv40_context
*,
112 struct nv40_fragment_program
*);
113 extern void nv40_fragprog_destroy(struct nv40_context
*,
114 struct nv40_fragment_program
*);
116 /* nv40_state.c and friends */
117 extern void nv40_emit_hw_state(struct nv40_context
*nv40
);
118 extern void nv40_state_tex_update(struct nv40_context
*nv40
);
121 extern boolean
nv40_draw_arrays(struct pipe_context
*, unsigned mode
,
122 unsigned start
, unsigned count
);
123 extern boolean
nv40_draw_elements(struct pipe_context
*pipe
,
124 struct pipe_buffer_handle
*indexBuffer
,
126 unsigned mode
, unsigned start
,
130 extern void nv40_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
131 unsigned clearValue
);