Merge branch 'mesa_7_5_branch'
[mesa.git] / src / gallium / drivers / nv40 / nv40_state_emit.c
index 722b9f31e6df2af27b933f372227a794de289e14..198692965dc4ad3d482c2826161af03c04457524 100644 (file)
@@ -5,7 +5,6 @@
 static struct nv40_state_entry *render_states[] = {
        &nv40_state_framebuffer,
        &nv40_state_rasterizer,
-       &nv40_state_clip,
        &nv40_state_scissor,
        &nv40_state_stipple,
        &nv40_state_fragprog,
@@ -22,7 +21,6 @@ static struct nv40_state_entry *render_states[] = {
 static struct nv40_state_entry *swtnl_states[] = {
        &nv40_state_framebuffer,
        &nv40_state_rasterizer,
-       &nv40_state_clip,
        &nv40_state_scissor,
        &nv40_state_stipple,
        &nv40_state_fragprog,
@@ -40,14 +38,6 @@ static void
 nv40_state_do_validate(struct nv40_context *nv40,
                       struct nv40_state_entry **states)
 {
-       const struct pipe_framebuffer_state *fb = &nv40->framebuffer;
-       unsigned i;
-
-       for (i = 0; i < fb->num_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        while (*states) {
                struct nv40_state_entry *e = *states;
 
@@ -64,10 +54,11 @@ nv40_state_do_validate(struct nv40_context *nv40,
 void
 nv40_state_emit(struct nv40_context *nv40)
 {
+       struct nouveau_channel *chan = nv40->screen->base.channel;
        struct nv40_state *state = &nv40->state;
        struct nv40_screen *screen = nv40->screen;
        unsigned i, samplers;
-       uint64 states;
+       uint64_t states;
 
        if (nv40->pctx_id != screen->cur_pctx) {
                for (i = 0; i < NV40_STATE_MAX; i++) {
@@ -82,7 +73,8 @@ nv40_state_emit(struct nv40_context *nv40)
                if (!(states & (1ULL << i)))
                        continue;
                so_ref (state->hw[i], &nv40->screen->state[i]);
-               so_emit(nv40->nvws, nv40->screen->state[i]);
+               if (state->hw[i])
+                       so_emit(chan, nv40->screen->state[i]);
                states &= ~(1ULL << i);
        }
 
@@ -96,17 +88,17 @@ nv40_state_emit(struct nv40_context *nv40)
 
        state->dirty = 0;
 
-       so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_FB]);
+       so_emit_reloc_markers(chan, state->hw[NV40_STATE_FB]);
        for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
                if (!(samplers & (1 << i)))
                        continue;
-               so_emit_reloc_markers(nv40->nvws,
+               so_emit_reloc_markers(chan,
                                      state->hw[NV40_STATE_FRAGTEX0+i]);
                samplers &= ~(1ULL << i);
        }
-       so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_FRAGPROG]);
+       so_emit_reloc_markers(chan, state->hw[NV40_STATE_FRAGPROG]);
        if (state->hw[NV40_STATE_VTXBUF] && nv40->render_mode == HW)
-               so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_VTXBUF]);
+               so_emit_reloc_markers(chan, state->hw[NV40_STATE_VTXBUF]);
 }
 
 boolean
@@ -126,8 +118,7 @@ nv40_state_validate(struct nv40_context *nv40)
                nv40->pipe.flush(&nv40->pipe, 0, NULL);
                nv40->dirty |= (NV40_NEW_VIEWPORT |
                                NV40_NEW_VERTPROG |
-                               NV40_NEW_ARRAYS |
-                               NV40_NEW_UCP);
+                               NV40_NEW_ARRAYS);
                nv40->render_mode = HW;
        }
 
@@ -152,8 +143,7 @@ nv40_state_validate_swtnl(struct nv40_context *nv40)
                nv40->pipe.flush(&nv40->pipe, 0, NULL);
                nv40->dirty |= (NV40_NEW_VIEWPORT |
                                NV40_NEW_VERTPROG |
-                               NV40_NEW_ARRAYS |
-                               NV40_NEW_UCP);
+                               NV40_NEW_ARRAYS);
                nv40->render_mode = SWTNL;
        }
 
@@ -170,6 +160,7 @@ nv40_state_validate_swtnl(struct nv40_context *nv40)
                draw_set_viewport_state(draw, &nv40->viewport);
 
        if (nv40->draw_dirty & NV40_NEW_ARRAYS) {
+               draw_set_edgeflags(draw, nv40->edgeflags);
                draw_set_vertex_buffers(draw, nv40->vtxbuf_nr, nv40->vtxbuf);
                draw_set_vertex_elements(draw, nv40->vtxelt_nr, nv40->vtxelt);  
        }