nvfx: rewrite draw code and buffer code
[mesa.git] / src / gallium / drivers / nvfx / nvfx_fragprog.c
index ee41f03b9b8fd7064f64ff75efeb63f266c427c5..ae4fe3aa262cf4ebb867335a04ca1d96130a9d93 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "nvfx_context.h"
 #include "nvfx_shader.h"
+#include "nvfx_resource.h"
 
 #define MAX_CONSTS 128
 #define MAX_IMM 32
@@ -925,10 +926,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
 
                if(nvfx->constbuf[PIPE_SHADER_FRAGMENT]) {
                        struct pipe_resource* constbuf = nvfx->constbuf[PIPE_SHADER_FRAGMENT];
-                       // TODO: avoid using transfers, just directly the buffer
-                       struct pipe_transfer* transfer;
-                       // TODO: does this check make any sense, or should we do this unconditionally?
-                       uint32_t* map = pipe_buffer_map(&nvfx->pipe, constbuf, PIPE_TRANSFER_READ, &transfer);
+                       uint32_t* map = (uint32_t*)nvfx_buffer(constbuf)->data;
                        uint32_t* fpmap = (uint32_t*)((char*)fp->fpbo->bo->map + offset);
                        uint32_t* buf = (uint32_t*)((char*)fp->fpbo->insn + offset);
                        int i;
@@ -942,7 +940,6 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
                                        nvfx_fp_memcpy(&fpmap[off], &map[idx], 4 * sizeof(uint32_t));
                                }
                        }
-                       pipe_buffer_unmap(&nvfx->pipe, constbuf, transfer);
                }
        }