nouveau: match interface changes
authorBen Skeggs <skeggsb@gmail.com>
Thu, 13 Mar 2008 01:36:35 +0000 (12:36 +1100)
committerBen Skeggs <skeggsb@gmail.com>
Thu, 13 Mar 2008 02:39:16 +0000 (13:39 +1100)
src/gallium/drivers/nv30/nv30_fragprog.c
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv30/nv30_state.h
src/gallium/drivers/nv30/nv30_vertprog.c
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_fragprog.c
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv40/nv40_state.h
src/gallium/drivers/nv40/nv40_vertprog.c
src/gallium/drivers/nv50/nv50_state.c

index 0a2ba04f958fd1d2512c176afbc6b09311ad3c24..6f61d36f4e8a09f193dff7cac2b6356edebbf818 100644 (file)
@@ -583,15 +583,14 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc,
                arith(fpc, sat, ADD, dst, mask, src[0], neg(src[1]), none);
                break;
        case TGSI_OPCODE_TEX:
-               if (finst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtDivide ==
-                               TGSI_EXTSWIZZLE_W) {
-                       tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
-               } else
-                       tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
+               tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
                break;
        case TGSI_OPCODE_TXB:
                tex(fpc, sat, TXB, unit, dst, mask, src[0], none, none);
                break;
