ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

t_dd_vbtmp.h
Go to the documentation of this file.
00001 
00002 /*
00003  * Mesa 3-D graphics library
00004  * Version:  5.0.1
00005  *
00006  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining a
00009  * copy of this software and associated documentation files (the "Software"),
00010  * to deal in the Software without restriction, including without limitation
00011  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00012  * and/or sell copies of the Software, and to permit persons to whom the
00013  * Software is furnished to do so, subject to the following conditions:
00014  *
00015  * The above copyright notice and this permission notice shall be included
00016  * in all copies or substantial portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00021  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00022  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00023  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00024  *
00025  * Authors:
00026  *    Keith Whitwell <keith@tungstengraphics.com>
00027  */
00028 
00029 
00030 /* Unlike the other templates here, this assumes quite a bit about the
00031  * underlying hardware.  Specifically it assumes a d3d-like vertex
00032  * format, with a layout more or less constrained to look like the
00033  * following:
00034  *
00035  * union {
00036  *    struct {
00037  *        float x, y, z, w;
00038  *        struct { char r, g, b, a; } color;
00039  *        struct { char r, g, b, fog; } spec;
00040  *        float u0, v0;
00041  *        float u1, v1;
00042  *        float u2, v2;
00043  *        float u3, v3;
00044  *    } v;
00045  *    struct {
00046  *        float x, y, z, w;
00047  *        struct { char r, g, b, a; } color;
00048  *        struct { char r, g, b, fog; } spec;
00049  *        float u0, v0, q0;
00050  *        float u1, v1, q1;
00051  *        float u2, v2, q2;
00052  *        float u3, v3, q3;
00053  *    } pv;
00054  *    struct {
00055  *        float x, y, z;
00056  *        struct { char r, g, b, a; } color;
00057  *    } tv;
00058  *    float f[16];
00059  *    unsigned int ui[16];
00060  *    unsigned char ub4[4][16];
00061  * }
00062  *
00063  
00064  * VERTEX:   hw vertex type as above
00065  * VERTEX_COLOR: hw color struct type in VERTEX
00066  *
00067  * DO_XYZW:  Emit xyz and maybe w coordinates.
00068  * DO_RGBA:  Emit color.
00069  * DO_SPEC:  Emit specular color.
00070  * DO_FOG:   Emit fog coordinate in specular alpha.
00071  * DO_TEX0:  Emit tex0 u,v coordinates.
00072  * DO_TEX1:  Emit tex1 u,v coordinates.
00073  * DO_TEX2:  Emit tex2 u,v coordinates.
00074  * DO_TEX3:  Emit tex3 u,v coordinates.
00075  * DO_PTEX:  Emit tex0,1,2,3 q coordinates where possible.
00076  *
00077  * HAVE_RGBA_COLOR: Hardware takes color in rgba order (else bgra).
00078  *
00079  * HAVE_HW_VIEWPORT:  Hardware performs viewport transform.
00080  * HAVE_HW_DIVIDE:  Hardware performs perspective divide.
00081  *
00082  * HAVE_TINY_VERTICES:  Hardware understands v.tv format.
00083  * HAVE_PTEX_VERTICES:  Hardware understands v.pv format.
00084  * HAVE_NOTEX_VERTICES:  Hardware understands v.v format with texcount 0.
00085  *
00086  * Additionally, this template assumes it is emitting *transformed*
00087  * vertices; the modifications to emit untransformed vertices (ie. to
00088  * t&l hardware) are probably too great to cooexist with the code
00089  * already in this file.
00090  *
00091  * NOTE: The PTEX vertex format always includes TEX0 and TEX1, even if
00092  * only TEX0 is enabled, in order to maintain a vertex size which is
00093  * an exact number of quadwords.
00094  */
00095 
00096 #if (HAVE_HW_VIEWPORT)
00097 #define VIEWPORT_X(dst,x) dst = x
00098 #define VIEWPORT_Y(dst,y) dst = y
00099 #define VIEWPORT_Z(dst,z) dst = z
00100 #else
00101 #define VIEWPORT_X(dst,x) dst = s[0]  * x + s[12]
00102 #define VIEWPORT_Y(dst,y) dst = s[5]  * y + s[13]
00103 #define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14]
00104 #endif
00105 
00106 #if (HAVE_HW_DIVIDE && !HAVE_PTEX_VERTICES)
00107 #error "can't cope with this combination" 
00108 #endif 
00109 
00110 #ifndef LOCALVARS
00111 #define LOCALVARS
00112 #endif
00113 
00114 #ifndef CHECK_HW_DIVIDE
00115 #define CHECK_HW_DIVIDE 1
00116 #endif
00117 
00118 #if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES)
00119 
00120 static void TAG(emit)( GLcontext *ctx,
00121                GLuint start, GLuint end,
00122                void *dest,
00123                GLuint stride )
00124 {
00125    LOCALVARS
00126       struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
00127    GLfloat (*tc0)[4], (*tc1)[4], (*fog)[4];
00128    GLfloat (*tc2)[4], (*tc3)[4];
00129    GLfloat (*col)[4], (*spec)[4];
00130    GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
00131    GLuint tc2_stride, tc3_stride;
00132    GLuint tc0_size, tc1_size, col_size;
00133    GLuint tc2_size, tc3_size;
00134    GLfloat (*coord)[4];
00135    GLuint coord_stride;
00136    VERTEX *v = (VERTEX *)dest;
00137    const GLfloat *s = GET_VIEWPORT_MAT();
00138    const GLubyte *mask = VB->ClipMask;
00139    int i;
00140 
00141 /*     fprintf(stderr, "%s(big) importable %d %d..%d\n",  */
00142 /*         __FUNCTION__, VB->importable_data, start, end); */
00143 
00144    if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
00145       (void) s;
00146       coord = VB->ClipPtr->data;
00147       coord_stride = VB->ClipPtr->stride;
00148    }
00149    else {
00150       coord = VB->NdcPtr->data;
00151       coord_stride = VB->NdcPtr->stride;
00152    }
00153 
00154    if (DO_TEX3) {
00155       const GLuint t3 = GET_TEXSOURCE(3);
00156       tc3 = VB->TexCoordPtr[t3]->data;
00157       tc3_stride = VB->TexCoordPtr[t3]->stride;
00158       if (DO_PTEX)
00159      tc3_size = VB->TexCoordPtr[t3]->size;
00160    }
00161 
00162    if (DO_TEX2) {
00163       const GLuint t2 = GET_TEXSOURCE(2);
00164       tc2 = VB->TexCoordPtr[t2]->data;
00165       tc2_stride = VB->TexCoordPtr[t2]->stride;
00166       if (DO_PTEX)
00167      tc2_size = VB->TexCoordPtr[t2]->size;
00168    }
00169 
00170    if (DO_TEX1) {
00171       const GLuint t1 = GET_TEXSOURCE(1);
00172       tc1 = VB->TexCoordPtr[t1]->data;
00173       tc1_stride = VB->TexCoordPtr[t1]->stride;
00174       if (DO_PTEX)
00175      tc1_size = VB->TexCoordPtr[t1]->size;
00176    }
00177 
00178    if (DO_TEX0) {
00179       const GLuint t0 = GET_TEXSOURCE(0);
00180       tc0_stride = VB->TexCoordPtr[t0]->stride;
00181       tc0 = VB->TexCoordPtr[t0]->data;
00182       if (DO_PTEX) 
00183      tc0_size = VB->TexCoordPtr[t0]->size;
00184    }
00185 
00186    if (DO_RGBA) {
00187       col_stride = VB->ColorPtr[0]->stride;
00188       col = VB->ColorPtr[0]->data;
00189       col_size = VB->ColorPtr[0]->size;
00190    }
00191 
00192    if (DO_SPEC) {
00193       if (VB->SecondaryColorPtr[0]) {
00194      spec_stride = VB->SecondaryColorPtr[0]->stride;
00195      spec = VB->SecondaryColorPtr[0]->data;
00196       } else {
00197      spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
00198      spec_stride = 0;
00199       }
00200    }
00201 
00202    if (DO_FOG) {
00203       if (VB->FogCoordPtr) {
00204      fog = VB->FogCoordPtr->data;
00205      fog_stride = VB->FogCoordPtr->stride;
00206       }
00207       else {
00208      static GLfloat tmp[4] = {0, 0, 0, 0};
00209      fog = &tmp;
00210      fog_stride = 0;
00211       }
00212    }
00213 
00214    /* May have nonstandard strides:
00215     */
00216    if (start) {
00217       STRIDE_4F(coord, start * coord_stride);
00218       if (DO_TEX0)
00219      STRIDE_4F(tc0, start * tc0_stride);
00220       if (DO_TEX1) 
00221      STRIDE_4F(tc1, start * tc1_stride);
00222       if (DO_TEX2) 
00223      STRIDE_4F(tc2, start * tc2_stride);
00224       if (DO_TEX3) 
00225      STRIDE_4F(tc3, start * tc3_stride);
00226       if (DO_RGBA) 
00227      STRIDE_4F(col, start * col_stride);
00228       if (DO_SPEC)
00229      STRIDE_4F(spec, start * spec_stride);
00230       if (DO_FOG)
00231      STRIDE_4F(fog, start * fog_stride);
00232    }
00233 
00234    for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) {
00235       if (DO_XYZW) {
00236      if (HAVE_HW_VIEWPORT || mask[i] == 0) {
00237         VIEWPORT_X(v->v.x, coord[0][0]);
00238         VIEWPORT_Y(v->v.y, coord[0][1]);
00239         VIEWPORT_Z(v->v.z, coord[0][2]);
00240         v->v.w = coord[0][3];
00241      }
00242      STRIDE_4F(coord, coord_stride);
00243       }
00244       if (DO_RGBA) {
00245      UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.red, col[0][0]);
00246      UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.green, col[0][1]);
00247      UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.blue, col[0][2]);
00248      if (col_size == 4) {
00249         UNCLAMPED_FLOAT_TO_UBYTE(v->v.color.alpha, col[0][3]);
00250      } else {
00251         v->v.color.alpha = CHAN_MAX;
00252      }
00253      STRIDE_4F(col, col_stride);
00254       }
00255       if (DO_SPEC) {
00256      UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.red, spec[0][0]);
00257      UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.green, spec[0][1]);
00258      UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.blue, spec[0][2]);
00259      STRIDE_4F(spec, spec_stride);
00260       }
00261       if (DO_FOG) {
00262      UNCLAMPED_FLOAT_TO_UBYTE(v->v.specular.alpha, fog[0][0]);
00263      STRIDE_4F(fog, fog_stride);
00264       }
00265       if (DO_TEX0) {
00266      v->v.u0 = tc0[0][0];
00267      v->v.v0 = tc0[0][1];
00268      if (DO_PTEX) {
00269         if (HAVE_PTEX_VERTICES) {
00270            if (tc0_size == 4) 
00271           v->pv.q0 = tc0[0][3];
00272            else
00273           v->pv.q0 = 1.0;
00274         } 
00275         else if (tc0_size == 4) {
00276            float rhw = 1.0 / tc0[0][3];
00277            v->v.w *= tc0[0][3];
00278            v->v.u0 *= rhw;
00279            v->v.v0 *= rhw;
00280         } 
00281      } 
00282      STRIDE_4F(tc0, tc0_stride);
00283       }
00284       if (DO_TEX1) {
00285      if (DO_PTEX) {
00286         v->pv.u1 = tc1[0][0];
00287         v->pv.v1 = tc1[0][1];
00288         if (tc1_size == 4) 
00289            v->pv.q1 = tc1[0][3];
00290         else
00291            v->pv.q1 = 1.0;
00292      } 
00293      else {
00294         v->v.u1 = tc1[0][0];
00295         v->v.v1 = tc1[0][1];
00296      }
00297      STRIDE_4F(tc1, tc1_stride);
00298       } 
00299       else if (DO_PTEX) {
00300      *(GLuint *)&v->pv.q1 = 0;  /* avoid culling on radeon */
00301       }
00302       if (DO_TEX2) {
00303      if (DO_PTEX) {
00304         v->pv.u2 = tc2[0][0];
00305         v->pv.v2 = tc2[0][1];
00306         if (tc2_size == 4) 
00307            v->pv.q2 = tc2[0][3];
00308         else
00309            v->pv.q2 = 1.0;
00310      } 
00311      else {
00312         v->v.u2 = tc2[0][0];
00313         v->v.v2 = tc2[0][1];
00314      }
00315      STRIDE_4F(tc2, tc2_stride);
00316       } 
00317       if (DO_TEX3) {
00318      if (DO_PTEX) {
00319         v->pv.u3 = tc3[0][0];
00320         v->pv.v3 = tc3[0][1];
00321         if (tc3_size == 4) 
00322            v->pv.q3 = tc3[0][3];
00323         else
00324            v->pv.q3 = 1.0;
00325      } 
00326      else {
00327         v->v.u3 = tc3[0][0];
00328         v->v.v3 = tc3[0][1];
00329      }
00330      STRIDE_4F(tc3, tc3_stride);
00331       } 
00332    }
00333 
00334 }
00335 #else
00336 
00337 #if HAVE_HW_DIVIDE
00338 #error "cannot use tiny vertices with hw perspective divide"
00339 #endif
00340 
00341 static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
00342                void *dest, GLuint stride )
00343 {
00344    LOCALVARS
00345       struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
00346    GLfloat (*col)[4];
00347    GLuint col_stride, col_size;
00348    GLfloat (*coord)[4] = VB->NdcPtr->data;
00349    GLuint coord_stride = VB->NdcPtr->stride;
00350    GLfloat *v = (GLfloat *)dest;
00351    const GLubyte *mask = VB->ClipMask;
00352    const GLfloat *s = GET_VIEWPORT_MAT();
00353    int i;
00354 
00355    (void) s;
00356 
00357    ASSERT(stride == 4);
00358 
00359    col = VB->ColorPtr[0]->data;
00360    col_stride = VB->ColorPtr[0]->stride;
00361    col_size = VB->ColorPtr[0]->size;
00362 
00363 /*     fprintf(stderr, "%s(small) importable %x\n",  */
00364 /*         __FUNCTION__, VB->importable_data); */
00365 
00366    /* Pack what's left into a 4-dword vertex.  Color is in a different
00367     * place, and there is no 'w' coordinate.
00368     */
00369    if (start) {
00370       STRIDE_4F(coord, start * coord_stride);
00371       STRIDE_4F(col, start * col_stride);
00372    }
00373 
00374    for (i=start; i < end; i++, v+=4) {
00375       if (DO_XYZW) {
00376      if (HAVE_HW_VIEWPORT || mask[i] == 0) {
00377         VIEWPORT_X(v[0], coord[0][0]);
00378         VIEWPORT_Y(v[1], coord[0][1]);
00379         VIEWPORT_Z(v[2], coord[0][2]);
00380      }
00381      STRIDE_4F( coord, coord_stride );
00382       }
00383       if (DO_RGBA) {
00384      VERTEX_COLOR *c = (VERTEX_COLOR *)&v[3];
00385      UNCLAMPED_FLOAT_TO_UBYTE(c->red, col[0][0]);
00386      UNCLAMPED_FLOAT_TO_UBYTE(c->green, col[0][1]);
00387      UNCLAMPED_FLOAT_TO_UBYTE(c->blue, col[0][2]);
00388      if (col_size == 4) {
00389         UNCLAMPED_FLOAT_TO_UBYTE(c->alpha, col[0][3]);
00390      } else {
00391         c->alpha = CHAN_MAX;
00392      }
00393      STRIDE_4F( col, col_stride );
00394       }
00395 /*       fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n",  */
00396 /*           i, v[0], v[1], v[2], *(int *)&v[3]); */
00397    }
00398 }
00399 
00400 #endif /* emit */
00401 
00402 #if (DO_XYZW) && (DO_RGBA)
00403 
00404 
00405 #if (HAVE_PTEX_VERTICES)
00406 static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
00407 {
00408    LOCALVARS
00409    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
00410 
00411    /* Force 'missing' texcoords to something valid.
00412     */
00413    if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
00414       VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
00415 
00416    if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
00417       VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
00418 
00419    if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
00420       VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
00421 
00422    if (DO_PTEX)
00423       return GL_TRUE;
00424    
00425    if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
00426        (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
00427        (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) ||
00428        (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4))
00429       return GL_FALSE;
00430 
00431    return GL_TRUE;
00432 }
00433 #else
00434 static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
00435 {
00436    LOCALVARS
00437    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
00438 
00439    /* Force 'missing' texcoords to something valid.
00440     */
00441    if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
00442       VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
00443 
00444    if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
00445       VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
00446 
00447    if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
00448       VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
00449 
00450    if (DO_PTEX)
00451       return GL_TRUE;
00452 
00453    /* No hardware support for projective texture.  Can fake it for
00454     * TEX0 only.
00455     */
00456    if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
00457        (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
00458        (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) {
00459       PTEX_FALLBACK();
00460       return GL_FALSE;
00461    }
00462 
00463    if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) {
00464       if (DO_TEX1 || DO_TEX2 || DO_TEX3) {
00465      PTEX_FALLBACK();
00466       }
00467       return GL_FALSE;
00468    }
00469 
00470    return GL_TRUE;
00471 }
00472 #endif /* ptex */
00473 
00474 
00475 static void TAG(interp)( GLcontext *ctx,
00476              GLfloat t,
00477              GLuint edst, GLuint eout, GLuint ein,
00478              GLboolean force_boundary )
00479 {
00480    LOCALVARS
00481    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
00482    GLubyte *ddverts = GET_VERTEX_STORE();
00483    GLuint size = GET_VERTEX_SIZE();
00484    const GLfloat *dstclip = VB->ClipPtr->data[edst];
00485    GLfloat w;
00486    const GLfloat *s = GET_VIEWPORT_MAT();
00487 
00488    VERTEX *dst = (VERTEX *)(ddverts + (edst * size));
00489    VERTEX *in  = (VERTEX *)(ddverts + (ein * size));
00490    VERTEX *out = (VERTEX *)(ddverts + (eout * size));
00491 
00492    (void)s;
00493 
00494    if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
00495       VIEWPORT_X( dst->v.x, dstclip[0] );
00496       VIEWPORT_Y( dst->v.y, dstclip[1] );
00497       VIEWPORT_Z( dst->v.z, dstclip[2] );
00498       w = dstclip[3];
00499    }
00500    else {
00501       w = 1.0 / dstclip[3];
00502       VIEWPORT_X( dst->v.x, dstclip[0] * w );
00503       VIEWPORT_Y( dst->v.y, dstclip[1] * w );
00504       VIEWPORT_Z( dst->v.z, dstclip[2] * w );
00505    }
00506 
00507    if ((HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) || 
00508        DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 ||
00509        DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) {
00510 
00511       dst->v.w = w;
00512 
00513       INTERP_UB( t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0] );
00514       INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] );
00515       INTERP_UB( t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2] );
00516       INTERP_UB( t, dst->ub4[4][3], out->ub4[4][3], in->ub4[4][3] );
00517 
00518       if (DO_SPEC) {
00519      INTERP_UB( t, dst->v.specular.red,   out->v.specular.red,   in->v.specular.red );
00520      INTERP_UB( t, dst->v.specular.green, out->v.specular.green, in->v.specular.green );
00521      INTERP_UB( t, dst->v.specular.blue,  out->v.specular.blue,  in->v.specular.blue );
00522       }
00523       if (DO_FOG) {
00524      INTERP_UB( t, dst->v.specular.alpha, out->v.specular.alpha, in->v.specular.alpha );
00525       }
00526       if (DO_TEX0) {
00527      if (DO_PTEX) {
00528         if (HAVE_PTEX_VERTICES) {
00529            INTERP_F( t, dst->pv.u0, out->pv.u0, in->pv.u0 );
00530            INTERP_F( t, dst->pv.v0, out->pv.v0, in->pv.v0 );
00531            INTERP_F( t, dst->pv.q0, out->pv.q0, in->pv.q0 );
00532         } else {
00533            GLfloat wout = VB->NdcPtr->data[eout][3];
00534            GLfloat win = VB->NdcPtr->data[ein][3];
00535            GLfloat qout = out->pv.w / wout;
00536            GLfloat qin = in->pv.w / win;
00537            GLfloat qdst, rqdst;
00538 
00539            ASSERT( !HAVE_HW_DIVIDE );
00540 
00541            INTERP_F( t, dst->v.u0, out->v.u0 * qout, in->v.u0 * qin );
00542            INTERP_F( t, dst->v.v0, out->v.v0 * qout, in->v.v0 * qin );
00543            INTERP_F( t, qdst, qout, qin );
00544 
00545            rqdst = 1.0 / qdst;
00546            dst->v.u0 *= rqdst;
00547            dst->v.v0 *= rqdst;
00548            dst->v.w *= rqdst;
00549         }
00550      }
00551      else {
00552         INTERP_F( t, dst->v.u0, out->v.u0, in->v.u0 );
00553         INTERP_F( t, dst->v.v0, out->v.v0, in->v.v0 );
00554      }
00555       }
00556       if (DO_TEX1) {
00557      if (DO_PTEX) {
00558         INTERP_F( t, dst->pv.u1, out->pv.u1, in->pv.u1 );
00559         INTERP_F( t, dst->pv.v1, out->pv.v1, in->pv.v1 );
00560         INTERP_F( t, dst->pv.q1, out->pv.q1, in->pv.q1 );
00561      } else {
00562         INTERP_F( t, dst->v.u1, out->v.u1, in->v.u1 );
00563         INTERP_F( t, dst->v.v1, out->v.v1, in->v.v1 );
00564      }
00565       }
00566       else if (DO_PTEX) {
00567      dst->pv.q1 = 0.0;  /* must be a valid float on radeon */
00568       }
00569       if (DO_TEX2) {
00570      if (DO_PTEX) {
00571         INTERP_F( t, dst->pv.u2, out->pv.u2, in->pv.u2 );
00572         INTERP_F( t, dst->pv.v2, out->pv.v2, in->pv.v2 );
00573         INTERP_F( t, dst->pv.q2, out->pv.q2, in->pv.q2 );
00574      } else {
00575         INTERP_F( t, dst->v.u2, out->v.u2, in->v.u2 );
00576         INTERP_F( t, dst->v.v2, out->v.v2, in->v.v2 );
00577      }
00578       }
00579       if (DO_TEX3) {
00580      if (DO_PTEX) {
00581         INTERP_F( t, dst->pv.u3, out->pv.u3, in->pv.u3 );
00582         INTERP_F( t, dst->pv.v3, out->pv.v3, in->pv.v3 );
00583         INTERP_F( t, dst->pv.q3, out->pv.q3, in->pv.q3 );
00584      } else {
00585         INTERP_F( t, dst->v.u3, out->v.u3, in->v.u3 );
00586         INTERP_F( t, dst->v.v3, out->v.v3, in->v.v3 );
00587      }
00588       }
00589    } else {
00590       /* 4-dword vertex.  Color is in v[3] and there is no oow coordinate.
00591        */
00592       INTERP_UB( t, dst->ub4[3][0], out->ub4[3][0], in->ub4[3][0] );
00593       INTERP_UB( t, dst->ub4[3][1], out->ub4[3][1], in->ub4[3][1] );
00594       INTERP_UB( t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2] );
00595       INTERP_UB( t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3] );
00596    }
00597 }
00598 
00599 #endif /* rgba && xyzw */
00600 
00601 
00602 static void TAG(init)( void )
00603 {
00604    setup_tab[IND].emit = TAG(emit);
00605 
00606 #if (DO_XYZW && DO_RGBA)
00607    setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
00608    setup_tab[IND].interp = TAG(interp);
00609 #endif
00610 
00611    if (DO_SPEC)
00612       setup_tab[IND].copy_pv = copy_pv_rgba4_spec5;
00613    else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 ||
00614         DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES)
00615       setup_tab[IND].copy_pv = copy_pv_rgba4;
00616    else
00617       setup_tab[IND].copy_pv = copy_pv_rgba3;
00618 
00619    if (DO_TEX3) {
00620       if (DO_PTEX) {
00621      ASSERT(HAVE_PTEX_VERTICES);
00622      setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
00623      setup_tab[IND].vertex_size = 18;
00624       }
00625       else {
00626      setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT;
00627      setup_tab[IND].vertex_size = 14;
00628       }
00629    }
00630    else if (DO_TEX2) {
00631       if (DO_PTEX) {
00632      ASSERT(HAVE_PTEX_VERTICES);
00633      setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
00634      setup_tab[IND].vertex_size = 18;
00635       }
00636       else {
00637      setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT;
00638      setup_tab[IND].vertex_size = 12;
00639       }
00640    }
00641    else if (DO_TEX1) {
00642       if (DO_PTEX) {
00643      ASSERT(HAVE_PTEX_VERTICES);
00644      setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
00645      setup_tab[IND].vertex_size = 12;
00646       }
00647       else {
00648      setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT;
00649      setup_tab[IND].vertex_size = 10;
00650       }
00651    }
00652    else if (DO_TEX0) {
00653       if (DO_PTEX && HAVE_PTEX_VERTICES) {
00654      setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
00655      setup_tab[IND].vertex_size = 12;
00656       } else {
00657      setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
00658      setup_tab[IND].vertex_size = 8;
00659       }
00660    }
00661    else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) {
00662       setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT;
00663       setup_tab[IND].vertex_size = 4;
00664    } else if (HAVE_NOTEX_VERTICES) {
00665       setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT;
00666       setup_tab[IND].vertex_size = 6;
00667    } else {
00668       setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
00669       setup_tab[IND].vertex_size = 8;
00670    }
00671 }
00672 
00673 
00674 #undef IND
00675 #undef TAG

Generated on Sun May 27 2012 04:20:48 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.