nv40: remove pipe_state struct now.
authorBen Skeggs <skeggsb@gmail.com>
Mon, 25 Feb 2008 02:33:08 +0000 (13:33 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Mon, 25 Feb 2008 02:33:08 +0000 (13:33 +1100)
14 files changed:
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_fragprog.c
src/gallium/drivers/nv40/nv40_fragtex.c
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv40/nv40_state_blend.c
src/gallium/drivers/nv40/nv40_state_clip.c
src/gallium/drivers/nv40/nv40_state_fb.c
src/gallium/drivers/nv40/nv40_state_rasterizer.c
src/gallium/drivers/nv40/nv40_state_scissor.c
src/gallium/drivers/nv40/nv40_state_stipple.c
src/gallium/drivers/nv40/nv40_state_viewport.c
src/gallium/drivers/nv40/nv40_state_zsa.c
src/gallium/drivers/nv40/nv40_vbo.c
src/gallium/drivers/nv40/nv40_vertprog.c

index 110d9d7..16cc053 100644 (file)
@@ -132,32 +132,29 @@ struct nv40_context {
 
        int chipset;
 
-       unsigned dirty;
+       /* HW state derived from pipe states */
+       struct nv40_state state;
+       unsigned fallback;
 
+       /* Context state */
+       unsigned dirty;
+       struct pipe_scissor_state scissor;
+       unsigned stipple[32];
+       struct pipe_clip_state clip;
+       struct nv40_vertex_program *vertprog;
+       struct nv40_fragment_program *fragprog;
+       struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+       struct nv40_rasterizer_state *rasterizer;
+       struct nv40_zsa_state *zsa;
+       struct nv40_blend_state *blend;
+       struct pipe_blend_color blend_colour;
+       struct pipe_viewport_state viewport;
+       struct pipe_framebuffer_state framebuffer;
+       struct pipe_buffer *idxbuf;
+       unsigned idxbuf_format;
        struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
        struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
        unsigned dirty_samplers;
-
-       struct {
-               struct pipe_scissor_state scissor;
-               unsigned stipple[32];
-               struct pipe_clip_state clip;
-               struct nv40_vertex_program *vertprog;
-               struct nv40_fragment_program *fragprog;
-               struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
-               struct nv40_rasterizer_state *rasterizer;
-               struct nv40_zsa_state *zsa;
-               struct nv40_blend_state *blend;
-               struct pipe_blend_color blend_colour;
-               struct pipe_viewport_state viewport;
-               struct pipe_framebuffer_state framebuffer;
-               struct pipe_buffer *idxbuf;
-               unsigned idxbuf_format;
-       } pipe_state;
-
-       struct nv40_state state;
-       unsigned fallback;
-
        struct pipe_vertex_buffer  vtxbuf[PIPE_ATTRIB_MAX];
        struct pipe_vertex_element vtxelt[PIPE_ATTRIB_MAX];
 };
index a4a1ea0..2a8abb3 100644 (file)
@@ -790,9 +790,9 @@ nv40_fragprog_upload(struct nv40_context *nv40,
 static boolean
 nv40_fragprog_validate(struct nv40_context *nv40)
 {
-       struct nv40_fragment_program *fp = nv40->pipe_state.fragprog;
+       struct nv40_fragment_program *fp = nv40->fragprog;
        struct pipe_buffer *constbuf =
-               nv40->pipe_state.constbuf[PIPE_SHADER_FRAGMENT];
+               nv40->constbuf[PIPE_SHADER_FRAGMENT];
        struct pipe_winsys *ws = nv40->pipe.winsys;
        struct nouveau_stateobj *so;
        int i;
index ed47d70..6be8378 100644 (file)
@@ -126,7 +126,7 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)
 static boolean
 nv40_fragtex_validate(struct nv40_context *nv40)
 {
-       struct nv40_fragment_program *fp = nv40->pipe_state.fragprog;
+       struct nv40_fragment_program *fp = nv40->fragprog;
        struct nv40_state *state = &nv40->state;
        struct nouveau_stateobj *so;
        unsigned samplers, unit;
index e6f2754..24335fb 100644 (file)
@@ -57,7 +57,7 @@ nv40_blend_state_bind(struct pipe_context *pipe, void *hwcso)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.blend = hwcso;
+       nv40->blend = hwcso;
        nv40->dirty |= NV40_NEW_BLEND;
 }
 
@@ -399,7 +399,7 @@ nv40_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.rasterizer = hwcso;
+       nv40->rasterizer = hwcso;
        nv40->dirty |= NV40_NEW_RAST;
 }
 
@@ -470,7 +470,7 @@ nv40_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.zsa = hwcso;
+       nv40->zsa = hwcso;
        nv40->dirty |= NV40_NEW_ZSA;
 }
 
@@ -500,7 +500,7 @@ nv40_vp_state_bind(struct pipe_context *pipe, void *hwcso)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.vertprog = hwcso;
+       nv40->vertprog = hwcso;
        nv40->dirty |= NV40_NEW_VERTPROG;
 }
 
