nv50_context.h revision 716c1cd2ecbc1e86c0fd747c9fa9e095ded5fd5d
1#ifndef __NV50_CONTEXT_H__ 2#define __NV50_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#include "nouveau/nouveau_stateobj.h" 13 14#define NOUVEAU_PUSH_CONTEXT(ctx) \ 15 struct nv50_screen *ctx = nv50->screen 16#include "nouveau/nouveau_push.h" 17 18#include "nv50_state.h" 19#include "nv50_screen.h" 20 21#define NOUVEAU_ERR(fmt, args...) \ 22 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args); 23#define NOUVEAU_MSG(fmt, args...) \ 24 fprintf(stderr, "nouveau: "fmt, ##args); 25 26/* Constant buffer assignment */ 27#define NV50_CB_PMISC 0 28#define NV50_CB_PVP 1 29#define NV50_CB_PFP 2 30#define NV50_CB_PGP 3 31#define NV50_CB_TIC 4 32#define NV50_CB_TSC 5 33 34#define NV50_NEW_BLEND (1 << 0) 35#define NV50_NEW_ZSA (1 << 1) 36#define NV50_NEW_BLEND_COLOUR (1 << 2) 37#define NV50_NEW_STIPPLE (1 << 3) 38#define NV50_NEW_SCISSOR (1 << 4) 39#define NV50_NEW_VIEWPORT (1 << 5) 40#define NV50_NEW_RASTERIZER (1 << 6) 41#define NV50_NEW_FRAMEBUFFER (1 << 7) 42#define NV50_NEW_VERTPROG (1 << 8) 43#define NV50_NEW_VERTPROG_CB (1 << 9) 44#define NV50_NEW_FRAGPROG (1 << 10) 45#define NV50_NEW_FRAGPROG_CB (1 << 11) 46#define NV50_NEW_ARRAYS (1 << 12) 47 48struct nv50_blend_stateobj { 49 struct pipe_blend_state pipe; 50 struct nouveau_stateobj *so; 51}; 52 53struct nv50_zsa_stateobj { 54 struct pipe_depth_stencil_alpha_state pipe; 55 struct nouveau_stateobj *so; 56}; 57 58struct nv50_rasterizer_stateobj { 59 struct pipe_rasterizer_state pipe; 60 struct nouveau_stateobj *so; 61}; 62 63struct nv50_context { 64 struct pipe_context pipe; 65 66 struct nv50_screen *screen; 67 unsigned pctx_id; 68 69 struct draw_context *draw; 70 71 unsigned dirty; 72 struct nv50_blend_stateobj *blend; 73 struct nv50_zsa_stateobj *zsa; 74 struct nv50_rasterizer_stateobj *rasterizer; 75 struct pipe_blend_color blend_colour; 76 struct pipe_poly_stipple stipple; 77 struct pipe_scissor_state scissor; 78 struct pipe_viewport_state viewport; 79 struct pipe_framebuffer_state framebuffer; 80 struct nv50_program *vertprog; 81 struct nv50_program *fragprog; 82 struct pipe_buffer *constbuf[PIPE_SHADER_TYPES]; 83 struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS]; 84 unsigned vtxbuf_nr; 85 struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS]; 86 unsigned vtxelt_nr; 87}; 88 89static INLINE struct nv50_context * 90nv50_context(struct pipe_context *pipe) 91{ 92 return (struct nv50_context *)pipe; 93} 94 95extern void nv50_init_surface_functions(struct nv50_context *nv50); 96extern void nv50_init_state_functions(struct nv50_context *nv50); 97extern void nv50_init_query_functions(struct nv50_context *nv50); 98 99extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen); 100 101/* nv50_draw.c */ 102extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50); 103 104/* nv50_vbo.c */ 105extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode, 106 unsigned start, unsigned count); 107extern boolean nv50_draw_elements(struct pipe_context *pipe, 108 struct pipe_buffer *indexBuffer, 109 unsigned indexSize, 110 unsigned mode, unsigned start, 111 unsigned count); 112extern void nv50_vbo_validate(struct nv50_context *nv50); 113 114/* nv50_clear.c */ 115extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps, 116 unsigned clearValue); 117 118/* nv50_program.c */ 119extern void nv50_vertprog_validate(struct nv50_context *nv50); 120extern void nv50_fragprog_validate(struct nv50_context *nv50); 121extern void nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p); 122 123/* nv50_state_validate.c */ 124extern boolean nv50_state_validate(struct nv50_context *nv50); 125 126#endif 127