nvfx: rewrite draw code and buffer code
[mesa.git] / src / gallium / drivers / nvfx / nvfx_vertprog.c
index 80b98b62d3477c3c49b9221f098b9ba537f539a4..939d2b83aee4ab3feda1e00aadd5afaabb1c2b4c 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "nvfx_context.h"
 #include "nvfx_state.h"
+#include "nvfx_resource.h"
 
 /* TODO (at least...):
  *  1. Indexed consts  + ARL
@@ -299,7 +300,13 @@ nvfx_vp_arith(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, int slot, int op,
                  (3 << NVFX_VP(INST_COND_SWZ_W_SHIFT)));
 
        if(!nvfx->is_nv4x) {
-               hw[1] |= (op << NV30_VP_INST_VEC_OPCODE_SHIFT);
+               if(slot == 0)
+                       hw[1] |= (op << NV30_VP_INST_VEC_OPCODE_SHIFT);
+               else
+               {
+                       hw[0] |= ((op >> 4) << NV30_VP_INST_SCA_OPCODEH_SHIFT);
+                       hw[1] |= ((op & 0xf) << NV30_VP_INST_SCA_OPCODEL_SHIFT);
+               }
 //             hw[3] |= NVFX_VP(INST_SCA_DEST_TEMP_MASK);
 //             hw[3] |= (mask << NVFX_VP(INST_VEC_WRITEMASK_SHIFT));
 
@@ -868,7 +875,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
        struct nouveau_grobj *eng3d = screen->eng3d;
        struct nvfx_vertex_program *vp;
        struct pipe_resource *constbuf;
-       struct pipe_transfer *transfer = NULL;
        boolean upload_code = FALSE, upload_data = FALSE;
        int i;
 
@@ -977,11 +983,8 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
        if (vp->nr_consts) {
                float *map = NULL;
 
-               if (constbuf) {
-                       map = pipe_buffer_map(pipe, constbuf,
-                                             PIPE_TRANSFER_READ,
-                                             &transfer);
-               }
+               if (constbuf)
+                       map = nvfx_buffer(constbuf)->data;
 
                for (i = 0; i < vp->nr_consts; i++) {
                        struct nvfx_vertex_program_data *vpd = &vp->consts[i];
@@ -999,9 +1002,6 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
                        OUT_RING  (chan, i + vp->data->start);
                        OUT_RINGp (chan, (uint32_t *)vpd->value, 4);
                }
-
-               if (constbuf)
-                       pipe_buffer_unmap(pipe, constbuf, transfer);
        }
 
        /* Upload vtxprog */