1 #ifndef __NV50_CONTEXT_H__
2 #define __NV50_CONTEXT_H__
4 #include "pipe/p_context.h"
5 #include "pipe/p_defines.h"
6 #include "pipe/p_state.h"
8 #include "draw/draw_vertex.h"
10 #include "nouveau/nouveau_winsys.h"
11 #include "nouveau/nouveau_gldefs.h"
13 #define NOUVEAU_PUSH_CONTEXT(ctx) \
14 struct nv50_screen *ctx = nv50->screen
15 #include "nouveau/nouveau_push.h"
17 #include "nv50_state.h"
18 #include "nv50_screen.h"
20 #define NOUVEAU_ERR(fmt, args...) \
21 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
22 #define NOUVEAU_MSG(fmt, args...) \
23 fprintf(stderr, "nouveau: "fmt, ##args);
25 #define NV50_NEW_BLEND (1 << 0)
26 #define NV50_NEW_ZSA (1 << 1)
27 #define NV50_NEW_BLEND_COLOUR (1 << 2)
28 #define NV50_NEW_STIPPLE (1 << 3)
29 #define NV50_NEW_SCISSOR (1 << 4)
30 #define NV50_NEW_VIEWPORT (1 << 5)
31 #define NV50_NEW_RASTERIZER (1 << 6)
32 #define NV50_NEW_FRAMEBUFFER (1 << 7)
34 struct nv50_blend_stateobj
{
35 struct pipe_blend_state pipe
;
36 struct nouveau_stateobj
*so
;
39 struct nv50_zsa_stateobj
{
40 struct pipe_depth_stencil_alpha_state pipe
;
41 struct nouveau_stateobj
*so
;
44 struct nv50_rasterizer_stateobj
{
45 struct pipe_rasterizer_state pipe
;
46 struct nouveau_stateobj
*so
;
50 struct pipe_context pipe
;
52 struct nv50_screen
*screen
;
55 struct draw_context
*draw
;
58 struct nv50_blend_stateobj
*blend
;
59 struct nv50_zsa_stateobj
*zsa
;
60 struct nv50_rasterizer_stateobj
*rasterizer
;
61 struct pipe_blend_color blend_colour
;
62 struct pipe_poly_stipple stipple
;
63 struct pipe_scissor_state scissor
;
64 struct pipe_viewport_state viewport
;
65 struct pipe_framebuffer_state framebuffer
;
68 static INLINE
struct nv50_context
*
69 nv50_context(struct pipe_context
*pipe
)
71 return (struct nv50_context
*)pipe
;
74 extern void nv50_init_miptree_functions(struct nv50_context
*nv50
);
75 extern void nv50_init_surface_functions(struct nv50_context
*nv50
);
76 extern void nv50_init_state_functions(struct nv50_context
*nv50
);
77 extern void nv50_init_query_functions(struct nv50_context
*nv50
);
79 extern void nv50_screen_init_miptree_functions(struct pipe_screen
*pscreen
);
82 extern struct draw_stage
*nv50_draw_render_stage(struct nv50_context
*nv50
);
85 extern boolean
nv50_draw_arrays(struct pipe_context
*, unsigned mode
,
86 unsigned start
, unsigned count
);
87 extern boolean
nv50_draw_elements(struct pipe_context
*pipe
,
88 struct pipe_buffer
*indexBuffer
,
90 unsigned mode
, unsigned start
,
94 extern void nv50_clear(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
97 extern boolean
nv50_state_validate(struct nv50_context
*nv50
);