nv30_context.h revision 84cc07dc89c0ebce4ad55b4b3684d4420a202683
1#ifndef __NV30_CONTEXT_H__ 2#define __NV30_CONTEXT_H__ 3 4#include "pipe/p_context.h" 5#include "pipe/p_defines.h" 6#include "pipe/p_state.h" 7 8#include "draw/draw_vertex.h" 9 10#include "nouveau/nouveau_winsys.h" 11#include "nouveau/nouveau_gldefs.h" 12 13#define NOUVEAU_PUSH_CONTEXT(ctx) \ 14 struct nv30_context *ctx = nv30 15#include "nouveau/nouveau_push.h" 16 17#include "nv30_state.h" 18 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); 23 24#define NV30_NEW_VERTPROG (1 << 1) 25#define NV30_NEW_FRAGPROG (1 << 2) 26#define NV30_NEW_ARRAYS (1 << 3) 27 28struct nv30_context { 29 struct pipe_context pipe; 30 struct nouveau_winsys *nvws; 31 32 struct draw_context *draw; 33 34 int chipset; 35 struct nouveau_grobj *rankine; 36 struct nouveau_notifier *sync; 37 38 /* query objects */ 39 struct nouveau_notifier *query; 40 struct nouveau_resource *query_heap; 41 42 uint32_t dirty; 43 44 struct nv30_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS]; 45 struct nv30_miptree *tex_miptree[PIPE_MAX_SAMPLERS]; 46 unsigned dirty_samplers; 47 unsigned fp_samplers; 48 unsigned vp_samplers; 49 50 uint32_t rt_enable; 51 struct pipe_buffer *rt[4]; 52 struct pipe_buffer *zeta; 53 54 struct { 55 struct pipe_buffer *buffer; 56 uint32_t format; 57 } tex[16]; 58 59 unsigned vb_enable; 60 struct { 61 struct pipe_buffer *buffer; 62 unsigned delta; 63 } vb[16]; 64 65 struct { 66 struct nouveau_resource *exec_heap; 67 struct nouveau_resource *data_heap; 68 69 struct nv30_vertex_program *active; 70 71 struct nv30_vertex_program *current; 72 struct pipe_buffer *constant_buf; 73 } vertprog; 74 75 struct { 76 struct nv30_fragment_program *active; 77 78 struct nv30_fragment_program *current; 79 struct pipe_buffer *constant_buf; 80 } fragprog; 81 82 struct pipe_vertex_buffer vtxbuf[PIPE_ATTRIB_MAX]; 83 struct pipe_vertex_element vtxelt[PIPE_ATTRIB_MAX]; 84}; 85 86static INLINE struct nv30_context * 87nv30_context(struct pipe_context *pipe) 88{ 89 return (struct nv30_context *)pipe; 90} 91 92extern void nv30_init_state_functions(struct nv30_context *nv30); 93extern void nv30_init_surface_functions(struct nv30_context *nv30); 94extern void nv30_init_miptree_functions(struct pipe_screen *screen); 95extern void nv30_init_query_functions(struct nv30_context *nv30); 96 97/* nv30_draw.c */ 98extern struct draw_stage *nv30_draw_render_stage(struct nv30_context *nv30); 99 100/* nv30_vertprog.c */ 101extern void nv30_vertprog_translate(struct nv30_context *, 102 struct nv30_vertex_program *); 103extern void nv30_vertprog_bind(struct nv30_context *, 104 struct nv30_vertex_program *); 105extern void nv30_vertprog_destroy(struct nv30_context *, 106 struct nv30_vertex_program *); 107 108/* nv30_fragprog.c */ 109extern void nv30_fragprog_translate(struct nv30_context *, 110 struct nv30_fragment_program *); 111extern void nv30_fragprog_bind(struct nv30_context *, 112 struct nv30_fragment_program *); 113extern void nv30_fragprog_destroy(struct nv30_context *, 114 struct nv30_fragment_program *); 115 116/* nv30_fragtex.c */ 117extern void nv30_fragtex_bind(struct nv30_context *); 118 119/* nv30_state.c and friends */ 120extern void nv30_emit_hw_state(struct nv30_context *nv30); 121extern void nv30_state_tex_update(struct nv30_context *nv30); 122 123/* nv30_vbo.c */ 124extern boolean nv30_draw_arrays(struct pipe_context *, unsigned mode, 125 unsigned start, unsigned count); 126extern boolean nv30_draw_elements(struct pipe_context *pipe, 127 struct pipe_buffer *indexBuffer, 128 unsigned indexSize, 129 unsigned mode, unsigned start, 130 unsigned count); 131 132/* nv30_clear.c */ 133extern void nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps, 134 unsigned clearValue); 135 136#endif 137