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 110d9d7ab70b8e30d56b417e68d43dc8c9640506..16cc053ad9ff9395192a51f59d6a8c73c8ea21ea 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 a4a1ea01e03b2cf276f77b3e7fe002398accaabb..2a8abb32a305b4a5787c114910112a8a9cce553f 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 ed47d707b2f0e20c854037090c6173597e783b1b..6be8378c0879bbcf31cbb9b3f93356ffeb8e8810 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 e6f2754dc51964bb7af4763bc3f7a88a7f4df5a7..24335fbc44de4f3bf730c0ee26892f540b88fdb8 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 81b927a67a94ddfb35c826c19a62fdadba6b0857..dd09830aa3d5fab5368a6800081dbd38528a27f8 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 19f1c3b36de6cfc5bb68b1faea5393925104aa6a..93e690161f3de0216daeb7cf1e3d30119b21ec18 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 c3bf4d43a335d1996230644c18f3cfe9787188aa..3d0ab920030269dd632eb156044c1181ec6163d5 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 59b35d1d50aed7a22e65911a969b3e7912fe307b..9ecda5990f0c6a69acfc04c25712b54185e48d95 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 ee797094d396440239e921c4496cc67e8d6a0adc..09ffc49f965a39ebf877a245fbabffcb1bb37677 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 aad4d179ac4f6c70cd4df5137ccfdfdcedbff47e..001c396d747ef1ed172c7ef7bf0e2c71a12ae758 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 68820d313391db7ada6fbc8267794dbf0f3e54d6..9616be5052ae824b7f670a95ad71c10abdba3d30 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 061a3555cbe7515edbfe545417c0b3bf9d4ea405..fb760677c8890e3ed07c8d039c186f68bcfc1e81 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 b5faf06291c071777fad6985aa84dbf46474df7e..1653ebf2a7e4a66f73b14462e39019ab3dc4f4e3 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 c482964adc04829f48f48c0aaa2c616b9a8c481e..d3ed57b19984fc24f0c391655dc22fd016f69f93 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;