@@ -531,7 +531,7 @@ nv40_fp_state_bind(struct pipe_context *pipe, void *hwcso)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.fragprog = hwcso;
+       nv40->fragprog = hwcso;
        nv40->dirty |= NV40_NEW_FRAGPROG;
 }
 
@@ -551,7 +551,7 @@ nv40_set_blend_color(struct pipe_context *pipe,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.blend_colour = *bcol;
+       nv40->blend_colour = *bcol;
        nv40->dirty |= NV40_NEW_BCOL;
 }
 
@@ -561,7 +561,7 @@ nv40_set_clip_state(struct pipe_context *pipe,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.clip = *clip;
+       nv40->clip = *clip;
        nv40->dirty |= NV40_NEW_UCP;
 }
 
@@ -572,11 +572,11 @@ nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
        struct nv40_context *nv40 = nv40_context(pipe);
 
        if (shader == PIPE_SHADER_VERTEX) {
-               nv40->pipe_state.constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
+               nv40->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
                nv40->dirty |= NV40_NEW_VERTPROG;
        } else
        if (shader == PIPE_SHADER_FRAGMENT) {
-               nv40->pipe_state.constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
+               nv40->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
                nv40->dirty |= NV40_NEW_FRAGPROG;
        }
 }
@@ -587,7 +587,7 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.framebuffer = *fb;
+       nv40->framebuffer = *fb;
        nv40->dirty |= NV40_NEW_FB;
 }
 
@@ -597,7 +597,7 @@ nv40_set_polygon_stipple(struct pipe_context *pipe,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       memcpy(nv40->pipe_state.stipple, stipple->stipple, 4 * 32);
+       memcpy(nv40->stipple, stipple->stipple, 4 * 32);
        nv40->dirty |= NV40_NEW_STIPPLE;
 }
 
@@ -607,7 +607,7 @@ nv40_set_scissor_state(struct pipe_context *pipe,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.scissor = *s;
+       nv40->scissor = *s;
        nv40->dirty |= NV40_NEW_SCISSOR;
 }
 
@@ -617,7 +617,7 @@ nv40_set_viewport_state(struct pipe_context *pipe,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->pipe_state.viewport = *vpt;
+       nv40->viewport = *vpt;
        nv40->dirty |= NV40_NEW_VIEWPORT;
 }
 
index 81b927a..dd09830 100644 (file)
@@ -3,7 +3,7 @@
 static boolean
 nv40_state_blend_validate(struct nv40_context *nv40)
 {
-       so_ref(nv40->pipe_state.blend->so, &nv40->state.hw[NV40_STATE_BLEND]);
+       so_ref(nv40->blend->so, &nv40->state.hw[NV40_STATE_BLEND]);
        return TRUE;
 }
 
