radeon, r200: automake: include builddir prior to srcdir
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_maos_arrays.c
index d810e6080eb786d38f4bb440c705ce1e25f6d117..b6520c3d172565af1cfd40be54c64ca1c494cf1a 100644 (file)
@@ -1,7 +1,7 @@
 /**************************************************************************
 
 Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
-                     Tungsten Graphics Inc., Cedar Park, Texas.
+                     VMware, Inc.
 
 All Rights Reserved.
 
@@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /*
  * Authors:
- *   Keith Whitwell <keith@tungstengraphics.com>
+ *   Keith Whitwell <keithw@vmware.com>
  */
 
 #include "main/glheader.h"
@@ -48,50 +48,12 @@ 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,
-                       GLvoid *data, int stride, int count)
-{
-   int i;
-   uint32_t *out;
-   int size = 1;
-   radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
-   if (RADEON_DEBUG & RADEON_VERTS)
-      fprintf(stderr, "%s count %d stride %d\n",
-             __FUNCTION__, count, stride);
-
-   if (stride == 0) {
-      radeonAllocDmaRegion( rmesa, &aos->bo, &aos->offset, size * 4, 32 );
-      count = 1;
-      aos->stride = 0;
-   }
-   else {
-      radeonAllocDmaRegion(rmesa, &aos->bo, &aos->offset, size * 4, 32);
-      aos->stride = size;
-   }
-
-   aos->components = size;
-   aos->count = count;
-
-
-   /* 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)
 {
    int i;
    if (RADEON_DEBUG & RADEON_VERTS)
       fprintf(stderr, "%s count %d stride %d\n",
-             __FUNCTION__, count, stride);
+             __func__, count, stride);
 
    for (i = 0; i < count; i++) {
       out[0] = *(int *)data;
@@ -107,7 +69,7 @@ static void emit_stq_vec(uint32_t *out, GLvoid *data, int stride, int count)
 
    if (RADEON_DEBUG & RADEON_VERTS)
       fprintf(stderr, "%s count %d stride %d\n",
-             __FUNCTION__, count, stride);
+             __func__, count, stride);
 
    for (i = 0; i < count; i++) {
       out[0] = *(int *)data;
@@ -118,10 +80,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);
@@ -129,7 +88,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
    uint32_t *out;
 
    if (RADEON_DEBUG & RADEON_VERTS)
-      fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
+      fprintf(stderr, "%s %d/%d\n", __func__, count, size);
 
    switch (size) {
    case 4: emitsize = 3; break;
@@ -182,7 +141,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;
@@ -193,7 +152,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
    
 #if 0
    if (RADEON_DEBUG & RADEON_VERTS)
-      _tnl_print_vert_flags( __FUNCTION__, inputs );
+      _tnl_print_vert_flags( __func__, inputs );
 #endif
 
    if (1) {
@@ -275,11 +234,11 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
    are emitted together but for secondary color not. */
    if (inputs & VERT_BIT_FOG) {
       if (!rmesa->tcl.fog.buf)
-        emit_vecfog( ctx,
-                     &(rmesa->tcl.aos[nr]),
-                     (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data,
-                     VB->AttribPtr[_TNL_ATTRIB_FOG]->stride,
-                     count);
+        rcommon_emit_vecfog( ctx,
+                             &(rmesa->tcl.aos[nr]),
+                             (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data,
+                             VB->AttribPtr[_TNL_ATTRIB_FOG]->stride,
+                             count);
 
       vfmt |= RADEON_CP_VC_FRMT_FPFOG;
       nr++;
@@ -310,7 +269,8 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
         if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
            vtx |= RADEON_Q_BIT(unit);
         else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) &&
-                 ((ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_CUBE_BIT)) == 0)) {
+                 (!ctx->Texture.Unit[unit]._Current ||
+                   ctx->Texture.Unit[unit]._Current->Target != GL_TEXTURE_CUBE_MAP)) {
            GLuint swaptexmatcol = (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size - 3);
            if (((rmesa->NeedTexMatrix >> unit) & 1) &&
                 (swaptexmatcol != ((rmesa->TexMatColSwap >> unit) & 1)))