mesa: Remove target parameter from dd_function_table::MapBuffer
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_maos_arrays.c
index 74b66900c9ab361955f297a29547c997540be763..94fe7e4b9f50fbae7dfea40052f259855998712e 100644 (file)
@@ -48,7 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_maos.h"
 #include "radeon_tcl.h"
 
-static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
+static void emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos,
                        GLvoid *data, int stride, int count)
 {
    int i;
@@ -76,12 +76,14 @@ static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
 
    /* Emit the data
     */
+   radeon_bo_map(aos->bo, 1);
    out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
    for (i = 0; i < count; i++) {
       out[0] = radeonComputeFogBlendFactor( ctx, *(GLfloat *)data );
       out++;
       data += stride;
    }
+   radeon_bo_unmap(aos->bo);
 }
 
 static void emit_s0_vec(uint32_t *out, GLvoid *data, int stride, int count)
@@ -119,7 +121,7 @@ static void emit_stq_vec(uint32_t *out, GLvoid *data, int stride, int count)
 
 
 
-static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
+static void emit_tex_vector(struct gl_context *ctx, struct radeon_aos *aos,
                            GLvoid *data, int size, int stride, int count)
 {
    radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
@@ -151,6 +153,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
 
    /* Emit the data
     */
+   radeon_bo_map(aos->bo, 1);
    out = (uint32_t*)((char*)aos->bo->ptr + aos->offset);
    switch (size) {
    case 1:
@@ -170,6 +173,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
       exit(1);
       break;
    }
+   radeon_bo_unmap(aos->bo);
 }
 
 
@@ -178,7 +182,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
 /* Emit any changed arrays to new GART memory, re-emit a packet to
  * update the arrays.  
  */
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
+void radeonEmitArrays( struct gl_context *ctx, GLuint inputs )
 {
    r100ContextPtr rmesa = R100_CONTEXT( ctx );
    struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
@@ -227,9 +231,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
 
    if (inputs & VERT_BIT_COLOR0) {
       int emitsize;
-      if (VB->ColorPtr[0]->size == 4 &&
-         (VB->ColorPtr[0]->stride != 0 ||
-          VB->ColorPtr[0]->data[0][3] != 1.0)) {
+      if (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size == 4 &&
+         (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride != 0 ||
+          VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data[0][3] != 1.0)) {
         vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA;
         emitsize = 4;
       }
@@ -242,9 +246,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
       if (!rmesa->tcl.rgba.buf)
        rcommon_emit_vector( ctx,
                             &(rmesa->tcl.aos[nr]),
-                            (char *)VB->ColorPtr[0]->data,
+                            (char *)VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data,
                             emitsize,
-                            VB->ColorPtr[0]->stride,
+                            VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride,
                             count);
 
       nr++;
@@ -256,9 +260,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
 
        rcommon_emit_vector( ctx,
                             &(rmesa->tcl.aos[nr]),
-                            (char *)VB->SecondaryColorPtr[0]->data,
+                            (char *)VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data,
                             3,
-                            VB->SecondaryColorPtr[0]->stride,
+                            VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride,
                             count);
       }
 
@@ -273,8 +277,8 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
       if (!rmesa->tcl.fog.buf)
         emit_vecfog( ctx,
                      &(rmesa->tcl.aos[nr]),
-                     (char *)VB->FogCoordPtr->data,
-                     VB->FogCoordPtr->stride,
+                     (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data,
+                     VB->AttribPtr[_TNL_ATTRIB_FOG]->stride,
                      count);
 
       vfmt |= RADEON_CP_VC_FRMT_FPFOG;