+       case TGSI_OPCODE_TXP:
+               tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
+               break;
        case TGSI_OPCODE_XPD:
                tmp = temp(fpc);
                arith(fpc, 0, MUL, tmp, mask,
@@ -683,7 +682,7 @@ nv30_fragprog_translate(struct nv30_context *nv30,
        fpc->high_temp = -1;
        fpc->num_regs = 2;
 
-       tgsi_parse_init(&parse, fp->pipe->tokens);
+       tgsi_parse_init(&parse, fp->pipe.tokens);
 
        while (!tgsi_parse_end_of_tokens(&parse)) {
                tgsi_parse_token(&parse);
index 319d53fccac7728965a2d6be2adc4cb2c013e5d0..951a32bc81eb68968331f98ce6dfb82adb809d73 100644 (file)
@@ -231,14 +231,15 @@ nv30_sampler_state_create(struct pipe_context *pipe,
 }
 
 static void
-nv30_sampler_state_bind(struct pipe_context *pipe, unsigned unit,
-                       void *hwcso)
+nv30_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
 {
        struct nv30_context *nv30 = nv30_context(pipe);
-       struct nv30_sampler_state *ps = hwcso;
+       unsigned unit;
 
-       nv30->tex_sampler[unit] = ps;
-       nv30->dirty_samplers |= (1 << unit);
+       for (unit = 0; unit < nr; unit++) {
+               nv30->tex_sampler[unit] = sampler[unit];
+               nv30->dirty_samplers |= (1 << unit);
+       }
 }
 
 static void
@@ -248,13 +249,16 @@ nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
 }
 
 static void
-nv30_set_sampler_texture(struct pipe_context *pipe, unsigned unit,
-                        struct pipe_texture *miptree)
+nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
+                        struct pipe_texture **miptree)
 {
        struct nv30_context *nv30 = nv30_context(pipe);
+       unsigned unit;
 
-       nv30->tex_miptree[unit] = (struct nv30_miptree *)miptree;
-       nv30->dirty_samplers |= (1 << unit);
+       for (unit = 0; unit < nr; unit++) {
+               nv30->tex_miptree[unit] = (struct nv30_miptree *)miptree[unit];
+               nv30->dirty_samplers |= (1 << unit);
+       }
 }
 
 static void *
@@ -440,7 +444,7 @@ nv30_vp_state_create(struct pipe_context *pipe,
        struct nv30_vertex_program *vp;
 
        vp = CALLOC(1, sizeof(struct nv30_vertex_program));
-       vp->pipe = cso;
+       vp->pipe = *cso;
 
        return (void *)vp;
 }
@@ -472,7 +476,7 @@ nv30_fp_state_create(struct pipe_context *pipe,
        struct nv30_fragment_program *fp;
 
        fp = CALLOC(1, sizeof(struct nv30_fragment_program));
-       fp->pipe = cso;
+       fp->pipe = *cso;
 
        return (void *)fp;
 }
@@ -709,9 +713,9 @@ nv30_init_state_functions(struct nv30_context *nv30)
        nv30->pipe.delete_blend_state = nv30_blend_state_delete;
 
        nv30->pipe.create_sampler_state = nv30_sampler_state_create;
-       nv30->pipe.bind_sampler_state = nv30_sampler_state_bind;
+       nv30->pipe.bind_sampler_states = nv30_sampler_state_bind;
        nv30->pipe.delete_sampler_state = nv30_sampler_state_delete;
-       nv30->pipe.set_sampler_texture = nv30_set_sampler_texture;
+       nv30->pipe.set_sampler_textures = nv30_set_sampler_texture;
 
        nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create;
        nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind;
index 233600f69ab98e84a1d2b821abded231450433fd..117520dd13c0ec73c5a1a55373b3a0cc693d4717 100644 (file)
@@ -60,7 +60,7 @@ struct nv30_vertex_program_data {
 };
 
 struct nv30_vertex_program {
-       const struct pipe_shader_state *pipe;
+       struct pipe_shader_state pipe;
 
        boolean translated;
        struct nv30_vertex_program_exec *insns;
@@ -84,7 +84,7 @@ struct nv30_fragment_program_data {
 };
 
 struct nv30_fragment_program {
-       const struct pipe_shader_state *pipe;
+       struct pipe_shader_state pipe;
 
        boolean translated;
        boolean on_hw;
index 75f7351261d48d26d524c15c0776f7a94e1ce8e0..e9b62ff48b43744ade91d56069173b4f72e8e5e2 100644 (file)
@@ -541,7 +541,7 @@ nv30_vertprog_prepare(struct nv30_vpc *vpc)
        struct tgsi_parse_context p;
        int nr_imm = 0;
 
-       tgsi_parse_init(&p, vpc->vp->pipe->tokens);
+       tgsi_parse_init(&p, vpc->vp->pipe.tokens);
        while (!tgsi_parse_end_of_tokens(&p)) {
                const union tgsi_full_token *tok = &p.FullToken;
 
@@ -582,7 +582,7 @@ nv30_vertprog_translate(struct nv30_context *nv30,
                return;
        }
 
-       tgsi_parse_init(&parse, vp->pipe->tokens);
+       tgsi_parse_init(&parse, vp->pipe.tokens);
 
        while (!tgsi_parse_end_of_tokens(&parse)) {
                tgsi_parse_token(&parse);
index e118776306b04ae20c07f9010b0126d33caaad48..100c678187a9de4ec475e074f3e61342e4a71f75 100644 (file)
@@ -136,6 +136,8 @@ struct nv40_context {
        unsigned idxbuf_format;
        struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
        struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
+       unsigned nr_samplers;
+       unsigned nr_textures;
        unsigned dirty_samplers;
        struct pipe_vertex_buffer  vtxbuf[PIPE_ATTRIB_MAX];
        struct pipe_vertex_element vtxelt[PIPE_ATTRIB_MAX];
index d981a02a63961d03f8fa097378ce5d7bb22de018..953f9cd90829fa5124357269b334b81601ce6959 100644 (file)
@@ -580,15 +580,14 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
                arith(fpc, sat, ADD, dst, mask, src[0], neg(src[1]), none);
                break;
        case TGSI_OPCODE_TEX:
-               if (finst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtDivide ==
-                               TGSI_EXTSWIZZLE_W) {
-                       tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
-               } else
-                       tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
+               tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
                break;
        case TGSI_OPCODE_TXB:
                tex(fpc, sat, TXB, unit, dst, mask, src[0], none, none);
                break;
+       case TGSI_OPCODE_TXP:
+               tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
+               break;
        case TGSI_OPCODE_XPD:
                tmp = temp(fpc);
                arith(fpc, 0, MUL, tmp, mask,
@@ -680,7 +679,7 @@ nv40_fragprog_translate(struct nv40_context *nv40,
        fpc->high_temp = -1;
        fpc->num_regs = 2;
 
-       tgsi_parse_init(&parse, fp->pipe->tokens);
+       tgsi_parse_init(&parse, fp->pipe.tokens);
 
        while (!tgsi_parse_end_of_tokens(&parse)) {
                tgsi_parse_token(&parse);
index caa2f9df0c689926d13e62db656f167a57d7fa1e..321d5de0415f692f40631f59b1da708b68b6a46b 100644 (file)
@@ -1,6 +1,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_util.h"
+#include "pipe/p_inlines.h"
 
 #include "nv40_context.h"
 #include "nv40_state.h"
@@ -251,14 +252,22 @@ nv40_sampler_state_create(struct pipe_context *pipe,
 }
 
 static void
-nv40_sampler_state_bind(struct pipe_context *pipe, unsigned unit,
-                       void *hwcso)
+nv40_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
-       struct nv40_sampler_state *ps = hwcso;
+       unsigned unit;
 
-       nv40->tex_sampler[unit] = ps;
-       nv40->dirty_samplers |= (1 << unit);
+       for (unit = 0; unit < nr; unit++) {
+               nv40->tex_sampler[unit] = sampler[unit];
+               nv40->dirty_samplers |= (1 << unit);
+       }
+
+       for (unit = nr; unit < nv40->nr_samplers; unit++) {
+               nv40->tex_sampler[unit] = NULL;
+               nv40->dirty_samplers |= (1 << unit);
+       }
+
+       nv40->nr_samplers = nr;
        nv40->dirty |= NV40_NEW_SAMPLER;
 }
 
@@ -269,13 +278,25 @@ nv40_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
 }
 
 static void
-nv40_set_sampler_texture(struct pipe_context *pipe, unsigned unit,
-                        struct pipe_texture *miptree)
+nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
+                        struct pipe_texture **miptree)
 {
        struct nv40_context *nv40 = nv40_context(pipe);
+       unsigned unit;
+
+       for (unit = 0; unit < nr; unit++) {
+               pipe_texture_reference((struct pipe_texture **)
+                                      &nv40->tex_miptree[unit], miptree[unit]);
+               nv40->dirty_samplers |= (1 << unit);
+       }
+
+       for (unit = nr; unit < nv40->nr_textures; unit++) {
+               pipe_texture_reference((struct pipe_texture **)
+                                      &nv40->tex_miptree[unit], NULL);
+               nv40->dirty_samplers |= (1 << unit);
+       }
 
-       nv40->tex_miptree[unit] = (struct nv40_miptree *)miptree;
-       nv40->dirty_samplers |= (1 << unit);
+       nv40->nr_textures = nr;
        nv40->dirty |= NV40_NEW_SAMPLER;
 }
 
@@ -490,7 +511,7 @@ nv40_vp_state_create(struct pipe_context *pipe,
        struct nv40_vertex_program *vp;
 
        vp = CALLOC(1, sizeof(struct nv40_vertex_program));
-       vp->pipe = cso;
+       vp->pipe = *cso;
 
        return (void *)vp;
 }
@@ -521,7 +542,7 @@ nv40_fp_state_create(struct pipe_context *pipe,
        struct nv40_fragment_program *fp;
 
        fp = CALLOC(1, sizeof(struct nv40_fragment_program));
-       fp->pipe = cso;
+       fp->pipe = *cso;
 
        return (void *)fp;
 }
@@ -649,9 +670,9 @@ nv40_init_state_functions(struct nv40_context *nv40)
        nv40->pipe.delete_blend_state = nv40_blend_state_delete;
 
        nv40->pipe.create_sampler_state = nv40_sampler_state_create;
-       nv40->pipe.bind_sampler_state = nv40_sampler_state_bind;
+       nv40->pipe.bind_sampler_states = nv40_sampler_state_bind;
        nv40->pipe.delete_sampler_state = nv40_sampler_state_delete;
-       nv40->pipe.set_sampler_texture = nv40_set_sampler_texture;
+       nv40->pipe.set_sampler_textures = nv40_set_sampler_texture;
 
        nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create;
        nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind;
index e5217fe91c46ea038e153d34c1afb3aafdef45cf..a02ea0c878172e25d0d384e5b87f1004b9ed0968 100644 (file)
@@ -23,7 +23,7 @@ struct nv40_vertex_program_data {
 };
 
 struct nv40_vertex_program {
-       const struct pipe_shader_state *pipe;
+       struct pipe_shader_state pipe;
 
        boolean translated;
        struct nv40_vertex_program_exec *insns;
@@ -48,7 +48,7 @@ struct nv40_fragment_program_data {
 };
 
 struct nv40_fragment_program {
-       const struct pipe_shader_state *pipe;
+       struct pipe_shader_state pipe;
 
        boolean translated;
        unsigned samplers;
index 5b7a343e55d431b928416b8c89842bac1fed50f7..3d730c1a321678fd692ff41cd3a19ca5c54c023b 100644 (file)
@@ -535,7 +535,7 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
        struct tgsi_parse_context p;
        int nr_imm = 0;
 
-       tgsi_parse_init(&p, vpc->vp->pipe->tokens);
+       tgsi_parse_init(&p, vpc->vp->pipe.tokens);
        while (!tgsi_parse_end_of_tokens(&p)) {
                const union tgsi_full_token *tok = &p.FullToken;
 
@@ -576,7 +576,7 @@ nv40_vertprog_translate(struct nv40_context *nv40,
                return;
        }
 
-       tgsi_parse_init(&parse, vp->pipe->tokens);
+       tgsi_parse_init(&parse, vp->pipe.tokens);
 
        while (!tgsi_parse_end_of_tokens(&parse)) {
                tgsi_parse_token(&parse);
index aa65fd482e48760d036073177913f8bec4ec6823..b096a2583d793f28b5f5844c4e2ac462dcfd79d2 100644 (file)
@@ -90,8 +90,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
 }
 
 static void
-nv50_sampler_state_bind(struct pipe_context *pipe, unsigned unit,
-                       void *hwcso)
+nv50_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
 {
 }
 
@@ -101,8 +100,8 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
 }
 
 static void
-nv50_set_sampler_texture(struct pipe_context *pipe, unsigned unit,
-                        struct pipe_texture *pt)
+nv50_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
+                        struct pipe_texture **pt)
 {
 }
 
@@ -442,9 +441,9 @@ nv50_init_state_functions(struct nv50_context *nv50)
        nv50->pipe.delete_blend_state = nv50_blend_state_delete;
 
        nv50->pipe.create_sampler_state = nv50_sampler_state_create;
-       nv50->pipe.bind_sampler_state = nv50_sampler_state_bind;
+       nv50->pipe.bind_sampler_states = nv50_sampler_state_bind;
        nv50->pipe.delete_sampler_state = nv50_sampler_state_delete;
-       nv50->pipe.set_sampler_texture = nv50_set_sampler_texture;
+       nv50->pipe.set_sampler_textures = nv50_set_sampler_texture;
 
        nv50->pipe.create_rasterizer_state = nv50_rasterizer_state_create;
        nv50->pipe.bind_rasterizer_state = nv50_rasterizer_state_bind;