Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxfastpath.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/3dfx/fxfastpath.c
r2938 r3598 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 56 56 #include "fxdrv.h" 57 57 #include "vertices.h" 58 //#include "X86/common_x86asm.h"58 #include "common_x86asm.h" 59 59 60 60 … … 70 70 71 71 72 #define CLIP(sgn,v,PLANE) 73 if (mask & PLANE) { 74 GLuint *indata = inlist[in]; 75 GLuint *outdata = inlist[in ^= 1]; 76 GLuint nr = n; 77 GLfloat *J = verts[indata[nr-1]].f; 78 GLfloat dpJ = (sgn J[v]) + J[CLIP_WCOORD]; 79 80 inlist[0] = vlist1; 81 for (i = n = 0 ; i < nr ; i++) { 82 GLuint elt_i = indata[i]; 83 GLfloat *I = verts[elt_i].f; 84 GLfloat dpI = (sgn I[v]) + I[CLIP_WCOORD]; 85 86 if (DIFFERENT_SIGNS(dpI, dpJ)) { 87 GLfloat *O = verts[next_vert].f;\88 GLfloat t = dpI / (dpI - dpJ); 89 GLuint j;\90 91 clipmask[next_vert] = 0;\92 outdata[n++] = next_vert++;\93 94 for (j = 0 ; j < SIZE ; j += 2) { 95 O[j] = LINTERP(t, I[j], J[j]);\96 O[j+1] = LINTERP(t, I[j+1], J[j+1]);\97 }\98 } 99 100 clipmask[elt_i] |= PLANE; /* don't set up */\101 102 if (!NEGATIVE(dpI)) { 103 outdata[n++] = elt_i;\104 clipmask[elt_i] &= ~PLANE; /* set up after all */\105 } 106 107 J = I; 108 dpJ = dpI; 109 } 110 111 if (n < 3) return; 72 #define CLIP(sgn,v,PLANE) \ 73 if (mask & PLANE) { \ 74 GLuint *indata = inlist[in]; \ 75 GLuint *outdata = inlist[in ^= 1]; \ 76 GLuint nr = n; \ 77 GLfloat *J = verts[indata[nr-1]].f; \ 78 GLfloat dpJ = (sgn J[v]) + J[CLIP_WCOORD]; \ 79 \ 80 inlist[0] = vlist1; \ 81 for (i = n = 0 ; i < nr ; i++) { \ 82 GLuint elt_i = indata[i]; \ 83 GLfloat *I = verts[elt_i].f; \ 84 GLfloat dpI = (sgn I[v]) + I[CLIP_WCOORD]; \ 85 \ 86 if (DIFFERENT_SIGNS(dpI, dpJ)) { \ 87 GLfloat *O = verts[next_vert].f; \ 88 GLfloat t = dpI / (dpI - dpJ); \ 89 GLuint j; \ 90 \ 91 clipmask[next_vert] = 0; \ 92 outdata[n++] = next_vert++; \ 93 \ 94 for (j = 0 ; j < SIZE ; j += 2) { \ 95 O[j] = LINTERP(t, I[j], J[j]); \ 96 O[j+1] = LINTERP(t, I[j+1], J[j+1]); \ 97 } \ 98 } \ 99 \ 100 clipmask[elt_i] |= PLANE; /* don't set up */ \ 101 \ 102 if (!NEGATIVE(dpI)) { \ 103 outdata[n++] = elt_i; \ 104 clipmask[elt_i] &= ~PLANE; /* set up after all */ \ 105 } \ 106 \ 107 J = I; \ 108 dpJ = dpI; \ 109 } \ 110 \ 111 if (n < 3) return; \ 112 112 } 113 113 114 #define LINE_CLIP(x,y,z,w,PLANE) 115 if (mask & PLANE) { 116 GLfloat dpI = DOT4V(I,x,y,z,w); 117 GLfloat dpJ = DOT4V(J,x,y,z,w); 118 119 if (DIFFERENT_SIGNS(dpI, dpJ)) { 120 GLfloat *O = verts[next_vert].f; 121 GLfloat t = dpI / (dpI - dpJ); 122 GLuint j; 123 124 for (j = 0 ; j < SIZE ; j += 2) { 125 O[j] = LINTERP(t, I[j], J[j]); 126 O[j+1] = LINTERP(t, I[j+1], J[j+1]);\127 } 128 129 clipmask[next_vert] = 0; 130 131 if (NEGATIVE(dpI)) { 132 clipmask[elts[0]] |= PLANE;\133 I = O; elts[0] = next_vert++;\134 } else { 135 clipmask[elts[1]] |= PLANE;\136 J = O; elts[1] = next_vert++;\137 } 138 } 139 else if (NEGATIVE(dpI)) 140 return; 114 #define LINE_CLIP(x,y,z,w,PLANE) \ 115 if (mask & PLANE) { \ 116 GLfloat dpI = DOT4V(I,x,y,z,w); \ 117 GLfloat dpJ = DOT4V(J,x,y,z,w); \ 118 \ 119 if (DIFFERENT_SIGNS(dpI, dpJ)) { \ 120 GLfloat *O = verts[next_vert].f; \ 121 GLfloat t = dpI / (dpI - dpJ); \ 122 GLuint j; \ 123 \ 124 for (j = 0 ; j < SIZE ; j += 2) { \ 125 O[j] = LINTERP(t, I[j], J[j]); \ 126 O[j+1] = LINTERP(t, I[j+1], J[j+1]); \ 127 } \ 128 \ 129 clipmask[next_vert] = 0; \ 130 \ 131 if (NEGATIVE(dpI)) { \ 132 clipmask[elts[0]] |= PLANE; \ 133 I = O; elts[0] = next_vert++; \ 134 } else { \ 135 clipmask[elts[1]] |= PLANE; \ 136 J = O; elts[1] = next_vert++; \ 137 } \ 138 } \ 139 else if (NEGATIVE(dpI)) \ 140 return; \ 141 141 } 142 142 143 143 144 #define CLIP_POINT( e ) 145 if (mask[e]) 146 *out++ = e 147 148 #define CLIP_LINE( e1, e0 ) 149 do { 150 GLubyte ormask = mask[e0] | mask[e1]; 151 out[0] = e1; 152 out[1] = e0; 153 out+=2; 154 if (ormask) { 155 out-=2; 156 if (!(mask[e0] & mask[e1])) { 157 TAG(fx_line_clip)( &out, verts, mask, &next_vert, ormask);\158 } 159 } 144 #define CLIP_POINT( e ) \ 145 if (mask[e]) \ 146 *out++ = e 147 148 #define CLIP_LINE( e1, e0 ) \ 149 do { \ 150 GLubyte ormask = mask[e0] | mask[e1]; \ 151 out[0] = e1; \ 152 out[1] = e0; \ 153 out+=2; \ 154 if (ormask) { \ 155 out-=2; \ 156 if (!(mask[e0] & mask[e1])) { \ 157 TAG(fx_line_clip)( &out, verts, mask, &next_vert, ormask); \ 158 } \ 159 } \ 160 160 } while (0) 161 161 162 #define CLIP_TRIANGLE( e2, e1, e0 ) 163 do { 164 GLubyte ormask; 165 out[0] = e2; 166 out[1] = e1; 167 out[2] = e0; 168 out += 3; 169 ormask = mask[e2] | mask[e1] | mask[e0]; 170 if (ormask) { 171 out -= 3; 172 if ( !(mask[e2] & mask[e1] & mask[e0])) { 173 TAG(fx_tri_clip)( &out, verts, mask, &next_vert, ormask );\174 } 175 } 162 #define CLIP_TRIANGLE( e2, e1, e0 ) \ 163 do { \ 164 GLubyte ormask; \ 165 out[0] = e2; \ 166 out[1] = e1; \ 167 out[2] = e0; \ 168 out += 3; \ 169 ormask = mask[e2] | mask[e1] | mask[e0]; \ 170 if (ormask) { \ 171 out -= 3; \ 172 if ( !(mask[e2] & mask[e1] & mask[e0])) { \ 173 TAG(fx_tri_clip)( &out, verts, mask, &next_vert, ormask ); \ 174 } \ 175 } \ 176 176 } while (0) 177 177 178 178 #if defined(FX_V2) || defined(DRIVERTS) 179 179 180 #define VARS_XYZ 181 GLfloat vsx = mat[MAT_SX]; 182 GLfloat vsy = mat[MAT_SY]; 183 GLfloat vsz = mat[MAT_SZ]; 184 GLfloat vtx = mat[MAT_TX]; 185 GLfloat vty = mat[MAT_TY]; 180 #define VARS_XYZ \ 181 GLfloat vsx = mat[MAT_SX]; \ 182 GLfloat vsy = mat[MAT_SY]; \ 183 GLfloat vsz = mat[MAT_SZ]; \ 184 GLfloat vtx = mat[MAT_TX]; \ 185 GLfloat vty = mat[MAT_TY]; \ 186 186 GLfloat vtz = mat[MAT_TZ]; 187 187 188 #define DO_SETUP_XYZ 189 f[XCOORD] = f[0] * oow * vsx + vtx; 190 f[YCOORD] = f[1] * oow * vsy + vty; 188 #define DO_SETUP_XYZ \ 189 f[XCOORD] = f[0] * oow * vsx + vtx; \ 190 f[YCOORD] = f[1] * oow * vsy + vty; \ 191 191 f[ZCOORD] = f[2] * oow * vsz + vtz; 192 192 … … 194 194 #if defined(HAVE_FAST_MATH) 195 195 196 #define VARS_XYZ 197 GLfloat vsx = mat[MAT_SX]; 198 GLfloat vsy = mat[MAT_SY]; 199 GLfloat vsz = mat[MAT_SZ]; 200 const GLfloat snapper = (3L << 18); 201 GLfloat vtx = mat[MAT_TX] + snapper; 202 GLfloat vty = mat[MAT_TY] + snapper; 196 #define VARS_XYZ \ 197 GLfloat vsx = mat[MAT_SX]; \ 198 GLfloat vsy = mat[MAT_SY]; \ 199 GLfloat vsz = mat[MAT_SZ]; \ 200 const GLfloat snapper = (3L << 18); \ 201 GLfloat vtx = mat[MAT_TX] + snapper; \ 202 GLfloat vty = mat[MAT_TY] + snapper; \ 203 203 GLfloat vtz = mat[MAT_TZ]; 204 204 205 #define DO_SETUP_XYZ 206 f[XCOORD] = f[0] * oow * vsx + vtx; 207 f[XCOORD] -= snapper; 208 f[YCOORD] = f[1] * oow * vsy + vty; 209 f[YCOORD] -= snapper; 205 #define DO_SETUP_XYZ \ 206 f[XCOORD] = f[0] * oow * vsx + vtx; \ 207 f[XCOORD] -= snapper; \ 208 f[YCOORD] = f[1] * oow * vsy + vty; \ 209 f[YCOORD] -= snapper; \ 210 210 f[ZCOORD] = f[2] * oow * vsz + vtz; 211 211 212 212 #else 213 213 214 #define VARS_XYZ 215 GLfloat vsx = mat[MAT_SX] * 16.0f; 216 GLfloat vsy = mat[MAT_SY] * 16.0f; 217 GLfloat vsz = mat[MAT_SZ]; 218 GLfloat vtx = mat[MAT_TX] * 16.0f; 219 GLfloat vty = mat[MAT_TY] * 16.0f; 214 #define VARS_XYZ \ 215 GLfloat vsx = mat[MAT_SX] * 16.0f; \ 216 GLfloat vsy = mat[MAT_SY] * 16.0f; \ 217 GLfloat vsz = mat[MAT_SZ]; \ 218 GLfloat vtx = mat[MAT_TX] * 16.0f; \ 219 GLfloat vty = mat[MAT_TY] * 16.0f; \ 220 220 GLfloat vtz = mat[MAT_TZ]; 221 221 222 #define DO_SETUP_XYZ 223 f[XCOORD] = ((int)(f[0]*oow*vsx+vtx)) * (1.0f/16.0f); 224 f[YCOORD] = ((int)(f[1]*oow*vsy+vty)) * (1.0f/16.0f); 222 #define DO_SETUP_XYZ \ 223 f[XCOORD] = ((int)(f[0]*oow*vsx+vtx)) * (1.0f/16.0f); \ 224 f[YCOORD] = ((int)(f[1]*oow*vsy+vty)) * (1.0f/16.0f); \ 225 225 f[ZCOORD] = f[2]*oow*vsz + vtz; 226 226 … … 231 231 232 232 233 struct fx_fast_tab 233 struct fx_fast_tab 234 234 { 235 235 void (*build_vertices)( struct vertex_buffer *VB, GLuint do_clip ); 236 236 237 void (*clip[GL_POLYGON+1])( struct vertex_buffer *VB, 238 239 240 237 void (*clip[GL_POLYGON+1])( struct vertex_buffer *VB, 238 GLuint start, 239 GLuint count, 240 GLuint parity ); 241 241 242 242 void (*project_clipped_vertices)( GLfloat *first, 243 244 245 246 243 GLfloat *last, 244 const GLfloat *mat, 245 GLuint stride, 246 const GLubyte *mask ); 247 247 248 248 void (*project_vertices)( GLfloat *first, 249 250 251 249 GLfloat *last, 250 const GLfloat *mat, 251 GLuint stride ); 252 252 }; 253 253 … … 258 258 #define CLIP_B CLIP_BCOORD 259 259 #define CLIP_A CLIP_ACOORD 260 #define CLIP_S0 4 260 #define CLIP_S0 4 261 261 #define CLIP_T0 5 262 262 #define CLIP_S1 6 … … 337 337 fx_init_fastpath_TMU0_TMU1( &fxFastTab[SETUP_TMU0|SETUP_TMU1] ); 338 338 fx_init_fastpath_RGBA_TMU0_TMU1( &fxFastTab[SETUP_RGBA|SETUP_TMU0| 339 339 SETUP_TMU1] ); 340 340 } 341 341 … … 357 357 GLfloat *mat = ctx->Viewport.WindowMap.m; 358 358 359 gl_prepare_arrays_cva( VB ); 359 gl_prepare_arrays_cva( VB ); /* still need this */ 360 360 361 361 if (VB->EltPtr->count * 12 > fxVB->size) { … … 377 377 if (VB->ClipOrMask) { 378 378 if (!VB->ClipAndMask) { 379 380 381 382 383 tab->project_clipped_vertices( fxVB->verts->f, 384 fxVB->last_vert->f, 385 mat, 16 * 4, 386 387 388 389 390 391 392 393 379 GLubyte tmp = VB->ClipOrMask; 380 381 tab->clip[prim]( VB, 0, VB->EltPtr->count, 0 ); /* clip */ 382 383 tab->project_clipped_vertices( fxVB->verts->f, 384 fxVB->last_vert->f, 385 mat, 16 * 4, 386 VB->ClipMask ); 387 388 ctx->CVA.elt_mode = gl_reduce_prim[prim]; 389 VB->EltPtr = &(FX_DRIVER_DATA(VB)->clipped_elements); 390 391 VB->ClipOrMask = 0; 392 fxDDRenderElementsDirect( VB ); /* render using new list */ 393 VB->ClipOrMask = tmp; 394 394 } 395 395 } else { 396 tab->project_vertices( fxVB->verts->f, 397 fxVB->last_vert->f, 398 mat, 16 * 4 ); 396 tab->project_vertices( fxVB->verts->f, 397 fxVB->last_vert->f, 398 mat, 16 * 4 ); 399 399 400 400 fxDDRenderElementsDirect( VB ); /* render using orig list */ … … 406 406 #endif 407 407 408 /* This indicates that there is no cached data to reuse. 408 /* This indicates that there is no cached data to reuse. 409 409 */ 410 410 VB->pipeline->data_valid = 0;
Note:
See TracChangeset
for help on using the changeset viewer.