@@ -19,7 +19,7 @@ static boolean
 nv40_state_blend_colour_validate(struct nv40_context *nv40)
 {
        struct nouveau_stateobj *so = so_new(2, 0);
-       struct pipe_blend_color *bcol = &nv40->pipe_state.blend_colour;
+       struct pipe_blend_color *bcol = &nv40->blend_colour;
 
        so_method(so, nv40->hw->curie, NV40TCL_BLEND_COLOR, 1);
        so_data  (so, ((float_to_ubyte(bcol->color[3]) << 24) |
index 19f1c3b..93e6901 100644 (file)
@@ -3,7 +3,7 @@
 static boolean
 nv40_state_clip_validate(struct nv40_context *nv40)
 {
-       if (nv40->pipe_state.clip.nr)
+       if (nv40->clip.nr)
                nv40->fallback |= NV40_FALLBACK_TNL;
 
        return FALSE;
index c3bf4d4..3d0ab92 100644 (file)
@@ -3,7 +3,7 @@
 static boolean
 nv40_state_framebuffer_validate(struct nv40_context *nv40)
 {
-       struct pipe_framebuffer_state *fb = &nv40->pipe_state.framebuffer;
+       struct pipe_framebuffer_state *fb = &nv40->framebuffer;
        struct pipe_surface *rt[4], *zeta;
        uint32_t rt_enable, rt_format, w, h;
        int i, colour_format = 0, zeta_format = 0;
index 59b35d1..9ecda59 100644 (file)
@@ -3,7 +3,7 @@
 static boolean
 nv40_state_rasterizer_validate(struct nv40_context *nv40)
 {
-       so_ref(nv40->pipe_state.rasterizer->so,
+       so_ref(nv40->rasterizer->so,
               &nv40->state.hw[NV40_STATE_RAST]);
        return TRUE;
 }
index ee79709..09ffc49 100644 (file)
@@ -3,8 +3,8 @@
 static boolean
 nv40_state_scissor_validate(struct nv40_context *nv40)
 {
-       struct pipe_rasterizer_state *rast = &nv40->pipe_state.rasterizer->pipe;
-       struct pipe_scissor_state *s = &nv40->pipe_state.scissor;
+       struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe;
+       struct pipe_scissor_state *s = &nv40->scissor;
        struct nouveau_stateobj *so;
 
        if (nv40->state.hw[NV40_STATE_SCISSOR] &&
index aad4d17..001c396 100644 (file)
@@ -3,7 +3,7 @@
 static boolean
 nv40_state_stipple_validate(struct nv40_context *nv40)
 {
-       struct pipe_rasterizer_state *rast = &nv40->pipe_state.rasterizer->pipe;
+       struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe;
        struct nouveau_grobj *curie = nv40->hw->curie;
        struct nouveau_stateobj *so;
 
@@ -19,7 +19,7 @@ nv40_state_stipple_validate(struct nv40_context *nv40)
                so_data  (so, 1);
                so_method(so, curie, NV40TCL_POLYGON_STIPPLE_PATTERN(0), 32);
                for (i = 0; i < 32; i++)
-                       so_data(so, nv40->pipe_state.stipple[i]);
+                       so_data(so, nv40->stipple[i]);
        } else {
                so = so_new(2, 0);
                so_method(so, curie, NV40TCL_POLYGON_STIPPLE_ENABLE, 1);
index 68820d3..9616be5 100644 (file)
@@ -4,7 +4,7 @@ static boolean
 nv40_state_viewport_validate(struct nv40_context *nv40)
 {
        struct nouveau_stateobj *so = so_new(9, 0);
-       struct pipe_viewport_state *vpt = &nv40->pipe_state.viewport;
+       struct pipe_viewport_state *vpt = &nv40->viewport;
 
        so_method(so, nv40->hw->curie, NV40TCL_VIEWPORT_TRANSLATE_X, 8);
        so_data  (so, fui(vpt->translate[0]));
index 061a355..fb76067 100644 (file)
@@ -3,7 +3,7 @@
 static boolean
 nv40_state_zsa_validate(struct nv40_context *nv40)
 {
-       so_ref(nv40->pipe_state.zsa->so,
+       so_ref(nv40->zsa->so,
               &nv40->state.hw[NV40_STATE_ZSA]);
        return TRUE;
 }
index b5faf06..1653ebf 100644 (file)
@@ -46,8 +46,8 @@ nv40_vbo_set_idxbuf(struct nv40_context *nv40, struct pipe_buffer *ib,
        unsigned type;
 
        if (!ib) {
-               nv40->pipe_state.idxbuf = NULL;
-               nv40->pipe_state.idxbuf_format = 0xdeadbeef;
+               nv40->idxbuf = NULL;
+               nv40->idxbuf_format = 0xdeadbeef;
                return FALSE;
        }
 
@@ -66,11 +66,11 @@ nv40_vbo_set_idxbuf(struct nv40_context *nv40, struct pipe_buffer *ib,
                return FALSE;
        }
 
-       if (ib != nv40->pipe_state.idxbuf ||
-           type != nv40->pipe_state.idxbuf_format) {
+       if (ib != nv40->idxbuf ||
+           type != nv40->idxbuf_format) {
                nv40->dirty |= NV40_NEW_ARRAYS;
-               nv40->pipe_state.idxbuf = ib;
-               nv40->pipe_state.idxbuf_format = type;
+               nv40->idxbuf = ib;
+               nv40->idxbuf_format = type;
        }
 
        return TRUE;
@@ -348,10 +348,10 @@ nv40_draw_elements(struct pipe_context *pipe,
 static boolean
 nv40_vbo_validate(struct nv40_context *nv40)
 {
-       struct nv40_vertex_program *vp = nv40->pipe_state.vertprog;
+       struct nv40_vertex_program *vp = nv40->vertprog;
        struct nouveau_stateobj *vtxbuf, *vtxfmt;
-       struct pipe_buffer *ib = nv40->pipe_state.idxbuf;
-       unsigned ib_format = nv40->pipe_state.idxbuf_format;
+       struct pipe_buffer *ib = nv40->idxbuf;
+       unsigned ib_format = nv40->idxbuf_format;
        unsigned inputs, hw, num_hw;
        unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
 
index c482964..d3ed57b 100644 (file)
@@ -634,9 +634,9 @@ out_err:
 static boolean
 nv40_vertprog_validate(struct nv40_context *nv40)
 { 
-       struct nv40_vertex_program *vp = nv40->pipe_state.vertprog;
+       struct nv40_vertex_program *vp = nv40->vertprog;
        struct pipe_buffer *constbuf =
-               nv40->pipe_state.constbuf[PIPE_SHADER_VERTEX];
+               nv40->constbuf[PIPE_SHADER_VERTEX];
        struct nouveau_winsys *nvws = nv40->nvws;
        struct pipe_winsys *ws = nv40->pipe.winsys;
        boolean upload_code = FALSE, upload_data = FALSE;