Merge remote branch 'upstream/gallium-0.1' into gallium-0.1
[mesa.git] / src / gallium / drivers / nv30 / nv30_context.h
index f49450f82d9e21e81216ac6c4ef6c60989baafe9..0ad1dc6f912a4a7a80c813f6fa5cb360c0543082 100644 (file)
@@ -76,6 +76,31 @@ enum nv30_state_index {
 #define NV30_NEW_ARRAYS                (1 << 11)
 #define NV30_NEW_UCP           (1 << 12)
 
+struct nv30_rasterizer_state {
+       struct pipe_rasterizer_state pipe;
+       struct nouveau_stateobj *so;
+};
+
+struct nv30_zsa_state {
+       struct pipe_depth_stencil_alpha_state pipe;
+       struct nouveau_stateobj *so;
+};
+
+struct nv30_blend_state {
+       struct pipe_blend_state pipe;
+       struct nouveau_stateobj *so;
+};
+
+
+struct nv30_state {
+       unsigned scissor_enabled;
+       unsigned stipple_enabled;
+       unsigned viewport_bypass;
+
+       uint64_t dirty;
+       struct nouveau_stateobj *hw[NV30_STATE_MAX];
+};
+
 struct nv30_context {
        struct pipe_context pipe;
 
@@ -85,7 +110,8 @@ struct nv30_context {
 
        struct draw_context *draw;
 
-       uint32_t dirty;
+       /* HW state derived from pipe states */
+       struct nv30_state state;
 
        struct nv30_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
        struct nv30_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
@@ -93,6 +119,17 @@ struct nv30_context {
        unsigned fp_samplers;
        unsigned vp_samplers;
 
+       /* Context state */
+       unsigned dirty;
+       struct pipe_scissor_state scissor;
+       unsigned stipple[32];
+       struct nv30_rasterizer_state *rasterizer;
+       struct nv30_zsa_state *zsa;
+       struct nv30_blend_state *blend;
+       struct pipe_blend_color blend_colour;
+       struct pipe_viewport_state viewport;
+       struct pipe_framebuffer_state framebuffer;
+
        uint32_t rt_enable;
        struct pipe_buffer *rt[2];
        struct pipe_buffer *zeta;
@@ -132,9 +169,16 @@ nv30_context(struct pipe_context *pipe)
        return (struct nv30_context *)pipe;
 }
 
+struct nv30_state_entry {
+       boolean (*validate)(struct nv30_context *nv30);
+       struct {
+               unsigned pipe;
+               unsigned hw;
+       } dirty;
+};
+
 extern void nv30_init_state_functions(struct nv30_context *nv30);
 extern void nv30_init_surface_functions(struct nv30_context *nv30);
-extern void nv30_init_miptree_functions(struct nv30_context *nv30);
 extern void nv30_init_query_functions(struct nv30_context *nv30);
 
 extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen);
@@ -162,8 +206,17 @@ extern void nv30_fragprog_destroy(struct nv30_context *,
 extern void nv30_fragtex_bind(struct nv30_context *);
 
 /* nv30_state.c and friends */
+extern boolean nv30_state_validate(struct nv30_context *nv30);
 extern void nv30_emit_hw_state(struct nv30_context *nv30);
 extern void nv30_state_tex_update(struct nv30_context *nv30);
+extern struct nv30_state_entry nv30_state_rasterizer;
+extern struct nv30_state_entry nv30_state_scissor;
+extern struct nv30_state_entry nv30_state_stipple;
+extern struct nv30_state_entry nv30_state_blend;
+extern struct nv30_state_entry nv30_state_blend_colour;
+extern struct nv30_state_entry nv30_state_zsa;
+extern struct nv30_state_entry nv30_state_viewport;
+extern struct nv30_state_entry nv30_state_framebuffer;
 
 /* nv30_vbo.c */
 extern boolean nv30_draw_arrays(struct pipe_context *, unsigned mode,