r600g: take into account force_add_cf in pops
[mesa.git] / src / gallium / drivers / nvfx / nvfx_vertprog.c
index 6914e730c5f0d8d8d75791373209522ae9b13279..a11941f3d51ee89b0f43d098e1e382c451ba5ba1 100644 (file)
@@ -377,6 +377,8 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
        src.swz[2] = fsrc->Register.SwizzleZ;
        src.swz[3] = fsrc->Register.SwizzleW;
        src.indirect = 0;
+       src.indirect_reg = 0;
+       src.indirect_swz = 0;
 
        if(fsrc->Register.Indirect) {
                if(fsrc->Indirect.File == TGSI_FILE_ADDRESS &&
@@ -878,7 +880,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
 
        /* hope 0xf is (0, 0, 0, 1) initialized; otherwise, we are _probably_ not required to do this */
        memset(vpc->vp->generic_to_fp_input, 0x0f, sizeof(vpc->vp->generic_to_fp_input));
-       for(int i = 0; i < 10; ++i) {
+       for(int i = 0; i < num_texcoords; ++i) {
                if(sem_layout[i] == 0xff)
                        continue;
                //printf("vp: GENERIC[%i] to fpreg %i\n", sem_layout[i], NVFX_FP_OP_INPUT_SRC_TC(0) + i);
@@ -886,7 +888,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
        }
 
        vpc->vp->sprite_fp_input = -1;
-       for(int i = 0; i < 10; ++i)
+       for(int i = 0; i < num_texcoords; ++i)
        {
                if(sem_layout[i] == 0xff)
                {
@@ -973,7 +975,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
 DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_vp, "NVFX_DUMP_VP", FALSE)
 
 static struct nvfx_vertex_program*
-nvfx_vertprog_translate(struct nvfx_context *nvfx, const struct pipe_shader_state* vps, const struct tgsi_shader_info* info)
+nvfx_vertprog_translate(struct nvfx_context *nvfx, const struct pipe_shader_state* vps, struct tgsi_shader_info* info)
 {
        struct tgsi_parse_context parse;
        struct nvfx_vertex_program* vp = NULL;
@@ -1180,6 +1182,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 {
        struct nvfx_screen *screen = nvfx->screen;
        struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *eng3d = screen->eng3d;
        struct nvfx_pipe_vertex_program *pvp = nvfx->vertprog;
        struct nvfx_vertex_program* vp;
        struct pipe_resource *constbuf;
@@ -1339,7 +1342,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
                }
                */
 
-               WAIT_RING(chan, 6 * vp->nr_consts);
                for (i = nvfx->use_vp_clipping ? 6 : 0; i < vp->nr_consts; i++) {
                        struct nvfx_vertex_program_data *vpd = &vp->consts[i];
 
@@ -1354,7 +1356,7 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 
                        //printf("upload into %i + %i: %f %f %f %f\n", vp->data->start, i, vpd->value[0], vpd->value[1], vpd->value[2], vpd->value[3]);
 
-                       OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_CONST_ID, 5));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_CONST_ID, 5);
                        OUT_RING(chan, i + vp->data->start);
                        OUT_RINGp(chan, (uint32_t *)vpd->value, 4);
                }
@@ -1362,11 +1364,10 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 
        /* Upload vtxprog */
        if (upload_code) {
-               WAIT_RING(chan, 2 + 5 * vp->nr_insns);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_FROM_ID, 1);
                OUT_RING(chan, vp->exec->start);
                for (i = 0; i < vp->nr_insns; i++) {
-                       OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+                       BEGIN_RING(chan, eng3d, NV30_3D_VP_UPLOAD_INST(0), 4);
                        //printf("%08x %08x %08x %08x\n", vp->insns[i].data[0], vp->insns[i].data[1], vp->insns[i].data[2], vp->insns[i].data[3]);
                        OUT_RINGp(chan, vp->insns[i].data, 4);
                }
@@ -1375,11 +1376,10 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
 
        if(nvfx->dirty & (NVFX_NEW_VERTPROG))
        {
-               WAIT_RING(chan, 6);
-               OUT_RING(chan, RING_3D(NV30_3D_VP_START_FROM_ID, 1));
+               BEGIN_RING(chan, eng3d, NV30_3D_VP_START_FROM_ID, 1);
                OUT_RING(chan, vp->exec->start);
                if(nvfx->is_nv4x) {
-                       OUT_RING(chan, RING_3D(NV40_3D_VP_ATTRIB_EN, 1));
+                       BEGIN_RING(chan, eng3d, NV40_3D_VP_ATTRIB_EN, 1);
                        OUT_RING(chan, vp->ir);
                }
        }
@@ -1407,7 +1407,6 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp)
 static void *
 nvfx_vp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso)
 {
-        struct nvfx_context *nvfx = nvfx_context(pipe);
         struct nvfx_pipe_vertex_program *pvp;
 
         pvp = CALLOC(1, sizeof(struct nvfx_pipe_vertex_program));