r300: Further reduced the radeon_span.c diff.
[mesa.git] / src / mesa / swrast / s_feedback.c
index 892c40db6a21958f061857354a82b79e1918d7fc..5d3fbdfeb6e1c415a569ef11ce1cd2ea8eec1bdd 100644 (file)
@@ -1,9 +1,8 @@
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.3
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 static void feedback_vertex( GLcontext *ctx,
                              const SWvertex *v, const SWvertex *pv )
 {
-   const GLuint texUnit = 0;  /* See section 5.3 of 1.2.1 spec */
    GLfloat win[4];
    GLfloat color[4];
    GLfloat tc[4];
+   const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
 
    win[0] = v->win[0];
    win[1] = v->win[1];
-   win[2] = v->win[2] / ctx->DepthMaxF;
+   win[2] = v->win[2] / ctx->DrawBuffer->_DepthMaxF;
    win[3] = 1.0F / v->win[3];
 
    color[0] = CHAN_TO_FLOAT(pv->color[0]);
@@ -62,16 +61,15 @@ static void feedback_vertex( GLcontext *ctx,
    color[2] = CHAN_TO_FLOAT(pv->color[2]);
    color[3] = CHAN_TO_FLOAT(pv->color[3]);
 
-   if (v->texcoord[texUnit][3] != 1.0 &&
-       v->texcoord[texUnit][3] != 0.0) {
-      GLfloat invq = 1.0F / v->texcoord[texUnit][3];
-      tc[0] = v->texcoord[texUnit][0] * invq;
-      tc[1] = v->texcoord[texUnit][1] * invq;
-      tc[2] = v->texcoord[texUnit][2] * invq;
-      tc[3] = v->texcoord[texUnit][3];
+   if (vtc[3] != 1.0 && vtc[3] != 0.0) {
+      GLfloat invq = 1.0F / vtc[3];
+      tc[0] = vtc[0] * invq;
+      tc[1] = vtc[1] * invq;
+      tc[2] = vtc[2] * invq;
+      tc[3] = vtc[3];
    }
    else {
-      COPY_4V(tc, v->texcoord[texUnit]);
+      COPY_4V(tc, vtc);
    }
 
    _mesa_feedback_vertex( ctx, win, color, (GLfloat) v->index, tc );
@@ -138,7 +136,7 @@ void _swrast_select_triangle( GLcontext *ctx,
                         const SWvertex *v2)
 {
    if (_swrast_culltriangle( ctx, v0, v1, v2 )) {
-      const GLfloat zs = 1.0F / ctx->DepthMaxF;
+      const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
 
       _mesa_update_hitflag( ctx, v0->win[2] * zs );
       _mesa_update_hitflag( ctx, v1->win[2] * zs );
@@ -149,7 +147,7 @@ void _swrast_select_triangle( GLcontext *ctx,
 
 void _swrast_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
 {
-   const GLfloat zs = 1.0F / ctx->DepthMaxF;
+   const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
    _mesa_update_hitflag( ctx, v0->win[2] * zs );
    _mesa_update_hitflag( ctx, v1->win[2] * zs );
 }
@@ -157,6 +155,6 @@ void _swrast_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1
 
 void _swrast_select_point( GLcontext *ctx, const SWvertex *v )
 {
-   const GLfloat zs = 1.0F / ctx->DepthMaxF;
+   const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
    _mesa_update_hitflag( ctx, v->win[2] * zs );
 }