Changeset 3598 for trunk/src/opengl/mesa/3dfx
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- Location:
- trunk/src/opengl/mesa/3dfx
- Files:
-
- 28 edited
-
fxapi.c (modified) (25 diffs)
-
fxclip.c (modified) (15 diffs)
-
fxcliptmp.h (modified) (18 diffs)
-
fxcva.c (modified) (16 diffs)
-
fxcva.h (modified) (2 diffs)
-
fxcvatmp.h (modified) (6 diffs)
-
fxdd.c (modified) (37 diffs)
-
fxddspan.c (modified) (14 diffs)
-
fxddtex.c (modified) (42 diffs)
-
fxdrv.h (modified) (24 diffs)
-
fxfastpath.c (modified) (10 diffs)
-
fxfasttmp.h (modified) (11 diffs)
-
fxglidew.c (modified) (25 diffs)
-
fxglidew.h (modified) (22 diffs)
-
fxpipeline.c (modified) (10 diffs)
-
fxrender.c (modified) (28 diffs)
-
fxsanity.c (modified) (3 diffs)
-
fxsdettmp.h (modified) (7 diffs)
-
fxsetup.c (modified) (50 diffs)
-
fxstripdet.c (modified) (3 diffs)
-
fxtexman.c (modified) (26 diffs)
-
fxtrifuncs.c (modified) (11 diffs)
-
fxtritmp.h (modified) (24 diffs)
-
fxvs_tmp.h (modified) (3 diffs)
-
fxvsetup.c (modified) (21 diffs)
-
fxvsetup.h (modified) (6 diffs)
-
fxwgl.c (modified) (6 diffs)
-
makefile (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/3dfx/fxapi.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. … … 70 70 * - fixed few problems in my and Keith's fxDDClear code 71 71 * - merged my code with the Keith's one 72 * - used the new BlendFunc Mesa device driver function 73 * - used the new AlphaFunc Mesa device driver function 74 * - used the new Enable Mesa device driver function 72 * - used the new BlendFunc Mesa device driver function 73 * - used the new AlphaFunc Mesa device driver function 74 * - used the new Enable Mesa device driver function 75 75 * - fixed a bug related to fog in the Mesa core. Fog 76 76 * were applied two times: at vertex level and at fragment … … 126 126 * OpenGL Optimizer 1.1 (thanks to Erwin Coumans for 127 127 * the bug report) 128 * - fixed some bug in the fxwgl.c code (thanks to 128 * - fixed some bug in the fxwgl.c code (thanks to 129 129 * Peter Pettersson for a patch and a bug report) 130 130 * … … 249 249 * - written the first partial support for the Multitexture extension. 250 250 * This task is quite hard because the color combine units work after 251 * the two texture combine units and not before as required by the 251 * the two texture combine units and not before as required by the 252 252 * Multitexture extension 253 253 * - written a workaround in fxBestResolution() in order to solve a … … 256 256 * screen resolution supported by the hardware (instead of 640x480) 257 257 * when it is unable to find an appropriate resolution that is large 258 * enough for the requested size 258 * enough for the requested size 259 259 * - the driver is now able to use also the texture memory attached to 260 260 * second TMU … … 349 349 * - fixed a bug in fxmesa6.h for GL_LINE_LOOP 350 350 * - fixed a NearFarStack bug in the Mesa when applications 351 * directly call glLoadMatrix to load a projection matrix 351 * directly call glLoadMatrix to load a projection matrix 352 352 * - done some cleanup in the fxmesa2.c file 353 353 * - the driver no longer translates the texture maps … … 484 484 * - optimized the SETUP macro (added one argument) 485 485 * - the Mesa/Voodoo is now 20/30% for points, lines and small triangles ! 486 * - performance improvement setting VBSIZE to 72 486 * - performance improvement setting VBSIZE to 72 487 487 * - the GrVertex texture code is now written in asm 488 488 * - the GrVertex zbuffer code is now written in asm … … 582 582 * V0.13 - David Bucciarelli (tech.hmw@plus.it) Humanware s.r.l. 583 583 * - now glBlendFunc() works for all glBlendFunc without DST_ALPHA 584 * (because the alpha buffer is not yet implemented) 584 * (because the alpha buffer is not yet implemented) 585 585 * - now fxMesaCreateContext() accept resolution and refresh rate 586 586 * - fixed a bug for texture mapping: the w (alias z) must be set … … 607 607 * - introduced texture mapping support (not yet finished !) 608 608 * - tested with Mesa2.2b6 609 * - the driver is faster 609 * - the driver is faster 610 610 * - written glFlush/glFinish 611 611 * - the driver print a lot of info about the Glide lib … … 665 665 666 666 cleangraphics(); 667 /* abort(); */668 exit(1);667 /* ABORT(); */ 668 EXIT(1); 669 669 } 670 670 #endif … … 702 702 703 703 /* 704 * The extension GL_FXMESA_global_texture_lod_bias705 */706 void GLAPIENTRY glGlobalTextureLODBiasFXMESA(GLfloat biasVal)707 {708 grTexLodBiasValue(GR_TMU0,biasVal);709 710 if(fxMesaCurrentCtx->haveTwoTMUs)711 grTexLodBiasValue(GR_TMU1,biasVal);712 }713 714 715 /*716 704 * The 3Dfx Global Palette extension for GLQuake. 717 705 * More a trick than a real extesion, use the shared global 718 * palette extension. 706 * palette extension. 719 707 */ 708 extern void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *pal); /* silence warning */ 720 709 void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *pal) 721 710 { 722 711 fxMesaContext fxMesa =fxMesaCurrentCtx; 723 712 724 713 if (MESA_VERBOSE&VERBOSE_DRIVER) { 725 714 int i; … … 730 719 fprintf(stderr,"%x\n",pal[i]); 731 720 } 732 721 733 722 if(fxMesa) { 734 723 fxMesa->haveGlobalPaletteTexture=1; 735 724 736 725 FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE,(GuTexPalette *)pal); 737 726 if (fxMesa->haveTwoTMUs) 738 FX_grTexDownloadTable(GR_TMU1,GR_TEXTABLE_PALETTE,(GuTexPalette *)pal);727 FX_grTexDownloadTable(GR_TMU1,GR_TEXTABLE_PALETTE,(GuTexPalette *)pal); 739 728 } 740 729 } … … 743 732 static GrScreenResolution_t fxBestResolution(int width, int height, int aux) 744 733 { 745 static int resolutions[][5]={ 734 static int resolutions[][5]={ 746 735 { 512, 384, GR_RESOLUTION_512x384, 2, 2 }, 747 736 { 640, 400, GR_RESOLUTION_640x400, 2, 2 }, … … 795 784 796 785 fxMesaContext GLAPIENTRY fxMesaCreateBestContext(GLuint win,GLint width, GLint height, 797 const GLint attribList[])786 const GLint attribList[]) 798 787 { 799 788 GrScreenRefresh_t refresh; … … 887 876 switch (attribList[i]) { 888 877 case FXMESA_DOUBLEBUFFER: 889 doubleBuffer=GL_TRUE;890 break;878 doubleBuffer=GL_TRUE; 879 break; 891 880 case FXMESA_ALPHA_SIZE: 892 i++;893 alphaBuffer=attribList[i]>0;894 if(alphaBuffer)895 aux=1;896 break;881 i++; 882 alphaBuffer=attribList[i]>0; 883 if(alphaBuffer) 884 aux=1; 885 break; 897 886 case FXMESA_DEPTH_SIZE: 898 i++; 899 depthSize=attribList[i]; 900 if(depthSize) 901 aux=1; 902 break; 887 i++; 888 depthSize=attribList[i]; 889 if(depthSize) { 890 aux=1; 891 depthSize = 16; 892 } 893 break; 903 894 case FXMESA_STENCIL_SIZE: 904 i++;905 stencilSize=attribList[i];906 break;895 i++; 896 stencilSize=attribList[i]; 897 break; 907 898 case FXMESA_ACCUM_SIZE: 908 i++;909 accumSize=attribList[i];910 break;911 /* XXX ugly hack here for sharing display lists */899 i++; 900 accumSize=attribList[i]; 901 break; 902 /* XXX ugly hack here for sharing display lists */ 912 903 #define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */ 913 904 case FXMESA_SHARE_CONTEXT: 914 i++;915 {916 const void *vPtr = &attribList[i];917 GLcontext **ctx = (GLcontext **) vPtr;918 shareCtx = *ctx;919 }920 break;905 i++; 906 { 907 const void *vPtr = &attribList[i]; 908 GLcontext **ctx = (GLcontext **) vPtr; 909 shareCtx = *ctx; 910 } 911 break; 921 912 default: 922 if (MESA_VERBOSE&VERBOSE_DRIVER) {923 fprintf(stderr,"fxmesa: fxMesaCreateContext() End (defualt)\n");924 }925 return NULL;913 if (MESA_VERBOSE&VERBOSE_DRIVER) { 914 fprintf(stderr,"fxmesa: fxMesaCreateContext() End (defualt)\n"); 915 } 916 return NULL; 926 917 } 927 918 i++; … … 965 956 fxMesa->board=glbCurrentBoard; 966 957 958 959 fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref, 967 960 #if FXMESA_USE_ARGB 968 fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref, 969 GR_COLORFORMAT_ARGB, 970 GR_ORIGIN_LOWER_LEFT, 971 2,aux); 961 GR_COLORFORMAT_ARGB, 972 962 #else 973 fxMesa->glideContext = FX_grSstWinOpen((FxU32)win,res,ref, 974 GR_COLORFORMAT_ABGR, 975 GR_ORIGIN_LOWER_LEFT, 976 2,aux); 963 GR_COLORFORMAT_ABGR, 977 964 #endif 965 GR_ORIGIN_LOWER_LEFT, 966 2,aux); 978 967 if (!fxMesa->glideContext){ 979 errorstr = "grSstWinOpen"; 968 errorstr = "grSstWinOpen"; 980 969 goto errorhandler; 981 970 } 982 971 983 972 /* Pixel tables are use during pixel read-back */ 984 #if FXMESA_USE_ARGB 985 fxInitPixelTables( GL_FALSE); /* Force RGB pixel order */973 #if FXMESA_USE_ARGB 974 fxInitPixelTables(fxMesa, GL_FALSE); /* Force RGB pixel order */ 986 975 #else 987 976 if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) { … … 992 981 * Thanks to Joseph Kain for that one 993 982 */ 994 if (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx == 2) { 995 fxInitPixelTables(GL_FALSE); /* use RGB pixel order (Voodoo3) */ 983 GrVoodooConfig_t *voodoo; 984 voodoo = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; 985 986 if (voodoo->nTexelfx == 2 && voodoo->fbiRev != 260) { 987 /* RGB pixel order (Voodoo3, but some Quantum3D models) */ 988 fxInitPixelTables(fxMesa, GL_FALSE); 996 989 } 997 990 else { 998 fxInitPixelTables(GL_TRUE); /* use BGR pixel order on Voodoo1/2 */ 991 /* BGR pixel order on Voodoo1/2, or certain Quantum3D models */ 992 fxInitPixelTables(fxMesa, GL_TRUE); 999 993 } 1000 994 } 1001 995 else { 1002 fxInitPixelTables( GL_FALSE); /* use RGB pixel order otherwise */996 fxInitPixelTables(fxMesa, GL_FALSE); /* use RGB pixel order otherwise */ 1003 997 } 1004 998 #endif … … 1017 1011 fxMesa->y_offset = 0; 1018 1012 fxMesa->y_delta = 0; 1019 1013 1020 1014 fxMesa->needClip = 0; 1021 1015 … … 1025 1019 1026 1020 fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */ 1027 alphaBuffer,1028 doubleBuffer,1029 GL_FALSE, /* stereo */1030 depthSize, /* depth_size */1031 stencilSize, /* stencil_size */1032 accumSize, /* accum_size */1033 0, /* index bits */1034 5,6,5,0); /* RGBA bits */1021 alphaBuffer, 1022 doubleBuffer, 1023 GL_FALSE, /* stereo */ 1024 depthSize, /* depth_size */ 1025 stencilSize, /* stencil_size */ 1026 accumSize, /* accum_size */ 1027 0, /* index bits */ 1028 5,6,5,0); /* RGBA bits */ 1035 1029 if (!fxMesa->glVis) { 1036 1030 errorstr = "gl_create_visual"; … … 1039 1033 1040 1034 ctx = fxMesa->glCtx=gl_create_context(fxMesa->glVis, 1041 shareCtx, /* share list context */1042 (void *) fxMesa, GL_TRUE);1035 shareCtx, /* share list context */ 1036 (void *) fxMesa, GL_TRUE); 1043 1037 if (!ctx) { 1044 1038 errorstr = "gl_create_context"; … … 1048 1042 1049 1043 if (!fxDDInitFxMesaContext( fxMesa )) { 1050 errorstr = "fxDDInitFxMesaContext failed"; 1044 errorstr = "fxDDInitFxMesaContext failed"; 1051 1045 goto errorhandler; 1052 1046 } 1053 1047 1054 1048 1055 fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis); 1049 fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis, 1050 GL_FALSE, /* no software depth */ 1051 fxMesa->glVis->StencilBits > 0, 1052 fxMesa->glVis->AccumBits > 0, 1053 fxMesa->glVis->AlphaBits > 0 ); 1056 1054 if (!fxMesa->glBuffer) { 1057 1055 errorstr = "gl_create_framebuffer"; 1058 1056 goto errorhandler; 1059 1057 } 1060 1058 1061 1059 glbTotNumCtx++; 1062 1060 1063 1061 /* install signal handlers */ 1064 1062 #if defined(__linux__) 1065 if (fxMesa->glCtx->CatchSignals) { 1063 /* Only install if environment var. is not set. */ 1064 if (fxMesa->glCtx->CatchSignals && !getenv("MESA_FX_NO_SIGNALS")) { 1066 1065 signal(SIGINT,cleangraphics_handler); 1067 1066 signal(SIGHUP,cleangraphics_handler); … … 1084 1083 if (fxMesa) { 1085 1084 if (fxMesa->glideContext) 1086 FX_grSstWinClose(fxMesa->glideContext);1085 FX_grSstWinClose(fxMesa->glideContext); 1087 1086 fxMesa->glideContext = 0; 1088 1089 if (fxMesa->state) 1090 free(fxMesa->state);1087 1088 if (fxMesa->state) 1089 free(fxMesa->state); 1091 1090 if (fxMesa->fogTable) 1092 free(fxMesa->fogTable);1091 free(fxMesa->fogTable); 1093 1092 if (fxMesa->glBuffer) 1094 gl_destroy_framebuffer(fxMesa->glBuffer);1093 gl_destroy_framebuffer(fxMesa->glBuffer); 1095 1094 if (fxMesa->glVis) 1096 gl_destroy_visual(fxMesa->glVis);1095 gl_destroy_visual(fxMesa->glVis); 1097 1096 if (fxMesa->glCtx) 1098 gl_destroy_context(fxMesa->glCtx);1097 gl_destroy_context(fxMesa->glCtx); 1099 1098 free(fxMesa); 1100 1099 } 1101 1100 1102 1101 if (MESA_VERBOSE&VERBOSE_DRIVER) { 1103 1102 fprintf(stderr,"fxmesa: fxMesaCreateContext() End (%s)\n",errorstr); … … 1160 1159 (fxMesa->stats.memTexUpload/(float)fxMesa->stats.swapBuffer)/(float)(1<<20)); 1161 1160 } 1162 if (fxMesa->state) 1161 if (fxMesa->state) 1163 1162 free(fxMesa->state); 1164 1163 if (fxMesa->fogTable) 1165 1164 free(fxMesa->fogTable); 1166 1165 fxTMClose(fxMesa); 1167 1166 1168 1167 free(fxMesa); 1169 1168 } … … 1276 1275 if(getenv("MESA_FX_INFO")) { 1277 1276 char buf[80]; 1278 1277 1279 1278 FX_grGlideGetVersion(buf); 1280 1279 fprintf(stderr,"Using Glide V%s\n",""); … … 1306 1305 onexit((_onexit_t)cleangraphics); 1307 1306 #elif defined(__linux__) 1308 atexit(cleangraphics); 1307 /* Only register handler if environment variable is not defined. */ 1308 if (!getenv("MESA_FX_NO_SIGNALS")) { 1309 atexit(cleangraphics); 1310 } 1309 1311 #endif 1310 1312 } -
trunk/src/opengl/mesa/3dfx/fxclip.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. … … 68 68 69 69 70 #define CLIP(sgn,v) \71 do { \72 GLuint out = in ^ 1; \73 GLfloat **indata = inlist[in]; \74 GrVertex **inverts = vertlist[in]; \75 GrVertex **outverts = vertlist[out]; \76 GLfloat **outdata = inlist[in = out]; \77 GLfloat *J = indata[n-1]; \78 GLfloat dpJ = (sgn J[v]) + J[3]; \79 GLuint nr = n; \80 \81 for (i = n = 0 ; i < nr ; i++) { \82 GLfloat *I = indata[i]; \83 GLfloat dpI = (sgn I[v]) + I[3]; \84 \85 if (DIFFERENT_SIGNS(dpI, dpJ)) { \86 GLuint j;\70 #define CLIP(sgn,v) \ 71 do { \ 72 GLuint out = in ^ 1; \ 73 GLfloat **indata = inlist[in]; \ 74 GrVertex **inverts = vertlist[in]; \ 75 GrVertex **outverts = vertlist[out]; \ 76 GLfloat **outdata = inlist[in = out]; \ 77 GLfloat *J = indata[n-1]; \ 78 GLfloat dpJ = (sgn J[v]) + J[3]; \ 79 GLuint nr = n; \ 80 \ 81 for (i = n = 0 ; i < nr ; i++) { \ 82 GLfloat *I = indata[i]; \ 83 GLfloat dpI = (sgn I[v]) + I[3]; \ 84 \ 85 if (DIFFERENT_SIGNS(dpI, dpJ)) { \ 86 GLuint j; \ 87 87 GLfloat t = dpI / (dpI - dpJ); \ 88 outverts[n] = 0;\89 outdata[n++] = store;\90 store[3] = LINTERP(t, I[3], J[3]);\91 store[v] = - sgn store[3];\92 if (v != 0) store[0] = LINTERP(t, I[0], J[0]);\93 if (v != 1) store[1] = LINTERP(t, I[1], J[1]);\94 if (v != 2) store[2] = LINTERP(t, I[2], J[2]);\95 store += 4;\96 for (j = 4 ; j < sz ; j+=4,store+=4) {\97 store[0] = LINTERP(t, I[j], J[j] );\98 store[1] = LINTERP(t, I[j+1], J[j+1] );\99 store[2] = LINTERP(t, I[j+2], J[j+2] );\100 store[3] = LINTERP(t, I[j+3], J[j+3] );\101 }\102 } \103 \104 if (!NEGATIVE(dpI)) { \105 outverts[n] = inverts[i];\106 outdata[n++] = I;\107 } \108 \109 \110 J = I; \111 dpJ = dpI; \112 } \113 \114 if (n < 3) return 0; \88 outverts[n] = 0; \ 89 outdata[n++] = store; \ 90 store[3] = LINTERP(t, I[3], J[3]); \ 91 store[v] = - sgn store[3]; \ 92 if (v != 0) store[0] = LINTERP(t, I[0], J[0]); \ 93 if (v != 1) store[1] = LINTERP(t, I[1], J[1]); \ 94 if (v != 2) store[2] = LINTERP(t, I[2], J[2]); \ 95 store += 4; \ 96 for (j = 4 ; j < sz ; j+=4,store+=4) { \ 97 store[0] = LINTERP(t, I[j], J[j] ); \ 98 store[1] = LINTERP(t, I[j+1], J[j+1] ); \ 99 store[2] = LINTERP(t, I[j+2], J[j+2] ); \ 100 store[3] = LINTERP(t, I[j+3], J[j+3] ); \ 101 } \ 102 } \ 103 \ 104 if (!NEGATIVE(dpI)) { \ 105 outverts[n] = inverts[i]; \ 106 outdata[n++] = I; \ 107 } \ 108 \ 109 \ 110 J = I; \ 111 dpJ = dpI; \ 112 } \ 113 \ 114 if (n < 3) return 0; \ 115 115 } while (0) 116 116 … … 121 121 * code only really differs in the way it sets store[v] to +- w. 122 122 */ 123 #define UCLIP(a,b,c,d) \124 do { \125 GLuint out = in ^ 1; \126 GLfloat **indata = inlist[in]; \127 GrVertex **inverts = vertlist[in]; \128 GrVertex **outverts = vertlist[out]; \129 GLfloat **outdata = inlist[in = out]; \130 GLfloat *J = indata[n-1]; \131 GLfloat dpJ = DOT4V(J,a,b,c,d); \132 GLuint nr = n; \133 \134 for (i = n = 0 ; i < nr ; i++) { \135 GLfloat *I = indata[i]; \136 GLfloat dpI = DOT4V(I,a,b,c,d); \137 \138 if (DIFFERENT_SIGNS(dpI, dpJ)) { \139 GLuint j;\140 GLfloat t = dpI / (dpI - dpJ);\141 outverts[n] = 0;\142 outdata[n++] = store;\143 for (j = 0 ; j < sz ; j+=4,store+=4) {\144 store[0] = LINTERP(t, I[j], J[j] );\145 store[1] = LINTERP(t, I[j+1], J[j+1] );\146 store[2] = LINTERP(t, I[j+2], J[j+2] );\147 store[3] = LINTERP(t, I[j+3], J[j+3] );\148 }\149 } \150 \151 if (!NEGATIVE(dpI)) { \152 outverts[n] = inverts[i];\153 outdata[n++] = I;\154 } \155 \156 \157 J = I; \158 dpJ = dpI; \159 } \160 \161 if (n < 3) return 0; \123 #define UCLIP(a,b,c,d) \ 124 do { \ 125 GLuint out = in ^ 1; \ 126 GLfloat **indata = inlist[in]; \ 127 GrVertex **inverts = vertlist[in]; \ 128 GrVertex **outverts = vertlist[out]; \ 129 GLfloat **outdata = inlist[in = out]; \ 130 GLfloat *J = indata[n-1]; \ 131 GLfloat dpJ = DOT4V(J,a,b,c,d); \ 132 GLuint nr = n; \ 133 \ 134 for (i = n = 0 ; i < nr ; i++) { \ 135 GLfloat *I = indata[i]; \ 136 GLfloat dpI = DOT4V(I,a,b,c,d); \ 137 \ 138 if (DIFFERENT_SIGNS(dpI, dpJ)) { \ 139 GLuint j; \ 140 GLfloat t = dpI / (dpI - dpJ); \ 141 outverts[n] = 0; \ 142 outdata[n++] = store; \ 143 for (j = 0 ; j < sz ; j+=4,store+=4) { \ 144 store[0] = LINTERP(t, I[j], J[j] ); \ 145 store[1] = LINTERP(t, I[j+1], J[j+1] ); \ 146 store[2] = LINTERP(t, I[j+2], J[j+2] ); \ 147 store[3] = LINTERP(t, I[j+3], J[j+3] ); \ 148 } \ 149 } \ 150 \ 151 if (!NEGATIVE(dpI)) { \ 152 outverts[n] = inverts[i]; \ 153 outdata[n++] = I; \ 154 } \ 155 \ 156 \ 157 J = I; \ 158 dpJ = dpI; \ 159 } \ 160 \ 161 if (n < 3) return 0; \ 162 162 } while (0) 163 163 … … 172 172 */ 173 173 static INLINE GLuint fx_clip_triangle( GLcontext *ctx, 174 GLfloat *inoutlist[],175 GrVertex **verts,176 GLuint sz,177 GLuint mask )174 GLfloat *inoutlist[], 175 GrVertex **verts, 176 GLuint sz, 177 GLuint mask ) 178 178 { 179 179 GLuint n = 3; … … 195 195 { 196 196 if (mask & CLIP_RIGHT_BIT) 197 CLIP(-,0);197 CLIP(-,0); 198 198 199 199 if (mask & CLIP_LEFT_BIT) 200 CLIP(+,0);200 CLIP(+,0); 201 201 202 202 if (mask & CLIP_TOP_BIT) 203 CLIP(-,1);203 CLIP(-,1); 204 204 205 205 if (mask & CLIP_BOTTOM_BIT) 206 CLIP(+,1);206 CLIP(+,1); 207 207 208 208 if (mask & CLIP_FAR_BIT) 209 CLIP(-,2);209 CLIP(-,2); 210 210 211 211 if (mask & CLIP_NEAR_BIT) 212 CLIP(+,2);212 CLIP(+,2); 213 213 } 214 214 … … 217 217 GLfloat (*plane)[4] = &ctx->Transform.ClipUserPlane[0]; 218 218 for (bit = 0x100 ; bit < mask ; plane++, bit *= 2) { 219 if (mask & bit) {220 GLfloat a = plane[0][0];221 GLfloat b = plane[0][1];222 GLfloat c = plane[0][2];223 GLfloat d = plane[0][3];224 UCLIP(a,b,c,d);225 }219 if (mask & bit) { 220 GLfloat a = plane[0][0]; 221 GLfloat b = plane[0][1]; 222 GLfloat c = plane[0][2]; 223 GLfloat d = plane[0][3]; 224 UCLIP(a,b,c,d); 225 } 226 226 } 227 227 } … … 229 229 if (inlist[in] != inoutlist) 230 230 for (i = 0 ; i < n ; i++) { 231 inoutlist[i] = inlist[in][i];232 verts[i] = verts2[i];231 inoutlist[i] = inlist[in][i]; 232 verts[i] = verts2[i]; 233 233 } 234 234 … … 239 239 240 240 static INLINE GLuint fx_view_clip_triangle( GLcontext *ctx, 241 GLfloat *inoutlist[],242 GrVertex **verts,243 GLuint sz,244 GLubyte mask )241 GLfloat *inoutlist[], 242 GrVertex **verts, 243 GLuint sz, 244 GLubyte mask ) 245 245 { 246 246 GLuint n = 3; … … 279 279 if (inlist[in] != inoutlist) 280 280 for (i = 0 ; i < n ; i++) { 281 inoutlist[i] = inlist[in][i];282 verts[i] = verts2[i];281 inoutlist[i] = inlist[in][i]; 282 verts[i] = verts2[i]; 283 283 } 284 284 … … 290 290 #undef CLIP 291 291 292 #define CLIP(x,y,z,w) \293 do { \294 GLfloat dpI = DOT4V(I,x,y,z,w); \295 GLfloat dpJ = DOT4V(J,x,y,z,w); \296 \297 if (DIFFERENT_SIGNS(dpI, dpJ)) { \298 GLuint j; \299 GLfloat t = dpI / (dpI - dpJ); \300 GLfloat *tmp = store; \301 \302 for (j = 0 ; j < sz ; j+=2) { \303 *store++ = LINTERP(t, I[j], J[j] );\304 *store++ = LINTERP(t, I[j+1], J[j+1] );\305 } \306 \307 if (NEGATIVE(dpI)) \308 I = tmp;\309 else \310 J = tmp;\311 \312 } \313 else if (NEGATIVE(dpI)) \314 return 0; \315 \292 #define CLIP(x,y,z,w) \ 293 do { \ 294 GLfloat dpI = DOT4V(I,x,y,z,w); \ 295 GLfloat dpJ = DOT4V(J,x,y,z,w); \ 296 \ 297 if (DIFFERENT_SIGNS(dpI, dpJ)) { \ 298 GLuint j; \ 299 GLfloat t = dpI / (dpI - dpJ); \ 300 GLfloat *tmp = store; \ 301 \ 302 for (j = 0 ; j < sz ; j+=2) { \ 303 *store++ = LINTERP(t, I[j], J[j] ); \ 304 *store++ = LINTERP(t, I[j+1], J[j+1] ); \ 305 } \ 306 \ 307 if (NEGATIVE(dpI)) \ 308 I = tmp; \ 309 else \ 310 J = tmp; \ 311 \ 312 } \ 313 else if (NEGATIVE(dpI)) \ 314 return 0; \ 315 \ 316 316 } while (0) 317 317 318 318 319 319 static GLuint fx_clip_line( GLcontext *ctx, 320 GLfloat *inoutlist[],321 GLuint sz,322 GLubyte clipor )320 GLfloat *inoutlist[], 321 GLuint sz, 322 GLubyte clipor ) 323 323 { 324 324 GLfloat *I = inoutlist[0]; … … 329 329 { 330 330 if (clipor & CLIP_LEFT_BIT) 331 CLIP(1,0,0,1);332 331 CLIP(1,0,0,1); 332 333 333 if (clipor & CLIP_RIGHT_BIT) 334 CLIP(-1,0,0,1);335 334 CLIP(-1,0,0,1); 335 336 336 if (clipor & CLIP_TOP_BIT) 337 CLIP(0,-1,0,1);338 337 CLIP(0,-1,0,1); 338 339 339 if (clipor & CLIP_BOTTOM_BIT) 340 CLIP(0,1,0,1);341 340 CLIP(0,1,0,1); 341 342 342 if (clipor & CLIP_FAR_BIT) 343 CLIP(0,0,-1,1);344 343 CLIP(0,0,-1,1); 344 345 345 if (clipor & CLIP_NEAR_BIT) 346 CLIP(0,0,1,1);346 CLIP(0,0,1,1); 347 347 } 348 348 … … 350 350 GLuint i; 351 351 for (i = 0 ; i < MAX_CLIP_PLANES ; i++) { 352 if (ctx->Transform.ClipEnabled[i]) {353 GLfloat a = ctx->Transform.ClipUserPlane[i][0];354 GLfloat b = ctx->Transform.ClipUserPlane[i][1];355 GLfloat c = ctx->Transform.ClipUserPlane[i][2];356 GLfloat d = ctx->Transform.ClipUserPlane[i][3];357 CLIP(a,b,c,d);358 }352 if (ctx->Transform.ClipEnabled[i]) { 353 GLfloat a = ctx->Transform.ClipUserPlane[i][0]; 354 GLfloat b = ctx->Transform.ClipUserPlane[i][1]; 355 GLfloat c = ctx->Transform.ClipUserPlane[i][2]; 356 GLfloat d = ctx->Transform.ClipUserPlane[i][3]; 357 CLIP(a,b,c,d); 358 } 359 359 } 360 360 } … … 373 373 #if defined(FX_V2) 374 374 375 #define VARS_XYZW \376 GLfloat vsx = mat[MAT_SX]; \377 GLfloat vsy = mat[MAT_SY]; \378 GLfloat vsz = mat[MAT_SZ]; \379 GLfloat vtx = mat[MAT_TX]; \380 GLfloat vty = mat[MAT_TY]; \381 GLfloat vtz = mat[MAT_TZ]; 382 383 #define DO_SETUP_XYZW \384 { \385 GLfloat oow = 1.0 / data[3]; \386 v->x = data[0]*oow*vsx + vtx; \387 v->y = data[1]*oow*vsy + vty; \388 v->ooz = data[2]*oow*vsz + vtz; \389 v->oow = oow; \375 #define VARS_XYZW \ 376 GLfloat vsx = mat[MAT_SX]; \ 377 GLfloat vsy = mat[MAT_SY]; \ 378 GLfloat vsz = mat[MAT_SZ]; \ 379 GLfloat vtx = mat[MAT_TX]; \ 380 GLfloat vty = mat[MAT_TY]; \ 381 GLfloat vtz = mat[MAT_TZ]; 382 383 #define DO_SETUP_XYZW \ 384 { \ 385 GLfloat oow = 1.0 / data[3]; \ 386 v->x = data[0]*oow*vsx + vtx; \ 387 v->y = data[1]*oow*vsy + vty; \ 388 v->ooz = data[2]*oow*vsz + vtz; \ 389 v->oow = oow; \ 390 390 } 391 391 #else … … 393 393 #if defined(DRIVERTS) 394 394 395 #define VARS_XYZW \396 GLfloat vsx = mat[MAT_SX]; \397 GLfloat vsy = mat[MAT_SY]; \398 GLfloat vsz = mat[MAT_SZ]; \399 GLfloat vtx = mat[MAT_TX]+fxMesa->x_offset; \400 GLfloat vty = mat[MAT_TY]+fxMesa->y_delta; \395 #define VARS_XYZW \ 396 GLfloat vsx = mat[MAT_SX]; \ 397 GLfloat vsy = mat[MAT_SY]; \ 398 GLfloat vsz = mat[MAT_SZ]; \ 399 GLfloat vtx = mat[MAT_TX]+fxMesa->x_offset; \ 400 GLfloat vty = mat[MAT_TY]+fxMesa->y_delta; \ 401 401 GLfloat vtz = mat[MAT_TZ]; 402 402 403 #define DO_SETUP_XYZW \404 { \405 GLfloat oow = 1.0 / data[3]; \406 v->x = data[0]*oow*vsx + vtx; \407 v->y = data[1]*oow*vsy + vty; \408 v->ooz = data[2]*oow*vsz + vtz; \409 v->oow = oow; \403 #define DO_SETUP_XYZW \ 404 { \ 405 GLfloat oow = 1.0 / data[3]; \ 406 v->x = data[0]*oow*vsx + vtx; \ 407 v->y = data[1]*oow*vsy + vty; \ 408 v->ooz = data[2]*oow*vsz + vtz; \ 409 v->oow = oow; \ 410 410 } 411 411 412 412 #else 413 #define VARS_XYZW \414 GLfloat vsx = mat[MAT_SX]; \415 GLfloat vsy = mat[MAT_SY]; \416 GLfloat vsz = mat[MAT_SZ]; \417 const GLfloat snapper = (3L << 18); \418 GLfloat snap_tx = mat[MAT_TX] + snapper; \419 GLfloat snap_ty = mat[MAT_TY] + snapper; \413 #define VARS_XYZW \ 414 GLfloat vsx = mat[MAT_SX]; \ 415 GLfloat vsy = mat[MAT_SY]; \ 416 GLfloat vsz = mat[MAT_SZ]; \ 417 const GLfloat snapper = (3L << 18); \ 418 GLfloat snap_tx = mat[MAT_TX] + snapper; \ 419 GLfloat snap_ty = mat[MAT_TY] + snapper; \ 420 420 GLfloat vtz = mat[MAT_TZ]; 421 421 422 #define DO_SETUP_XYZW \423 { \424 GLfloat oow = 1.0 / data[3]; \425 v->x = data[0]*oow*vsx + snap_tx; \426 v->y = data[1]*oow*vsy + snap_ty; \427 v->ooz = data[2]*oow*vsz + vtz; \428 v->oow = oow; \429 v->x -= snapper; \430 v->y -= snapper; \422 #define DO_SETUP_XYZW \ 423 { \ 424 GLfloat oow = 1.0 / data[3]; \ 425 v->x = data[0]*oow*vsx + snap_tx; \ 426 v->y = data[1]*oow*vsy + snap_ty; \ 427 v->ooz = data[2]*oow*vsz + vtz; \ 428 v->oow = oow; \ 429 v->x -= snapper; \ 430 v->y -= snapper; \ 431 431 } 432 432 … … 434 434 #endif 435 435 436 #define COPY_XYZW_STRIDE \437 { GLfloat *clip = VEC_ELT(VB->ClipPtr, GLfloat, e); \436 #define COPY_XYZW_STRIDE \ 437 { GLfloat *clip = VEC_ELT(VB->ClipPtr, GLfloat, e); \ 438 438 COPY_4FV(out, clip); } 439 439 440 440 #define VARS_RGBA 441 441 442 #define COPY_RGBA_STRIDE \443 { GLubyte *color = VEC_ELT(VB->ColorPtr, GLubyte, e); \442 #define COPY_RGBA_STRIDE \ 443 { GLubyte *color = VEC_ELT(VB->ColorPtr, GLubyte, e); \ 444 444 UBYTE_RGBA_TO_FLOAT_255_RGBA((out+4), color); } 445 445 446 446 #if FX_USE_PARGB 447 #define DO_SETUP_RGBA \448 GET_PARGB(v) = (((int)data[4+3]) << 24) | \449 (((int)data[4+0]) << 16) |\450 (((int)data[4+1]) << 8) |\451 (((int)data[4+2]) << 0);447 #define DO_SETUP_RGBA \ 448 GET_PARGB(v) = (((int)data[4+3]) << 24) | \ 449 (((int)data[4+0]) << 16) | \ 450 (((int)data[4+1]) << 8) | \ 451 (((int)data[4+2]) << 0); 452 452 #else 453 #define DO_SETUP_RGBA \454 v->r = data[4+0]; \455 v->g = data[4+1]; \456 v->b = data[4+2]; \453 #define DO_SETUP_RGBA \ 454 v->r = data[4+0]; \ 455 v->g = data[4+1]; \ 456 v->b = data[4+2]; \ 457 457 v->a = data[4+3]; 458 458 #endif /* FX_USE_PARGB */ 459 459 460 #define VARS_TMU0 \461 struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \462 GLfloat sScale0 = fxTMGetTexInfo(t0->Current)->sScale; \463 GLfloat tScale0 = fxTMGetTexInfo(t0->Current)->tScale; \464 465 466 #define COPY_TMU0_STRIDE(offset) \467 { GLfloat *tc0 = VEC_ELT(tc0_vec, GLfloat, e); \460 #define VARS_TMU0 \ 461 struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \ 462 GLfloat sScale0 = fxTMGetTexInfo(t0->Current)->sScale; \ 463 GLfloat tScale0 = fxTMGetTexInfo(t0->Current)->tScale; \ 464 465 466 #define COPY_TMU0_STRIDE(offset) \ 467 { GLfloat *tc0 = VEC_ELT(tc0_vec, GLfloat, e); \ 468 468 COPY_2V((out+offset), tc0); } 469 469 470 470 471 #define DO_SETUP_TMU0(offset) \472 v->tmuvtx[0].sow = data[offset+0]*sScale0*v->oow; \471 #define DO_SETUP_TMU0(offset) \ 472 v->tmuvtx[0].sow = data[offset+0]*sScale0*v->oow; \ 473 473 v->tmuvtx[0].tow = data[offset+1]*tScale0*v->oow; 474 474 475 #define VARS_TMU1 \476 struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \477 GLfloat sScale1 = fxTMGetTexInfo(t1->Current)->sScale; \475 #define VARS_TMU1 \ 476 struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \ 477 GLfloat sScale1 = fxTMGetTexInfo(t1->Current)->sScale; \ 478 478 GLfloat tScale1 = fxTMGetTexInfo(t1->Current)->tScale; 479 479 480 #define COPY_TMU1_STRIDE(offset) \481 { GLfloat *tc1 = VEC_ELT(tc1_vec, GLfloat, e); \480 #define COPY_TMU1_STRIDE(offset) \ 481 { GLfloat *tc1 = VEC_ELT(tc1_vec, GLfloat, e); \ 482 482 COPY_2V((out+offset), tc1); } 483 483 484 484 485 #define DO_SETUP_TMU1(offset) \486 v->tmuvtx[1].sow = data[offset+0]*sScale1*v->oow; \485 #define DO_SETUP_TMU1(offset) \ 486 v->tmuvtx[1].sow = data[offset+0]*sScale1*v->oow; \ 487 487 v->tmuvtx[1].tow = data[offset+1]*tScale1*v->oow; 488 488 -
trunk/src/opengl/mesa/3dfx/fxcliptmp.h
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. … … 96 96 #define SETUP S4 97 97 98 99 static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB, 100 GLuint v[], 101 GLubyte mask ) 98 #define DRAW_LINE(tmp0, tmp1, width) \ 99 do { \ 100 GrVertex verts[4]; \ 101 float dx, dy, ix, iy; \ 102 \ 103 dx = tmp0->x - tmp1->x; \ 104 dy = tmp0->y - tmp1->y; \ 105 \ 106 if (dx * dx > dy * dy) { \ 107 iy = width * .5; \ 108 ix = 0; \ 109 } else { \ 110 iy = 0; \ 111 ix = width * .5; \ 112 } \ 113 \ 114 verts[0] = *tmp0; \ 115 verts[1] = *tmp0; \ 116 verts[2] = *tmp1; \ 117 verts[3] = *tmp1; \ 118 \ 119 verts[0].x = tmp0->x - ix; \ 120 verts[0].y = tmp0->y - iy; \ 121 \ 122 verts[1].x = tmp0->x + ix; \ 123 verts[1].y = tmp0->y + iy; \ 124 \ 125 verts[2].x = tmp1->x + ix; \ 126 verts[2].y = tmp1->y + iy; \ 127 \ 128 verts[3].x = tmp1->x - ix; \ 129 verts[3].y = tmp1->y - iy; \ 130 \ 131 FX_grDrawPolygonVertexList(4, verts); \ 132 } while (0) 133 134 static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB, 135 GLuint v[], 136 GLubyte mask ) 102 137 { 103 138 GLcontext *ctx = VB->ctx; … … 112 147 GLubyte *clipmask = VB->ClipMask; 113 148 114 GLuint tmu0_source = fxMesa->tmu_source[0]; 115 GLuint tmu1_source = fxMesa->tmu_source[1]; 149 GLuint tmu0_source = fxMesa->tmu_source[0]; 150 GLuint tmu1_source = fxMesa->tmu_source[1]; 116 151 GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; 117 152 GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; … … 124 159 GLuint e = v[i]; 125 160 verts[i] = 0; 126 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 127 vlist[i] = out; 161 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 162 vlist[i] = out; 128 163 COPY_STRIDE; 129 164 out += SIZE; … … 135 170 GrVertex *v = tmp, *v2, *v3; 136 171 VARS; 137 172 138 173 for (i = 0 ; i < n ; i++) 139 if (!verts[i]) {140 GLfloat *data = vlist[i];141 SETUP;142 verts[i] = v++;143 }144 174 if (!verts[i]) { 175 GLfloat *data = vlist[i]; 176 SETUP; 177 verts[i] = v++; 178 } 179 145 180 v = verts[0]; 146 181 v2 = verts[1]; … … 148 183 149 184 for (i = 2 ; i < n ; v2 = v3, v3=verts[++i]) 150 FX_grDrawTriangle(v, v2, v3);185 FX_grDrawTriangle(v, v2, v3); 151 186 } 152 187 } … … 156 191 157 192 158 static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB, 159 GLuint v[],160 GLuint mask )193 static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB, 194 GLuint v[], 195 GLuint mask ) 161 196 { 162 197 GLcontext *ctx = VB->ctx; … … 171 206 GLubyte *clipmask = VB->ClipMask; 172 207 173 GLuint tmu0_source = fxMesa->tmu_source[0]; 174 GLuint tmu1_source = fxMesa->tmu_source[1]; 208 GLuint tmu0_source = fxMesa->tmu_source[0]; 209 GLuint tmu1_source = fxMesa->tmu_source[1]; 175 210 GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; 176 211 GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; … … 183 218 GLuint e = v[i]; 184 219 verts[i] = 0; 185 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 186 vlist[i] = out; 220 if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f; 221 vlist[i] = out; 187 222 COPY_STRIDE; 188 223 out += SIZE; … … 191 226 if (VB->ClipPtr->size < 4) { 192 227 vlist[0][3] = vlist[1][3] = vlist[2][3] = 1.0; 193 if (VB->ClipPtr->size == 2) 194 vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0;195 } 196 228 if (VB->ClipPtr->size == 2) 229 vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0; 230 } 231 197 232 if ((n = fx_clip_triangle( ctx, vlist, verts, SIZE, mask )) >= 3) 198 233 { … … 200 235 GrVertex *v = tmp, *v2, *v3; 201 236 VARS; 202 237 203 238 for (i = 0 ; i < n ; i++) 204 if (!verts[i]) {205 GLfloat *data = vlist[i];206 SETUP;207 verts[i] = v++;208 }209 239 if (!verts[i]) { 240 GLfloat *data = vlist[i]; 241 SETUP; 242 verts[i] = v++; 243 } 244 210 245 v = verts[0]; 211 246 v2 = verts[1]; … … 213 248 214 249 for (i = 2 ; i < n ; v2 = v3, v3=verts[++i]) 215 FX_grDrawTriangle(v, v2, v3);250 FX_grDrawTriangle(v, v2, v3); 216 251 } 217 252 } … … 219 254 220 255 221 static void TAG(fx_line_clip)( struct vertex_buffer *VB, 222 GLuint v1, GLuint v2,223 GLubyte mask )256 static void TAG(fx_line_clip)( struct vertex_buffer *VB, 257 GLuint v1, GLuint v2, 258 GLubyte mask ) 224 259 { 225 260 GLcontext *ctx = VB->ctx; … … 229 264 GLfloat *out = data; 230 265 GLfloat *mat = ctx->Viewport.WindowMap.m; 266 GLfloat w = ctx->Line.Width*.5; 231 267 GLuint e, n; 232 268 233 GLuint tmu0_source = fxMesa->tmu_source[0]; 234 GLuint tmu1_source = fxMesa->tmu_source[1]; 269 GLuint tmu0_source = fxMesa->tmu_source[0]; 270 GLuint tmu1_source = fxMesa->tmu_source[1]; 235 271 GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source]; 236 272 GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source]; … … 242 278 (void) tmu1_source; (void) tc1_vec; 243 279 244 vlist[0] = out; 280 vlist[0] = out; 245 281 e = v1; 246 282 COPY_STRIDE; 247 283 out += SIZE; 248 284 249 vlist[1] = out; 285 vlist[1] = out; 250 286 e = v2; 251 287 COPY_STRIDE; … … 254 290 if (VB->ClipPtr->size < 4) { 255 291 vlist[0][3] = vlist[1][3] = 1.0; 256 if (VB->ClipPtr->size == 2) 257 vlist[0][2] = vlist[1][2] = 0.0;258 } 259 292 if (VB->ClipPtr->size == 2) 293 vlist[0][2] = vlist[1][2] = 0.0; 294 } 295 260 296 if ((n = fx_clip_line( ctx, vlist, SIZE, mask )) != 0) 261 297 { … … 272 308 SETUP; 273 309 274 FX_grDrawLine(gWin, v);310 DRAW_LINE(gWin, v, w); 275 311 } 276 312 } … … 278 314 279 315 280 #undef V1 281 #undef S1 282 #undef C1 283 #undef Z1 316 #undef V1 317 #undef S1 318 #undef C1 319 #undef Z1 284 320 #undef T1 285 321 286 #undef V2 287 #undef S2 288 #undef C2 289 #undef Z2 322 #undef V2 323 #undef S2 324 #undef C2 325 #undef Z2 290 326 #undef T2 291 327 292 #undef V3 293 #undef S3 294 #undef C3 295 #undef Z3 328 #undef V3 329 #undef S3 330 #undef C3 331 #undef Z3 296 332 #undef T3 297 333 298 #undef V4 299 #undef S4 300 #undef C4 301 #undef Z4 334 #undef V4 335 #undef S4 336 #undef C4 337 #undef Z4 302 338 #undef T4 303 339 304 #undef VARS 305 #undef SETUP 306 #undef COPY 340 #undef VARS 341 #undef SETUP 342 #undef COPY 307 343 #undef COPY_STRIDE 308 344 #undef SIZE -
trunk/src/opengl/mesa/3dfx/fxcva.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. … … 82 82 83 83 typedef void (*mergefunc)( struct vertex_buffer *cvaVB, 84 struct vertex_buffer *VB,85 const struct gl_prim_state *state,86 GLuint start,87 GLuint count );84 struct vertex_buffer *VB, 85 const struct gl_prim_state *state, 86 GLuint start, 87 GLuint count ); 88 88 89 89 static void fxCvaRenderNoop( struct vertex_buffer *cvaVB, 90 struct vertex_buffer *VB,91 const struct gl_prim_state *state,92 GLuint start,93 GLuint count )90 struct vertex_buffer *VB, 91 const struct gl_prim_state *state, 92 GLuint start, 93 GLuint count ) 94 94 { 95 95 } 96 96 97 97 static INLINE void fxRenderClippedTriangle2( struct vertex_buffer *VB, 98 GLuint v1, GLuint v2, GLuint v3 )98 GLuint v1, GLuint v2, GLuint v3 ) 99 99 { 100 100 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; … … 103 103 104 104 if (!mask) { 105 FX_grDrawTriangle((GrVertex *)gWin[v1].f, 106 (GrVertex *)gWin[v2].f, 107 (GrVertex *)gWin[v3].f);108 } else if (!(clipmask[v1]&clipmask[v2]&clipmask[v3]&CLIP_ALL_BITS)) { 105 FX_grDrawTriangle((GrVertex *)gWin[v1].f, 106 (GrVertex *)gWin[v2].f, 107 (GrVertex *)gWin[v3].f); 108 } else if (!(clipmask[v1]&clipmask[v2]&clipmask[v3]&CLIP_ALL_BITS)) { 109 109 GLuint n; 110 110 GLuint vlist[VB_MAX_CLIPPED_VERTS]; … … 115 115 GLuint i, j0 = vlist[0]; 116 116 for (i=2;i<n;i++) { 117 FX_grDrawTriangle((GrVertex *)gWin[j0].f,118 (GrVertex *)gWin[vlist[i-1]].f,119 (GrVertex *)gWin[vlist[i]].f);117 FX_grDrawTriangle((GrVertex *)gWin[j0].f, 118 (GrVertex *)gWin[vlist[i-1]].f, 119 (GrVertex *)gWin[vlist[i]].f); 120 120 } 121 121 } … … 128 128 129 129 /* 130 #define CVA_VARS_RGBA \131 GLubyte (*color)[4] = VB->ColorPtr->data; \130 #define CVA_VARS_RGBA \ 131 GLubyte (*color)[4] = VB->ColorPtr->data; \ 132 132 GLubyte (*cva_color)[4] = (cvaVB->ColorPtr = cvaVB->LitColor[0])->data; 133 133 */ 134 134 135 #define CVA_VARS_RGBA \136 GLubyte (*color)[4] = VB->ColorPtr->data; \135 #define CVA_VARS_RGBA \ 136 GLubyte (*color)[4] = VB->ColorPtr->data; \ 137 137 GLubyte (*cva_color)[4] = cvaVB->ColorPtr->data; 138 138 … … 141 141 #undef DO_SETUP_RGBA 142 142 #if FX_USE_PARGB 143 #define DO_SETUP_RGBA \144 { \145 GLubyte *col = color[i]; \146 GET_PARGB(v)= ((col[3] << 24) |\147 (col[0] << 16) |\148 (col[1] << 8) | \149 (col[2]));\143 #define DO_SETUP_RGBA \ 144 { \ 145 GLubyte *col = color[i]; \ 146 GET_PARGB(v)= ((col[3] << 24) | \ 147 (col[0] << 16) | \ 148 (col[1] << 8) | \ 149 (col[2])); \ 150 150 } 151 151 #else 152 #define DO_SETUP_RGBA \153 { \154 GLubyte *col = color[i]; \155 v[GR_VERTEX_R_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \156 v[GR_VERTEX_G_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \157 v[GR_VERTEX_B_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \158 v[GR_VERTEX_A_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \152 #define DO_SETUP_RGBA \ 153 { \ 154 GLubyte *col = color[i]; \ 155 v[GR_VERTEX_R_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ 156 v[GR_VERTEX_G_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ 157 v[GR_VERTEX_B_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ 158 v[GR_VERTEX_A_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ 159 159 } 160 160 #endif /* FX_USE_PARGB */ 161 161 162 162 163 #define CVA_VARS_TMU0 \164 VARS_TMU0 \163 #define CVA_VARS_TMU0 \ 164 VARS_TMU0 \ 165 165 GLfloat (*cva_tex0)[4] = (cvaVB->TexCoordPtr[tmu0_source] = cvaVB->store.TexCoord[tmu0_source])->data; 166 166 167 #define CVA_VARS_TMU1 \168 VARS_TMU1 \167 #define CVA_VARS_TMU1 \ 168 VARS_TMU1 \ 169 169 GLfloat (*cva_tex1)[4] = (cvaVB->TexCoordPtr[tmu1_source] = cvaVB->store.TexCoord[tmu1_source])->data; 170 170 … … 221 221 #define TAG(x) x##T0T1 222 222 #define IDX SETUP_TMU0|SETUP_TMU1 223 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 224 #define INIT INIT_TMU0 INIT_TMU1 223 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 224 #define INIT INIT_TMU0 INIT_TMU1 225 225 #define INCR , tmu0_data+=4 , tmu1_data+=4 226 226 #define MERGE_RAST DO_SETUP_TMU0 DO_SETUP_TMU1 … … 231 231 #define TAG(x) x##RGBAT0 232 232 #define IDX SETUP_RGBA|SETUP_TMU0 233 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 234 #define INIT INIT_RGBA INIT_TMU0 235 #define INCR , tmu0_data+=4 233 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 234 #define INIT INIT_RGBA INIT_TMU0 235 #define INCR , tmu0_data+=4 236 236 #define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 237 237 #define MERGE_VB COPY_2FV(cva_tex0[e], tmu0_data); \ … … 262 262 263 263 264 #undef DRAW_POINT 265 #undef DRAW_LINE 266 #undef DRAW_TRI 267 #undef CLIP_LINE 268 #undef CLIP_OR_DRAW_TRI 264 #undef DRAW_POINT 265 #undef DRAW_LINE 266 #undef DRAW_TRI 267 #undef CLIP_LINE 268 #undef CLIP_OR_DRAW_TRI 269 269 #undef DIRECT 270 270 271 271 #define DRAW_POINT ctx->Driver.PointsFunc( ctx, e, e ) 272 #define DRAW_LINE ctx->Driver.LineFunc( ctx, e, prev, e ) 272 #define DRAW_LINE ctx->Driver.LineFunc( ctx, e, prev, e ) 273 273 #define DRAW_TRI ctx->TriangleFunc( ctx, l[0], l[1], e, e ) 274 274 #define CLIP_LINE gl_render_clipped_line( ctx, e, prev ) 275 #define CLIP_OR_DRAW_TRI \276 do { \277 if (clip[l[0]] | clip[l[1]] | clip[e]) { \278 if (!(clip[l[0]] & clip[l[1]] & clip[e] & CLIP_ALL_BITS)) { \279 COPY_3V(vlist, l);\280 gl_render_clipped_triangle( ctx, 3, vlist, e );\281 } \282 } \283 else ctx->TriangleFunc( ctx, l[0], l[1], e, e ); \275 #define CLIP_OR_DRAW_TRI \ 276 do { \ 277 if (clip[l[0]] | clip[l[1]] | clip[e]) { \ 278 if (!(clip[l[0]] & clip[l[1]] & clip[e] & CLIP_ALL_BITS)) { \ 279 COPY_3V(vlist, l); \ 280 gl_render_clipped_triangle( ctx, 3, vlist, e ); \ 281 } \ 282 } \ 283 else ctx->TriangleFunc( ctx, l[0], l[1], e, e ); \ 284 284 } while (0) 285 285 286 286 287 287 #define DIRECT 0 288 288 … … 325 325 #define TAG(x) x##T0T1_indirect 326 326 #define IDX SETUP_TMU0|SETUP_TMU1 327 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 328 #define INIT INIT_TMU0 INIT_TMU1 327 #define VARS CVA_VARS_TMU0 CVA_VARS_TMU1 328 #define INIT INIT_TMU0 INIT_TMU1 329 329 #define INCR , tmu0_data+=4 , tmu1_data+=4 330 330 #define MERGE_RAST DO_SETUP_TMU0 DO_SETUP_TMU1 … … 335 335 #define TAG(x) x##RGBAT0_indirect 336 336 #define IDX SETUP_RGBA|SETUP_TMU0 337 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 338 #define INIT INIT_RGBA INIT_TMU0 337 #define VARS CVA_VARS_RGBA CVA_VARS_TMU0 338 #define INIT INIT_RGBA INIT_TMU0 339 339 #define INCR , tmu0_data+=4 340 340 #define MERGE_RAST DO_SETUP_RGBA; DO_SETUP_TMU0 … … 398 398 (ctx->Array.Summary & VERT_OBJ_ANY)) 399 399 { 400 d->inputs = (VERT_SETUP_PART | VERT_ELT | inputs); 400 d->inputs = (VERT_SETUP_PART | VERT_ELT | inputs); 401 401 d->outputs = 0; 402 402 d->type = PIPE_IMMEDIATE; … … 409 409 extern void fxPointSmooth(GLcontext *ctx, GLuint first, GLuint last); 410 410 extern void fxLineSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv); 411 extern void fxTriangleSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, 412 GLuint pv);411 extern void fxTriangleSmooth(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, 412 GLuint pv); 413 413 extern const char *gl_prim_name[]; 414 414 … … 433 433 GLuint p = 0; 434 434 435 if (fxMesa->new_state) 435 if (fxMesa->new_state) 436 436 fxSetupFXUnits(ctx); 437 437 … … 441 441 * VB so that funcs like fxTriangleFlat will be able to reach them. 442 442 * 443 * This leads to some duplication of effort in the merge funcs. 443 * This leads to some duplication of effort in the merge funcs. 444 444 */ 445 445 if (inputs & VERT_RGBA) { … … 464 464 if (cvaVB->ClipOrMask) 465 465 gl_import_client_data( cvaVB, ctx->RenderFlags, 466 VEC_WRITABLE|VEC_GOOD_STRIDE );466 VEC_WRITABLE|VEC_GOOD_STRIDE ); 467 467 468 468 ctx->VB = cvaVB; 469 469 470 470 do { 471 for ( i= VB->CopyStart ; i < count ; parity = 0, i = next ) 471 for ( i= VB->CopyStart ; i < count ; parity = 0, i = next ) 472 472 { 473 prim = VB->Primitive[i];474 next = VB->NextPrimitive[i];475 476 state = gl_prim_state_machine[prim][parity];477 func = tab[flags][reduce_prim[prim]];478 func( cvaVB, VB, state, i, next );479 480 if ( ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE ) 481 {482 cvaVB->Specular = cvaVB->Spec[0];483 cvaVB->ColorPtr = cvaVB->Color[0];484 cvaVB->IndexPtr = cvaVB->Index[0];485 }473 prim = VB->Primitive[i]; 474 next = VB->NextPrimitive[i]; 475 476 state = gl_prim_state_machine[prim][parity]; 477 func = tab[flags][reduce_prim[prim]]; 478 func( cvaVB, VB, state, i, next ); 479 480 if ( ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE ) 481 { 482 cvaVB->Specular = cvaVB->Spec[0]; 483 cvaVB->ColorPtr = cvaVB->Color[0]; 484 cvaVB->IndexPtr = cvaVB->Index[0]; 485 } 486 486 } 487 487 } while (ctx->Driver.MultipassFunc && 488 ctx->Driver.MultipassFunc( VB, ++p ));489 490 491 492 if (ctx->PB->count > 0) 488 ctx->Driver.MultipassFunc( VB, ++p )); 489 490 491 492 if (ctx->PB->count > 0) 493 493 gl_flush_pb(ctx); 494 494 -
trunk/src/opengl/mesa/3dfx/fxcva.h
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. … … 50 50 51 51 extern GLboolean fxMergeAndRenderCVA( struct vertex_buffer *VB, 52 struct vertex_buffer *cvaVB );52 struct vertex_buffer *cvaVB ); 53 53 54 54 55 55 56 56 extern void fxRenderCVAElements( struct vertex_buffer *VB, 57 GLenum mode,58 GLuint *elts,59 GLuint n );57 GLenum mode, 58 GLuint *elts, 59 GLuint n ); 60 60 61 61 -
trunk/src/opengl/mesa/3dfx/fxcvatmp.h
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. … … 45 45 46 46 static void TAG(cva_render_points)( struct vertex_buffer *cvaVB, 47 struct vertex_buffer *VB,48 const struct gl_prim_state *state,49 GLuint start,50 GLuint count ) 47 struct vertex_buffer *VB, 48 const struct gl_prim_state *state, 49 GLuint start, 50 GLuint count ) 51 51 { 52 52 GLcontext *ctx = VB->ctx; … … 63 63 const GLubyte *clip = cvaVB->ClipMask; 64 64 for (i = start ; i < count ; i++ INCR) { 65 GLuint e = elt[i];66 if (!clip[e]) {67 GLfloat *v = gWin[e].f; (void) v;68 if (!DIRECT) { MERGE_VB; }69 MERGE_RAST;70 DRAW_POINT;71 }65 GLuint e = elt[i]; 66 if (!clip[e]) { 67 GLfloat *v = gWin[e].f; (void) v; 68 if (!DIRECT) { MERGE_VB; } 69 MERGE_RAST; 70 DRAW_POINT; 71 } 72 72 } 73 73 } else { 74 74 for (i = start ; i < count ; i++ INCR) { 75 GLuint e = elt[i];76 GLfloat *v = gWin[e].f; (void) v;77 if (!DIRECT) { MERGE_VB; }78 MERGE_RAST;79 DRAW_POINT;75 GLuint e = elt[i]; 76 GLfloat *v = gWin[e].f; (void) v; 77 if (!DIRECT) { MERGE_VB; } 78 MERGE_RAST; 79 DRAW_POINT; 80 80 } 81 81 } … … 83 83 84 84 static void TAG(cva_render_lines)( struct vertex_buffer *cvaVB, 85 struct vertex_buffer *VB,86 const struct gl_prim_state *state,87 GLuint start,88 GLuint count ) 85 struct vertex_buffer *VB, 86 const struct gl_prim_state *state, 87 GLuint start, 88 GLuint count ) 89 89 { 90 90 GLcontext *ctx = VB->ctx; … … 104 104 105 105 (void) ctx; 106 107 for (i = start ; i < count ; i++ INCR) { 108 GLuint e = elt[i];109 GLfloat *v = gWin[e].f;110 111 MERGE_VB;112 113 if (!clip[e])114 MERGE_RAST;115 116 if (state->draw) {117 if (clip[e] | clip[prev]) 118 CLIP_LINE;119 else120 DRAW_LINE;121 }122 123 prev = e; 124 prev_v = v;125 state = state->next;106 107 for (i = start ; i < count ; i++ INCR) { 108 GLuint e = elt[i]; 109 GLfloat *v = gWin[e].f; 110 111 MERGE_VB; 112 113 if (!clip[e]) 114 MERGE_RAST; 115 116 if (state->draw) { 117 if (clip[e] | clip[prev]) 118 CLIP_LINE; 119 else 120 DRAW_LINE; 121 } 122 123 prev = e; 124 prev_v = v; 125 state = state->next; 126 126 } 127 127 if (state->finish_loop) { 128 GLuint e = elt[start];129 GLfloat *v = gWin[e].f; (void) v;130 131 if (!DIRECT) { MERGE_VB; }132 MERGE_RAST;133 134 if (clip[e] | clip[prev]) 135 CLIP_LINE;136 else137 DRAW_LINE;128 GLuint e = elt[start]; 129 GLfloat *v = gWin[e].f; (void) v; 130 131 if (!DIRECT) { MERGE_VB; } 132 MERGE_RAST; 133 134 if (clip[e] | clip[prev]) 135 CLIP_LINE; 136 else 137 DRAW_LINE; 138 138 } 139 139 } else { 140 140 GLuint prev = 0; 141 141 GLfloat *prev_v = 0; 142 143 for (i = start ; i < count ; i++ INCR) { 144 GLuint e = elt[i];145 GLfloat *v = gWin[e].f;146 147 if (!DIRECT) { MERGE_VB; }148 MERGE_RAST;149 if (state->draw) DRAW_LINE;150 prev = e;151 prev_v = v;152 state = state->next;142 143 for (i = start ; i < count ; i++ INCR) { 144 GLuint e = elt[i]; 145 GLfloat *v = gWin[e].f; 146 147 if (!DIRECT) { MERGE_VB; } 148 MERGE_RAST; 149 if (state->draw) DRAW_LINE; 150 prev = e; 151 prev_v = v; 152 state = state->next; 153 153 } 154 154 if (state->finish_loop) { 155 GLuint e = elt[start];156 GLfloat *v = gWin[e].f; (void) v;157 158 if (!DIRECT) { MERGE_VB; }159 MERGE_RAST;160 DRAW_LINE;161 } 162 } 155 GLuint e = elt[start]; 156 GLfloat *v = gWin[e].f; (void) v; 157 158 if (!DIRECT) { MERGE_VB; } 159 MERGE_RAST; 160 DRAW_LINE; 161 } 162 } 163 163 } 164 164 165 165 166 166 static void TAG(cva_render_tris)( struct vertex_buffer *cvaVB, 167 struct vertex_buffer *VB,168 const struct gl_prim_state *state,169 GLuint start,170 GLuint count ) 167 struct vertex_buffer *VB, 168 const struct gl_prim_state *state, 169 GLuint start, 170 GLuint count ) 171 171 { 172 172 GLcontext *ctx = VB->ctx; … … 179 179 (void) fxMesa; 180 180 181 if (cvaVB->ClipOrMask) { 181 if (cvaVB->ClipOrMask) { 182 182 GLuint vlist[VB_MAX_CLIPPED_VERTS]; 183 183 GLuint l[3]; 184 const GLubyte *clip = cvaVB->ClipMask; 185 184 const GLubyte *clip = cvaVB->ClipMask; 185 186 186 (void) vlist; 187 187 188 188 for (i = start ; i < count ; i++ INCR) { 189 GLuint e = l[2] = elt[i];190 GLfloat *v = gWin[e].f; (void) v;191 192 MERGE_VB;/* needed for clip-interp */193 194 if (!clip[e]) {195 MERGE_RAST;196 }197 198 if (state->draw) 199 CLIP_OR_DRAW_TRI;200 201 202 l[0] = l[state->v0];203 l[1] = l[state->v1];204 state = state->next;189 GLuint e = l[2] = elt[i]; 190 GLfloat *v = gWin[e].f; (void) v; 191 192 MERGE_VB; /* needed for clip-interp */ 193 194 if (!clip[e]) { 195 MERGE_RAST; 196 } 197 198 if (state->draw) 199 CLIP_OR_DRAW_TRI; 200 201 202 l[0] = l[state->v0]; 203 l[1] = l[state->v1]; 204 state = state->next; 205 205 } 206 206 } else if (DIRECT) { 207 207 GrVertex *vl[3]; 208 208 for (i = start ; i < count ; i++ INCR) { 209 GLuint e = elt[i];210 GLfloat *v = gWin[elt[i]].f;211 212 vl[2] = (GrVertex *)v;213 214 (void) v; 215 (void) e;216 217 MERGE_RAST;218 219 if (state->draw) 220 DRAW_TRI2;221 222 vl[0] = vl[state->v0];223 vl[1] = vl[state->v1];224 state = state->next;209 GLuint e = elt[i]; 210 GLfloat *v = gWin[elt[i]].f; 211 212 vl[2] = (GrVertex *)v; 213 214 (void) v; 215 (void) e; 216 217 MERGE_RAST; 218 219 if (state->draw) 220 DRAW_TRI2; 221 222 vl[0] = vl[state->v0]; 223 vl[1] = vl[state->v1]; 224 state = state->next; 225 225 } 226 226 } else { 227 227 GLuint l[3]; 228 228 for (i = start ; i < count ; i++ INCR) { 229 GLuint e = l[2] = elt[i];230 GLfloat *v = gWin[e].f; (void) v;231 232 MERGE_VB;/* needed for ctx->trianglefunc? */233 MERGE_RAST;234 235 if (state->draw) 236 DRAW_TRI;237 238 l[0] = l[state->v0];239 l[1] = l[state->v1];240 state = state->next;229 GLuint e = l[2] = elt[i]; 230 GLfloat *v = gWin[e].f; (void) v; 231 232 MERGE_VB; /* needed for ctx->trianglefunc? */ 233 MERGE_RAST; 234 235 if (state->draw) 236 DRAW_TRI; 237 238 l[0] = l[state->v0]; 239 l[1] = l[state->v1]; 240 state = state->next; 241 241 } 242 242 } -
trunk/src/opengl/mesa/3dfx/fxdd.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. … … 53 53 #if defined(FX) 54 54 55 #include "image.h" 55 56 #include "types.h" 56 57 #include "fxdrv.h" 57 58 #include "enums.h" 58 59 #include "extensions.h" 59 60 #include "pb.h" 60 61 61 62 /* These lookup table are used to extract RGB values in [0,255] from … … 71 72 * Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order. 72 73 */ 73 void fxInitPixelTables( GLboolean bgrOrder)74 void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder) 74 75 { 75 76 GLuint pixel; 77 78 fxMesa->bgrOrder=bgrOrder; 76 79 for (pixel = 0; pixel <= 0xffff; pixel++) { 77 80 GLuint r, g, b; … … 101 104 102 105 /* Enalbe/Disable dithering */ 103 void fxDDDither(GLcontext *ctx, GLboolean enable)106 static void fxDDDither(GLcontext *ctx, GLboolean enable) 104 107 { 105 108 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 116 119 117 120 /* Return buffer size information */ 118 void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height)121 static void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height) 119 122 { 120 123 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; … … 140 143 GLubyte col[4]; 141 144 ASSIGN_4V( col, red, green, blue, alpha ); 142 145 143 146 if (MESA_VERBOSE&VERBOSE_DRIVER) { 144 147 fprintf(stderr,"fxmesa: fxDDSetColor(%d,%d,%d,%d)\n",red,green,blue,alpha); … … 163 166 fprintf(stderr,"fxmesa: fxDDClearColor(%d,%d,%d,%d)\n",red,green,blue,alpha); 164 167 } 165 168 166 169 fxMesa->clearC=FXCOLOR4( col ); 167 170 fxMesa->clearA=alpha; … … 173 176 { 174 177 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 175 GLbitfield newmask; 178 const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); 179 const FxU16 clearD = (FxU16) (ctx->Depth.Clear * 0xffff); 180 GLbitfield softwareMask = mask & (DD_STENCIL_BIT | DD_ACCUM_BIT); 176 181 177 182 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 179 184 } 180 185 181 switch(mask & (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)) { 182 case (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT): 183 /* clear color and depth buffer */ 184 185 if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) { 186 if (colorMask != 0xffffffff) { 187 /* do color buffer clears in software */ 188 softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); 189 mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); 190 } 191 192 /* 193 * This could probably be done fancier but doing each possible case 194 * explicitly is less error prone. 195 */ 196 switch (mask) { 197 case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: 198 /* back buffer & depth */ 199 FX_grDepthMask(FXTRUE); 186 200 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); 187 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 188 (FxU16)(ctx->Depth.Clear*0xffff)); 189 } 190 if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) { 201 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 202 if (!ctx->Depth.Mask) { 203 FX_grDepthMask(FXFALSE); 204 } 205 break; 206 case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT: 207 /* XXX it appears that the depth buffer isn't cleared when 208 * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set. 209 * This is a work-around/ 210 */ 211 /* clear depth */ 212 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); 213 FX_grColorMask(FXFALSE,FXFALSE); 214 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 215 /* clear front */ 216 FX_grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 191 217 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 192 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 193 (FxU16)(ctx->Depth.Clear*0xffff)); 194 } 195 196 newmask=mask & (~(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)); 197 break; 198 case (GL_COLOR_BUFFER_BIT): 199 /* clear color buffer */ 200 201 if(ctx->Color.ColorMask) { 218 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 219 break; 220 case DD_BACK_LEFT_BIT: 221 /* back buffer only */ 202 222 FX_grDepthMask(FXFALSE); 203 204 if (ctx->Color.DrawDestMask & BACK_LEFT_BIT) {205 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);206 FX_gr BufferClear(fxMesa->clearC, fxMesa->clearA, 0);223 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); 224 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 225 if (!ctx->Depth.Mask) { 226 FX_grDepthMask(FXFALSE); 207 227 } 208 if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) { 209 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 210 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 0); 228 break; 229 case DD_FRONT_LEFT_BIT: 230 /* front buffer only */ 231 FX_grDepthMask(FXFALSE); 232 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 233 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 234 if (!ctx->Depth.Mask) { 235 FX_grDepthMask(FXFALSE); 211 236 } 212 213 if(ctx->Depth.Mask) { 214 FX_grDepthMask(FXTRUE); 237 break; 238 case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT: 239 /* front and back */ 240 FX_grDepthMask(FXFALSE); 241 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); 242 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 243 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 244 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 245 if (!ctx->Depth.Mask) { 246 FX_grDepthMask(FXFALSE); 215 247 } 216 } 217 218 newmask=mask & (~(GL_COLOR_BUFFER_BIT)); 219 break; 220 case (GL_DEPTH_BUFFER_BIT): 221 /* clear depth buffer */ 222 223 if(ctx->Depth.Mask) { 248 break; 249 case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT: 250 /* clear front */ 251 FX_grDepthMask(FXFALSE); 252 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 253 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 254 /* clear back and depth */ 255 FX_grDepthMask(FXTRUE); 256 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); 257 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); 258 if (!ctx->Depth.Mask) { 259 FX_grDepthMask(FXFALSE); 260 } 261 break; 262 case DD_DEPTH_BIT: 263 /* just the depth buffer */ 224 264 FX_grColorMask(FXFALSE,FXFALSE); 225 265 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, 226 (FxU16)(ctx->Depth.Clear*0xffff)); 227 228 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 229 ctx->Color.ColorMask[GCOMP] || 230 ctx->Color.ColorMask[BCOMP], 231 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 232 } 233 234 newmask=mask & (~(GL_DEPTH_BUFFER_BIT)); 235 break; 236 default: 237 newmask=mask; 238 break; 239 } 240 241 return newmask; 242 } 243 244 245 /* Set the buffer used in double buffering */ 246 static GLboolean fxDDSetBuffer(GLcontext *ctx, GLenum mode ) 266 (FxU16)(ctx->Depth.Clear*0xffff)); 267 FX_grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 268 break; 269 default: 270 /* error */ 271 ; 272 } 273 274 return softwareMask; 275 } 276 277 278 /* Set the buffer used for reading */ 279 static GLboolean fxDDSetDrawBuffer(GLcontext *ctx, GLenum mode ) 247 280 { 248 281 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; … … 267 300 } 268 301 302 /* Set the buffer used for reading */ 303 static void fxDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer, 304 GLenum mode ) 305 { 306 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 307 (void) buffer; 308 309 if (MESA_VERBOSE&VERBOSE_DRIVER) { 310 fprintf(stderr,"fxmesa: fxDDSetBuffer(%x)\n", (int) mode); 311 } 312 313 if (mode == GL_FRONT_LEFT) { 314 fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; 315 FX_grRenderBuffer(fxMesa->currentFB); 316 } 317 else if (mode == GL_BACK_LEFT) { 318 fxMesa->currentFB = GR_BUFFER_BACKBUFFER; 319 FX_grRenderBuffer(fxMesa->currentFB); 320 } 321 } 322 323 269 324 270 325 #ifdef XF86DRI 326 /* test if window coord (px,py) is visible */ 271 327 static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py) 272 328 { 273 329 int i; 274 275 py=fxMesa->height+fxMesa->y_offset-py;276 330 for (i=0; i<fxMesa->numClipRects; i++) { 277 if ((px>=fxMesa->pClipRects[i].x1) && 278 (px<fxMesa->pClipRects[i].x2) &&279 (py>=fxMesa->pClipRects[i].y1) && 280 (py<fxMesa->pClipRects[i].y2)) return GL_TRUE;331 if ((px>=fxMesa->pClipRects[i].x1) && 332 (px<fxMesa->pClipRects[i].x2) && 333 (py>=fxMesa->pClipRects[i].y1) && 334 (py<fxMesa->pClipRects[i].y2)) return GL_TRUE; 281 335 } 282 336 return GL_FALSE; … … 291 345 { 292 346 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 293 FxU16 *p;294 347 GrLfbInfo_t info; 295 const GLubyte *pb;296 int x,y,xmin,xmax,ymin,ymax;297 GLint r,g,b,a,scrwidth,scrheight,stride;298 348 FxU16 color; 299 300 /* TODO: with a little work, these bitmap unpacking parameter restrictions 301 * could be removed. 302 */ 303 if((unpack->Alignment!=1) || 304 (unpack->RowLength!=0) || 305 (unpack->SkipPixels!=0) || 306 (unpack->SkipRows!=0) || 307 (unpack->SwapBytes) || 308 (unpack->LsbFirst)) 349 const struct gl_pixelstore_attrib *finalUnpack; 350 struct gl_pixelstore_attrib scissoredUnpack; 351 352 /* check if there's any raster operations enabled which we can't handle */ 353 if (ctx->RasterMask & (ALPHATEST_BIT | 354 BLEND_BIT | 355 DEPTH_BIT | 356 FOG_BIT | 357 LOGIC_OP_BIT | 358 SCISSOR_BIT | 359 STENCIL_BIT | 360 MASKING_BIT | 361 ALPHABUF_BIT | 362 MULTI_DRAW_BIT)) 309 363 return GL_FALSE; 310 364 311 365 if (ctx->Scissor.Enabled) { 312 xmin=ctx->Scissor.X; 313 xmax=ctx->Scissor.X+ctx->Scissor.Width; 314 ymin=ctx->Scissor.Y; 315 ymax=ctx->Scissor.Y+ctx->Scissor.Height; 316 } else { 317 xmin=0; 318 xmax=fxMesa->width; 319 ymin=0; 320 ymax=fxMesa->height; 321 } 322 323 xmin+=fxMesa->x_offset; 324 xmax+=fxMesa->x_offset; 325 326 #ifdef XF86DRI 327 #define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) || !inClipRects(fxMesa, rx, ry)) 328 #else 329 #define ISCLIPPED(rx, ry) ( ((rx)<xmin) || ((rx)>=xmax) ) 330 #endif 331 #define DRAWBIT(i) { \ 332 if(!ISCLIPPED(x+px, y)) \ 333 if( (*pb) & (1<<(i)) ) \ 334 (*p)=color; \ 335 p++; \ 336 x++; \ 337 if(x>=width) { \ 338 pb++; \ 339 break; \ 340 } \ 341 } 342 343 scrwidth=fxMesa->width; 344 scrheight=fxMesa->height; 345 346 if ((px>=scrwidth) || (px+width<=0) || (py>=scrheight) || (py+height<=0)) 347 return GL_TRUE; 348 349 pb=bitmap; 350 351 if(py<0) { 352 pb+=(height*(-py)) >> (3+1); 353 height+=py; 354 py=0; 355 } 356 357 if (py+height>=scrheight) 358 height-=(py+height)-scrheight; 359 360 info.size=sizeof(info); 361 if(!FX_grLfbLock(GR_LFB_WRITE_ONLY, 362 fxMesa->currentFB, 363 GR_LFBWRITEMODE_565, 364 GR_ORIGIN_UPPER_LEFT, 365 FXFALSE, 366 &info)) { 366 /* This is a bit tricky, but by carefully adjusting the px, py, 367 * width, height, skipPixels and skipRows values we can do 368 * scissoring without special code in the rendering loop. 369 */ 370 371 /* we'll construct a new pixelstore struct */ 372 finalUnpack = &scissoredUnpack; 373 scissoredUnpack = *unpack; 374 if (scissoredUnpack.RowLength == 0) 375 scissoredUnpack.RowLength = width; 376 377 /* clip left */ 378 if (px < ctx->Scissor.X) { 379 scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); 380 width -= (ctx->Scissor.X - px); 381 px = ctx->Scissor.X; 382 } 383 /* clip right */ 384 if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { 385 width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); 386 } 387 /* clip bottom */ 388 if (py < ctx->Scissor.Y) { 389 scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); 390 height -= (ctx->Scissor.Y - py); 391 py = ctx->Scissor.Y; 392 } 393 /* clip top */ 394 if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { 395 height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); 396 } 397 398 if (width <= 0 || height <= 0) 399 return GL_TRUE; /* totally scissored away */ 400 } 401 else { 402 finalUnpack = unpack; 403 } 404 405 /* compute pixel value */ 406 { 407 GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); 408 GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); 409 GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); 410 /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f);*/ 411 if (fxMesa->bgrOrder) 412 color = (FxU16) 413 ( ((FxU16)0xf8 & b) << (11-3)) | 414 ( ((FxU16)0xfc & g) << (5-3+1)) | 415 ( ((FxU16)0xf8 & r) >> 3); 416 else 417 color = (FxU16) 418 ( ((FxU16)0xf8 & r) << (11-3)) | 419 ( ((FxU16)0xfc & g) << (5-3+1)) | 420 ( ((FxU16)0xf8 & b) >> 3); 421 } 422 423 info.size = sizeof(info); 424 if (!FX_grLfbLock(GR_LFB_WRITE_ONLY, 425 fxMesa->currentFB, 426 GR_LFBWRITEMODE_565, 427 GR_ORIGIN_UPPER_LEFT, 428 FXFALSE, 429 &info)) { 367 430 #ifndef FX_SILENT 368 431 fprintf(stderr,"fx Driver: error locking the linear frame buffer\n"); … … 371 434 } 372 435 373 r=(GLint)(ctx->Current.RasterColor[0]*255.0f); 374 g=(GLint)(ctx->Current.RasterColor[1]*255.0f); 375 b=(GLint)(ctx->Current.RasterColor[2]*255.0f); 376 a=(GLint)(ctx->Current.RasterColor[3]*255.0f); 377 color=(FxU16) 378 ( ((FxU16)0xf8 & b) <<(11-3)) | 379 ( ((FxU16)0xfc & g) <<(5-3+1)) | 380 ( ((FxU16)0xf8 & r) >> 3); 381 382 stride=info.strideInBytes>>1; 383 384 /* This code is a bit slow... */ 385 386 if (py>ymin) ymin=py; 387 if (py+height<ymax) ymax=py+height; 388 389 px+=fxMesa->x_offset; 390 scrheight=fxMesa->height+fxMesa->y_offset; 391 392 for(y=ymin; y<ymax; y++) { 393 394 p=((FxU16 *)info.lfbPtr)+px+((scrheight-y)*stride); 395 396 for(x=0;;) { 397 DRAWBIT(7); DRAWBIT(6); DRAWBIT(5); DRAWBIT(4); 398 DRAWBIT(3); DRAWBIT(2); DRAWBIT(1); DRAWBIT(0); 399 pb++; 400 } 401 } 436 #ifdef XF86DRI 437 #define INSIDE(c, x, y) inClipRects((c), (x), (y)) 438 #else 439 #define INSIDE(c, x, y) (1) 440 #endif 441 442 { 443 const GLint winX = fxMesa->x_offset; 444 const GLint winY = fxMesa->y_offset + fxMesa->height - 1; 445 /* The dest stride depends on the hardware and whether we're drawing 446 * to the front or back buffer. This compile-time test seems to do 447 * the job for now. 448 */ 449 #ifdef XF86DRI 450 const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) 451 ? (fxMesa->screen_width) : (info.strideInBytes / 2); 452 #else 453 const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */ 454 #endif 455 GLint row; 456 /* compute dest address of bottom-left pixel in bitmap */ 457 GLushort *dst = (GLushort *) info.lfbPtr 458 + (winY - py) * dstStride 459 + (winX + px); 460 461 for (row = 0; row < height; row++) { 462 const GLubyte *src = (const GLubyte *) _mesa_image_address( finalUnpack, 463 bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); 464 if (finalUnpack->LsbFirst) { 465 /* least significan bit first */ 466 GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); 467 GLint col; 468 for (col=0; col<width; col++) { 469 if (*src & mask) { 470 if (INSIDE(fxMesa, winX + px + col, winY - py - row)) 471 dst[col] = color; 472 } 473 if (mask == 128U) { 474 src++; 475 mask = 1U; 476 } 477 else { 478 mask = mask << 1; 479 } 480 } 481 if (mask != 1) 482 src++; 483 } 484 else { 485 /* most significan bit first */ 486 GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); 487 GLint col; 488 for (col=0; col<width; col++) { 489 if (*src & mask) { 490 if (INSIDE(fxMesa, winX + px + col, winY - py - row)) 491 dst[col] = color; 492 } 493 if (mask == 1U) { 494 src++; 495 mask = 128U; 496 } 497 else { 498 mask = mask >> 1; 499 } 500 } 501 if (mask != 128) 502 src++; 503 } 504 dst -= dstStride; 505 } 506 } 507 508 #undef INSIDE 402 509 403 510 FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB); 404 405 #undef ISCLIPPED406 #undef DRAWBIT407 408 511 return GL_TRUE; 409 512 } … … 423 526 fprintf(stderr,"fx Driver: internal error in fxDDGetParameteri(): %x\n",param); 424 527 fxCloseHardware(); 425 exit(-1);528 EXIT(-1); 426 529 return 0; 427 530 } … … 441 544 static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) 442 545 { 443 switch (name) {444 case GL_RENDERER:445 546 #if defined(GLX_DIRECT_RENDERING) 446 return "Mesa Glide - DRI VB/V3"; 547 /* Building for DRI driver */ 548 switch (name) { 549 case GL_RENDERER: 550 { 551 static char buffer[100]; 552 char hardware[100]; 553 strcpy(hardware, grGetString(GR_HARDWARE)); 554 if (strcmp(hardware, "Voodoo3 (tm)") == 0) 555 strcpy(hardware, "Voodoo3"); 556 else if (strcmp(hardware, "Voodoo Banshee (tm)") == 0) 557 strcpy(hardware, "VoodooBanshee"); 558 else { 559 /* unexpected result: replace spaces with hyphens */ 560 int i; 561 for (i = 0; hardware[i]; i++) { 562 if (hardware[i] == ' ' || hardware[i] == '\t') 563 hardware[i] = '-'; 564 } 565 } 566 /* now make the GL_RENDERER string */ 567 sprintf(buffer, "Mesa DRI %s 20000322", hardware); 568 return buffer; 569 } 570 case GL_VENDOR: 571 return "Precision Insight, Inc."; 572 default: 573 return NULL; 574 } 575 447 576 #else 577 578 /* Building for Voodoo1/2 stand-alone Mesa */ 579 switch (name) { 580 case GL_RENDERER: 448 581 { 449 static char buf[80]; 450 451 if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) 452 { 453 GrVoodooConfig_t *vc = 454 &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; 455 456 sprintf(buf, 457 "Mesa Glide v0.30 Voodoo_Graphics %d " 458 "CARD/%d FB/%d TM/%d TMU/%s", 459 glbCurrentBoard, 460 (vc->sliDetect ? (vc->fbRam*2) : vc->fbRam), 461 (vc->tmuConfig[GR_TMU0].tmuRam + 462 ((vc->nTexelfx>1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)), 463 vc->nTexelfx, 464 (vc->sliDetect ? "SLI" : "NOSLI")); 465 } 466 else if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96) 467 { 468 GrSst96Config_t *sc = 469 &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config; 470 471 sprintf(buf, 472 "Glide v0.30 Voodoo_Rush %d " 473 "CARD/%d FB/%d TM/%d TMU/NOSLI", 474 glbCurrentBoard, 475 sc->fbRam, 476 sc->tmuConfig.tmuRam, 477 sc->nTexelfx); 478 } 479 else 480 { 481 strcpy(buf, "Glide v0.30 UNKNOWN"); 482 } 483 484 return (GLubyte *) buf; 582 static char buf[80]; 583 584 if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) { 585 GrVoodooConfig_t *vc = 586 &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; 587 588 sprintf(buf, 589 "Mesa Glide v0.30 Voodoo_Graphics %d " 590 "CARD/%d FB/%d TM/%d TMU/%s", 591 glbCurrentBoard, 592 (vc->sliDetect ? (vc->fbRam*2) : vc->fbRam), 593 (vc->tmuConfig[GR_TMU0].tmuRam + 594 ((vc->nTexelfx>1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)), 595 vc->nTexelfx, 596 (vc->sliDetect ? "SLI" : "NOSLI")); 597 } 598 else if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96) { 599 GrSst96Config_t *sc = 600 &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config; 601 602 sprintf(buf, 603 "Glide v0.30 Voodoo_Rush %d " 604 "CARD/%d FB/%d TM/%d TMU/NOSLI", 605 glbCurrentBoard, 606 sc->fbRam, 607 sc->tmuConfig.tmuRam, 608 sc->nTexelfx); 609 } 610 else { 611 strcpy(buf, "Glide v0.30 UNKNOWN"); 612 } 613 return (GLubyte *) buf; 485 614 } 615 default: 616 return NULL; 617 } 486 618 #endif 487 default:488 return NULL;489 }490 619 } 491 620 … … 493 622 int fxDDInitFxMesaContext( fxMesaContext fxMesa ) 494 623 { 495 624 496 625 FX_setupGrVertexLayout(); 497 498 if (getenv("FX_EMULATE_SINGLE_TMU")) 626 627 if (getenv("FX_EMULATE_SINGLE_TMU")) 499 628 fxMesa->haveTwoTMUs = GL_FALSE; 500 629 501 630 fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs; 502 503 if (!getenv("FX_DONT_FAKE_MULTITEX")) 631 632 if (!getenv("FX_DONT_FAKE_MULTITEX")) 504 633 fxMesa->emulateTwoTMUs = GL_TRUE; 505 634 506 635 if(getenv("FX_GLIDE_SWAPINTERVAL")) 507 636 fxMesa->swapInterval=atoi(getenv("FX_GLIDE_SWAPINTERVAL")); … … 513 642 else 514 643 fxMesa->maxPendingSwapBuffers=2; 515 644 645 if(getenv("MESA_FX_INFO")) 646 fxMesa->verbose=GL_TRUE; 647 else 648 fxMesa->verbose=GL_FALSE; 649 516 650 fxMesa->color=0xffffffff; 517 651 fxMesa->clearC=0; … … 539 673 fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO; 540 674 541 fxMesa->unitsState.depthTestEnabled =GL_FALSE;542 fxMesa->unitsState.depthMask =GL_TRUE;543 fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;675 fxMesa->unitsState.depthTestEnabled =GL_FALSE; 676 fxMesa->unitsState.depthMask =GL_TRUE; 677 fxMesa->unitsState.depthTestFunc =GR_CMP_LESS; 544 678 545 679 FX_grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE); … … 551 685 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 552 686 } 553 554 fxMesa->state = NULL;555 fxMesa->fogTable = NULL;556 557 fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));558 fxMesa->fogTable = (GrFog_t*)malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));559 687 688 fxMesa->state = NULL; 689 fxMesa->fogTable = NULL; 690 691 fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE)); 692 fxMesa->fogTable = (GrFog_t*)malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t)); 693 560 694 if (!fxMesa->state || !fxMesa->fogTable) { 561 695 if (fxMesa->state) free(fxMesa->state); … … 566 700 if(fxMesa->haveZBuffer) 567 701 FX_grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); 568 702 569 703 #if (!FXMESA_USE_ARGB) 570 704 FX_grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */ 571 705 #endif 572 706 707 fxMesa->textureAlign=FX_grGetInteger(FX_TEXTURE_ALIGN); 573 708 fxMesa->glCtx->Const.MaxTextureLevels=9; 574 709 fxMesa->glCtx->Const.MaxTextureSize=256; … … 576 711 fxMesa->glCtx->NewState|=NEW_DRVSTATE1; 577 712 fxMesa->new_state = NEW_ALL; 578 713 579 714 fxDDSetupInit(); 580 715 fxDDCvaInit(); … … 585 720 fxSetupDDPointers(fxMesa->glCtx); 586 721 fxDDRenderInit(fxMesa->glCtx); 587 fxDDInitExtensions(fxMesa->glCtx); 722 fxDDInitExtensions(fxMesa->glCtx); 588 723 589 724 fxDDSetNearFar(fxMesa->glCtx,1.0,100.0); 590 725 591 726 FX_grGlideGetState((GrState*)fxMesa->state); 592 727 593 728 /* XXX Fix me: callback not registered when main VB is created. 594 729 */ 595 if (fxMesa->glCtx->VB) 730 if (fxMesa->glCtx->VB) 596 731 fxDDRegisterVB( fxMesa->glCtx->VB ); 597 732 598 733 /* XXX Fix me too: need to have the 'struct dd' prepared prior to 599 734 * creating the context... The below is broken if you try to insert 600 * new stages. 735 * new stages. 601 736 */ 602 737 if (fxMesa->glCtx->NrPipelineStages) 603 fxMesa->glCtx->NrPipelineStages = fxDDRegisterPipelineStages( 604 fxMesa->glCtx->PipelineStage,605 fxMesa->glCtx->PipelineStage,606 fxMesa->glCtx->NrPipelineStages);738 fxMesa->glCtx->NrPipelineStages = fxDDRegisterPipelineStages( 739 fxMesa->glCtx->PipelineStage, 740 fxMesa->glCtx->PipelineStage, 741 fxMesa->glCtx->NrPipelineStages); 607 742 608 743 /* Run the config file */ … … 620 755 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 621 756 622 gl_extensions_add( ctx, DEFAULT_ON, "3DFX_set_global_palette", 0 ); 623 gl_extensions_add( ctx, DEFAULT_ON, "GL_FXMESA_global_texture_lod_bias", 0); 624 625 if(fxMesa->haveTwoTMUs) 626 gl_extensions_add( ctx, DEFAULT_ON, "GL_EXT_texture_env_add", 0); 627 628 if (!fxMesa->emulateTwoTMUs) 629 gl_extensions_disable( ctx, "GL_ARB_multitexture" ); 757 gl_extensions_disable(ctx, "GL_EXT_blend_logic_op"); 758 gl_extensions_disable(ctx, "GL_EXT_blend_minmax"); 759 gl_extensions_disable(ctx, "GL_EXT_blend_subtract"); 760 gl_extensions_disable(ctx, "GL_EXT_blend_color"); 761 gl_extensions_disable(ctx, "GL_EXT_paletted_texture"); 762 763 gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0); 764 765 if (!fxMesa->haveTwoTMUs) 766 gl_extensions_disable(ctx, "GL_EXT_texture_env_add"); 767 768 if (!fxMesa->emulateTwoTMUs) 769 gl_extensions_disable(ctx, "GL_ARB_multitexture"); 770 771 772 /* Example of hooking in an extension function. 773 * For DRI-based drivers, also see __driRegisterExtensions in the 774 * tdfx_xmesa.c file. 775 */ 776 #if 0 777 { 778 void **dispatchTable = (void **) ctx->Exec; 779 const int _gloffset_FooBarEXT = 555; /* just an example number! */ 780 const int tabSize = _glapi_get_dispatch_table_size(); 781 assert(_gloffset_FooBarEXT < tabSize); 782 dispatchTable[_gloffset_FooBarEXT] = (void *) fxFooBarEXT; 783 /* XXX You would also need to hook into the display list dispatch 784 * table. Really, the implementation of extensions might as well 785 * be in the core of Mesa since core Mesa and the device driver 786 * is one big shared lib. 787 */ 788 } 789 #endif 630 790 } 631 791 … … 640 800 /************************************************************************/ 641 801 642 /* This is a no-op, since the z-buffer is in hardware */ 643 static void fxAllocDepthBuffer(GLcontext *ctx) 644 { 645 if (MESA_VERBOSE&VERBOSE_DRIVER) { 646 fprintf(stderr,"fxmesa: fxAllocDepthBuffer()\n"); 647 } 648 } 649 650 /************************************************************************/ 651 /************************************************************************/ 652 /************************************************************************/ 653 654 /* Check if the hardware supports the current context 802 /* Check if the hardware supports the current context 655 803 * 656 804 * Performs similar work to fxDDChooseRenderState() - should be merged. … … 661 809 662 810 if (!ctx->Hint.AllowDrawMem) 663 return GL_TRUE; /* you'll take it and like it */811 return GL_TRUE; /* you'll take it and like it */ 664 812 665 813 if((ctx->RasterMask & STENCIL_BIT) || … … 679 827 if((ctx->Enabled & (TEXTURE0_3D | TEXTURE1_3D)) || 680 828 /* Not very well written ... */ 681 ((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) && 829 ((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) && 682 830 ((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D))) 683 831 ) { … … 698 846 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE)) 699 847 fprintf(stderr, "fxMesa: fxIsInHardware, envmode is %s/%s\n", 700 gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),701 gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));848 gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), 849 gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode)); 702 850 703 851 /* KW: This was wrong (I think) and I changed it... which doesn't mean … … 708 856 { 709 857 /* Can't use multipass to blend a multitextured triangle - fall 710 * back to software.711 */858 * back to software. 859 */ 712 860 if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) { 713 return GL_FALSE;861 return GL_FALSE; 714 862 } 715 863 716 864 if ((ctx->Texture.Unit[0].EnvMode!=ctx->Texture.Unit[1].EnvMode) && 717 (ctx->Texture.Unit[0].EnvMode!=GL_MODULATE) &&718 (ctx->Texture.Unit[0].EnvMode!=GL_REPLACE)) /* q2, seems ok... */865 (ctx->Texture.Unit[0].EnvMode!=GL_MODULATE) && 866 (ctx->Texture.Unit[0].EnvMode!=GL_REPLACE)) /* q2, seems ok... */ 719 867 { 720 if (MESA_VERBOSE&VERBOSE_DRIVER)721 fprintf(stderr, "fxMesa: unsupported multitex env mode\n");722 return GL_FALSE;868 if (MESA_VERBOSE&VERBOSE_DRIVER) 869 fprintf(stderr, "fxMesa: unsupported multitex env mode\n"); 870 return GL_FALSE; 723 871 } 724 872 } … … 726 874 if((ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) || 727 875 /* Not very well written ... */ 728 ((ctx->Enabled & TEXTURE0_1D) && 876 ((ctx->Enabled & TEXTURE0_1D) && 729 877 (!(ctx->Enabled & TEXTURE0_2D))) 730 878 ) { … … 732 880 } 733 881 734 882 735 883 if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) && 736 884 (ctx->Texture.Unit[0].EnvMode==GL_BLEND)) { … … 751 899 GLuint new_state = ctx->NewState; 752 900 753 if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_STATE)) 901 if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_STATE)) 754 902 fprintf(stderr,"fxmesa: fxDDUpdateDDPointers(...)\n"); 755 903 756 if (new_state & (NEW_RASTER_OPS|NEW_TEXTURING)) 904 if (new_state & (NEW_RASTER_OPS|NEW_TEXTURING)) 757 905 fxMesa->is_in_hardware = fxIsInHardware(ctx); 758 906 … … 770 918 ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx); 771 919 } 772 920 773 921 ctx->Driver.PointsFunc=fxMesa->PointsFunc; 774 922 ctx->Driver.LineFunc=fxMesa->LineFunc; … … 780 928 } 781 929 930 static void fxDDReducedPrimitiveChange(GLcontext *ctx, GLenum prim) 931 { 932 if (ctx->Polygon.CullFlag) { 933 if (ctx->PB->primitive != GL_POLYGON) { /* Lines or Points */ 934 FX_grCullMode(GR_CULL_DISABLE); 935 FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; 936 } 937 } 938 } 939 782 940 void fxSetupDDPointers(GLcontext *ctx) 783 941 { … … 788 946 ctx->Driver.UpdateState=fxDDUpdateDDPointers; 789 947 790 ctx->Driver.AllocDepthBuffer=fxAllocDepthBuffer; 791 ctx->Driver.DepthTestSpan=fxDDDepthTestSpanGeneric; 792 ctx->Driver.DepthTestPixels=fxDDDepthTestPixelsGeneric; 793 ctx->Driver.ReadDepthSpanFloat=fxDDReadDepthSpanFloat; 794 ctx->Driver.ReadDepthSpanInt=fxDDReadDepthSpanInt; 795 948 ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan; 949 ctx->Driver.WriteDepthPixels=fxDDWriteDepthPixels; 950 ctx->Driver.ReadDepthSpan=fxDDReadDepthSpan; 951 ctx->Driver.ReadDepthPixels=fxDDReadDepthPixels; 952 796 953 ctx->Driver.GetString=fxDDGetString; 797 954 … … 809 966 ctx->Driver.Color=fxDDSetColor; 810 967 811 ctx->Driver.SetBuffer=fxDDSetBuffer; 968 ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer; 969 ctx->Driver.SetReadBuffer=fxDDSetReadBuffer; 812 970 ctx->Driver.GetBufferSize=fxDDBufferSize; 813 971 … … 828 986 ctx->Driver.DeleteTexture=fxDDTexDel; 829 987 ctx->Driver.UpdateTexturePalette=fxDDTexPalette; 830 ctx->Driver.UseGlobalTexturePalette=fxDDTexUseGlbPalette;831 988 832 989 ctx->Driver.RectFunc=NULL; … … 843 1000 ctx->Driver.ShadeModel=fxDDShadeModel; 844 1001 ctx->Driver.Enable=fxDDEnable; 1002 ctx->Driver.ReducedPrimitiveChange=fxDDReducedPrimitiveChange; 845 1003 846 1004 ctx->Driver.RegisterVB=fxDDRegisterVB; … … 855 1013 /* ctx->Driver.OptimizePrecalcPipeline = fxDDOptimizePrecalcPipeline; */ 856 1014 857 if (!getenv("FX_NO_FAST")) 858 ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline; 1015 if (!getenv("FX_NO_FAST")) 1016 ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline; 859 1017 860 1018 ctx->Driver.TriangleCaps = DD_TRI_CULL|DD_TRI_OFFSET|DD_TRI_LIGHT_TWOSIDE; -
trunk/src/opengl/mesa/3dfx/fxddspan.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. … … 65 65 66 66 67 #if !defined(FXMESA_USE_ARGB) 67 #if !defined(FXMESA_USE_ARGB) 68 68 69 69 … … 71 71 72 72 static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, 73 FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, 74 FxU32 src_width, FxU32 src_height, FxI32 src_stride, 75 void *src_data); 76 77 FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, 78 FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, 79 FxU32 src_width, FxU32 src_height, FxI32 src_stride, 80 void *src_data) 81 { 82 int i, x, w; 73 FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, 74 FxU32 src_width, FxU32 src_height, FxI32 src_stride, 75 void *src_data) 76 { 77 int i, x, w, srcElt; 83 78 void *data; 84 79 85 80 if (src_width==1 && src_height==1) { /* Easy case writing a point */ 86 81 for (i=0; i<fxMesa->numClipRects; i++) { 87 if ((dst_x>=fxMesa->pClipRects[i].x1) && 88 (dst_x<fxMesa->pClipRects[i].x2) &&89 (dst_y>=fxMesa->pClipRects[i].y1) && 90 (dst_y<fxMesa->pClipRects[i].y2)) {91 FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format,92 src_width, src_height, src_stride, src_data);93 return GL_TRUE;82 if ((dst_x>=fxMesa->pClipRects[i].x1) && 83 (dst_x<fxMesa->pClipRects[i].x2) && 84 (dst_y>=fxMesa->pClipRects[i].y1) && 85 (dst_y<fxMesa->pClipRects[i].y2)) { 86 FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, 87 1, 1, src_stride, src_data); 88 return GL_TRUE; 94 89 } 95 90 } 96 91 } else if (src_height==1) { /* Writing a span */ 92 if (src_format==GR_LFB_SRC_FMT_8888) srcElt=4; 93 else if (src_format==GR_LFB_SRC_FMT_ZA16) srcElt=2; 94 else { 95 fprintf(stderr, "Unknown src_format passed to writeRegionClipped\n"); 96 return GL_FALSE; 97 } 97 98 for (i=0; i<fxMesa->numClipRects; i++) { 98 99 if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) { 99 if (dst_x<fxMesa->pClipRects[i].x1) {100 x=fxMesa->pClipRects[i].x1;101 data=((char*)src_data)+2*(dst_x-x);102 w=src_width-(x-dst_x);103 } else {104 x=dst_x;105 data=src_data;106 w=src_width;107 }108 if (x+w>fxMesa->pClipRects[i].x2) {109 w=fxMesa->pClipRects[i].x2-x;110 }111 FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, src_height,112 src_stride, data);100 if (dst_x<fxMesa->pClipRects[i].x1) { 101 x=fxMesa->pClipRects[i].x1; 102 data=((char*)src_data)+srcElt*(dst_x-x); 103 w=src_width-(x-dst_x); 104 } else { 105 x=dst_x; 106 data=src_data; 107 w=src_width; 108 } 109 if (x+w>fxMesa->pClipRects[i].x2) { 110 w=fxMesa->pClipRects[i].x2-x; 111 } 112 FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, 1, 113 src_stride, data); 113 114 } 114 115 } … … 121 122 #else 122 123 123 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \124 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ 124 125 FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) 125 126 … … 129 130 /* KW: Rearranged the args in the call to grLfbWriteRegion(). 130 131 */ 131 #define LFB_WRITE_SPAN_MESA(dst_buffer, \132 dst_x,\133 dst_y,\134 src_width,\135 src_stride,\136 src_data)\137 writeRegionClipped(fxMesa, dst_buffer, \138 dst_x,\139 dst_y,\140 GR_LFB_SRC_FMT_8888,\141 src_width,\142 1,\143 src_stride,\144 src_data)\132 #define LFB_WRITE_SPAN_MESA(dst_buffer, \ 133 dst_x, \ 134 dst_y, \ 135 src_width, \ 136 src_stride, \ 137 src_data) \ 138 writeRegionClipped(fxMesa, dst_buffer, \ 139 dst_x, \ 140 dst_y, \ 141 GR_LFB_SRC_FMT_8888, \ 142 src_width, \ 143 1, \ 144 src_stride, \ 145 src_data) \ 145 146 146 147 147 148 #else /* !defined(FXMESA_USE_RGBA) */ 148 149 149 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \150 #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ 150 151 FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) 151 152 152 153 153 #define MESACOLOR_TO_ARGB(c) ( \154 ( ((unsigned int)(c[ACOMP]))<<24 ) | \155 ( ((unsigned int)(c[RCOMP]))<<16 ) | \156 ( ((unsigned int)(c[GCOMP]))<<8 ) | \154 #define MESACOLOR_TO_ARGB(c) ( \ 155 ( ((unsigned int)(c[ACOMP]))<<24 ) | \ 156 ( ((unsigned int)(c[RCOMP]))<<16 ) | \ 157 ( ((unsigned int)(c[GCOMP]))<<8 ) | \ 157 158 ( (unsigned int)(c[BCOMP])) ) 158 159 inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer, 160 FxU32 dst_x, 161 FxU32 dst_y, 162 FxU32 src_width,163 FxI32 src_stride, 164 void *src_data )159 160 inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer, 161 FxU32 dst_x, 162 FxU32 dst_y, 163 FxU32 src_width, 164 FxI32 src_stride, 165 void *src_data ) 165 166 { 166 167 /* Covert to ARGB */ … … 168 169 GLuint argb[MAX_WIDTH]; 169 170 int i; 170 171 171 172 for (i = 0; i < src_width; i++) 172 173 { … … 174 175 } 175 176 writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer, 176 dst_x,177 dst_y,178 GR_LFB_SRC_FMT_8888,179 src_width,180 1,181 src_stride,182 (void*)argb);183 } 184 177 dst_x, 178 dst_y, 179 GR_LFB_SRC_FMT_8888, 180 src_width, 181 1, 182 src_stride, 183 (void*)argb); 184 } 185 185 186 #endif /* !defined(FXMESA_USE_RGBA) */ 186 187 … … 191 192 192 193 193 static void fxDDWriteRGBASpan(const GLcontext *ctx, 194 static void fxDDWriteRGBASpan(const GLcontext *ctx, 194 195 GLuint n, GLint x, GLint y, 195 196 const GLubyte rgba[][4], const GLubyte mask[]) … … 197 198 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 198 199 GLuint i; 199 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 200 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 200 201 201 202 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 209 210 for (i=0;i<n;i++) { 210 211 if (mask[i]) { 211 ++span; 212 ++span; 212 213 } else { 213 214 if (span > 0) { … … 228 229 229 230 230 static void fxDDWriteRGBSpan(const GLcontext *ctx, 231 static void fxDDWriteRGBSpan(const GLcontext *ctx, 231 232 GLuint n, GLint x, GLint y, 232 233 const GLubyte rgb[][3], const GLubyte mask[]) … … 278 279 279 280 280 static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, 281 static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, 281 282 GLuint n, GLint x, GLint y, 282 283 const GLubyte mask[]) … … 324 325 325 326 326 static void fxDDReadRGBASpan(const GLcontext *ctx, 327 static void fxDDReadRGBASpan(const GLcontext *ctx, 327 328 GLuint n, GLint x, GLint y, GLubyte rgba[][4]) 328 329 { … … 419 420 /************************************************************************/ 420 421 421 void fxDDReadDepthSpanFloat(GLcontext *ctx, 422 GLuint n, GLint x, GLint y, GLfloat depth[]) 423 { 424 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 425 GLuint i; 426 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 427 GLushort data[MAX_WIDTH]; 428 429 if (MESA_VERBOSE&VERBOSE_DRIVER) { 430 fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n"); 431 } 432 433 x+=fxMesa->x_offset; 434 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data); 435 436 /* 437 convert the read values to float values [0.0 .. 1.0]. 438 */ 439 for(i=0;i<n;i++) 440 depth[i]=data[i]/65535.0f; 441 } 442 443 void fxDDReadDepthSpanInt(GLcontext *ctx, 444 GLuint n, GLint x, GLint y, GLdepth depth[]) 445 { 446 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 447 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 448 449 if (MESA_VERBOSE&VERBOSE_DRIVER) { 450 fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n"); 451 } 452 453 x+=fxMesa->x_offset; 454 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth); 455 } 456 457 GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx, 458 GLuint n, GLint x, GLint y, const GLdepth z[], 459 GLubyte mask[]) 460 { 461 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 462 GLushort depthdata[MAX_WIDTH]; 463 GLdepth *zptr=depthdata; 464 GLubyte *m=mask; 465 GLuint i; 466 GLuint passed=0; 467 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 468 469 if (MESA_VERBOSE&VERBOSE_DRIVER) { 470 fprintf(stderr,"fxmesa: fxDDDepthTestSpanGeneric(...)\n"); 471 } 472 473 x+=fxMesa->x_offset; 474 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata); 475 476 /* switch cases ordered from most frequent to less frequent */ 477 switch (ctx->Depth.Func) { 478 case GL_LESS: 479 if (ctx->Depth.Mask) { 480 /* Update Z buffer */ 481 for (i=0; i<n; i++,zptr++,m++) { 482 if (*m) { 483 if (z[i] < *zptr) { 484 /* pass */ 485 *zptr = z[i]; 486 passed++; 487 } else { 488 /* fail */ 489 *m = 0; 490 } 491 } 422 void fxDDWriteDepthSpan(GLcontext *ctx, 423 GLuint n, GLint x, GLint y, const GLdepth depth[], 424 const GLubyte mask[]) 425 { 426 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 427 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 428 429 if (MESA_VERBOSE & VERBOSE_DRIVER) { 430 fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n"); 431 } 432 433 x += fxMesa->x_offset; 434 435 if (mask) { 436 GLint i; 437 for (i = 0; i < n; i++) { 438 if (mask[i]) { 439 GLshort d = depth[i]; 440 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y, 441 GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d); 492 442 } 493 } else { 494 /* Don't update Z buffer */ 495 for (i=0; i<n; i++,zptr++,m++) { 496 if (*m) { 497 if (z[i] < *zptr) { 498 /* pass */ 499 passed++; 500 } else { 501 *m = 0; 502 } 503 } 504 } 505 } 506 break; 507 case GL_LEQUAL: 508 if (ctx->Depth.Mask) { 509 /* Update Z buffer */ 510 for (i=0;i<n;i++,zptr++,m++) { 511 if (*m) { 512 if (z[i] <= *zptr) { 513 *zptr = z[i]; 514 passed++; 515 } else { 516 *m = 0; 517 } 518 } 519 } 520 } else { 521 /* Don't update Z buffer */ 522 for (i=0;i<n;i++,zptr++,m++) { 523 if (*m) { 524 if (z[i] <= *zptr) { 525 /* pass */ 526 passed++; 527 } else { 528 *m = 0; 529 } 530 } 531 } 532 } 533 break; 534 case GL_GEQUAL: 535 if (ctx->Depth.Mask) { 536 /* Update Z buffer */ 537 for (i=0;i<n;i++,zptr++,m++) { 538 if (*m) { 539 if (z[i] >= *zptr) { 540 *zptr = z[i]; 541 passed++; 542 } else { 543 *m = 0; 544 } 545 } 546 } 547 } else { 548 /* Don't update Z buffer */ 549 for (i=0;i<n;i++,zptr++,m++) { 550 if (*m) { 551 if (z[i] >= *zptr) { 552 /* pass */ 553 passed++; 554 } else { 555 *m = 0; 556 } 557 } 558 } 559 } 560 break; 561 case GL_GREATER: 562 if (ctx->Depth.Mask) { 563 /* Update Z buffer */ 564 for (i=0;i<n;i++,zptr++,m++) { 565 if (*m) { 566 if (z[i] > *zptr) { 567 *zptr = z[i]; 568 passed++; 569 } else { 570 *m = 0; 571 } 572 } 573 } 574 } else { 575 /* Don't update Z buffer */ 576 for (i=0;i<n;i++,zptr++,m++) { 577 if (*m) { 578 if (z[i] > *zptr) { 579 /* pass */ 580 passed++; 581 } else { 582 *m = 0; 583 } 584 } 585 } 586 } 587 break; 588 case GL_NOTEQUAL: 589 if (ctx->Depth.Mask) { 590 /* Update Z buffer */ 591 for (i=0;i<n;i++,zptr++,m++) { 592 if (*m) { 593 if (z[i] != *zptr) { 594 *zptr = z[i]; 595 passed++; 596 } else { 597 *m = 0; 598 } 599 } 600 } 601 } else { 602 /* Don't update Z buffer */ 603 for (i=0;i<n;i++,zptr++,m++) { 604 if (*m) { 605 if (z[i] != *zptr) { 606 /* pass */ 607 passed++; 608 } else { 609 *m = 0; 610 } 611 } 612 } 613 } 614 break; 615 case GL_EQUAL: 616 if (ctx->Depth.Mask) { 617 /* Update Z buffer */ 618 for (i=0;i<n;i++,zptr++,m++) { 619 if (*m) { 620 if (z[i] == *zptr) { 621 *zptr = z[i]; 622 passed++; 623 } else { 624 *m =0; 625 } 626 } 627 } 628 } else { 629 /* Don't update Z buffer */ 630 for (i=0;i<n;i++,zptr++,m++) { 631 if (*m) { 632 if (z[i] == *zptr) { 633 /* pass */ 634 passed++; 635 } else { 636 *m =0; 637 } 638 } 639 } 640 } 641 break; 642 case GL_ALWAYS: 643 if (ctx->Depth.Mask) { 644 /* Update Z buffer */ 645 for (i=0;i<n;i++,zptr++,m++) { 646 if (*m) { 647 *zptr = z[i]; 648 passed++; 649 } 650 } 651 } else { 652 /* Don't update Z buffer or mask */ 653 passed = n; 654 } 655 break; 656 case GL_NEVER: 657 for (i=0;i<n;i++) { 658 mask[i] = 0; 659 } 660 break; 661 default: 662 ; 663 } /*switch*/ 664 665 if(passed) 666 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata); 667 668 return passed; 669 } 670 671 void fxDDDepthTestPixelsGeneric(GLcontext* ctx, 672 GLuint n, const GLint x[], const GLint y[], 673 const GLdepth z[], GLubyte mask[]) 674 { 675 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 676 GLdepth zval; 677 GLuint i; 678 GLint bottom=fxMesa->height+fxMesa->y_offset-1; 679 680 if (MESA_VERBOSE&VERBOSE_DRIVER) { 681 fprintf(stderr,"fxmesa: fxDDDepthTestPixelsGeneric(...)\n"); 682 } 683 684 /* switch cases ordered from most frequent to less frequent */ 685 switch (ctx->Depth.Func) { 686 case GL_LESS: 687 if (ctx->Depth.Mask) { 688 /* Update Z buffer */ 689 for (i=0; i<n; i++) { 690 if (mask[i]) { 691 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 692 if (z[i] < zval) { 693 /* pass */ 694 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 695 } else { 696 /* fail */ 697 mask[i] = 0; 698 } 699 } 700 } 701 } else { 702 /* Don't update Z buffer */ 703 for (i=0; i<n; i++) { 704 if (mask[i]) { 705 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 706 if (z[i] < zval) { 707 /* pass */ 708 } 709 else { 710 /* fail */ 711 mask[i] = 0; 712 } 713 } 714 } 715 } 716 break; 717 case GL_LEQUAL: 718 if (ctx->Depth.Mask) { 719 /* Update Z buffer */ 720 for (i=0; i<n; i++) { 721 if (mask[i]) { 722 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 723 if (z[i] <= zval) { 724 /* pass */ 725 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 726 } else { 727 /* fail */ 728 mask[i] = 0; 729 } 730 } 731 } 732 } else { 733 /* Don't update Z buffer */ 734 for (i=0; i<n; i++) { 735 if (mask[i]) { 736 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 737 if (z[i] <= zval) { 738 /* pass */ 739 } else { 740 /* fail */ 741 mask[i] = 0; 742 } 743 } 744 } 745 } 746 break; 747 case GL_GEQUAL: 748 if (ctx->Depth.Mask) { 749 /* Update Z buffer */ 750 for (i=0; i<n; i++) { 751 if (mask[i]) { 752 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 753 if (z[i] >= zval) { 754 /* pass */ 755 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 756 } else { 757 /* fail */ 758 mask[i] = 0; 759 } 760 } 761 } 762 } else { 763 /* Don't update Z buffer */ 764 for (i=0; i<n; i++) { 765 if (mask[i]) { 766 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 767 if (z[i] >= zval) { 768 /* pass */ 769 } else { 770 /* fail */ 771 mask[i] = 0; 772 } 773 } 774 } 775 } 776 break; 777 case GL_GREATER: 778 if (ctx->Depth.Mask) { 779 /* Update Z buffer */ 780 for (i=0; i<n; i++) { 781 if (mask[i]) { 782 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 783 if (z[i] > zval) { 784 /* pass */ 785 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 786 } else { 787 /* fail */ 788 mask[i] = 0; 789 } 790 } 791 } 792 } else { 793 /* Don't update Z buffer */ 794 for (i=0; i<n; i++) { 795 if (mask[i]) { 796 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 797 if (z[i] > zval) { 798 /* pass */ 799 } else { 800 /* fail */ 801 mask[i] = 0; 802 } 803 } 804 } 805 } 806 break; 807 case GL_NOTEQUAL: 808 if (ctx->Depth.Mask) { 809 /* Update Z buffer */ 810 for (i=0; i<n; i++) { 811 if (mask[i]) { 812 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 813 if (z[i] != zval) { 814 /* pass */ 815 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 816 } else { 817 /* fail */ 818 mask[i] = 0; 819 } 820 } 821 } 822 } else { 823 /* Don't update Z buffer */ 824 for (i=0; i<n; i++) { 825 if (mask[i]) { 826 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 827 if (z[i] != zval) { 828 /* pass */ 829 } 830 else { 831 /* fail */ 832 mask[i] = 0; 833 } 834 } 835 } 836 } 837 break; 838 case GL_EQUAL: 839 if (ctx->Depth.Mask) { 840 /* Update Z buffer */ 841 for (i=0; i<n; i++) { 842 if (mask[i]) { 843 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 844 if (z[i] == zval) { 845 /* pass */ 846 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 847 } else { 848 /* fail */ 849 mask[i] = 0; 850 } 851 } 852 } 853 } else { 854 /* Don't update Z buffer */ 855 for (i=0; i<n; i++) { 856 if (mask[i]) { 857 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval); 858 if (z[i] == zval) { 859 /* pass */ 860 } else { 861 /* fail */ 862 mask[i] = 0; 863 } 864 } 865 } 866 } 867 break; 868 case GL_ALWAYS: 869 if (ctx->Depth.Mask) { 870 /* Update Z buffer */ 871 for (i=0; i<n; i++) { 872 if (mask[i]) { 873 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]); 874 } 875 } 876 } else { 877 /* Don't update Z buffer or mask */ 878 } 879 break; 880 case GL_NEVER: 881 /* depth test never passes */ 882 for (i=0;i<n;i++) { 883 mask[i] = 0; 884 } 885 break; 886 default: 887 ; 888 } /*switch*/ 889 } 443 } 444 } 445 else { 446 GLushort depth16[MAX_WIDTH]; 447 GLint i; 448 for (i = 0; i < n; i++) { 449 depth16[i] = depth[i]; 450 } 451 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y, 452 GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth16); 453 } 454 } 455 456 457 void fxDDReadDepthSpan(GLcontext *ctx, 458 GLuint n, GLint x, GLint y, GLdepth depth[]) 459 { 460 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 461 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 462 GLushort depth16[MAX_WIDTH]; 463 GLuint i; 464 465 if (MESA_VERBOSE & VERBOSE_DRIVER) { 466 fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n"); 467 } 468 469 x += fxMesa->x_offset; 470 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16); 471 for (i = 0; i < n; i++) { 472 depth[i] = depth16[i]; 473 } 474 } 475 476 477 478 void fxDDWriteDepthPixels(GLcontext *ctx, 479 GLuint n, const GLint x[], const GLint y[], 480 const GLdepth depth[], const GLubyte mask[]) 481 { 482 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 483 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 484 GLuint i; 485 486 if (MESA_VERBOSE & VERBOSE_DRIVER) { 487 fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n"); 488 } 489 490 for (i = 0; i < n; i++) { 491 if (mask[i]) { 492 int xpos = x[i] + fxMesa->x_offset; 493 int ypos = bottom - y[i]; 494 GLushort d = depth[i]; 495 writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, 496 GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d); 497 } 498 } 499 } 500 501 502 void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, 503 const GLint x[], const GLint y[], GLdepth depth[]) 504 { 505 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 506 GLint bottom = fxMesa->height + fxMesa->y_offset - 1; 507 GLuint i; 508 509 if (MESA_VERBOSE & VERBOSE_DRIVER) { 510 fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n"); 511 } 512 513 for (i = 0; i < n; i++) { 514 int xpos = x[i] + fxMesa->x_offset; 515 int ypos = bottom - y[i]; 516 GLushort d; 517 FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d); 518 depth[i] = d; 519 } 520 } 521 522 523 890 524 891 525 /************************************************************************/ -
trunk/src/opengl/mesa/3dfx/fxddtex.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. … … 58 58 fprintf(stderr, "\tName: %d\n", ti->tObj->Name); 59 59 fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel); 60 fprintf(stderr, "\tSize: %d x %d\n", 61 ti->tObj->Image[ti->tObj->BaseLevel]->Width,62 ti->tObj->Image[ti->tObj->BaseLevel]->Height);60 fprintf(stderr, "\tSize: %d x %d\n", 61 ti->tObj->Image[ti->tObj->BaseLevel]->Width, 62 ti->tObj->Image[ti->tObj->BaseLevel]->Height); 63 63 } else 64 64 fprintf(stderr, "\tName: UNNAMED\n"); 65 65 fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed); 66 fprintf(stderr, "\tTMU: % d\n", ti->whichTMU);66 fprintf(stderr, "\tTMU: %ld\n", ti->whichTMU); 67 67 fprintf(stderr, "\t%s\n", (ti->isInTM)?"In TMU":"Not in TMU"); 68 if (ti->tm[0]) 69 fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr, 70 ti->tm[0]->endAddr);71 if (ti->tm[1]) 72 fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr, 73 ti->tm[1]->endAddr);68 if (ti->tm[0]) 69 fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr, 70 ti->tm[0]->endAddr); 71 if (ti->tm[1]) 72 fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr, 73 ti->tm[1]->endAddr); 74 74 fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel); 75 75 fprintf(stderr, "\tFilters: min %d min %d\n", ti->minFilt, ti->maxFilt); 76 76 fprintf(stderr, "\tClamps: s %d t %d\n", ti->sClamp, ti->tClamp); 77 77 fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale); 78 fprintf(stderr, "\tInt Scales: s %d t %d\n", 79 ti->int_sScale/0x800000, ti->int_tScale/0x800000);78 fprintf(stderr, "\tInt Scales: s %d t %d\n", 79 ti->int_sScale/0x800000, ti->int_tScale/0x800000); 80 80 fprintf(stderr, "\t%s\n", (ti->fixedPalette)?"Fixed palette":"Non fixed palette"); 81 81 fprintf(stderr, "\t%s\n", (ti->validated)?"Validated":"Not validated"); … … 87 87 /************************************************************************/ 88 88 89 void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj)89 static void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj) 90 90 { 91 91 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; … … 108 108 fprintf(stderr,"fx Driver: out of memory !\n"); 109 109 fxCloseHardware(); 110 exit(-1);110 EXIT(-1); 111 111 } 112 112 … … 161 161 } 162 162 163 void fxDDTexEnv(GLcontext *ctx, GLenum pname, const GLfloat *param)163 void fxDDTexEnv(GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param) 164 164 { 165 165 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; … … 167 167 if (MESA_VERBOSE&VERBOSE_DRIVER) { 168 168 if(param) 169 fprintf(stderr,"fxmesa: texenv(%x,%x)\n",pname,(GLint)(*param));169 fprintf(stderr,"fxmesa: texenv(%x,%x)\n",pname,(GLint)(*param)); 170 170 else 171 fprintf(stderr,"fxmesa: texenv(%x)\n",pname); 171 fprintf(stderr,"fxmesa: texenv(%x)\n",pname); 172 } 173 174 /* apply any lod biasing right now */ 175 if (pname==GL_TEXTURE_LOD_BIAS_EXT) { 176 grTexLodBiasValue(GR_TMU0,*param); 177 178 if(fxMesa->haveTwoTMUs) { 179 grTexLodBiasValue(GR_TMU1,*param); 180 } 181 172 182 } 173 183 … … 338 348 tfxTexInfo *ti; 339 349 340 if(tObj) { 350 if(tObj) { 341 351 if (MESA_VERBOSE&VERBOSE_DRIVER) { 342 fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n",tObj->Name,(GLuint)tObj->DriverData);352 fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n",tObj->Name,(GLuint)tObj->DriverData); 343 353 } 344 354 345 if(tObj->Palette Format!=GL_RGBA) {355 if(tObj->Palette.Format!=GL_RGBA) { 346 356 #ifndef FX_SILENT 347 357 fprintf(stderr,"fx Driver: unsupported palette format in texpalette()\n"); … … 350 360 } 351 361 352 if(tObj->Palette Size>256) {362 if(tObj->Palette.Size>256) { 353 363 #ifndef FX_SILENT 354 364 fprintf(stderr,"fx Driver: unsupported palette size in texpalette()\n"); … … 359 369 if (!tObj->DriverData) 360 370 tObj->DriverData=fxAllocTexObjData(fxMesa); 361 371 362 372 ti=fxTMGetTexInfo(tObj); 363 373 364 for(i=0;i<tObj->Palette Size;i++) {365 r=tObj->Palette [i*4];366 g=tObj->Palette [i*4+1];367 b=tObj->Palette [i*4+2];368 a=tObj->Palette [i*4+3];374 for(i=0;i<tObj->Palette.Size;i++) { 375 r=tObj->Palette.Table[i*4]; 376 g=tObj->Palette.Table[i*4+1]; 377 b=tObj->Palette.Table[i*4+2]; 378 a=tObj->Palette.Table[i*4+3]; 369 379 ti->palette.data[i]=(a<<24)|(r<<16)|(g<<8)|b; 370 380 } … … 373 383 } else { 374 384 if (MESA_VERBOSE&VERBOSE_DRIVER) { 375 fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n");385 fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n"); 376 386 } 377 if(ctx->Texture.Palette Format!=GL_RGBA) {387 if(ctx->Texture.Palette.Format!=GL_RGBA) { 378 388 #ifndef FX_SILENT 379 389 fprintf(stderr,"fx Driver: unsupported palette format in texpalette()\n"); … … 382 392 } 383 393 384 if(ctx->Texture.Palette Size>256) {394 if(ctx->Texture.Palette.Size>256) { 385 395 #ifndef FX_SILENT 386 396 fprintf(stderr,"fx Driver: unsupported palette size in texpalette()\n"); … … 389 399 } 390 400 391 for(i=0;i<ctx->Texture.Palette Size;i++) {392 r=ctx->Texture.Palette [i*4];393 g=ctx->Texture.Palette [i*4+1];394 b=ctx->Texture.Palette [i*4+2];395 a=ctx->Texture.Palette [i*4+3];401 for(i=0;i<ctx->Texture.Palette.Size;i++) { 402 r=ctx->Texture.Palette.Table[i*4]; 403 g=ctx->Texture.Palette.Table[i*4+1]; 404 b=ctx->Texture.Palette.Table[i*4+2]; 405 a=ctx->Texture.Palette.Table[i*4+3]; 396 406 fxMesa->glbPalette.data[i]=(a<<24)|(r<<16)|(g<<8)|b; 397 407 } … … 425 435 if (!tObj->DriverData) 426 436 tObj->DriverData=fxAllocTexObjData(fxMesa); 427 437 428 438 fxTexInvalidate(ctx,tObj); 429 439 } … … 660 670 } 661 671 672 /* 673 * Given an OpenGL internal texture format, return the corresponding 674 * Glide internal texture format and base texture format. 675 */ 662 676 void fxTexGetFormat(GLenum glformat, GrTextureFormat_t *tfmt, GLint *ifmt) 663 677 { 664 678 switch(glformat) { 665 case 1: 666 case GL_LUMINANCE: 667 case GL_LUMINANCE4: 668 case GL_LUMINANCE8: 669 case GL_LUMINANCE12: 670 case GL_LUMINANCE16: 671 if(tfmt) 672 (*tfmt)=GR_TEXFMT_INTENSITY_8; 673 if(ifmt) 674 (*ifmt)=GL_LUMINANCE; 675 break; 676 case 2: 677 case GL_LUMINANCE_ALPHA: 678 case GL_LUMINANCE4_ALPHA4: 679 case GL_LUMINANCE6_ALPHA2: 680 case GL_LUMINANCE8_ALPHA8: 681 case GL_LUMINANCE12_ALPHA4: 682 case GL_LUMINANCE12_ALPHA12: 683 case GL_LUMINANCE16_ALPHA16: 684 if(tfmt) 685 (*tfmt)=GR_TEXFMT_ALPHA_INTENSITY_88; 686 if(ifmt) 687 (*ifmt)=GL_LUMINANCE_ALPHA; 688 break; 689 case GL_INTENSITY: 690 case GL_INTENSITY4: 691 case GL_INTENSITY8: 692 case GL_INTENSITY12: 693 case GL_INTENSITY16: 694 if(tfmt) 695 (*tfmt)=GR_TEXFMT_ALPHA_8; 696 if(ifmt) 697 (*ifmt)=GL_INTENSITY; 698 break; 699 case GL_ALPHA: 700 case GL_ALPHA4: 701 case GL_ALPHA8: 702 case GL_ALPHA12: 703 case GL_ALPHA16: 704 if(tfmt) 705 (*tfmt)=GR_TEXFMT_ALPHA_8; 706 if(ifmt) 707 (*ifmt)=GL_ALPHA; 708 break; 709 case 3: 710 case GL_RGB: 711 case GL_R3_G3_B2: 712 case GL_RGB4: 713 case GL_RGB5: 714 case GL_RGB8: 715 case GL_RGB10: 716 case GL_RGB12: 717 case GL_RGB16: 718 if(tfmt) 719 (*tfmt)=GR_TEXFMT_RGB_565; 720 if(ifmt) 721 (*ifmt)=GL_RGB; 722 break; 723 case 4: 724 case GL_RGBA: 725 case GL_RGBA2: 726 case GL_RGBA4: 727 case GL_RGB5_A1: 728 case GL_RGBA8: 729 case GL_RGB10_A2: 730 case GL_RGBA12: 731 case GL_RGBA16: 732 if(tfmt) 733 (*tfmt)=GR_TEXFMT_ARGB_4444; 734 if(ifmt) 735 (*ifmt)=GL_RGBA; 736 break; 737 case GL_COLOR_INDEX: 738 case GL_COLOR_INDEX1_EXT: 739 case GL_COLOR_INDEX2_EXT: 740 case GL_COLOR_INDEX4_EXT: 741 case GL_COLOR_INDEX8_EXT: 742 case GL_COLOR_INDEX12_EXT: 743 case GL_COLOR_INDEX16_EXT: 744 if(tfmt) 745 (*tfmt)=GR_TEXFMT_P_8; 746 if(ifmt) 747 (*ifmt)=GL_RGBA; 748 break; 749 default: 750 fprintf(stderr,"fx Driver: unsupported internalFormat in fxTexGetFormat()\n"); 751 fxCloseHardware(); 752 exit(-1); 753 break; 679 case 1: 680 case GL_LUMINANCE: 681 case GL_LUMINANCE4: 682 case GL_LUMINANCE8: 683 case GL_LUMINANCE12: 684 case GL_LUMINANCE16: 685 if(tfmt) 686 (*tfmt)=GR_TEXFMT_INTENSITY_8; 687 if(ifmt) 688 (*ifmt)=GL_LUMINANCE; 689 break; 690 case 2: 691 case GL_LUMINANCE_ALPHA: 692 case GL_LUMINANCE4_ALPHA4: 693 case GL_LUMINANCE6_ALPHA2: 694 case GL_LUMINANCE8_ALPHA8: 695 case GL_LUMINANCE12_ALPHA4: 696 case GL_LUMINANCE12_ALPHA12: 697 case GL_LUMINANCE16_ALPHA16: 698 if(tfmt) 699 (*tfmt)=GR_TEXFMT_ALPHA_INTENSITY_88; 700 if(ifmt) 701 (*ifmt)=GL_LUMINANCE_ALPHA; 702 break; 703 case GL_INTENSITY: 704 case GL_INTENSITY4: 705 case GL_INTENSITY8: 706 case GL_INTENSITY12: 707 case GL_INTENSITY16: 708 if(tfmt) 709 (*tfmt)=GR_TEXFMT_ALPHA_8; 710 if(ifmt) 711 (*ifmt)=GL_INTENSITY; 712 break; 713 case GL_ALPHA: 714 case GL_ALPHA4: 715 case GL_ALPHA8: 716 case GL_ALPHA12: 717 case GL_ALPHA16: 718 if(tfmt) 719 (*tfmt)=GR_TEXFMT_ALPHA_8; 720 if(ifmt) 721 (*ifmt)=GL_ALPHA; 722 break; 723 case 3: 724 case GL_RGB: 725 case GL_R3_G3_B2: 726 case GL_RGB4: 727 case GL_RGB5: 728 case GL_RGB8: 729 case GL_RGB10: 730 case GL_RGB12: 731 case GL_RGB16: 732 if(tfmt) 733 (*tfmt)=GR_TEXFMT_RGB_565; 734 if(ifmt) 735 (*ifmt)=GL_RGB; 736 break; 737 case 4: 738 case GL_RGBA: 739 case GL_RGBA2: 740 case GL_RGBA4: 741 case GL_RGBA8: 742 case GL_RGB10_A2: 743 case GL_RGBA12: 744 case GL_RGBA16: 745 if(tfmt) 746 (*tfmt)=GR_TEXFMT_ARGB_4444; 747 if(ifmt) 748 (*ifmt)=GL_RGBA; 749 break; 750 case GL_RGB5_A1: 751 if(tfmt) 752 (*tfmt)=GR_TEXFMT_ARGB_1555; 753 if(ifmt) 754 (*ifmt)=GL_RGBA; 755 break; 756 case GL_COLOR_INDEX: 757 case GL_COLOR_INDEX1_EXT: 758 case GL_COLOR_INDEX2_EXT: 759 case GL_COLOR_INDEX4_EXT: 760 case GL_COLOR_INDEX8_EXT: 761 case GL_COLOR_INDEX12_EXT: 762 case GL_COLOR_INDEX16_EXT: 763 if(tfmt) 764 (*tfmt)=GR_TEXFMT_P_8; 765 if(ifmt) 766 (*ifmt)=GL_RGBA; 767 break; 768 default: 769 fprintf(stderr,"fx Driver: unsupported internalFormat in fxTexGetFormat()\n"); 770 fxCloseHardware(); 771 EXIT(-1); 772 break; 754 773 } 755 774 } … … 762 781 763 782 switch(internalFormat) { 764 case GL_INTENSITY:765 case GL_INTENSITY4:766 case GL_INTENSITY8:767 case GL_INTENSITY12:768 case GL_INTENSITY16:769 case 1:770 case GL_LUMINANCE:771 case GL_LUMINANCE4:772 case GL_LUMINANCE8:773 case GL_LUMINANCE12:774 case GL_LUMINANCE16:775 case 2:776 case GL_LUMINANCE_ALPHA:777 case GL_LUMINANCE4_ALPHA4:778 case GL_LUMINANCE6_ALPHA2:779 case GL_LUMINANCE8_ALPHA8:780 case GL_LUMINANCE12_ALPHA4:781 case GL_LUMINANCE12_ALPHA12:782 case GL_LUMINANCE16_ALPHA16:783 case GL_ALPHA:784 case GL_ALPHA4:785 case GL_ALPHA8:786 case GL_ALPHA12:787 case GL_ALPHA16:788 case 3:789 case GL_RGB:790 case GL_R3_G3_B2:791 case GL_RGB4:792 case GL_RGB5:793 case GL_RGB8:794 case GL_RGB10:795 case GL_RGB12:796 case GL_RGB16:797 case 4:798 case GL_RGBA:799 case GL_RGBA2:800 case GL_RGBA4:801 case GL_RGB5_A1:802 case GL_RGBA8:803 case GL_RGB10_A2:804 case GL_RGBA12:805 case GL_RGBA16:806 case GL_COLOR_INDEX:807 case GL_COLOR_INDEX1_EXT:808 case GL_COLOR_INDEX2_EXT:809 case GL_COLOR_INDEX4_EXT:810 case GL_COLOR_INDEX8_EXT:811 case GL_COLOR_INDEX12_EXT:812 case GL_COLOR_INDEX16_EXT:813 break;814 default:815 return GL_FALSE;783 case GL_INTENSITY: 784 case GL_INTENSITY4: 785 case GL_INTENSITY8: 786 case GL_INTENSITY12: 787 case GL_INTENSITY16: 788 case 1: 789 case GL_LUMINANCE: 790 case GL_LUMINANCE4: 791 case GL_LUMINANCE8: 792 case GL_LUMINANCE12: 793 case GL_LUMINANCE16: 794 case 2: 795 case GL_LUMINANCE_ALPHA: 796 case GL_LUMINANCE4_ALPHA4: 797 case GL_LUMINANCE6_ALPHA2: 798 case GL_LUMINANCE8_ALPHA8: 799 case GL_LUMINANCE12_ALPHA4: 800 case GL_LUMINANCE12_ALPHA12: 801 case GL_LUMINANCE16_ALPHA16: 802 case GL_ALPHA: 803 case GL_ALPHA4: 804 case GL_ALPHA8: 805 case GL_ALPHA12: 806 case GL_ALPHA16: 807 case 3: 808 case GL_RGB: 809 case GL_R3_G3_B2: 810 case GL_RGB4: 811 case GL_RGB5: 812 case GL_RGB8: 813 case GL_RGB10: 814 case GL_RGB12: 815 case GL_RGB16: 816 case 4: 817 case GL_RGBA: 818 case GL_RGBA2: 819 case GL_RGBA4: 820 case GL_RGB5_A1: 821 case GL_RGBA8: 822 case GL_RGB10_A2: 823 case GL_RGBA12: 824 case GL_RGBA16: 825 case GL_COLOR_INDEX: 826 case GL_COLOR_INDEX1_EXT: 827 case GL_COLOR_INDEX2_EXT: 828 case GL_COLOR_INDEX4_EXT: 829 case GL_COLOR_INDEX8_EXT: 830 case GL_COLOR_INDEX12_EXT: 831 case GL_COLOR_INDEX16_EXT: 832 break; 833 default: 834 return GL_FALSE; 816 835 } 817 836 … … 823 842 824 843 if(!fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL, 825 NULL,NULL))844 NULL,NULL)) 826 845 return GL_FALSE; 827 846 … … 838 857 839 858 fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL, 840 &wscale,&hscale);859 &wscale,&hscale); 841 860 w=image->Width*wscale; 842 861 h=image->Height*hscale; … … 882 901 fprintf(stderr,"fx Driver: out of memory !\n"); 883 902 fxCloseHardware(); 884 exit(-1);903 EXIT(-1); 885 904 } 886 905 } else … … 910 929 fprintf(stderr,"fx Driver: out of memory !\n"); 911 930 fxCloseHardware(); 912 exit(-1);931 EXIT(-1); 913 932 } 914 933 } else … … 954 973 fprintf(stderr,"fx Driver: out of memory !\n"); 955 974 fxCloseHardware(); 956 exit(-1);975 EXIT(-1); 957 976 } 958 977 } else … … 962 981 int i=0; 963 982 int length=h*w; 964 unsigned short r,g,b;983 unsigned int r,g,b; 965 984 966 985 while(i++<length) { … … 971 990 *src++=((0xf8 & r) << (11-3)) | 972 991 ((0xfc & g) << (5-3+1)) | 973 ((0xf8 & b) >> 3); 992 ((0xf8 & b) >> 3); 974 993 } 975 994 } else { 976 unsigned short r,g,b;995 unsigned int r,g,b; 977 996 978 997 for(y=0;y<h;y++) … … 985 1004 src[x+y*w]=((0xf8 & r) << (11-3)) | 986 1005 ((0xfc & g) << (5-3+1)) | 987 ((0xf8 & b) >> 3); 1006 ((0xf8 & b) >> 3); 988 1007 } 989 1008 } … … 993 1012 case GL_RGBA2: 994 1013 case GL_RGBA4: 995 case GL_RGB5_A1:996 1014 case GL_RGBA8: 997 1015 case GL_RGB10_A2: … … 1004 1022 fprintf(stderr,"fx Driver: out of memory !\n"); 1005 1023 fxCloseHardware(); 1006 exit(-1);1024 EXIT(-1); 1007 1025 } 1008 1026 } else … … 1012 1030 int i=0; 1013 1031 int length=h*w; 1014 unsigned short r,g,b,a;1032 unsigned int r,g,b,a; 1015 1033 1016 1034 while(i++<length) { … … 1026 1044 } 1027 1045 } else { 1028 unsigned short r,g,b,a;1046 unsigned int r,g,b,a; 1029 1047 1030 1048 for(y=0;y<h;y++) … … 1043 1061 } 1044 1062 break; 1063 case GL_RGB5_A1: 1064 (*istranslate)=GL_TRUE; 1065 1066 if(!(*dest)) { 1067 if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) { 1068 fprintf(stderr,"fx Driver: out of memory !\n"); 1069 fxCloseHardware(); 1070 exit(-1); 1071 } 1072 } else 1073 src=(*dest); 1074 1075 if(wscale==hscale==1) { 1076 int i=0; 1077 int lenght=h*w; 1078 unsigned r,g,b,a; 1079 1080 while(i++<lenght) { 1081 r=*data++; 1082 g=*data++; 1083 b=*data++; 1084 a=*data++; 1085 *src++=((0x80 & a) << 8) | 1086 ((0xf8 & r) << 7) | 1087 ((0xf8 & g) << 2) | 1088 ((0xf8 & b) >> 3); 1089 } 1090 } else { 1091 unsigned r,g,b,a; 1092 1093 for(y=0;y<h;y++) 1094 for(x=0;x<w;x++) { 1095 idx=(x/wscale+(y/hscale)*(w/wscale))*4; 1096 r=data[idx]; 1097 g=data[idx+1]; 1098 b=data[idx+2]; 1099 a=data[idx+3]; 1100 1101 src[x+y*w]=((0x80 & a) << 8) | 1102 ((0xf8 & r) << 7) | 1103 ((0xf8 & g) << 2) | 1104 ((0xf8 & b) >> 3); 1105 } 1106 } 1107 break; 1045 1108 default: 1046 1109 fprintf(stderr,"fx Driver: wrong internalFormat in texbuildimagemap()\n"); 1047 1110 fxCloseHardware(); 1048 exit(-1);1111 EXIT(-1); 1049 1112 break; 1050 1113 } … … 1060 1123 if (MESA_VERBOSE&VERBOSE_DRIVER) { 1061 1124 fprintf(stderr, 1062 "fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n",1063 tObj->Name, level, target, internalFormat, image->Width,1064 image->Height);1125 "fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n", 1126 tObj->Name, level, target, internalFormat, image->Width, 1127 image->Height); 1065 1128 } 1066 1129 … … 1078 1141 1079 1142 fxTexGetFormat((GLenum)internalFormat,&gldformat,NULL); 1080 1143 1081 1144 if(mml->used) { 1082 1145 if((mml->glideFormat==gldformat) && … … 1121 1184 { 1122 1185 fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL, 1123 NULL,NULL);1186 NULL,NULL); 1124 1187 1125 1188 switch(internalFormat) { … … 1154 1217 bsrc=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)); 1155 1218 bdst=((unsigned char *)destimg)+(yoffset*image->Width+xoffset); 1156 1219 1157 1220 for(y=0;y<height;y++) { 1158 1221 MEMCPY(bdst,bsrc,width); … … 1178 1241 src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*2); 1179 1242 dst=destimg+(yoffset*image->Width+xoffset); 1180 1243 1181 1244 simgw=(image->Width-width)*2; 1182 1245 dimgw=image->Width-width; … … 1210 1273 src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*3); 1211 1274 dst=destimg+(yoffset*image->Width+xoffset); 1212 1275 1213 1276 simgw=(image->Width-width)*3; 1214 1277 dimgw=image->Width-width; … … 1220 1283 *dst++=((0xf8 & r) << (11-3)) | 1221 1284 ((0xfc & g) << (5-3+1)) | 1222 ((0xf8 & b) >> 3); 1285 ((0xf8 & b) >> 3); 1223 1286 } 1224 1287 … … 1232 1295 case GL_RGBA2: 1233 1296 case GL_RGBA4: 1234 case GL_RGB5_A1:1235 1297 case GL_RGBA8: 1236 1298 case GL_RGB10_A2: … … 1245 1307 src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*4); 1246 1308 dst=destimg+(yoffset*image->Width+xoffset); 1247 1309 1248 1310 simgw=(image->Width-width)*4; 1249 1311 dimgw=image->Width-width; … … 1265 1327 } 1266 1328 break; 1329 case GL_RGB5_A1: 1330 { 1331 int x,y; 1332 unsigned char *src; 1333 unsigned short *dst,r,g,b,a; 1334 int simgw,dimgw; 1335 1336 src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*4); 1337 dst=destimg+(yoffset*image->Width+xoffset); 1338 1339 simgw=(image->Width-width)*4; 1340 dimgw=image->Width-width; 1341 for(y=0;y<height;y++) { 1342 for(x=0;x<width;x++) { 1343 r=*src++; 1344 g=*src++; 1345 b=*src++; 1346 a=*src++; 1347 *dst++= 1348 ((0x80 & a) << 8) | 1349 ((0xf8 & r) << 7) | 1350 ((0xf8 & g) << 2) | 1351 ((0xf8 & b) >> 3); 1352 } 1353 1354 src += simgw; 1355 dst += dimgw; 1356 } 1357 } 1358 break; 1267 1359 default: 1268 1360 fprintf(stderr,"fx Driver: wrong internalFormat in fxTexBuildSubImageMap()\n"); 1269 1361 fxCloseHardware(); 1270 exit(-1);1271 break; 1272 } 1273 } 1274 1362 EXIT(-1); 1363 break; 1364 } 1365 } 1366 1275 1367 1276 1368 void fxDDTexSubImg(GLcontext *ctx, GLenum target, … … 1287 1379 if (MESA_VERBOSE&VERBOSE_DRIVER) { 1288 1380 fprintf(stderr, 1289 "fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n",1290 tObj->Name, level, target, internalFormat, image->Width,1291 image->Height);1381 "fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n", 1382 tObj->Name, level, target, internalFormat, image->Width, 1383 image->Height); 1292 1384 } 1293 1385 … … 1305 1397 if(mml->glideFormat!=gldformat) { 1306 1398 if (MESA_VERBOSE&VERBOSE_DRIVER) { 1307 fprintf(stderr,"fxmesa: ti->info.format!=format in fxDDTexSubImg()\n");1399 fprintf(stderr,"fxmesa: ti->info.format!=format in fxDDTexSubImg()\n"); 1308 1400 } 1309 1401 fxDDTexImg(ctx,target,tObj,level,internalFormat,image); … … 1316 1408 if((wscale!=1) || (hscale!=1)) { 1317 1409 if (MESA_VERBOSE&VERBOSE_DRIVER) { 1318 fprintf(stderr,"fxmesa: (wscale!=1) || (hscale!=1) in fxDDTexSubImg()\n");1410 fprintf(stderr,"fxmesa: (wscale!=1) || (hscale!=1) in fxDDTexSubImg()\n"); 1319 1411 } 1320 1412 fxDDTexImg(ctx,target,tObj,level,internalFormat,image); … … 1334 1426 1335 1427 1428 1429 /**********************************************************************/ 1430 /**** NEW TEXTURE IMAGE FUNCTIONS ****/ 1431 /**********************************************************************/ 1432 1433 GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, 1434 GLenum format, GLenum type, const GLvoid *pixels, 1435 const struct gl_pixelstore_attrib *packing, 1436 struct gl_texture_object *texObj, 1437 struct gl_texture_image *texImage, 1438 GLboolean *retainInternalCopy) 1439 { 1440 *retainInternalCopy = GL_TRUE; 1441 return GL_FALSE; 1442 } 1443 1444 1445 GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, 1446 GLint xoffset, GLint yoffset, 1447 GLsizei width, GLsizei height, 1448 GLenum format, GLenum type, const GLvoid *pixels, 1449 const struct gl_pixelstore_attrib *packing, 1450 struct gl_texture_object *texObj, 1451 struct gl_texture_image *texImage) 1452 { 1453 1454 return GL_FALSE; 1455 } 1456 1457 1336 1458 #else 1337 1459 -
trunk/src/opengl/mesa/3dfx/fxdrv.h
r2965 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. … … 75 75 #include "clip.h" 76 76 #include "vbrender.h" 77 #include "mem.h" 77 78 78 79 #ifdef XF86DRI … … 87 88 88 89 90 extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * ); 89 91 #if defined(MESA_DEBUG) && 0 90 extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );91 92 #define grDrawTriangle fx_sanity_triangle 92 93 #endif … … 113 114 #if FX_USE_PARGB 114 115 115 #define CLIP_XCOORD 0 /* normal place */116 #define CLIP_YCOROD 1 /* normal place */117 #define CLIP_ZCOORD 2 /* normal place */118 #define CLIP_WCOORD 3 /* normal place */119 #define CLIP_GCOORD 4 /* GR_VERTEX_PARGB_OFFSET */120 #define CLIP_BCOORD 5 /* GR_VERTEX_SOW_TMU0_OFFSET */121 #define CLIP_RCOORD 6 /* GR_VERTEX_TOW_TMU0_OFFSET */122 #define CLIP_ACOORD 7 /* GR_VERTEX_OOW_TMU0_OFFSET */116 #define CLIP_XCOORD 0 /* normal place */ 117 #define CLIP_YCOROD 1 /* normal place */ 118 #define CLIP_ZCOORD 2 /* normal place */ 119 #define CLIP_WCOORD 3 /* normal place */ 120 #define CLIP_GCOORD 4 /* GR_VERTEX_PARGB_OFFSET */ 121 #define CLIP_BCOORD 5 /* GR_VERTEX_SOW_TMU0_OFFSET */ 122 #define CLIP_RCOORD 6 /* GR_VERTEX_TOW_TMU0_OFFSET */ 123 #define CLIP_ACOORD 7 /* GR_VERTEX_OOW_TMU0_OFFSET */ 123 124 124 125 #else 125 126 126 #define CLIP_XCOORD 0 /* normal place */127 #define CLIP_YCOROD 1 /* normal place */128 #define CLIP_ZCOORD 2 /* GR_VERTEX_Z_OFFSET */129 #define CLIP_WCOORD 3 /* GR_VERTEX_R_OFFSET */130 #define CLIP_GCOORD 4 /* normal place */131 #define CLIP_BCOORD 5 /* normal place */132 #define CLIP_RCOORD 6 /* GR_VERTEX_OOZ_OFFSET */133 #define CLIP_ACOORD 7 /* normal place */127 #define CLIP_XCOORD 0 /* normal place */ 128 #define CLIP_YCOROD 1 /* normal place */ 129 #define CLIP_ZCOORD 2 /* GR_VERTEX_Z_OFFSET */ 130 #define CLIP_WCOORD 3 /* GR_VERTEX_R_OFFSET */ 131 #define CLIP_GCOORD 4 /* normal place */ 132 #define CLIP_BCOORD 5 /* normal place */ 133 #define CLIP_RCOORD 6 /* GR_VERTEX_OOZ_OFFSET */ 134 #define CLIP_ACOORD 7 /* normal place */ 134 135 135 136 … … 139 140 */ 140 141 typedef struct { 141 GLfloat f[15]; /* Same layout as GrVertex */142 GLubyte mask; /* Unsued */143 GLubyte usermask; /* Unused */142 GLfloat f[15]; /* Same layout as GrVertex */ 143 GLubyte mask; /* Unsued */ 144 GLubyte usermask; /* Unused */ 144 145 } fxVertex; 145 146 … … 166 167 #endif 167 168 168 #define FX_VB_COLOR(fxm, color) \169 do { \170 if (sizeof(GLint) == 4*sizeof(GLubyte)) { \171 if (fxm->constColor != *(GLuint*)color) { \172 fxm->constColor = *(GLuint*)color;\173 FX_grConstantColorValue(FXCOLOR4(color));\174 } \175 } else { \176 FX_grConstantColorValue(FXCOLOR4(color)); \177 } \169 #define FX_VB_COLOR(fxm, color) \ 170 do { \ 171 if (sizeof(GLint) == 4*sizeof(GLubyte)) { \ 172 if (fxm->constColor != *(GLuint*)color) { \ 173 fxm->constColor = *(GLuint*)color; \ 174 FX_grConstantColorValue(FXCOLOR4(color)); \ 175 } \ 176 } else { \ 177 FX_grConstantColorValue(FXCOLOR4(color)); \ 178 } \ 178 179 } while (0) 179 180 180 #define GOURAUD(x) { \181 GLubyte *col = VB->ColorPtr->data[(x)]; \182 gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \183 gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \184 gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \185 gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \181 #define GOURAUD(x) { \ 182 GLubyte *col = VB->ColorPtr->data[(x)]; \ 183 gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ 184 gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ 185 gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ 186 gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ 186 187 } 187 188 188 189 #if FX_USE_PARGB 189 #define GOURAUD2(v, c) { \190 GLubyte *col = c; \191 v->argb=MESACOLOR2PARGB(col); \190 #define GOURAUD2(v, c) { \ 191 GLubyte *col = c; \ 192 v->argb=MESACOLOR2PARGB(col); \ 192 193 } 193 194 #else 194 #define GOURAUD2(v, c) { \195 GLubyte *col = c; \196 v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \197 v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \198 v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \199 v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \195 #define GOURAUD2(v, c) { \ 196 GLubyte *col = c; \ 197 v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ 198 v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ 199 v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ 200 v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ 200 201 } 201 202 #endif … … 230 231 #define FX_UM_E0_DECAL 0x00000004 231 232 #define FX_UM_E0_BLEND 0x00000008 232 #define FX_UM_E0_ADD 0x00000010233 #define FX_UM_E0_ADD 0x00000010 233 234 234 235 #define FX_UM_E1_REPLACE 0x00000020 … … 236 237 #define FX_UM_E1_DECAL 0x00000080 237 238 #define FX_UM_E1_BLEND 0x00000100 238 #define FX_UM_E1_ADD 0x00000200239 #define FX_UM_E1_ADD 0x00000200 239 240 240 241 #define FX_UM_E_ENVMODE 0x000003ff … … 256 257 #define FX_UM_E_IFMT 0x00fff000 257 258 258 #define FX_UM_COLOR_ITERATED 0x0 0100000259 #define FX_UM_COLOR_CONSTANT 0x0 0200000260 #define FX_UM_ALPHA_ITERATED 0x0 0400000261 #define FX_UM_ALPHA_CONSTANT 0x0 0800000259 #define FX_UM_COLOR_ITERATED 0x01000000 260 #define FX_UM_COLOR_CONSTANT 0x02000000 261 #define FX_UM_ALPHA_ITERATED 0x04000000 262 #define FX_UM_ALPHA_CONSTANT 0x08000000 262 263 263 264 typedef void (*tfxRenderVBFunc)(GLcontext *); … … 272 273 273 274 typedef struct { 274 GLsizei width, height; 275 G Lint glideFormat;276 277 unsigned short *data;278 GLboolean translated, used;275 GLsizei width, height; /* image size */ 276 GrTextureFormat_t glideFormat; /* Glide image format */ 277 unsigned short *data; /* Glide-formated texture image */ 278 GLboolean translated; /* True if data points to a reformated image */ 279 GLboolean used; /* True if we've given the image to Glide */ 279 280 } tfxMipMapLevel; 280 281 … … 306 307 307 308 GLfloat sScale, tScale; 308 GLint int_sScale, int_tScale; /* x86 floating point trick for309 * multiplication by powers of 2.310 * Used in fxfasttmp.h311 */309 GLint int_sScale, int_tScale; /* x86 floating point trick for 310 * multiplication by powers of 2. 311 * Used in fxfasttmp.h 312 */ 312 313 313 314 GuTexPalette palette; … … 326 327 327 328 typedef void (*tfxTriViewClipFunc)( struct vertex_buffer *VB, 328 GLuint v[],329 GLubyte mask );329 GLuint v[], 330 GLubyte mask ); 330 331 331 332 typedef void (*tfxTriClipFunc)( struct vertex_buffer *VB, 332 GLuint v[],333 GLuint mask );333 GLuint v[], 334 GLuint mask ); 334 335 335 336 336 337 typedef void (*tfxLineClipFunc)( struct vertex_buffer *VB, 337 GLuint v1, GLuint v2,338 GLubyte mask );338 GLuint v1, GLuint v2, 339 GLubyte mask ); 339 340 340 341 … … 396 397 void *vert_store; 397 398 #if defined(FX_GLIDE3) 398 GrVertex **triangle_b; /* Triangle buffer */399 GrVertex **strips_b; /* Strips buffer */399 GrVertex **triangle_b; /* Triangle buffer */ 400 GrVertex **strips_b; /* Strips buffer */ 400 401 #endif 401 402 … … 438 439 GrBuffer_t currentFB; 439 440 441 GLboolean bgrOrder; 440 442 GrColor_t color; 441 443 GrColor_t clearC; 442 444 GrAlpha_t clearA; 443 445 GLuint constColor; 446 GrCullMode_t cullMode; 444 447 445 448 tfxUnitsState unitsState; … … 455 458 GLuint render_index; 456 459 GLuint last_tri_caps; 457 GLuint stw_hint_state; /* for grHints */460 GLuint stw_hint_state; /* for grHints */ 458 461 GLuint is_in_hardware; 459 462 GLuint new_state; … … 476 479 GLenum fogTableMode; 477 480 GLfloat fogDensity; 481 GLfloat fogStart, fogEnd; 478 482 GrFog_t *fogTable; 483 GLint textureAlign; 479 484 480 485 /* Acc. functions */ … … 499 504 500 505 GLboolean verbose; 501 GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */502 GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */506 GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */ 507 GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */ 503 508 GLboolean haveAlphaBuffer; 504 509 GLboolean haveZBuffer; … … 530 535 extern int glbCurrentBoard; 531 536 537 extern void fxPrintSetupFlags( const char *msg, GLuint flags ); 532 538 extern void fxSetupFXUnits(GLcontext *); 533 539 extern void fxSetupDDPointers(GLcontext *); … … 542 548 543 549 extern void fxRenderClippedLine( struct vertex_buffer *VB, 544 GLuint v1, GLuint v2 );550 GLuint v1, GLuint v2 ); 545 551 546 552 extern void fxRenderClippedTriangle( struct vertex_buffer *VB, 547 GLuint n, GLuint vlist[] );553 GLuint n, GLuint vlist[] ); 548 554 549 555 … … 562 568 extern void fxSetupDDSpanPointers(GLcontext *); 563 569 564 extern void fxDDBufferSize(GLcontext *, GLuint *, GLuint *);565 566 570 extern void fxPrintTextureData(tfxTexInfo *ti); 567 extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *);568 571 extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *, 569 GLint, GLint, const struct gl_texture_image *); 572 GLint, GLint, const struct gl_texture_image *); 573 extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *, 574 GLint, GLint, GLint, GLint, GLint, GLint, 575 const struct gl_texture_image *); 576 extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, 577 GLenum format, GLenum type, const GLvoid *pixels, 578 const struct gl_pixelstore_attrib *packing, 579 struct gl_texture_object *texObj, 580 struct gl_texture_image *texImage, 581 GLboolean *retainInternalCopy); 582 extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, 583 GLint xoffset, GLint yoffset, 584 GLsizei width, GLsizei height, 585 GLenum format, GLenum type, const GLvoid *pixels, 586 const struct gl_pixelstore_attrib *packing, 587 struct gl_texture_object *texObj, 588 struct gl_texture_image *texImage); 589 extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *); 570 590 extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *, 571 GLenum, const GLfloat *);591 GLenum, const GLfloat *); 572 592 extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *); 573 593 extern void fxDDTexDel(GLcontext *, struct gl_texture_object *); 574 594 extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *); 575 extern void fxDDTexuseGlbPalette(GLcontext *, GLboolean);576 extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *, GLint,577 GLint, GLint, GLint, GLint, GLint, const struct gl_texture_image *);578 595 extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean); 579 596 … … 589 606 590 607 extern void fxDDCheckMergeAndRender( GLcontext *ctx, 591 struct gl_pipeline_stage *d );608 struct gl_pipeline_stage *d ); 592 609 593 610 extern void fxDDMergeAndRender( struct vertex_buffer *VB ); 594 611 595 612 extern void fxDDCheckPartialRasterSetup( GLcontext *ctx, 596 struct gl_pipeline_stage *d );613 struct gl_pipeline_stage *d ); 597 614 598 615 extern void fxDDPartialRasterSetup( struct vertex_buffer *VB ); … … 601 618 602 619 extern GLuint fxDDRegisterPipelineStages( struct gl_pipeline_stage *out, 603 const struct gl_pipeline_stage *in,604 GLuint nr );620 const struct gl_pipeline_stage *in, 621 GLuint nr ); 605 622 606 623 extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ); 607 624 608 625 extern void fxDDOptimizePrecalcPipeline( GLcontext *ctx, 609 struct gl_pipeline *pipe );626 struct gl_pipeline *pipe ); 610 627 611 628 extern void fxDDRenderElementsDirect( struct vertex_buffer *VB ); … … 617 634 extern void fxTMInit(fxMesaContext ctx); 618 635 extern void fxTMClose(fxMesaContext ctx); 636 extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx); 619 637 extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint); 620 638 extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *); 639 #define fxTMMoveOutTM_NoLock fxTMMoveOutTM 621 640 extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *); 622 641 extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *, GLint); 623 642 extern void fxTMReloadSubMipMapLevel(fxMesaContext, struct gl_texture_object *, 624 GLint, GLint, GLint);643 GLint, GLint, GLint); 625 644 626 645 extern void fxTexGetFormat(GLenum, GrTextureFormat_t *, GLint *); 627 646 extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *, 628 float *, float *, int *, int *, int *, int *);647 float *, float *, int *, int *, int *, int *); 629 648 630 649 extern void fxDDScissor( GLcontext *ctx, 631 GLint x, GLint y, GLsizei w, GLsizei h );650 GLint x, GLint y, GLsizei w, GLsizei h ); 632 651 extern void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ); 633 652 extern GLboolean fxDDColorMask(GLcontext *ctx, 634 GLboolean r, GLboolean g, 635 GLboolean b, GLboolean a ); 636 637 extern GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx, 638 GLuint n, GLint x, GLint y, 639 const GLdepth z[], 640 GLubyte mask[]); 641 642 extern void fxDDDepthTestPixelsGeneric(GLcontext* ctx, 643 GLuint n, 644 const GLint x[], const GLint y[], 645 const GLdepth z[], GLubyte mask[]); 646 647 extern void fxDDReadDepthSpanFloat(GLcontext *ctx, 648 GLuint n, GLint x, GLint y, GLfloat depth[]); 649 650 extern void fxDDReadDepthSpanInt(GLcontext *ctx, 651 GLuint n, GLint x, GLint y, GLdepth depth[]); 652 653 GLboolean r, GLboolean g, 654 GLboolean b, GLboolean a ); 655 656 extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, 657 const GLdepth depth[], const GLubyte mask[]); 658 659 extern void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, 660 GLdepth depth[]); 661 662 extern void fxDDWriteDepthPixels(GLcontext *ctx, GLuint n, 663 const GLint x[], const GLint y[], 664 const GLdepth depth[], const GLubyte mask[]); 665 666 extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, 667 const GLint x[], const GLint y[], 668 GLdepth depth[]); 653 669 654 670 extern void fxDDFastPath( struct vertex_buffer *VB ); … … 669 685 extern void fxSetScissorValues(GLcontext *ctx); 670 686 extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, 671 struct gl_texture_object *tObj, 672 GLint where); 673 extern void fxSetupTexture_NoLock(GLcontext *ctx); 674 extern void fxSetupTexture(GLcontext *ctx); 675 676 extern void fxInitPixelTables(GLboolean bgrOrder); 677 678 #endif 687 struct gl_texture_object *tObj, 688 GLint where); 689 extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder); 690 691 #endif -
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 GLuint start,239 GLuint count,240 GLuint parity );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 GLfloat *last,244 const GLfloat *mat,245 GLuint stride,246 const GLubyte *mask );243 GLfloat *last, 244 const GLfloat *mat, 245 GLuint stride, 246 const GLubyte *mask ); 247 247 248 248 void (*project_vertices)( GLfloat *first, 249 GLfloat *last,250 const GLfloat *mat,251 GLuint stride );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 SETUP_TMU1] );339 SETUP_TMU1] ); 340 340 } 341 341 … … 357 357 GLfloat *mat = ctx->Viewport.WindowMap.m; 358 358 359 gl_prepare_arrays_cva( VB ); /* still need this */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 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;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; -
trunk/src/opengl/mesa/3dfx/fxfasttmp.h
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. … … 89 89 */ 90 90 gl_xform_points3_v16_general(FX_DRIVER_DATA(VB)->verts[0].f, 91 m,92 VB->ObjPtr->start,93 VB->ObjPtr->stride,94 count);91 m, 92 VB->ObjPtr->start, 93 VB->ObjPtr->stride, 94 count); 95 95 96 96 if (do_clip) 97 97 { 98 VB->ClipAndMask = ~0; 98 VB->ClipAndMask = ~0; 99 99 VB->ClipOrMask = 0; 100 100 gl_cliptest_points4_v16(FX_DRIVER_DATA(VB)->verts[0].f, 101 FX_DRIVER_DATA(VB)->verts[count].f,102 &(VB->ClipOrMask),103 &(VB->ClipAndMask),104 VB->ClipMask);101 FX_DRIVER_DATA(VB)->verts[count].f, 102 &(VB->ClipOrMask), 103 &(VB->ClipAndMask), 104 VB->ClipMask); 105 105 } 106 106 … … 137 137 */ 138 138 static void TAG(fx_project_vertices)( GLfloat *first, 139 GLfloat *last,140 const GLfloat *mat,141 GLuint stride )139 GLfloat *last, 140 const GLfloat *mat, 141 GLuint stride ) 142 142 { 143 143 GLfloat *f; 144 144 VARS_XYZ; 145 145 146 for ( f = first ; f != last ; STRIDE_F(f, stride)) 146 for ( f = first ; f != last ; STRIDE_F(f, stride)) 147 147 { 148 GLfloat oow = 1.0f/f[ 3];/* urp! */148 GLfloat oow = 1.0f/f[CLIP_WCOORD]; /* urp! */ 149 149 150 150 #if FX_USE_PARGB … … 154 154 #else 155 155 if (TYPE & SETUP_RGBA) { 156 f[RCOORD]=f[CLIP_R];156 f[RCOORD]=f[CLIP_R]; 157 157 } 158 158 #endif 159 159 if (TYPE & SETUP_TMU1) { 160 f[S1COORD] = f[CLIP_S1] * oow;161 f[T1COORD] = f[CLIP_T1] * oow;160 f[S1COORD] = f[CLIP_S1] * oow; 161 f[T1COORD] = f[CLIP_T1] * oow; 162 162 } 163 163 164 164 if (TYPE & SETUP_TMU0) { 165 f[T0COORD] = f[CLIP_T0] * oow;166 f[S0COORD] = f[CLIP_S0] * oow;165 f[T0COORD] = f[CLIP_T0] * oow; 166 f[S0COORD] = f[CLIP_S0] * oow; 167 167 } 168 168 … … 174 174 175 175 static void TAG(fx_project_clipped_vertices)( GLfloat *first, 176 GLfloat *last,177 const GLfloat *mat,178 GLuint stride,179 const GLubyte *mask )176 GLfloat *last, 177 const GLfloat *mat, 178 GLuint stride, 179 const GLubyte *mask ) 180 180 { 181 181 GLfloat *f; … … 185 185 if (!*mask) { 186 186 187 GLfloat oow = 1.0f / f[3];187 GLfloat oow = 1.0f / f[CLIP_WCOORD]; 188 188 #if FX_USE_PARGB 189 189 if (TYPE & SETUP_RGBA) { … … 197 197 #else 198 198 if (TYPE & SETUP_RGBA) { 199 f[RCOORD]=f[CLIP_R];199 f[RCOORD]=f[CLIP_R]; 200 200 } 201 201 #endif 202 202 203 if (TYPE & SETUP_TMU1) {204 f[S1COORD] = f[CLIP_S1] * oow;205 f[T1COORD] = f[CLIP_T1] * oow;206 }207 208 if (TYPE & SETUP_TMU0) {209 f[T0COORD] = f[CLIP_T0] * oow;210 f[S0COORD] = f[CLIP_S0] * oow;211 }212 213 DO_SETUP_XYZ;214 215 f[OOWCOORD] = oow;203 if (TYPE & SETUP_TMU1) { 204 f[S1COORD] = f[CLIP_S1] * oow; 205 f[T1COORD] = f[CLIP_T1] * oow; 206 } 207 208 if (TYPE & SETUP_TMU0) { 209 f[T0COORD] = f[CLIP_T0] * oow; 210 f[S0COORD] = f[CLIP_S0] * oow; 211 } 212 213 DO_SETUP_XYZ; 214 215 f[OOWCOORD] = oow; 216 216 } 217 217 } … … 224 224 #endif 225 225 void TAG(fx_tri_clip)( GLuint **p_elts, 226 fxVertex *verts,227 GLubyte *clipmask,228 GLuint *p_next_vert,229 GLubyte mask )226 fxVertex *verts, 227 GLubyte *clipmask, 228 GLuint *p_next_vert, 229 GLubyte mask ) 230 230 { 231 231 GLuint *elts = *p_elts; … … 266 266 267 267 static INLINE void TAG(fx_line_clip)( GLuint **p_elts, 268 fxVertex *verts,269 GLubyte *clipmask,270 GLuint *p_next_vert,271 GLubyte mask )268 fxVertex *verts, 269 GLubyte *clipmask, 270 GLuint *p_next_vert, 271 GLubyte mask ) 272 272 { 273 273 GLuint *elts = *p_elts; … … 290 290 /* Build a table of functions to clip each primitive type. 291 291 */ 292 #define LOCAL_VARS \293 GLuint *elt = VB->EltPtr->data; \294 fxVertex *verts = FX_DRIVER_DATA(VB)->verts; \295 GLuint next_vert = VB->Count; \296 GLuint *out = FX_DRIVER_DATA(VB)->clipped_elements.data; \292 #define LOCAL_VARS \ 293 GLuint *elt = VB->EltPtr->data; \ 294 fxVertex *verts = FX_DRIVER_DATA(VB)->verts; \ 295 GLuint next_vert = VB->Count; \ 296 GLuint *out = FX_DRIVER_DATA(VB)->clipped_elements.data; \ 297 297 GLubyte *mask = VB->ClipMask; \ 298 298 299 299 300 #define POSTFIX \301 FX_DRIVER_DATA(VB)->clipped_elements.count = \302 out - FX_DRIVER_DATA(VB)->clipped_elements.data; \300 #define POSTFIX \ 301 FX_DRIVER_DATA(VB)->clipped_elements.count = \ 302 out - FX_DRIVER_DATA(VB)->clipped_elements.data; \ 303 303 FX_DRIVER_DATA(VB)->last_vert = &verts[next_vert]; 304 304 305 305 #define INIT(x) 306 306 307 #define RENDER_POINTS(start, count) \308 do { \309 GLuint i; \310 for (i = start ; i < count ; i++ ) \311 CLIP_POINT( elt[i] ); \307 #define RENDER_POINTS(start, count) \ 308 do { \ 309 GLuint i; \ 310 for (i = start ; i < count ; i++ ) \ 311 CLIP_POINT( elt[i] ); \ 312 312 } while (0) 313 313 314 #define RENDER_LINE(i1, i0) \314 #define RENDER_LINE(i1, i0) \ 315 315 CLIP_LINE(elt[i1], elt[i0]) 316 316 317 #define RENDER_TRI(i2, i1, i0, pv, parroty) \318 do { \319 GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \320 if (parroty) e2 = elt[i1], e1 = elt[i2]; \321 CLIP_TRIANGLE( e2, e1, e0 ); \317 #define RENDER_TRI(i2, i1, i0, pv, parroty) \ 318 do { \ 319 GLuint e2 = elt[i2], e1 = elt[i1], e0 = elt[i0]; \ 320 if (parroty) e2 = elt[i1], e1 = elt[i2]; \ 321 CLIP_TRIANGLE( e2, e1, e0 ); \ 322 322 } while (0) 323 323 324 #define RENDER_QUAD(i3, i2, i1, i0, pv) \325 CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \324 #define RENDER_QUAD(i3, i2, i1, i0, pv) \ 325 CLIP_TRIANGLE(elt[i3], elt[i2], elt[i0]); \ 326 326 CLIP_TRIANGLE(elt[i2], elt[i1], elt[i0]) 327 327 … … 344 344 tab->project_clipped_vertices = TAG(fx_project_clipped_vertices); 345 345 346 #if defined(USE_3DNOW_ASM) 346 #if defined(USE_3DNOW_ASM) 347 347 if (gl_x86_cpu_features & GL_CPU_3Dnow) { 348 348 extern void TAG(fx_3dnow_project_vertices)( GLfloat *first, 349 GLfloat *last,350 const GLfloat *mat,351 GLuint stride );349 GLfloat *last, 350 const GLfloat *mat, 351 GLuint stride ); 352 352 353 353 extern void TAG(fx_3dnow_project_clipped_vertices)( GLfloat *first, 354 GLfloat *last,355 const GLfloat *mat,356 GLuint stride,357 const GLubyte *mask );354 GLfloat *last, 355 const GLfloat *mat, 356 GLuint stride, 357 const GLubyte *mask ); 358 358 359 359 tab->project_vertices = TAG(fx_3dnow_project_vertices); -
trunk/src/opengl/mesa/3dfx/fxglidew.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. … … 43 43 */ 44 44 45 45 46 46 #ifdef HAVE_CONFIG_H 47 47 #include "conf.h" … … 56 56 #include <string.h> 57 57 58 staticFxI32 FX_grGetInteger_NoLock(FxU32 pname)58 FxI32 FX_grGetInteger_NoLock(FxU32 pname) 59 59 { 60 60 #if !defined(FX_GLIDE3) 61 switch (pname) 61 switch (pname) 62 62 { 63 63 case FX_FOG_TABLE_ENTRIES: … … 68 68 return FXFALSE; 69 69 case FX_PENDING_BUFFERSWAPS: 70 return grBufferNumPending(); 70 return grBufferNumPending(); 71 case FX_TEXTURE_ALIGN: 72 /* This is a guess from reading the glide3 docs */ 73 return 8; 71 74 default: 72 75 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 78 81 FxU32 grname; 79 82 FxI32 result; 80 83 81 84 switch (pname) 82 85 { … … 85 88 case FX_LFB_PIXEL_PIPE: 86 89 case FX_PENDING_BUFFERSWAPS: 90 case FX_TEXTURE_ALIGN: 87 91 grname = pname; 88 92 break; … … 110 114 111 115 112 FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer, 113 GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, 114 FxBool pixelPipeline, GrLfbInfo_t *info ) {116 FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer, 117 GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, 118 FxBool pixelPipeline, GrLfbInfo_t *info ) { 115 119 FxBool result; 116 120 … … 177 181 grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result); 178 182 END_BOARD_LOCK(); 179 return result; 183 return result; 180 184 } 181 185 … … 188 192 189 193 return result; 190 194 191 195 } 192 196 … … 198 202 grGet(GR_VIEWPORT,sizeof(FxI32)*4,result); 199 203 END_BOARD_LOCK(); 200 204 201 205 return result[2]; 202 206 } … … 209 213 grGet(GR_VIEWPORT,sizeof(FxI32)*4,result); 210 214 END_BOARD_LOCK(); 211 215 212 216 return result[3]; 213 217 } … … 222 226 void FX_grSstPerfStats(GrSstPerfStats_t *st) 223 227 { 224 /* ToDo */225 st->pixelsIn = 0;226 st->chromaFail = 0;227 st->zFuncFail = 0;228 st->aFuncFail = 0;229 st->pixelsOut = 0;228 int n; 229 grGet(GR_STATS_PIXELS_IN, 4, &n); st->pixelsIn = n; 230 grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); st->chromaFail = n; 231 grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); st->zFuncFail = n; 232 grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); st->aFuncFail = n; 233 grGet(GR_STATS_PIXELS_OUT, 4, &n); st->pixelsOut = n; 230 234 } 231 235 … … 245 249 } 246 250 251 void FX_grDrawPolygonVertexList(int n, GrVertex *verts) 252 { 253 BEGIN_CLIP_LOOP(); 254 grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); 255 END_CLIP_LOOP(); 256 } 257 247 258 #if FX_USE_PARGB 248 259 void FX_setupGrVertexLayout(void) … … 250 261 BEGIN_BOARD_LOCK(); 251 262 grReset(GR_VERTEX_PARAMETER); 252 263 253 264 grCoordinateSpace(GR_WINDOW_COORDS); 254 265 grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); … … 256 267 grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); 257 268 grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); 258 grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); 259 grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); 260 grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 261 grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 269 grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); 270 grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); 271 grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 272 grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 262 273 END_BOARD_LOCK(); 263 274 } … … 267 278 BEGIN_BOARD_LOCK(); 268 279 grReset(GR_VERTEX_PARAMETER); 269 280 270 281 grCoordinateSpace(GR_WINDOW_COORDS); 271 282 grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); … … 273 284 grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); 274 285 grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); 275 grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);276 grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); 286 grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); 287 grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); 277 288 grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); 278 grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 289 grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 279 290 grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 280 291 END_BOARD_LOCK(); … … 288 299 { 289 300 if (hintMask & GR_STWHINT_W_DIFF_TMU0) 290 grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,GR_PARAM_ENABLE);301 grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); 291 302 else 292 grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2,GR_PARAM_DISABLE);293 303 grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); 304 294 305 if (hintMask & GR_STWHINT_ST_DIFF_TMU1) 295 grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);306 grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE); 296 307 else 297 grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);298 308 grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 309 299 310 if (hintMask & GR_STWHINT_W_DIFF_TMU1) 300 grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2,GR_PARAM_ENABLE);311 grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE); 301 312 else 302 grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2,GR_PARAM_DISABLE);303 313 grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); 314 304 315 } 305 316 } … … 320 331 grGet(GR_NUM_BOARDS,4,(void*)&(config->num_sst)); 321 332 if (config->num_sst == 0) 322 return 0;333 return 0; 323 334 for (i = 0; i< config->num_sst; i++) 324 335 { … … 327 338 grGet(GR_MEMORY_FB,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.fbRam)); 328 339 config->SSTs[i].sstBoard.VoodooConfig.fbRam/= 1024*1024; 329 340 330 341 grGet(GR_NUM_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.nTexelfx)); 331 332 342 343 333 344 grGet(GR_NUM_FB,4,(void*)&numFB); 334 345 if (numFB > 1) … … 338 349 for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++) 339 350 { 340 grGet(GR_MEMORY_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam));341 config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024;351 grGet(GR_MEMORY_TMU,4,(void*)&(config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam)); 352 config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam /= 1024*1024; 342 353 } 343 354 } … … 366 377 } 367 378 368 int FX_grSstQueryHardware(GrHwConfiguration *c) 379 int FX_grSstQueryHardware(GrHwConfiguration *c) 369 380 { 370 381 int i; … … 373 384 END_BOARD_LOCK(); 374 385 return i; 375 } 386 } 376 387 377 388 FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, … … 392 403 nColBuffers, 393 404 nAuxBuffers ); 394 405 395 406 #if 0 396 fprintf(stderr, 407 fprintf(stderr, 397 408 "grSstWinOpen( win %d res %d ref %d fmt %d\n" 398 409 " org %d ncol %d naux %d )\n" … … 413 424 414 425 415 #endif 426 #endif 416 427 #else 417 428 -
trunk/src/opengl/mesa/3dfx/fxglidew.h
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. … … 49 49 #include <glide.h> 50 50 51 /* 52 * General context: 51 /* 52 * General context: 53 53 */ 54 54 #if !defined(FX_GLIDE3) 55 typedef FxU32 FX_GrContext_t;/* Not used in Glide2 */55 typedef FxU32 FX_GrContext_t; /* Not used in Glide2 */ 56 56 #else 57 57 typedef GrContext_t FX_GrContext_t; 58 58 #endif 59 59 60 /* 61 * Glide3 emulation on Glide2: 60 /* 61 * Glide3 emulation on Glide2: 62 62 */ 63 63 #if !defined(FX_GLIDE3) 64 /* Constanst for FX_grGetInteger( ) */ 65 #define FX_FOG_TABLE_ENTRIES 0x0004 /* The number of entries in the hardware fog table. */ 66 #define FX_GLIDE_STATE_SIZE 0x0006 /* Size of buffer, in bytes, needed to save Glide state. */ 67 #define FX_LFB_PIXEL_PIPE 0x0009 /* 1 if LFB writes can go through the 3D pixel pipe. */ 68 #define FX_PENDING_BUFFERSWAPS 0x0014 /* The number of buffer swaps pending. */ 69 #else 70 #define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES 71 #define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE 72 #define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE 73 #define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS 64 /* Constanst for FX_grGetInteger( ) */ 65 #define FX_FOG_TABLE_ENTRIES 0x0004 /* The number of entries in the hardware fog table. */ 66 #define FX_GLIDE_STATE_SIZE 0x0006 /* Size of buffer, in bytes, needed to save Glide state. */ 67 #define FX_LFB_PIXEL_PIPE 0x0009 /* 1 if LFB writes can go through the 3D pixel pipe. */ 68 #define FX_PENDING_BUFFERSWAPS 0x0014 /* The number of buffer swaps pending. */ 69 #define FX_TEXTURE_ALIGN 0x0024 /* The required alignment for textures */ 70 #else 71 #define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES 72 #define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE 73 #define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE 74 #define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS 75 #define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN 74 76 #endif 75 77 76 78 /* 77 79 * Genral warper functions for Glide2/Glide3: 78 */ 80 */ 79 81 extern FxI32 FX_grGetInteger(FxU32 pname); 82 extern FxI32 FX_grGetInteger_NoLock(FxU32 pname); 80 83 81 84 /* … … 92 95 #define GR_ASPECT_1x8 GR_ASPECT_LOG2_1x8 93 96 94 #define GR_LOD_256 GR_LOD_LOG2_25695 #define GR_LOD_128 GR_LOD_LOG2_12896 #define GR_LOD_64 GR_LOD_LOG2_6497 #define GR_LOD_32 GR_LOD_LOG2_3298 #define GR_LOD_16 GR_LOD_LOG2_1699 #define GR_LOD_8 GR_LOD_LOG2_8100 #define GR_LOD_4 GR_LOD_LOG2_4101 #define GR_LOD_2 GR_LOD_LOG2_2102 #define GR_LOD_1 GR_LOD_LOG2_197 #define GR_LOD_256 GR_LOD_LOG2_256 98 #define GR_LOD_128 GR_LOD_LOG2_128 99 #define GR_LOD_64 GR_LOD_LOG2_64 100 #define GR_LOD_32 GR_LOD_LOG2_32 101 #define GR_LOD_16 GR_LOD_LOG2_16 102 #define GR_LOD_8 GR_LOD_LOG2_8 103 #define GR_LOD_4 GR_LOD_LOG2_4 104 #define GR_LOD_2 GR_LOD_LOG2_2 105 #define GR_LOD_1 GR_LOD_LOG2_1 103 106 104 107 #define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q … … 164 167 #define GR_STWHINT_ST_DIFF_TMU2 FXBIT(6) 165 168 166 #define GR_CONTROL_ACTIVATE 1167 #define GR_CONTROL_DEACTIVATE 0168 169 #define GrState void169 #define GR_CONTROL_ACTIVATE 1 170 #define GR_CONTROL_DEACTIVATE 0 171 172 #define GrState void 170 173 171 174 /* … … 174 177 typedef struct { 175 178 float sow; /* s texture ordinate (s over w) */ 176 float tow; /* t texture ordinate (t over w) */ 179 float tow; /* t texture ordinate (t over w) */ 177 180 float oow; /* 1/w (used mipmapping - really 0xfff/w) */ 178 181 } GrTmuVertex; … … 202 205 #define GR_VERTEX_TOW_TMU1_OFFSET 9 203 206 #define GR_VERTEX_OOW_TMU1_OFFSET 10 204 #define GR_VERTEX_Z_OFFSET 11205 206 #define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET]207 #define GR_VERTEX_Z_OFFSET 11 208 209 #define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET] 207 210 /* GET_PA: returns the alpha component */ 208 211 #if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG 209 #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4]210 #else 211 #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3]212 #endif 213 #define MESACOLOR2PARGB(c) (c[ACOMP] << 24 | c[GCOMP] << 16 | c[GCOMP] << 8 | c[BCOMP])214 #define PACK_4F_ARGB(dest,a,r,g,b) { \215 const GLuint cr = (int)r;\216 const GLuint cg = (int)g;\217 const GLuint ca = (int)a;\218 const GLuint cb = (int)b;\219 dest = ca << 24 | cr << 16 | cg << 8 | cb;\220 }212 #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4] 213 #else 214 #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3] 215 #endif 216 #define MESACOLOR2PARGB(c) (c[ACOMP] << 24 | c[GCOMP] << 16 | c[GCOMP] << 8 | c[BCOMP]) 217 #define PACK_4F_ARGB(dest,a,r,g,b) { \ 218 const GLuint cr = (int)r; \ 219 const GLuint cg = (int)g; \ 220 const GLuint ca = (int)a; \ 221 const GLuint cb = (int)b; \ 222 dest = ca << 24 | cr << 16 | cg << 8 | cb; \ 223 } 221 224 222 225 #else /* FX_USE_PARGB */ … … 256 259 */ 257 260 #if defined(FX_GLIDE3) 258 #define FX_grTexDownloadTable(TMU,type,data) \259 do { \260 BEGIN_BOARD_LOCK(); \261 grTexDownloadTable(type,data); \262 END_BOARD_LOCK(); \261 #define FX_grTexDownloadTable(TMU,type,data) \ 262 do { \ 263 BEGIN_BOARD_LOCK(); \ 264 grTexDownloadTable(type,data); \ 265 END_BOARD_LOCK(); \ 263 266 } while (0); 264 267 #define FX_grTexDownloadTable_NoLock(TMU,type,data) \ 265 268 grTexDownloadTable(type, data) 266 269 #else 267 #define FX_grTexDownloadTable(TMU,type,data) \268 do { \269 BEGIN_BOARD_LOCK(); \270 grTexDownloadTable(TMU,type,data); \271 END_BOARD_LOCK(); \270 #define FX_grTexDownloadTable(TMU,type,data) \ 271 do { \ 272 BEGIN_BOARD_LOCK(); \ 273 grTexDownloadTable(TMU,type,data); \ 274 END_BOARD_LOCK(); \ 272 275 } while (0); 273 276 #define FX_grTexDownloadTable_NoLock grTexDownloadTable … … 278 281 */ 279 282 #if defined(FX_GLIDE3) 280 #define FX_grFlush() \281 do { \283 #define FX_grFlush() \ 284 do { \ 282 285 BEGIN_BOARD_LOCK(); \ 283 grFlush(); \284 END_BOARD_LOCK(); \285 } while (0) 286 #else 287 #define FX_grFlush() \288 do { \286 grFlush(); \ 287 END_BOARD_LOCK(); \ 288 } while (0) 289 #else 290 #define FX_grFlush() \ 291 do { \ 289 292 BEGIN_BOARD_LOCK(); \ 290 grSstIdle(); \291 END_BOARD_LOCK(); \292 } while (0) 293 #endif 294 295 #define FX_grFinish() \296 do { \293 grSstIdle(); \ 294 END_BOARD_LOCK(); \ 295 } while (0) 296 #endif 297 298 #define FX_grFinish() \ 299 do { \ 297 300 BEGIN_BOARD_LOCK(); \ 298 grFinish(); \299 END_BOARD_LOCK(); \301 grFinish(); \ 302 END_BOARD_LOCK(); \ 300 303 } while (0) 301 304 … … 304 307 */ 305 308 #if defined(FX_GLIDE3) 306 #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \307 do { \308 BEGIN_BOARD_LOCK(); \309 grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \310 END_BOARD_LOCK(); \309 #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ 310 do { \ 311 BEGIN_BOARD_LOCK(); \ 312 grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \ 313 END_BOARD_LOCK(); \ 311 314 } while(0) 312 315 #else 313 #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \314 do { \315 BEGIN_BOARD_LOCK(); \316 grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \317 END_BOARD_LOCK(); \316 #define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ 317 do { \ 318 BEGIN_BOARD_LOCK(); \ 319 grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \ 320 END_BOARD_LOCK(); \ 318 321 } while (0) 319 322 #endif … … 322 325 * Read region 323 326 */ 324 #define FX_grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \325 do { \326 BEGIN_BOARD_LOCK(); \327 grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \328 END_BOARD_LOCK(); \327 #define FX_grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \ 328 do { \ 329 BEGIN_BOARD_LOCK(); \ 330 grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \ 331 END_BOARD_LOCK(); \ 329 332 } while (0); 330 333 … … 332 335 * Draw triangle 333 336 */ 334 #define FX_grDrawTriangle(a,b,c) \335 do { \336 BEGIN_CLIP_LOOP(); \337 grDrawTriangle(a,b,c); \338 END_CLIP_LOOP(); \337 #define FX_grDrawTriangle(a,b,c) \ 338 do { \ 339 BEGIN_CLIP_LOOP(); \ 340 grDrawTriangle(a,b,c); \ 341 END_CLIP_LOOP(); \ 339 342 } while (0) 340 343 … … 343 346 */ 344 347 #if defined(FX_GLIDE3) 345 #define FX_largeLodLog2(info)(info).largeLodLog2346 #else 347 #define FX_largeLodLog2(info) (info).largeLod 348 #endif 349 350 #if defined(FX_GLIDE3) 351 #define FX_aspectRatioLog2(info)(info).aspectRatioLog2352 #else 353 #define FX_aspectRatioLog2(info)(info).aspectRatio354 #endif 355 356 #if defined(FX_GLIDE3) 357 #define FX_smallLodLog2(info)(info).smallLodLog2358 #else 359 #define FX_smallLodLog2(info)(info).smallLod360 #endif 361 362 #if defined(FX_GLIDE3) 363 #define FX_lodToValue(val)((int)(GR_LOD_256-val))364 #else 365 #define FX_lodToValue(val)((int)(val))366 #endif 367 368 #if defined(FX_GLIDE3) 369 #define FX_largeLodValue(info)((int)(GR_LOD_256-(info).largeLodLog2))370 #else 371 #define FX_largeLodValue(info)((int)(info).largeLod)348 #define FX_largeLodLog2(info) (info).largeLodLog2 349 #else 350 #define FX_largeLodLog2(info) (info).largeLod 351 #endif 352 353 #if defined(FX_GLIDE3) 354 #define FX_aspectRatioLog2(info) (info).aspectRatioLog2 355 #else 356 #define FX_aspectRatioLog2(info) (info).aspectRatio 357 #endif 358 359 #if defined(FX_GLIDE3) 360 #define FX_smallLodLog2(info) (info).smallLodLog2 361 #else 362 #define FX_smallLodLog2(info) (info).smallLod 363 #endif 364 365 #if defined(FX_GLIDE3) 366 #define FX_lodToValue(val) ((int)(GR_LOD_256-val)) 367 #else 368 #define FX_lodToValue(val) ((int)(val)) 369 #endif 370 371 #if defined(FX_GLIDE3) 372 #define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2)) 373 #else 374 #define FX_largeLodValue(info) ((int)(info).largeLod) 372 375 #endif 373 376 #define FX_largeLodValue_NoLock FX_largeLodValue 374 377 375 378 #if defined(FX_GLIDE3) 376 #define FX_smallLodValue(info)((int)(GR_LOD_256-(info).smallLodLog2))377 #else 378 #define FX_smallLodValue(info)((int)(info).smallLod)379 #define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2)) 380 #else 381 #define FX_smallLodValue(info) ((int)(info).smallLod) 379 382 #endif 380 383 #define FX_smallLodValue_NoLock FX_smallLodValue 381 384 382 385 #if defined(FX_GLIDE3) 383 #define FX_valueToLod(val)((GrLOD_t)(GR_LOD_256-val))384 #else 385 #define FX_valueToLod(val)((GrLOD_t)(val))386 #define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val)) 387 #else 388 #define FX_valueToLod(val) ((GrLOD_t)(val)) 386 389 #endif 387 390 … … 389 392 * ScreenWidth/Height stuff. 390 393 */ 391 extern int FX_grSstScreenWidth(void);392 extern int FX_grSstScreenHeight(void);394 extern int FX_grSstScreenWidth(void); 395 extern int FX_grSstScreenHeight(void); 393 396 394 397 … … 398 401 */ 399 402 #if defined(FX_GLIDE3) 400 extern void FX_grGlideGetVersion(char *buf);401 #else 402 #define FX_grGlideGetVersion(b)\403 do {\404 BEGIN_BOARD_LOCK();\405 grGlideGetVersion(b);\406 END_BOARD_LOCK();\407 } while (0)403 extern void FX_grGlideGetVersion(char *buf); 404 #else 405 #define FX_grGlideGetVersion(b) \ 406 do { \ 407 BEGIN_BOARD_LOCK(); \ 408 grGlideGetVersion(b); \ 409 END_BOARD_LOCK(); \ 410 } while (0) 408 411 #endif 409 412 /* … … 413 416 extern void FX_grSstPerfStats(GrSstPerfStats_t *st); 414 417 #else 415 #define FX_grSstPerfStats(s)\416 do {\417 BEGIN_BOARD_LOCK();\418 grSstPerfStats(s);\419 END_BOARD_LOCK();\420 } while (0)418 #define FX_grSstPerfStats(s) \ 419 do { \ 420 BEGIN_BOARD_LOCK(); \ 421 grSstPerfStats(s); \ 422 END_BOARD_LOCK(); \ 423 } while (0) 421 424 #endif 422 425 … … 431 434 #if defined(FX_GLIDE3) 432 435 extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask); 433 extern void FX_grHints(GrHint_t hintType, FxU32 hintMask);434 #else 435 #define FX_grHints(t,m)\436 do {\437 BEGIN_BOARD_LOCK();\438 grHints(t, m);\439 END_BOARD_LOCK();\440 } while(0)436 extern void FX_grHints(GrHint_t hintType, FxU32 hintMask); 437 #else 438 #define FX_grHints(t,m) \ 439 do { \ 440 BEGIN_BOARD_LOCK(); \ 441 grHints(t, m); \ 442 END_BOARD_LOCK(); \ 443 } while(0) 441 444 #define FX_grHints_NoLock grHints 442 445 #endif … … 445 448 */ 446 449 #if defined(FX_GLIDE3) 447 extern void FX_grAADrawLine(GrVertex *a,GrVertex *b);448 #else 449 #define FX_grAADrawLine(a,b)\450 do {\451 BEGIN_CLIP_LOOP();\452 grAADrawLine(a,b);\453 END_CLIP_LOOP();\454 } while (0)455 #endif 456 457 #if defined(FX_GLIDE3) 458 extern void FX_grAADrawPoint(GrVertex *a);459 #else 460 #define FX_grAADrawPoint(a)\461 do {\462 BEGIN_CLIP_LOOP();\463 grAADrawPoint(a);\464 END_CLIP_LOOP();\465 } while (0)450 extern void FX_grAADrawLine(GrVertex *a,GrVertex *b); 451 #else 452 #define FX_grAADrawLine(a,b) \ 453 do { \ 454 BEGIN_CLIP_LOOP(); \ 455 grAADrawLine(a,b); \ 456 END_CLIP_LOOP(); \ 457 } while (0) 458 #endif 459 460 #if defined(FX_GLIDE3) 461 extern void FX_grAADrawPoint(GrVertex *a); 462 #else 463 #define FX_grAADrawPoint(a) \ 464 do { \ 465 BEGIN_CLIP_LOOP(); \ 466 grAADrawPoint(a); \ 467 END_CLIP_LOOP(); \ 468 } while (0) 466 469 #endif 467 470 … … 470 473 */ 471 474 #if defined(FX_GLIDE3) 472 extern void FX_setupGrVertexLayout(void);473 #else 474 #define FX_setupGrVertexLayout()do {} while (0)475 extern void FX_setupGrVertexLayout(void); 476 #else 477 #define FX_setupGrVertexLayout() do {} while (0) 475 478 #endif 476 479 /* … … 485 488 extern void FX_grGammaCorrectionValue(float val); 486 489 #else 487 #define FX_grGammaCorrectionValue(v) \488 do { \489 BEGIN_BOARD_LOCK(); \490 grGammaCorrectionValue(v)\491 END_BOARD_LOCK(); \490 #define FX_grGammaCorrectionValue(v) \ 491 do { \ 492 BEGIN_BOARD_LOCK(); \ 493 grGammaCorrectionValue(v) \ 494 END_BOARD_LOCK(); \ 492 495 } while (0) 493 496 #endif 494 497 495 498 #if defined(FX_GLIDE3) 496 #define FX_grSstWinClose(w) \497 do { \498 BEGIN_BOARD_LOCK(); \499 grSstWinClose(w); \500 END_BOARD_LOCK(); \501 } while (0) 502 #else 503 #define FX_grSstWinClose(w) \504 do { \505 BEGIN_BOARD_LOCK(); \506 grSstWinClose(); \507 END_BOARD_LOCK(); \499 #define FX_grSstWinClose(w) \ 500 do { \ 501 BEGIN_BOARD_LOCK(); \ 502 grSstWinClose(w); \ 503 END_BOARD_LOCK(); \ 504 } while (0) 505 #else 506 #define FX_grSstWinClose(w) \ 507 do { \ 508 BEGIN_BOARD_LOCK(); \ 509 grSstWinClose(); \ 510 END_BOARD_LOCK(); \ 508 511 } while (0) 509 512 #endif … … 519 522 520 523 521 #define FX_grDrawLine(v1, v2) \ 522 do { \ 523 BEGIN_CLIP_LOOP(); \ 524 grDrawLine(v1, v2); \ 525 END_CLIP_LOOP(); \ 526 } while (0) 527 528 #define FX_grDrawPoint(p) \ 529 do { \ 530 BEGIN_CLIP_LOOP(); \ 531 grDrawPoint(p); \ 532 END_CLIP_LOOP(); \ 533 } while (0) 534 535 #define FX_grDitherMode(m) \ 536 do { \ 537 BEGIN_BOARD_LOCK(); \ 538 grDitherMode(m); \ 539 END_BOARD_LOCK(); \ 540 } while (0) 541 542 #define FX_grRenderBuffer(b) \ 543 do { \ 544 BEGIN_BOARD_LOCK(); \ 545 grRenderBuffer(b); \ 546 END_BOARD_LOCK(); \ 547 } while (0) 548 549 #define FX_grBufferClear(c, a, d) \ 550 do { \ 551 BEGIN_CLIP_LOOP(); \ 552 grBufferClear(c, a, d); \ 553 END_CLIP_LOOP(); \ 554 } while (0) 555 556 #define FX_grDepthMask(m) \ 557 do { \ 558 BEGIN_BOARD_LOCK(); \ 559 grDepthMask(m); \ 560 END_BOARD_LOCK(); \ 561 } while (0) 562 563 #define FX_grColorMask(c, a) \ 564 do { \ 565 BEGIN_BOARD_LOCK(); \ 566 grColorMask(c, a); \ 567 END_BOARD_LOCK(); \ 568 } while (0) 569 570 extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer, 571 GrLfbWriteMode_t writeMode, 572 GrOriginLocation_t origin, FxBool pixelPipeline, 573 GrLfbInfo_t *info ); 574 575 #define FX_grLfbUnlock(t, b) \ 576 do { \ 577 BEGIN_BOARD_LOCK(); \ 578 grLfbUnlock(t, b); \ 579 END_BOARD_LOCK(); \ 580 } while (0) 581 582 #define FX_grConstantColorValue(v) \ 583 do { \ 584 BEGIN_BOARD_LOCK(); \ 585 grConstantColorValue(v); \ 586 END_BOARD_LOCK(); \ 524 #define FX_grDrawLine(v1, v2) \ 525 do { \ 526 BEGIN_CLIP_LOOP(); \ 527 grDrawLine(v1, v2); \ 528 END_CLIP_LOOP(); \ 529 } while (0) 530 531 #define FX_grDrawPoint(p) \ 532 do { \ 533 BEGIN_CLIP_LOOP(); \ 534 grDrawPoint(p); \ 535 END_CLIP_LOOP(); \ 536 } while (0) 537 538 #if defined(FX_GLIDE3) 539 extern void FX_grDrawPolygonVertexList(int n, GrVertex *v); 540 #else 541 #define FX_grDrawPolygonVertexList(n, v) \ 542 do { \ 543 BEGIN_CLIP_LOOP(); \ 544 grDrawPolygonVertexList(n, v); \ 545 END_CLIP_LOOP(); \ 546 } while (0) 547 #endif 548 549 #define FX_grDitherMode(m) \ 550 do { \ 551 BEGIN_BOARD_LOCK(); \ 552 grDitherMode(m); \ 553 END_BOARD_LOCK(); \ 554 } while (0) 555 556 #define FX_grRenderBuffer(b) \ 557 do { \ 558 BEGIN_BOARD_LOCK(); \ 559 grRenderBuffer(b); \ 560 END_BOARD_LOCK(); \ 561 } while (0) 562 563 #define FX_grBufferClear(c, a, d) \ 564 do { \ 565 BEGIN_CLIP_LOOP(); \ 566 grBufferClear(c, a, d); \ 567 END_CLIP_LOOP(); \ 568 } while (0) 569 570 #define FX_grDepthMask(m) \ 571 do { \ 572 BEGIN_BOARD_LOCK(); \ 573 grDepthMask(m); \ 574 END_BOARD_LOCK(); \ 575 } while (0) 576 577 #define FX_grColorMask(c, a) \ 578 do { \ 579 BEGIN_BOARD_LOCK(); \ 580 grColorMask(c, a); \ 581 END_BOARD_LOCK(); \ 582 } while (0) 583 584 extern FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer, 585 GrLfbWriteMode_t writeMode, 586 GrOriginLocation_t origin, FxBool pixelPipeline, 587 GrLfbInfo_t *info ); 588 589 #define FX_grLfbUnlock(t, b) \ 590 do { \ 591 BEGIN_BOARD_LOCK(); \ 592 grLfbUnlock(t, b); \ 593 END_BOARD_LOCK(); \ 594 } while (0) 595 596 #define FX_grConstantColorValue(v) \ 597 do { \ 598 BEGIN_BOARD_LOCK(); \ 599 grConstantColorValue(v); \ 600 END_BOARD_LOCK(); \ 587 601 } while (0) 588 602 589 603 #define FX_grConstantColorValue_NoLock grConstantColorValue 590 604 591 #define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \592 do { \593 BEGIN_CLIP_LOOP(); \594 grAADrawTriangle(a, b, c, ab, bc, ca); \595 END_CLIP_LOOP(); \596 } while (0) 597 598 #define FX_grAlphaBlendFunction(rs, rd, as, ad) \599 do { \600 BEGIN_BOARD_LOCK(); \601 grAlphaBlendFunction(rs, rd, as, ad); \602 END_BOARD_LOCK(); \603 } while (0) 604 605 #define FX_grAlphaCombine(func, fact, loc, oth, inv) \606 do { \607 BEGIN_BOARD_LOCK(); \608 grAlphaCombine(func, fact, loc, oth, inv); \609 END_BOARD_LOCK(); \605 #define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \ 606 do { \ 607 BEGIN_CLIP_LOOP(); \ 608 grAADrawTriangle(a, b, c, ab, bc, ca); \ 609 END_CLIP_LOOP(); \ 610 } while (0) 611 612 #define FX_grAlphaBlendFunction(rs, rd, as, ad) \ 613 do { \ 614 BEGIN_BOARD_LOCK(); \ 615 grAlphaBlendFunction(rs, rd, as, ad); \ 616 END_BOARD_LOCK(); \ 617 } while (0) 618 619 #define FX_grAlphaCombine(func, fact, loc, oth, inv) \ 620 do { \ 621 BEGIN_BOARD_LOCK(); \ 622 grAlphaCombine(func, fact, loc, oth, inv); \ 623 END_BOARD_LOCK(); \ 610 624 } while (0) 611 625 612 626 #define FX_grAlphaCombine_NoLock grAlphaCombine 613 627 614 #define FX_grAlphaTestFunction(f) \615 do { \616 BEGIN_BOARD_LOCK(); \617 grAlphaTestFunction(f); \618 END_BOARD_LOCK(); \619 } while (0) 620 621 #define FX_grAlphaTestReferenceValue(v) \622 do { \623 BEGIN_BOARD_LOCK(); \624 grAlphaTestReferenceValue(v); \625 END_BOARD_LOCK(); \626 } while (0) 627 628 #define FX_grClipWindow(minx, miny, maxx, maxy) \629 do { \630 BEGIN_BOARD_LOCK(); \631 grClipWindow(minx, miny, maxx, maxy); \632 END_BOARD_LOCK(); \628 #define FX_grAlphaTestFunction(f) \ 629 do { \ 630 BEGIN_BOARD_LOCK(); \ 631 grAlphaTestFunction(f); \ 632 END_BOARD_LOCK(); \ 633 } while (0) 634 635 #define FX_grAlphaTestReferenceValue(v) \ 636 do { \ 637 BEGIN_BOARD_LOCK(); \ 638 grAlphaTestReferenceValue(v); \ 639 END_BOARD_LOCK(); \ 640 } while (0) 641 642 #define FX_grClipWindow(minx, miny, maxx, maxy) \ 643 do { \ 644 BEGIN_BOARD_LOCK(); \ 645 grClipWindow(minx, miny, maxx, maxy); \ 646 END_BOARD_LOCK(); \ 633 647 } while (0) 634 648 635 649 #define FX_grClipWindow_NoLock grClipWindow 636 650 637 #define FX_grColorCombine(func, fact, loc, oth, inv) \638 do { \639 BEGIN_BOARD_LOCK(); \640 grColorCombine(func, fact, loc, oth, inv); \641 END_BOARD_LOCK(); \651 #define FX_grColorCombine(func, fact, loc, oth, inv) \ 652 do { \ 653 BEGIN_BOARD_LOCK(); \ 654 grColorCombine(func, fact, loc, oth, inv); \ 655 END_BOARD_LOCK(); \ 642 656 } while (0) 643 657 644 658 #define FX_grColorCombine_NoLock grColorCombine 645 659 646 #define FX_grCullMode(m) \647 do { \648 BEGIN_BOARD_LOCK(); \649 grCullMode(m); \650 END_BOARD_LOCK(); \651 } while (0) 652 653 #define FX_grDepthBiasLevel(lev) \654 do { \655 BEGIN_BOARD_LOCK(); \656 grDepthBiasLevel(lev); \657 END_BOARD_LOCK(); \658 } while (0) 659 660 #define FX_grDepthBufferFunction(func) \661 do { \662 BEGIN_BOARD_LOCK(); \663 grDepthBufferFunction(func); \664 END_BOARD_LOCK(); \665 } while (0) 666 667 #define FX_grFogColorValue(c) \668 do { \669 BEGIN_BOARD_LOCK(); \670 grFogColorValue(c); \671 END_BOARD_LOCK(); \672 } while (0) 673 674 #define FX_grFogMode(m) \675 do { \660 #define FX_grCullMode(m) \ 661 do { \ 662 BEGIN_BOARD_LOCK(); \ 663 grCullMode(m); \ 664 END_BOARD_LOCK(); \ 665 } while (0) 666 667 #define FX_grDepthBiasLevel(lev) \ 668 do { \ 669 BEGIN_BOARD_LOCK(); \ 670 grDepthBiasLevel(lev); \ 671 END_BOARD_LOCK(); \ 672 } while (0) 673 674 #define FX_grDepthBufferFunction(func) \ 675 do { \ 676 BEGIN_BOARD_LOCK(); \ 677 grDepthBufferFunction(func); \ 678 END_BOARD_LOCK(); \ 679 } while (0) 680 681 #define FX_grFogColorValue(c) \ 682 do { \ 683 BEGIN_BOARD_LOCK(); \ 684 grFogColorValue(c); \ 685 END_BOARD_LOCK(); \ 686 } while (0) 687 688 #define FX_grFogMode(m) \ 689 do { \ 676 690 BEGIN_BOARD_LOCK(); \ 677 grFogMode(m); \678 END_BOARD_LOCK(); \679 } while (0) 680 681 #define FX_grFogTable(t) \682 do { \683 BEGIN_BOARD_LOCK(); \684 grFogTable(t); \685 END_BOARD_LOCK(); \686 } while (0) 687 688 #define FX_grTexClampMode(t, sc, tc) \689 do { \690 BEGIN_BOARD_LOCK(); \691 grTexClampMode(t, sc, tc); \692 END_BOARD_LOCK(); \691 grFogMode(m); \ 692 END_BOARD_LOCK(); \ 693 } while (0) 694 695 #define FX_grFogTable(t) \ 696 do { \ 697 BEGIN_BOARD_LOCK(); \ 698 grFogTable(t); \ 699 END_BOARD_LOCK(); \ 700 } while (0) 701 702 #define FX_grTexClampMode(t, sc, tc) \ 703 do { \ 704 BEGIN_BOARD_LOCK(); \ 705 grTexClampMode(t, sc, tc); \ 706 END_BOARD_LOCK(); \ 693 707 } while (0) 694 708 695 709 #define FX_grTexClampMode_NoLock grTexClampMode 696 710 697 #define FX_grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv) \698 do { \699 BEGIN_BOARD_LOCK(); \700 grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \701 END_BOARD_LOCK(); \711 #define FX_grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv) \ 712 do { \ 713 BEGIN_BOARD_LOCK(); \ 714 grTexCombine(t, rfunc, rfact, afunc, afact, rinv, ainv); \ 715 END_BOARD_LOCK(); \ 702 716 } while (0) 703 717 704 718 #define FX_grTexCombine_NoLock grTexCombine 705 719 706 #define FX_grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d) \707 do { \708 BEGIN_BOARD_LOCK(); \709 grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \710 END_BOARD_LOCK(); \720 #define FX_grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d) \ 721 do { \ 722 BEGIN_BOARD_LOCK(); \ 723 grTexDownloadMipMapLevel(t, sa, tlod, llod, ar, f, eo, d); \ 724 END_BOARD_LOCK(); \ 711 725 } while (0) 712 726 713 727 #define FX_grTexDownloadMipMapLevel_NoLock grTexDownloadMipMapLevel 714 728 715 #define FX_grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \716 do { \717 BEGIN_BOARD_LOCK(); \729 #define FX_grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \ 730 do { \ 731 BEGIN_BOARD_LOCK(); \ 718 732 grTexDownloadMipMapLevelPartial(t, sa, tlod, llod, ar, f, eo, d, s, e); \ 719 END_BOARD_LOCK(); \720 } while (0) 721 722 #define FX_grTexFilterMode(t, minf, magf) \723 do { \724 BEGIN_BOARD_LOCK(); \725 grTexFilterMode(t, minf, magf); \726 END_BOARD_LOCK(); \733 END_BOARD_LOCK(); \ 734 } while (0) 735 736 #define FX_grTexFilterMode(t, minf, magf) \ 737 do { \ 738 BEGIN_BOARD_LOCK(); \ 739 grTexFilterMode(t, minf, magf); \ 740 END_BOARD_LOCK(); \ 727 741 } while (0) 728 742 … … 732 746 extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu); 733 747 734 #define FX_grTexMipMapMode(t, m, lod) \735 do { \736 BEGIN_BOARD_LOCK(); \737 grTexMipMapMode(t, m, lod); \738 END_BOARD_LOCK(); \748 #define FX_grTexMipMapMode(t, m, lod) \ 749 do { \ 750 BEGIN_BOARD_LOCK(); \ 751 grTexMipMapMode(t, m, lod); \ 752 END_BOARD_LOCK(); \ 739 753 } while (0) 740 754 741 755 #define FX_grTexMipMapMode_NoLock grTexMipMapMode 742 756 743 #define FX_grTexSource(t, sa, eo, i) \744 do { \745 BEGIN_BOARD_LOCK(); \746 grTexSource(t, sa, eo, i); \747 END_BOARD_LOCK(); \757 #define FX_grTexSource(t, sa, eo, i) \ 758 do { \ 759 BEGIN_BOARD_LOCK(); \ 760 grTexSource(t, sa, eo, i); \ 761 END_BOARD_LOCK(); \ 748 762 } while (0) 749 763 … … 753 767 #define FX_grTexTextureMemRequired_NoLock grTexTextureMemRequired 754 768 755 #define FX_grGlideGetState(s) \ 756 do { \ 757 BEGIN_BOARD_LOCK(); \ 758 grGlideGetState(s); \ 759 END_BOARD_LOCK(); \ 760 } while (0) 761 762 #define FX_grDRIBufferSwap(i) \ 763 do { \ 764 BEGIN_BOARD_LOCK(); \ 765 grDRIBufferSwap(i); \ 766 END_BOARD_LOCK(); \ 767 } while (0) 768 769 #define FX_grSstSelect(b) \ 770 do { \ 771 BEGIN_BOARD_LOCK(); \ 772 grSstSelect(b); \ 773 END_BOARD_LOCK(); \ 769 #define FX_grGlideGetState(s) \ 770 do { \ 771 BEGIN_BOARD_LOCK(); \ 772 grGlideGetState(s); \ 773 END_BOARD_LOCK(); \ 774 } while (0) 775 #define FX_grGlideGetState_NoLock(s) grGlideGetState(s); 776 777 #define FX_grDRIBufferSwap(i) \ 778 do { \ 779 BEGIN_BOARD_LOCK(); \ 780 grDRIBufferSwap(i); \ 781 END_BOARD_LOCK(); \ 782 } while (0) 783 784 #define FX_grSstSelect(b) \ 785 do { \ 786 BEGIN_BOARD_LOCK(); \ 787 grSstSelect(b); \ 788 END_BOARD_LOCK(); \ 774 789 } while (0) 775 790 776 791 #define FX_grSstSelect_NoLock grSstSelect 777 792 778 #define FX_grGlideSetState(s) \ 779 do { \ 780 BEGIN_BOARD_LOCK(); \ 781 grGlideSetState(s); \ 782 END_BOARD_LOCK(); \ 783 } while (0) 784 785 #define FX_grDepthBufferMode(m) \ 786 do { \ 787 BEGIN_BOARD_LOCK(); \ 788 grDepthBufferMode(m); \ 789 END_BOARD_LOCK(); \ 790 } while (0) 791 792 #define FX_grLfbWriteColorFormat(f) \ 793 do { \ 794 BEGIN_BOARD_LOCK(); \ 795 grLfbWriteColorFormat(f); \ 796 END_BOARD_LOCK(); \ 797 } while (0) 798 799 #define FX_grDrawVertexArray(m, c, p) \ 800 do { \ 801 BEGIN_CLIP_LOOP(); \ 802 grDrawVertexArray(m, c, p); \ 803 END_CLIP_LOOP(); \ 804 } while (0) 805 806 #define FX_grGlideShutdown() \ 807 do { \ 808 BEGIN_CLIP_LOOP(); \ 809 grGlideShutdown(); \ 810 END_CLIP_LOOP(); \ 793 #define FX_grGlideSetState(s) \ 794 do { \ 795 BEGIN_BOARD_LOCK(); \ 796 grGlideSetState(s); \ 797 END_BOARD_LOCK(); \ 798 } while (0) 799 #define FX_grGlideSetState_NoLock(s) grGlideSetState(s); 800 801 #define FX_grDepthBufferMode(m) \ 802 do { \ 803 BEGIN_BOARD_LOCK(); \ 804 grDepthBufferMode(m); \ 805 END_BOARD_LOCK(); \ 806 } while (0) 807 808 #define FX_grLfbWriteColorFormat(f) \ 809 do { \ 810 BEGIN_BOARD_LOCK(); \ 811 grLfbWriteColorFormat(f); \ 812 END_BOARD_LOCK(); \ 813 } while (0) 814 815 #define FX_grDrawVertexArray(m, c, p) \ 816 do { \ 817 BEGIN_CLIP_LOOP(); \ 818 grDrawVertexArray(m, c, p); \ 819 END_CLIP_LOOP(); \ 820 } while (0) 821 822 #define FX_grGlideShutdown() \ 823 do { \ 824 BEGIN_CLIP_LOOP(); \ 825 grGlideShutdown(); \ 826 END_CLIP_LOOP(); \ 811 827 } while (0) 812 828 -
trunk/src/opengl/mesa/3dfx/fxpipeline.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. … … 65 65 ((ctx->Texture.ReallyEnabled & 0xf) && VB->TexCoordPtr[0]->size>2) || 66 66 ((ctx->Texture.ReallyEnabled & 0xf0) && VB->TexCoordPtr[1]->size>2) || 67 (VB->ClipPtr->size != 4)) /* Brokes clipping otherwise*/67 (VB->ClipPtr->size != 4)) /* Brokes clipping otherwise*/ 68 68 gl_render_elts( VB ); 69 else 69 else 70 70 fxDDRenderElementsDirect( VB ); 71 71 } 72 72 73 static void fxDDCheckRenderVBIndirect( GLcontext *ctx, 74 struct gl_pipeline_stage *d )75 { 73 static void fxDDCheckRenderVBIndirect( GLcontext *ctx, 74 struct gl_pipeline_stage *d ) 75 { 76 76 d->type = 0; 77 77 78 78 if ((ctx->IndirectTriangles & DD_SW_SETUP) == 0 && 79 ctx->Driver.MultipassFunc == 0) 79 ctx->Driver.MultipassFunc == 0) 80 80 { 81 81 d->type = PIPE_IMMEDIATE; 82 82 d->inputs = VERT_SETUP_FULL | VERT_ELT | VERT_PRECALC_DATA; 83 } 83 } 84 84 } 85 85 … … 122 122 */ 123 123 GLuint fxDDRegisterPipelineStages( struct gl_pipeline_stage *out, 124 const struct gl_pipeline_stage *in,125 GLuint nr )124 const struct gl_pipeline_stage *in, 125 GLuint nr ) 126 126 { 127 127 GLuint i, o; … … 130 130 switch (in[i].ops) { 131 131 case PIPE_OP_RAST_SETUP_1|PIPE_OP_RENDER: 132 out[o] = in[i];133 out[o].state_change = NEW_CLIENT_STATE;134 out[o].check = fxDDCheckMergeAndRender;135 out[o].run = fxDDMergeAndRender; 136 o++;137 break;132 out[o] = in[i]; 133 out[o].state_change = NEW_CLIENT_STATE; 134 out[o].check = fxDDCheckMergeAndRender; 135 out[o].run = fxDDMergeAndRender; 136 o++; 137 break; 138 138 case PIPE_OP_RAST_SETUP_0: 139 out[o] = in[i];140 out[o].cva_state_change = NEW_LIGHTING|NEW_TEXTURING|NEW_RASTER_OPS;141 out[o].state_change = ~0;142 out[o].check = fxDDCheckPartialRasterSetup;143 out[o].run = fxDDPartialRasterSetup;144 o++;145 break;139 out[o] = in[i]; 140 out[o].cva_state_change = NEW_LIGHTING|NEW_TEXTURING|NEW_RASTER_OPS; 141 out[o].state_change = ~0; 142 out[o].check = fxDDCheckPartialRasterSetup; 143 out[o].run = fxDDPartialRasterSetup; 144 o++; 145 break; 146 146 case PIPE_OP_RAST_SETUP_0|PIPE_OP_RAST_SETUP_1: 147 out[o] = in[i];148 out[o].run = fxDDDoRasterSetup;149 o++;150 break;147 out[o] = in[i]; 148 out[o].run = fxDDDoRasterSetup; 149 o++; 150 break; 151 151 case PIPE_OP_RENDER: 152 out[o] = in[i];153 if (in[i].run == gl_render_elts) {154 out[o].run = fxDDRenderElements;155 } else if (in[i].run == gl_render_vb_indirect) {156 out[o].check = fxDDCheckRenderVBIndirect;157 out[o].run = fxDDRenderVBIndirect;158 } else if (in[i].run == gl_render_vb) {159 out[o].run = fxDDRenderVB;160 }161 162 o++;163 break;152 out[o] = in[i]; 153 if (in[i].run == gl_render_elts) { 154 out[o].run = fxDDRenderElements; 155 } else if (in[i].run == gl_render_vb_indirect) { 156 out[o].check = fxDDCheckRenderVBIndirect; 157 out[o].run = fxDDRenderVBIndirect; 158 } else if (in[i].run == gl_render_vb) { 159 out[o].run = fxDDRenderVB; 160 } 161 162 o++; 163 break; 164 164 default: 165 out[o++] = in[i];166 break;165 out[o++] = in[i]; 166 break; 167 167 } 168 168 } … … 171 171 } 172 172 173 #define ILLEGAL_ENABLES (TEXTURE0_3D| \174 TEXTURE1_3D|\175 ENABLE_TEXMAT0 |\176 ENABLE_TEXMAT1 |\177 ENABLE_TEXGEN0 |\178 ENABLE_TEXGEN1 |\179 ENABLE_USERCLIP |\180 ENABLE_LIGHT |\181 ENABLE_FOG)182 183 184 173 #define ILLEGAL_ENABLES (TEXTURE0_3D| \ 174 TEXTURE1_3D| \ 175 ENABLE_TEXMAT0 | \ 176 ENABLE_TEXMAT1 | \ 177 ENABLE_TEXGEN0 | \ 178 ENABLE_TEXGEN1 | \ 179 ENABLE_USERCLIP | \ 180 ENABLE_LIGHT | \ 181 ENABLE_FOG) 182 183 184 185 185 /* Because this is slotted in by the OptimizePipeline function, most 186 186 * of the information here is just for gl_print_pipeline(). Only the 187 * run member is required. 187 * run member is required. 188 188 */ 189 189 static struct gl_pipeline_stage fx_fast_stage = { … … 199 199 0, 200 200 0, 201 0, /* never called */201 0, /* never called */ 202 202 fxDDFastPath 203 203 }; … … 210 210 */ 211 211 GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ) 212 { 212 { 213 213 struct gl_pipeline *pipe = &ctx->CVA.pre; 214 214 fxMesaContext fxMesa = FX_CONTEXT(ctx); 215 215 216 216 217 217 if (fxMesa->is_in_hardware && 218 fxMesa->render_index == 0 && 218 fxMesa->render_index == 0 && 219 219 (ctx->Enabled & ILLEGAL_ENABLES) == 0 && 220 220 (ctx->Array.Flags & (VERT_OBJ_234| 221 VERT_TEX0_4|222 VERT_TEX1_4|223 VERT_ELT)) == (VERT_OBJ_23|VERT_ELT))221 VERT_TEX0_4| 222 VERT_TEX1_4| 223 VERT_ELT)) == (VERT_OBJ_23|VERT_ELT)) 224 224 { 225 if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_DRIVER)) 226 if (!fxMesa->using_fast_path)227 fprintf(stderr, "fxMesa: using fast path\n");225 if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_DRIVER)) 226 if (!fxMesa->using_fast_path) 227 fprintf(stderr, "fxMesa: using fast path\n"); 228 228 229 229 pipe->stages[0] = &fx_fast_stage; … … 233 233 fxMesa->using_fast_path = 1; 234 234 return 1; 235 } 236 237 if (fxMesa->using_fast_path) 235 } 236 237 if (fxMesa->using_fast_path) 238 238 { 239 if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_DRIVER)) 240 fprintf(stderr, "fxMesa: fall back to full pipeline %x %x %x %x %x\n",241 fxMesa->is_in_hardware,242 fxMesa->render_index,243 (ctx->Enabled & ILLEGAL_ENABLES),244 (ctx->Array.Summary & (VERT_OBJ_23)),245 (ctx->Array.Summary & (VERT_OBJ_4|VERT_TEX0_4|VERT_TEX1_4)));239 if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_DRIVER)) 240 fprintf(stderr, "fxMesa: fall back to full pipeline %x %x %x %x %x\n", 241 fxMesa->is_in_hardware, 242 fxMesa->render_index, 243 (ctx->Enabled & ILLEGAL_ENABLES), 244 (ctx->Array.Summary & (VERT_OBJ_23)), 245 (ctx->Array.Summary & (VERT_OBJ_4|VERT_TEX0_4|VERT_TEX1_4))); 246 246 247 247 fxMesa->using_fast_path = 0; … … 251 251 return 0; 252 252 } 253 253 254 254 return 0; 255 255 } … … 271 271 272 272 if (fxMesa->is_in_hardware && 273 fxMesa->render_index == 0 && 273 fxMesa->render_index == 0 && 274 274 (ctx->Enabled & ILLEGAL_ENABLES) == 0 && 275 275 (ctx->Array.Summary & VERT_ELT)) -
trunk/src/opengl/mesa/3dfx/fxrender.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. … … 60 60 * endpoints must be clipped. 61 61 */ 62 #if !defined(__MWERKS__) 62 #if !defined(__MWERKS__) 63 63 INLINE 64 64 #endif 65 void fxRenderClippedLine( struct vertex_buffer *VB, 66 GLuint v1, GLuint v2 )65 void fxRenderClippedLine( struct vertex_buffer *VB, 66 GLuint v1, GLuint v2 ) 67 67 { 68 68 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; … … 79 79 */ 80 80 INLINE void fxRenderClippedTriangle( struct vertex_buffer *VB, 81 GLuint n, GLuint vlist[] )81 GLuint n, GLuint vlist[] ) 82 82 { 83 83 GLubyte mask = 0; … … 92 92 return; 93 93 } 94 94 95 95 n = (VB->ctx->poly_clip_tab[VB->ClipPtr->size])( VB, n, vlist, mask ); 96 96 if (n >= 3) { … … 100 100 GrVertex *i2 = (GrVertex *)gWin[vlist[2]].f; 101 101 GLuint i; 102 102 103 103 for (i=2;i<n;i++, i1 = i2, i2 = (GrVertex *)gWin[vlist[i]].f) { 104 104 FX_grDrawTriangle(i0,i1,i2); … … 111 111 112 112 113 static INLINE void fxSafeClippedLine( struct vertex_buffer *VB, 114 GLuint v1, GLuint v2 )113 static INLINE void fxSafeClippedLine( struct vertex_buffer *VB, 114 GLuint v1, GLuint v2 ) 115 115 { 116 116 GLubyte mask = VB->ClipMask[v1] | VB->ClipMask[v2]; … … 127 127 128 128 static INLINE void fxSafeClippedTriangle( struct vertex_buffer *VB, 129 fxVertex *gWin,130 tfxTriClipFunc cliptri,131 GLuint v2, GLuint v1, GLuint v )129 fxVertex *gWin, 130 tfxTriClipFunc cliptri, 131 GLuint v2, GLuint v1, GLuint v ) 132 132 { 133 133 GLubyte *clipmask = VB->ClipMask; … … 136 136 if (!mask) { 137 137 FX_grDrawTriangle((GrVertex *)gWin[v2].f, 138 (GrVertex *)gWin[v1].f,139 (GrVertex *)gWin[v].f);138 (GrVertex *)gWin[v1].f, 139 (GrVertex *)gWin[v].f); 140 140 return; 141 141 } … … 149 149 GLubyte *userclipmask = VB->UserClipMask; 150 150 if (userclipmask[v2] & userclipmask[v1] & userclipmask[v]) 151 return;151 return; 152 152 imask |= (userclipmask[v2] | userclipmask[v1] | userclipmask[v]) << 8; 153 153 } … … 160 160 161 161 static INLINE void fxSafeClippedTriangle2( struct vertex_buffer *VB, 162 fxVertex *gWin,163 tfxTriViewClipFunc cliptri,164 GLuint v2, GLuint v1, GLuint v )162 fxVertex *gWin, 163 tfxTriViewClipFunc cliptri, 164 GLuint v2, GLuint v1, GLuint v ) 165 165 { 166 166 GLubyte *clipmask = VB->ClipMask; … … 169 169 if (!mask) { 170 170 FX_grDrawTriangle((GrVertex *)gWin[v2].f,(GrVertex *)gWin[v1].f, 171 (GrVertex *)gWin[v].f);171 (GrVertex *)gWin[v].f); 172 172 } else if (!(clipmask[v2] & clipmask[v1] & clipmask[v])) { 173 173 GLuint vl[3]; … … 179 179 180 180 static INLINE void fxSafeClippedTriangle3( struct vertex_buffer *VB, 181 fxVertex *gWin,182 tfxTriClipFunc cliptri,183 GLuint v2, GLuint v1, GLuint v )181 fxVertex *gWin, 182 tfxTriClipFunc cliptri, 183 GLuint v2, GLuint v1, GLuint v ) 184 184 { 185 185 GLubyte *clipmask = VB->ClipMask; … … 213 213 */ 214 214 215 #define RENDER_POINTS( start, count ) \216 (void) gWin; \217 (void) VB; \215 #define RENDER_POINTS( start, count ) \ 216 (void) gWin; \ 217 (void) VB; \ 218 218 (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count-1 ) 219 219 220 #define RENDER_LINE( i1, i ) \221 do { \222 RVB_COLOR(i); \223 FX_grDrawLine((GrVertex *)gWin[i1].f, \224 (GrVertex *)gWin[i].f);\225 } while (0) 226 227 #define RENDER_TRI( i2, i1, i, pv, parity ) \228 do { \229 RVB_COLOR(pv); \230 if (parity) { \231 FX_grDrawTriangle((GrVertex *)gWin[i1].f, \232 (GrVertex *)gWin[i2].f,\233 (GrVertex *)gWin[i].f);\234 } else { \235 FX_grDrawTriangle((GrVertex *)gWin[i2].f, \236 (GrVertex *)gWin[i1].f,\237 (GrVertex *)gWin[i].f);\238 } \239 } while (0) 240 241 #define RENDER_QUAD( i3, i2, i1, i, pv ) \242 do { \243 RVB_COLOR(pv); \244 FX_grDrawTriangle((GrVertex *)gWin[i3].f, \245 (GrVertex *)gWin[i2].f,\246 (GrVertex *)gWin[i].f);\247 FX_grDrawTriangle((GrVertex *)gWin[i2].f, \248 (GrVertex *)gWin[i1].f,\249 (GrVertex *)gWin[i].f);\250 } while (0) 251 252 253 254 #define LOCAL_VARS \255 fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \256 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \220 #define RENDER_LINE( i1, i ) \ 221 do { \ 222 RVB_COLOR(i); \ 223 FX_grDrawLine((GrVertex *)gWin[i1].f, \ 224 (GrVertex *)gWin[i].f); \ 225 } while (0) 226 227 #define RENDER_TRI( i2, i1, i, pv, parity ) \ 228 do { \ 229 RVB_COLOR(pv); \ 230 if (parity) { \ 231 FX_grDrawTriangle((GrVertex *)gWin[i1].f, \ 232 (GrVertex *)gWin[i2].f, \ 233 (GrVertex *)gWin[i].f); \ 234 } else { \ 235 FX_grDrawTriangle((GrVertex *)gWin[i2].f, \ 236 (GrVertex *)gWin[i1].f, \ 237 (GrVertex *)gWin[i].f); \ 238 } \ 239 } while (0) 240 241 #define RENDER_QUAD( i3, i2, i1, i, pv ) \ 242 do { \ 243 RVB_COLOR(pv); \ 244 FX_grDrawTriangle((GrVertex *)gWin[i3].f, \ 245 (GrVertex *)gWin[i2].f, \ 246 (GrVertex *)gWin[i].f); \ 247 FX_grDrawTriangle((GrVertex *)gWin[i2].f, \ 248 (GrVertex *)gWin[i1].f, \ 249 (GrVertex *)gWin[i].f); \ 250 } while (0) 251 252 253 254 #define LOCAL_VARS \ 255 fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 256 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 257 257 (void) fxMesa; 258 258 259 #define INIT(x) 259 #define INIT(x) 260 260 261 261 #define TAG(x) x##_fx_flat_raw … … 276 276 /* Render with clipped and/or culled primitives with cullmask information. 277 277 */ 278 #define RENDER_POINTS( start, count ) \279 (void) gWin; \280 (void) cullmask; \278 #define RENDER_POINTS( start, count ) \ 279 (void) gWin; \ 280 (void) cullmask; \ 281 281 (VB->ctx->Driver.PointsFunc)( VB->ctx, start, count-1 ) 282 282 283 283 284 #define RENDER_LINE( i1, i ) \285 do { \286 const GLubyte flags = cullmask[i]; \287 \288 if (!(flags & PRIM_NOT_CULLED)) \289 continue; \290 \291 RVB_COLOR(i); \292 if (flags & PRIM_ANY_CLIP) \293 fxRenderClippedLine( VB, i1, i ); \294 else \295 FX_grDrawLine( (GrVertex *)gWin[i1].f, (GrVertex *)gWin[i].f ); \284 #define RENDER_LINE( i1, i ) \ 285 do { \ 286 const GLubyte flags = cullmask[i]; \ 287 \ 288 if (!(flags & PRIM_NOT_CULLED)) \ 289 continue; \ 290 \ 291 RVB_COLOR(i); \ 292 if (flags & PRIM_ANY_CLIP) \ 293 fxRenderClippedLine( VB, i1, i ); \ 294 else \ 295 FX_grDrawLine( (GrVertex *)gWin[i1].f, (GrVertex *)gWin[i].f ); \ 296 296 } while (0) 297 297 298 298 299 #define RENDER_TRI( i2, i1, i, pv, parity) \300 do { \301 const GLubyte flags = cullmask[i]; \302 GLuint e2,e1; \303 \304 if (!(flags & PRIM_NOT_CULLED)) \305 continue; \306 \307 e2=i2, e1=i1; \308 if (parity) { e2=i1; e1=i2; } \309 \310 RVB_COLOR(pv); \311 if (flags & PRIM_ANY_CLIP) { \312 fxSafeClippedTriangle3(VB,gWin,cliptri,e2,e1,i); \313 } else { \314 FX_grDrawTriangle((GrVertex *)gWin[e2].f, \315 (GrVertex *)gWin[e1].f,\316 (GrVertex *)gWin[i].f);\317 } \318 } while (0) 319 320 321 #define RENDER_QUAD(i3, i2, i1, i, pv) \322 do { \323 const GLubyte flags = cullmask[i]; \324 \325 if (!(flags & PRIM_NOT_CULLED)) \326 continue; \327 \328 RVB_COLOR(pv); \329 if (flags&PRIM_ANY_CLIP) { \330 fxSafeClippedTriangle3(VB,gWin,cliptri,i3,i2,i); \331 fxSafeClippedTriangle3(VB,gWin,cliptri,i2,i1,i); \332 } else { \333 FX_grDrawTriangle((GrVertex *)gWin[i3].f, \334 (GrVertex *)gWin[i2].f,\335 (GrVertex *)gWin[i].f);\336 FX_grDrawTriangle((GrVertex *)gWin[i2].f, \337 (GrVertex *)gWin[i1].f,\338 (GrVertex *)gWin[i].f);\339 } \340 } while (0) 341 342 343 344 345 346 #define LOCAL_VARS \347 fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \348 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \349 const GLubyte *cullmask = VB->CullMask; \299 #define RENDER_TRI( i2, i1, i, pv, parity) \ 300 do { \ 301 const GLubyte flags = cullmask[i]; \ 302 GLuint e2,e1; \ 303 \ 304 if (!(flags & PRIM_NOT_CULLED)) \ 305 continue; \ 306 \ 307 e2=i2, e1=i1; \ 308 if (parity) { e2=i1; e1=i2; } \ 309 \ 310 RVB_COLOR(pv); \ 311 if (flags & PRIM_ANY_CLIP) { \ 312 fxSafeClippedTriangle3(VB,gWin,cliptri,e2,e1,i); \ 313 } else { \ 314 FX_grDrawTriangle((GrVertex *)gWin[e2].f, \ 315 (GrVertex *)gWin[e1].f, \ 316 (GrVertex *)gWin[i].f); \ 317 } \ 318 } while (0) 319 320 321 #define RENDER_QUAD(i3, i2, i1, i, pv) \ 322 do { \ 323 const GLubyte flags = cullmask[i]; \ 324 \ 325 if (!(flags & PRIM_NOT_CULLED)) \ 326 continue; \ 327 \ 328 RVB_COLOR(pv); \ 329 if (flags&PRIM_ANY_CLIP) { \ 330 fxSafeClippedTriangle3(VB,gWin,cliptri,i3,i2,i); \ 331 fxSafeClippedTriangle3(VB,gWin,cliptri,i2,i1,i); \ 332 } else { \ 333 FX_grDrawTriangle((GrVertex *)gWin[i3].f, \ 334 (GrVertex *)gWin[i2].f, \ 335 (GrVertex *)gWin[i].f); \ 336 FX_grDrawTriangle((GrVertex *)gWin[i2].f, \ 337 (GrVertex *)gWin[i1].f, \ 338 (GrVertex *)gWin[i].f); \ 339 } \ 340 } while (0) 341 342 343 344 345 346 #define LOCAL_VARS \ 347 fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 348 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 349 const GLubyte *cullmask = VB->CullMask; \ 350 350 tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 351 351 … … 371 371 372 372 /* Direct, with the possibility of clipping. 373 */ 374 #define RENDER_POINTS( start, count ) \375 do { \376 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \377 GLubyte *clipmask = VB->ClipMask; \378 GLuint i; \379 for (i = start ; i <= count ; i++) \380 if (clipmask[i] == 0) { \381 RVB_COLOR(i); \373 */ 374 #define RENDER_POINTS( start, count ) \ 375 do { \ 376 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 377 GLubyte *clipmask = VB->ClipMask; \ 378 GLuint i; \ 379 for (i = start ; i <= count ; i++) \ 380 if (clipmask[i] == 0) { \ 381 RVB_COLOR(i); \ 382 382 FX_grDrawPoint( (GrVertex *)gWin[i].f );\ 383 } \384 } while (0) 385 386 #define RENDER_LINE( i1, i ) \387 do { \388 RVB_COLOR(i); \389 fxSafeClippedLine( VB, i1, i ); \390 } while (0) 391 392 #define RENDER_TRI( i2, i1, i, pv, parity) \393 do { \394 GLuint e2=i2, e1=i1; \395 if (parity) { GLuint t=e2; e2=e1; e1=t; } \396 RVB_COLOR(pv); \397 fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,i); \398 } while (0) 399 400 #define RENDER_QUAD( i3, i2, i1, i, pv) \401 do { \402 RVB_COLOR(pv); \403 fxSafeClippedTriangle(VB,gWin,cliptri,i3,i2,i); \404 fxSafeClippedTriangle(VB,gWin,cliptri,i2,i1,i); \405 } while (0) 406 407 #define LOCAL_VARS \408 fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \409 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \383 } \ 384 } while (0) 385 386 #define RENDER_LINE( i1, i ) \ 387 do { \ 388 RVB_COLOR(i); \ 389 fxSafeClippedLine( VB, i1, i ); \ 390 } while (0) 391 392 #define RENDER_TRI( i2, i1, i, pv, parity) \ 393 do { \ 394 GLuint e2=i2, e1=i1; \ 395 if (parity) { GLuint t=e2; e2=e1; e1=t; } \ 396 RVB_COLOR(pv); \ 397 fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,i); \ 398 } while (0) 399 400 #define RENDER_QUAD( i3, i2, i1, i, pv) \ 401 do { \ 402 RVB_COLOR(pv); \ 403 fxSafeClippedTriangle(VB,gWin,cliptri,i3,i2,i); \ 404 fxSafeClippedTriangle(VB,gWin,cliptri,i2,i1,i); \ 405 } while (0) 406 407 #define LOCAL_VARS \ 408 fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 409 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 410 410 tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 411 411 … … 430 430 431 431 /* Indirect, with the possibility of clipping. 432 */ 433 #define RENDER_POINTS( start, count ) \434 do { \435 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \436 GLuint e; \437 GLubyte *clipmask = VB->ClipMask; \438 for(e=start;e<=count;e++) \439 if(clipmask[elt[e]]==0) { \440 FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \441 } \442 } while (0) 443 444 #define RENDER_LINE( i1, i ) \445 do { \446 GLuint e1 = elt[i1], e = elt[i]; \447 RVB_COLOR(e); \448 fxSafeClippedLine( VB, e1, e ); \449 } while (0) 450 451 #define RENDER_TRI( i2, i1, i, pv, parity) \452 do { \453 GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \454 if (parity) { GLuint t=e2; e2=e1; e1=t; } \455 fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \456 } while (0) 457 458 #define RENDER_QUAD( i3, i2, i1, i, pv) \459 do { \432 */ 433 #define RENDER_POINTS( start, count ) \ 434 do { \ 435 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 436 GLuint e; \ 437 GLubyte *clipmask = VB->ClipMask; \ 438 for(e=start;e<=count;e++) \ 439 if(clipmask[elt[e]]==0) { \ 440 FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \ 441 } \ 442 } while (0) 443 444 #define RENDER_LINE( i1, i ) \ 445 do { \ 446 GLuint e1 = elt[i1], e = elt[i]; \ 447 RVB_COLOR(e); \ 448 fxSafeClippedLine( VB, e1, e ); \ 449 } while (0) 450 451 #define RENDER_TRI( i2, i1, i, pv, parity) \ 452 do { \ 453 GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ 454 if (parity) { GLuint t=e2; e2=e1; e1=t; } \ 455 fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \ 456 } while (0) 457 458 #define RENDER_QUAD( i3, i2, i1, i, pv) \ 459 do { \ 460 460 GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ 461 fxSafeClippedTriangle(VB,gWin,cliptri,e3,e2,e); \462 fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \463 } while (0) 464 465 #define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \466 fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \467 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \461 fxSafeClippedTriangle(VB,gWin,cliptri,e3,e2,e); \ 462 fxSafeClippedTriangle(VB,gWin,cliptri,e2,e1,e); \ 463 } while (0) 464 465 #define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \ 466 fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \ 467 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 468 468 tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 469 469 … … 478 478 /* Indirect, clipped, but no user clip. 479 479 */ 480 #define RENDER_POINTS( start, count ) \481 do { \482 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \483 GLuint e; \484 GLubyte *clipmask = VB->ClipMask; \485 for(e=start;e<=count;e++) \486 if(clipmask[elt[e]]==0) { \487 FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \488 } \489 } while (0) 490 491 #define RENDER_LINE( i1, i ) \492 do { \493 GLuint e1 = elt[i1], e = elt[i]; \494 RVB_COLOR(e); \495 fxSafeClippedLine( VB, e1, e ); \496 } while (0) 497 498 #define RENDER_TRI( i2, i1, i, pv, parity) \499 do { \500 GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \501 if (parity) { GLuint t=e2; e2=e1; e1=t; } \502 fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \503 } while (0) 504 505 #define RENDER_QUAD( i3, i2, i1, i, pv) \506 do { \480 #define RENDER_POINTS( start, count ) \ 481 do { \ 482 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 483 GLuint e; \ 484 GLubyte *clipmask = VB->ClipMask; \ 485 for(e=start;e<=count;e++) \ 486 if(clipmask[elt[e]]==0) { \ 487 FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \ 488 } \ 489 } while (0) 490 491 #define RENDER_LINE( i1, i ) \ 492 do { \ 493 GLuint e1 = elt[i1], e = elt[i]; \ 494 RVB_COLOR(e); \ 495 fxSafeClippedLine( VB, e1, e ); \ 496 } while (0) 497 498 #define RENDER_TRI( i2, i1, i, pv, parity) \ 499 do { \ 500 GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ 501 if (parity) { GLuint t=e2; e2=e1; e1=t; } \ 502 fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \ 503 } while (0) 504 505 #define RENDER_QUAD( i3, i2, i1, i, pv) \ 506 do { \ 507 507 GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ 508 fxSafeClippedTriangle2(VB,gWin,cliptri,e3,e2,e); \509 fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \510 } while (0) 511 512 #define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \513 fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \514 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \508 fxSafeClippedTriangle2(VB,gWin,cliptri,e3,e2,e); \ 509 fxSafeClippedTriangle2(VB,gWin,cliptri,e2,e1,e); \ 510 } while (0) 511 512 #define LOCAL_VARS const GLuint *elt = VB->EltPtr->data; \ 513 fxMesaContext fxMesa = (fxMesaContext)VB->ctx->DriverCtx; \ 514 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 515 515 tfxTriViewClipFunc cliptri = fxMesa->view_clip_tri; 516 516 … … 530 530 /* Indirect, and no clipping required. 531 531 */ 532 #define RENDER_POINTS( start, count ) \533 do { \534 GLuint e; \535 for(e=start;e<=count;e++) { \536 FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \537 } \538 } while (0) 539 540 #define RENDER_LINE( i1, i ) \541 do { \542 GLuint e1 = elt[i1], e = elt[i]; \543 FX_grDrawLine((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f); \544 } while (0) 545 546 547 #define RENDER_TRI( i2, i1, i, pv, parity) \548 do { \549 GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \550 if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \551 FX_grDrawTriangle((GrVertex *)gWin[e2].f, \552 (GrVertex *)gWin[e1].f,\553 (GrVertex *)gWin[e].f);\554 } while (0) 555 556 557 #define RENDER_QUAD( i3, i2, i1, i, pv) \558 do { \532 #define RENDER_POINTS( start, count ) \ 533 do { \ 534 GLuint e; \ 535 for(e=start;e<=count;e++) { \ 536 FX_grDrawPoint((GrVertex *)gWin[elt[e]].f); \ 537 } \ 538 } while (0) 539 540 #define RENDER_LINE( i1, i ) \ 541 do { \ 542 GLuint e1 = elt[i1], e = elt[i]; \ 543 FX_grDrawLine((GrVertex *)gWin[e1].f, (GrVertex *)gWin[e].f); \ 544 } while (0) 545 546 547 #define RENDER_TRI( i2, i1, i, pv, parity) \ 548 do { \ 549 GLuint e2 = elt[i2], e1 = elt[i1], e = elt[i]; \ 550 if (parity) {GLuint tmp = e2; e2 = e1; e1 = tmp;} \ 551 FX_grDrawTriangle((GrVertex *)gWin[e2].f, \ 552 (GrVertex *)gWin[e1].f, \ 553 (GrVertex *)gWin[e].f); \ 554 } while (0) 555 556 557 #define RENDER_QUAD( i3, i2, i1, i, pv) \ 558 do { \ 559 559 GLuint e3 = elt[i3], e2 = elt[i2], e1 = elt[i1], e = elt[i];\ 560 FX_grDrawTriangle((GrVertex *)gWin[e3].f, \561 (GrVertex *)gWin[e2].f,\562 (GrVertex *)gWin[e].f);\563 FX_grDrawTriangle((GrVertex *)gWin[e2].f, \564 (GrVertex *)gWin[e1].f,\565 (GrVertex *)gWin[e].f);\566 } while (0) 567 568 #define LOCAL_VARS \569 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \560 FX_grDrawTriangle((GrVertex *)gWin[e3].f, \ 561 (GrVertex *)gWin[e2].f, \ 562 (GrVertex *)gWin[e].f); \ 563 FX_grDrawTriangle((GrVertex *)gWin[e2].f, \ 564 (GrVertex *)gWin[e1].f, \ 565 (GrVertex *)gWin[e].f); \ 566 } while (0) 567 568 #define LOCAL_VARS \ 569 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; \ 570 570 const GLuint *elt = VB->EltPtr->data; 571 571 572 #define INIT(x) 572 #define INIT(x) 573 573 574 574 #define TAG(x) x##_fx_smooth_indirect … … 586 586 * 'safe' set of clipping routines which don't require write-access to 587 587 * the arrays in the vertex buffer, and don't care about array 588 * stride. 589 * 590 * Thus there is no call to gl_import_arrays() in this function. 588 * stride. 589 * 590 * Thus there is no call to gl_import_arrays() in this function. 591 591 * 592 592 * This safe clipping should be generalized to call driver->trianglefunc … … 606 606 GLuint p = 0; 607 607 608 if (!nr) 608 if (!nr) 609 609 return; 610 610 611 if (fxMesa->new_state) 611 if (fxMesa->new_state) 612 612 fxSetupFXUnits(ctx); 613 613 … … 619 619 func = render_tab_fx_smooth_indirect_clipped[prim]; 620 620 } 621 622 ctx->VB = VB; /* kludge */621 622 ctx->VB = VB; /* kludge */ 623 623 624 624 do { 625 625 func( VB, 0, nr, 0 ); 626 626 } while (ctx->Driver.MultipassFunc && 627 ctx->Driver.MultipassFunc( VB, ++p ));627 ctx->Driver.MultipassFunc( VB, ++p )); 628 628 629 629 … … 644 644 if (cvaVB->ClipOrMask) 645 645 tab = render_tab_fx_smooth_indirect_clipped; 646 646 647 647 if (!VB->CullDone) 648 648 gl_fast_copy_vb( VB ); 649 649 650 if (fxMesa->new_state) 650 if (fxMesa->new_state) 651 651 fxSetupFXUnits( ctx ); 652 652 … … 657 657 GLuint parity = VB->Parity; 658 658 659 for (i = VB->CopyStart ; i < count ; parity = 0, i = next) 659 for (i = VB->CopyStart ; i < count ; parity = 0, i = next) 660 660 { 661 661 GLuint prim = VB->Primitive[i]; … … 665 665 /* loop never taken */ 666 666 } while (ctx->Driver.MultipassFunc && 667 ctx->Driver.MultipassFunc( cvaVB, ++p ));667 ctx->Driver.MultipassFunc( cvaVB, ++p )); 668 668 669 669 cvaVB->EltPtr = 0; … … 719 719 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 720 720 721 if (ctx->IndirectTriangles & DD_SW_SETUP) 722 return null_tables; 721 if (ctx->IndirectTriangles & DD_SW_SETUP) 722 return null_tables; 723 723 724 724 switch (fxMesa->render_index) { … … 726 726 return fxDDRenderVBFlat_tables; 727 727 case 0: 728 return fxDDRenderVBSmooth_tables; 728 return fxDDRenderVBSmooth_tables; 729 729 default: 730 return null_tables; 730 return null_tables; 731 731 } 732 732 } … … 743 743 GLint p = 0; 744 744 745 if (fxMesa->new_state) 745 if (fxMesa->new_state) 746 746 fxSetupFXUnits(ctx); 747 747 748 if (VB->Indirect) { 749 return; 748 if (VB->Indirect) { 749 return; 750 750 } else if (VB->CullMode & CLIP_MASK_ACTIVE) { 751 751 tab = fxMesa->RenderVBClippedTab; … … 758 758 759 759 do 760 { 761 for ( i= VB->CopyStart ; i < count ; parity = 0, i = next ) 760 { 761 for ( i= VB->CopyStart ; i < count ; parity = 0, i = next ) 762 762 { 763 prim = VB->Primitive[i];764 next = VB->NextPrimitive[i];765 tab[prim]( VB, i, next, parity );763 prim = VB->Primitive[i]; 764 next = VB->NextPrimitive[i]; 765 tab[prim]( VB, i, next, parity ); 766 766 } 767 767 768 768 } while (ctx->Driver.MultipassFunc && 769 ctx->Driver.MultipassFunc( VB, ++p ));769 ctx->Driver.MultipassFunc( VB, ++p )); 770 770 } 771 771 -
trunk/src/opengl/mesa/3dfx/fxsanity.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. … … 68 68 69 69 GLfloat area = ((v1->x - v3->x) * (v2->y - v3->y) - 70 (v1->y - v3->y) * (v2->x - v3->x));70 (v1->y - v3->y) * (v2->x - v3->x)); 71 71 72 72 if (v1->x < 0 || v1->y < 0 || v1->x > WID || v1->y > HI || 73 73 v2->x < 0 || v2->y < 0 || v2->x > WID || v2->y > HI || 74 v3->x < 0 || v3->y < 0 || v3->x > WID || v3->y > HI) 74 v3->x < 0 || v3->y < 0 || v3->x > WID || v3->y > HI) 75 75 { 76 76 fprintf(stderr,"not clipped/set up!!!!!\n"); … … 94 94 if (print) { 95 95 fprintf(stderr,"v1: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n", 96 v1->x, v1->y, v1->ooz, v1->oow,97 v1->r, v1->g, v1->b, v1->a,98 v1->tmuvtx[0].sow, v1->tmuvtx[0].tow, v1->tmuvtx[0].oow,99 v1->tmuvtx[1].sow, v1->tmuvtx[1].tow, v1->tmuvtx[1].oow);96 v1->x, v1->y, v1->ooz, v1->oow, 97 v1->r, v1->g, v1->b, v1->a, 98 v1->tmuvtx[0].sow, v1->tmuvtx[0].tow, v1->tmuvtx[0].oow, 99 v1->tmuvtx[1].sow, v1->tmuvtx[1].tow, v1->tmuvtx[1].oow); 100 100 fprintf(stderr,"v2: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n", 101 v2->x, v2->y, v2->ooz, v2->oow,102 v2->r, v2->g, v2->b, v2->a,103 v2->tmuvtx[0].sow, v2->tmuvtx[0].tow, v2->tmuvtx[0].oow,104 v2->tmuvtx[1].sow, v2->tmuvtx[1].tow, v2->tmuvtx[1].oow);101 v2->x, v2->y, v2->ooz, v2->oow, 102 v2->r, v2->g, v2->b, v2->a, 103 v2->tmuvtx[0].sow, v2->tmuvtx[0].tow, v2->tmuvtx[0].oow, 104 v2->tmuvtx[1].sow, v2->tmuvtx[1].tow, v2->tmuvtx[1].oow); 105 105 fprintf(stderr,"v3: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n", 106 v3->x, v3->y, v3->ooz, v3->oow,107 v3->r, v3->g, v3->b, v3->a,108 v3->tmuvtx[0].sow, v3->tmuvtx[0].tow, v3->tmuvtx[0].oow,109 v3->tmuvtx[1].sow, v3->tmuvtx[1].tow, v3->tmuvtx[1].oow);106 v3->x, v3->y, v3->ooz, v3->oow, 107 v3->r, v3->g, v3->b, v3->a, 108 v3->tmuvtx[0].sow, v3->tmuvtx[0].tow, v3->tmuvtx[0].oow, 109 v3->tmuvtx[1].sow, v3->tmuvtx[1].tow, v3->tmuvtx[1].oow); 110 110 } 111 111 112 if (1) 112 if (1) 113 113 FX_grDrawTriangle(v1,v2,v3); 114 else 114 else 115 115 fprintf(stderr, "\n\n\n"); 116 116 } 117 117 118 #else 119 120 void gl_fxsanity_dummy() 121 { 122 } 123 118 124 #endif -
trunk/src/opengl/mesa/3dfx/fxsdettmp.h
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. … … 42 42 * See fxapi.h for more revision/author details. 43 43 */ 44 45 46 /* 44 45 46 /* 47 47 * Notes: the folowing code works only if count is > start. 48 48 * Corrently we are looking for the pattern: … … 50 50 * 51 51 * For this: 52 * #define STRIP0 ((u1 == v1) && (u2 == v0))53 * #define STRIP1 ((u0 == v0) && (u2 == v1))52 * #define STRIP0 ((u1 == v1) && (u2 == v0)) 53 * #define STRIP1 ((u0 == v0) && (u2 == v1)) 54 54 * 55 55 */ … … 57 57 58 58 static void TAG(render_vb_triangles_smooth_indirect_sd) 59 ( struct vertex_buffer*VB,60 GLuintstart,61 GLuintcount,62 GLuintparity)59 ( struct vertex_buffer *VB, 60 GLuint start, 61 GLuint count, 62 GLuint parity) 63 63 { 64 64 GLint u0,u1,u2; 65 65 GLint v0,v1,v2; 66 66 GLuint *elt = VB->EltPtr->data; 67 68 int i;67 68 int i; 69 69 LOCAL_VARS 70 70 71 71 INIT(GL_TRIANGLES); 72 72 73 73 elt = &elt[start-1]; 74 74 u0 = *(++elt); … … 81 81 v1 = *(++elt); 82 82 v2 = *(++elt); 83 84 if (CLIPPED(u0,u1,u2)) 83 84 if (CLIPPED(u0,u1,u2)) 85 85 { 86 if (!CULLED(u0,u1,u2)) SENDCLIPTRI(u0,u1,u2);86 if (!CULLED(u0,u1,u2)) SENDCLIPTRI(u0,u1,u2); 87 87 } 88 88 else 89 89 { 90 if (STRIP0(u,v))90 if (STRIP0(u,v)) 91 91 { 92 92 int is_strips = 1; 93 93 int parity = 0; 94 94 STRIPSLOCAL_VAR 95 96 FLUSHTRI();97 STARTSTRIPS(u0,u1,u2);98 while (is_strips && i < count)99 {100 SENDSTRIPS(v2);101 102 u0 = v0; u1 = v1; u2 = v2; i+= 3;103 v0 = *(++elt);104 v1 = *(++elt);105 v2 = *(++elt);106 107 if (parity) {108 is_strips = STRIP0(u,v);109 parity = 0;110 } else {111 is_strips = STRIP1(u,v);112 parity = 1;113 }114 }115 FLUSHSTRIPS();116 117 if (i >= count)118 return;119 }120 else121 {95 96 FLUSHTRI(); 97 STARTSTRIPS(u0,u1,u2); 98 while (is_strips && i < count) 99 { 100 SENDSTRIPS(v2); 101 102 u0 = v0; u1 = v1; u2 = v2; i+= 3; 103 v0 = *(++elt); 104 v1 = *(++elt); 105 v2 = *(++elt); 106 107 if (parity) { 108 is_strips = STRIP0(u,v); 109 parity = 0; 110 } else { 111 is_strips = STRIP1(u,v); 112 parity = 1; 113 } 114 } 115 FLUSHSTRIPS(); 116 117 if (i >= count) 118 return; 119 } 120 else 121 { 122 122 SENDTRI(u0,u1,u2); 123 }123 } 124 124 } 125 125 u0 = v0; u1 = v1; u2 = v2; i+= 3; … … 127 127 if (CLIPPED(u0,u1,u2)) 128 128 { 129 if (!CULLED(u0,u1,u2)) SENDCLIPTRI(u0,u1,u2);129 if (!CULLED(u0,u1,u2)) SENDCLIPTRI(u0,u1,u2); 130 130 } 131 131 else … … 134 134 } 135 135 FLUSHTRI(); 136 136 137 137 } 138 138 139 139 #ifndef PRESERVE_VB_DEFS 140 140 #undef SENDTRI -
trunk/src/opengl/mesa/3dfx/fxsetup.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. … … 57 57 58 58 static GLuint fxGetTexSetConfiguration(GLcontext *ctx, 59 struct gl_texture_object *tObj0,60 struct gl_texture_object *tObj1);59 struct gl_texture_object *tObj0, 60 struct gl_texture_object *tObj1); 61 61 static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset); 62 static void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset); 63 static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, 64 struct gl_texture_object *tObj0, 65 struct gl_texture_object *tObj1); 62 static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, 63 struct gl_texture_object *tObj0, 64 struct gl_texture_object *tObj1); 65 static void fxSetupTexture_NoLock(GLcontext *ctx); 66 static void fxSetupTexture(GLcontext *ctx); 66 67 static void fxSetupBlend(GLcontext *ctx); 67 68 static void fxSetupDepthTest(GLcontext *ctx); 68 static void fxFogTableGenerate(GLcontext *ctx);69 static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild);70 69 static void fxSetupScissor(GLcontext *ctx); 71 70 static void fxSetupCull(GLcontext *ctx); … … 85 84 if(ti->validated) { 86 85 if (MESA_VERBOSE&VERBOSE_DRIVER) { 87 fprintf(stderr,"fxmesa: fxTexValidate(...) End (validated=GL_TRUE)\n");86 fprintf(stderr,"fxmesa: fxTexValidate(...) End (validated=GL_TRUE)\n"); 88 87 } 89 88 return; … … 95 94 96 95 fxTexGetInfo(tObj->Image[minl]->Width, tObj->Image[minl]->Height, 97 &(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)),98 &(ti->sScale), &(ti->tScale),99 &(ti->int_sScale), &(ti->int_tScale), 100 NULL, NULL);96 &(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)), 97 &(ti->sScale), &(ti->tScale), 98 &(ti->int_sScale), &(ti->int_tScale), 99 NULL, NULL); 101 100 102 101 if((tObj->MinFilter!=GL_NEAREST) && (tObj->MinFilter!=GL_LINEAR)) 103 102 fxTexGetInfo(tObj->Image[maxl]->Width,tObj->Image[maxl]->Height, 104 &(FX_smallLodLog2(ti->info)),NULL,105 NULL,NULL,106 NULL,NULL,107 NULL,NULL);103 &(FX_smallLodLog2(ti->info)),NULL, 104 NULL,NULL, 105 NULL,NULL, 106 NULL,NULL); 108 107 else 109 108 FX_smallLodLog2(ti->info)=FX_largeLodLog2(ti->info); 110 109 111 fxTexGetFormat(tObj->Image[minl]-> Format,&(ti->info.format),&(ti->baseLevelInternalFormat));110 fxTexGetFormat(tObj->Image[minl]->IntFormat,&(ti->info.format),&(ti->baseLevelInternalFormat)); 112 111 113 112 switch (tObj->WrapS) { … … 147 146 static void fxPrintUnitsMode( const char *msg, GLuint mode ) 148 147 { 149 fprintf(stderr, 150 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",151 msg,152 mode,153 (mode & FX_UM_E0_REPLACE) ? "E0_REPLACE, " : "",154 (mode & FX_UM_E0_MODULATE) ? "E0_MODULATE, " : "",155 (mode & FX_UM_E0_DECAL) ? "E0_DECAL, " : "",156 (mode & FX_UM_E0_BLEND) ? "E0_BLEND, " : "",157 (mode & FX_UM_E1_REPLACE) ? "E1_REPLACE, " : "",158 (mode & FX_UM_E1_MODULATE) ? "E1_MODULATE, " : "",159 (mode & FX_UM_E1_DECAL) ? "E1_DECAL, " : "",160 (mode & FX_UM_E1_BLEND) ? "E1_BLEND, " : "",161 (mode & FX_UM_E0_ALPHA) ? "E0_ALPHA, " : "",162 (mode & FX_UM_E0_LUMINANCE) ? "E0_LUMINANCE, " : "",163 (mode & FX_UM_E0_LUMINANCE_ALPHA) ? "E0_LUMINANCE_ALPHA, " : "",164 (mode & FX_UM_E0_INTENSITY) ? "E0_INTENSITY, " : "",165 (mode & FX_UM_E0_RGB) ? "E0_RGB, " : "",166 (mode & FX_UM_E0_RGBA) ? "E0_RGBA, " : "",167 (mode & FX_UM_E1_ALPHA) ? "E1_ALPHA, " : "",168 (mode & FX_UM_E1_LUMINANCE) ? "E1_LUMINANCE, " : "",169 (mode & FX_UM_E1_LUMINANCE_ALPHA) ? "E1_LUMINANCE_ALPHA, " : "",170 (mode & FX_UM_E1_INTENSITY) ? "E1_INTENSITY, " : "",171 (mode & FX_UM_E1_RGB) ? "E1_RGB, " : "",172 (mode & FX_UM_E1_RGBA) ? "E1_RGBA, " : "",173 (mode & FX_UM_COLOR_ITERATED) ? "COLOR_ITERATED, " : "",174 (mode & FX_UM_COLOR_CONSTANT) ? "COLOR_CONSTANT, " : "",175 (mode & FX_UM_ALPHA_ITERATED) ? "ALPHA_ITERATED, " : "",176 (mode & FX_UM_ALPHA_CONSTANT) ? "ALPHA_CONSTANT, " : "");148 fprintf(stderr, 149 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", 150 msg, 151 mode, 152 (mode & FX_UM_E0_REPLACE) ? "E0_REPLACE, " : "", 153 (mode & FX_UM_E0_MODULATE) ? "E0_MODULATE, " : "", 154 (mode & FX_UM_E0_DECAL) ? "E0_DECAL, " : "", 155 (mode & FX_UM_E0_BLEND) ? "E0_BLEND, " : "", 156 (mode & FX_UM_E1_REPLACE) ? "E1_REPLACE, " : "", 157 (mode & FX_UM_E1_MODULATE) ? "E1_MODULATE, " : "", 158 (mode & FX_UM_E1_DECAL) ? "E1_DECAL, " : "", 159 (mode & FX_UM_E1_BLEND) ? "E1_BLEND, " : "", 160 (mode & FX_UM_E0_ALPHA) ? "E0_ALPHA, " : "", 161 (mode & FX_UM_E0_LUMINANCE) ? "E0_LUMINANCE, " : "", 162 (mode & FX_UM_E0_LUMINANCE_ALPHA) ? "E0_LUMINANCE_ALPHA, " : "", 163 (mode & FX_UM_E0_INTENSITY) ? "E0_INTENSITY, " : "", 164 (mode & FX_UM_E0_RGB) ? "E0_RGB, " : "", 165 (mode & FX_UM_E0_RGBA) ? "E0_RGBA, " : "", 166 (mode & FX_UM_E1_ALPHA) ? "E1_ALPHA, " : "", 167 (mode & FX_UM_E1_LUMINANCE) ? "E1_LUMINANCE, " : "", 168 (mode & FX_UM_E1_LUMINANCE_ALPHA) ? "E1_LUMINANCE_ALPHA, " : "", 169 (mode & FX_UM_E1_INTENSITY) ? "E1_INTENSITY, " : "", 170 (mode & FX_UM_E1_RGB) ? "E1_RGB, " : "", 171 (mode & FX_UM_E1_RGBA) ? "E1_RGBA, " : "", 172 (mode & FX_UM_COLOR_ITERATED) ? "COLOR_ITERATED, " : "", 173 (mode & FX_UM_COLOR_CONSTANT) ? "COLOR_CONSTANT, " : "", 174 (mode & FX_UM_ALPHA_ITERATED) ? "ALPHA_ITERATED, " : "", 175 (mode & FX_UM_ALPHA_CONSTANT) ? "ALPHA_CONSTANT, " : ""); 177 176 } 178 177 179 178 static GLuint fxGetTexSetConfiguration(GLcontext *ctx, 180 struct gl_texture_object *tObj0,181 struct gl_texture_object *tObj1)179 struct gl_texture_object *tObj0, 180 struct gl_texture_object *tObj1) 182 181 { 183 182 GLuint unitsmode=0; … … 198 197 unitsmode|=FX_UM_COLOR_CONSTANT; 199 198 199 /* 200 OpenGL Feeds Texture 0 into Texture 1 201 Glide Feeds Texture 1 into Texture 0 202 */ 200 203 if(tObj0) { 201 204 tfxTexInfo *ti0=fxTMGetTexInfo(tObj0); … … 310 313 { 311 314 tfxTexInfo *ti=fxTMGetTexInfo(tObj); 312 315 int tmu; 316 317 /* Make sure we're not loaded incorrectly */ 318 if (ti->isInTM) { 319 if (ti->LODblend) { 320 if (ti->whichTMU!=FX_TMU_SPLIT) 321 fxTMMoveOutTM(fxMesa, tObj); 322 } else { 323 if (ti->whichTMU==FX_TMU_SPLIT) 324 fxTMMoveOutTM(fxMesa, tObj); 325 } 326 } 327 328 /* Make sure we're loaded correctly */ 313 329 if (!ti->isInTM) { 314 330 if (ti->LODblend) … … 316 332 else { 317 333 if (fxMesa->haveTwoTMUs) { 318 #if 0 319 /* This path is disabled because we're not correctly setting up 320 the second TMU as the only texture unit. It is arguable if this 321 fallback is ever really a win, because when we use the second 322 TMU we have to do setup for both TMU0 and TMU1 which is extra 323 work. We could just flush a texture from TMU0 instead. */ 324 if (fxMesa->freeTexMem[FX_TMU0] > 325 FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, 326 &(ti->info))) { 327 fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU0); 328 } else { 329 fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU1); 330 } 331 #else 332 fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0); 333 #endif 334 if (fxMesa->freeTexMem[FX_TMU0] > 335 FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, 336 &(ti->info))) { 337 fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU0); 338 } else { 339 fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU1); 340 } 334 341 } else 335 fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU0);342 fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU0); 336 343 } 337 344 } … … 340 347 if ((ti->info.format==GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) { 341 348 if (MESA_VERBOSE&VERBOSE_DRIVER) { 342 fprintf(stderr,"fxmesa: uploading texture palette\n");349 fprintf(stderr,"fxmesa: uploading texture palette\n"); 343 350 } 344 351 FX_grTexDownloadTable_NoLock(GR_TMU0,GR_TEXTABLE_PALETTE,&(ti->palette)); … … 354 361 355 362 FX_grTexSource_NoLock(GR_TMU0,ti->tm[FX_TMU0]->startAddr, 356 GR_MIPMAPLEVELMASK_ODD,&(ti->info));363 GR_MIPMAPLEVELMASK_ODD,&(ti->info)); 357 364 FX_grTexSource_NoLock(GR_TMU1,ti->tm[FX_TMU1]->startAddr, 358 GR_MIPMAPLEVELMASK_EVEN,&(ti->info));365 GR_MIPMAPLEVELMASK_EVEN,&(ti->info)); 359 366 } else { 367 if (ti->whichTMU==FX_TMU_BOTH) tmu=FX_TMU0; 368 else tmu=ti->whichTMU; 369 360 370 if((ti->info.format==GR_TEXFMT_P_8) && (!fxMesa->haveGlobalPaletteTexture)) { 361 371 if (MESA_VERBOSE&VERBOSE_DRIVER) { 362 fprintf(stderr,"fxmesa: uploading texture palette\n");372 fprintf(stderr,"fxmesa: uploading texture palette\n"); 363 373 } 364 FX_grTexDownloadTable_NoLock(t i->whichTMU,GR_TEXTABLE_PALETTE,&(ti->palette));374 FX_grTexDownloadTable_NoLock(tmu, GR_TEXTABLE_PALETTE, &(ti->palette)); 365 375 } 366 376 367 377 /* KW: The alternative is to do the download to the other tmu. If 368 378 * we get to this point, I think it means we are thrashing the 369 * texture memory, so perhaps it's not a good idea. 379 * texture memory, so perhaps it's not a good idea. 370 380 */ 371 381 if (ti->LODblend && (MESA_VERBOSE&VERBOSE_DRIVER)) 372 382 fprintf(stderr, "fxmesa: not blending texture - only on one tmu\n"); 373 383 374 FX_grTexClampMode_NoLock(ti->whichTMU,ti->sClamp,ti->tClamp); 375 FX_grTexFilterMode_NoLock(ti->whichTMU,ti->minFilt,ti->maxFilt); 376 FX_grTexMipMapMode_NoLock(ti->whichTMU,ti->mmMode,FXFALSE); 377 378 FX_grTexSource_NoLock(ti->whichTMU, 379 ti->tm[ti->whichTMU]->startAddr, 380 GR_MIPMAPLEVELMASK_BOTH,&(ti->info)); 381 } 382 } 383 384 static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tObj) { 385 BEGIN_BOARD_LOCK(); 386 fxSetupSingleTMU_NoLock(fxMesa, tObj); 387 END_BOARD_LOCK(); 388 } 389 390 static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, 391 FxBool LODblend) 392 { 393 if (MESA_VERBOSE&VERBOSE_DRIVER) { 394 fprintf(stderr,"fxmesa: fxSelectSingleTMUSrc(%d,%d)\n",tmu,LODblend); 395 } 396 397 if(LODblend) { 384 FX_grTexClampMode_NoLock(tmu, ti->sClamp, ti->tClamp); 385 FX_grTexFilterMode_NoLock(tmu, ti->minFilt, ti->maxFilt); 386 FX_grTexMipMapMode_NoLock(tmu, ti->mmMode, FXFALSE); 387 388 FX_grTexSource_NoLock(tmu, ti->tm[tmu]->startAddr, 389 GR_MIPMAPLEVELMASK_BOTH, &(ti->info)); 390 } 391 } 392 393 static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, 394 FxBool LODblend) 395 { 396 if (MESA_VERBOSE&VERBOSE_DRIVER) { 397 fprintf(stderr,"fxmesa: fxSelectSingleTMUSrc(%d,%d)\n",tmu,LODblend); 398 } 399 400 if (LODblend) { 398 401 FX_grTexCombine_NoLock(GR_TMU0, 399 GR_COMBINE_FUNCTION_BLEND, 400 GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, 401 GR_COMBINE_FUNCTION_BLEND, 402 GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, 403 FXFALSE,FXFALSE); 404 405 FX_grTexCombine_NoLock(GR_TMU1, 406 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 407 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 408 FXFALSE,FXFALSE); 402 GR_COMBINE_FUNCTION_BLEND, 403 GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, 404 GR_COMBINE_FUNCTION_BLEND, 405 GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, 406 FXFALSE,FXFALSE); 407 408 if (fxMesa->haveTwoTMUs) 409 FX_grTexCombine_NoLock(GR_TMU1, 410 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 411 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 412 FXFALSE,FXFALSE); 409 413 fxMesa->tmuSrc=FX_TMU_SPLIT; 410 } else { 411 if(tmu==FX_TMU0) { 414 } 415 else { 416 if (tmu!=FX_TMU1) { 412 417 FX_grTexCombine_NoLock(GR_TMU0, 413 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 414 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 415 FXFALSE,FXFALSE); 418 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 419 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 420 FXFALSE,FXFALSE); 421 if (fxMesa->haveTwoTMUs) { 422 FX_grTexCombine_NoLock(GR_TMU1, 423 GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, 424 GR_COMBINE_FUNCTION_ZERO, GR_COMBINE_FACTOR_NONE, 425 FXFALSE,FXFALSE); 426 } 416 427 fxMesa->tmuSrc=FX_TMU0; 417 } else { 428 } 429 else { 418 430 FX_grTexCombine_NoLock(GR_TMU1, 419 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,420 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,421 FXFALSE,FXFALSE);422 431 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 432 GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, 433 FXFALSE,FXFALSE); 434 423 435 /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */ 424 436 425 437 FX_grTexCombine_NoLock(GR_TMU0, 426 GR_COMBINE_FUNCTION_BLEND,427 GR_COMBINE_FACTOR_ONE,428 GR_COMBINE_FUNCTION_BLEND,429 GR_COMBINE_FACTOR_ONE,430 FXFALSE,FXFALSE);431 438 GR_COMBINE_FUNCTION_BLEND, 439 GR_COMBINE_FACTOR_ONE, 440 GR_COMBINE_FUNCTION_BLEND, 441 GR_COMBINE_FACTOR_ONE, 442 FXFALSE,FXFALSE); 443 432 444 fxMesa->tmuSrc=FX_TMU1; 433 445 } … … 443 455 tfxTexInfo *ti; 444 456 struct gl_texture_object *tObj=ctx->Texture.Unit[textureset].CurrentD[2]; 457 int tmu; 445 458 446 459 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 454 467 fxSetupSingleTMU_NoLock(fxMesa,tObj); 455 468 456 if(fxMesa->tmuSrc!=ti->whichTMU) 457 fxSelectSingleTMUSrc_NoLock(fxMesa,ti->whichTMU,ti->LODblend); 469 if (ti->whichTMU==FX_TMU_BOTH) tmu=FX_TMU0; 470 else tmu=ti->whichTMU; 471 if (fxMesa->tmuSrc!=tmu) 472 fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend); 458 473 459 474 if(textureset==0 || !fxMesa->haveTwoTMUs) … … 484 499 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE)) 485 500 fprintf(stderr, "fxMesa: fxSetupTextureSingleTMU, envmode is %s\n", 486 gl_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));501 gl_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode)); 487 502 488 503 switch(ctx->Texture.Unit[textureset].EnvMode) { 489 504 case GL_DECAL: 490 505 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 491 GR_COMBINE_FACTOR_NONE,492 locala,493 GR_COMBINE_OTHER_NONE,494 FXFALSE);506 GR_COMBINE_FACTOR_NONE, 507 locala, 508 GR_COMBINE_OTHER_NONE, 509 FXFALSE); 495 510 496 511 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_BLEND, 497 GR_COMBINE_FACTOR_TEXTURE_ALPHA,498 localc,499 GR_COMBINE_OTHER_TEXTURE,500 FXFALSE);512 GR_COMBINE_FACTOR_TEXTURE_ALPHA, 513 localc, 514 GR_COMBINE_OTHER_TEXTURE, 515 FXFALSE); 501 516 break; 502 517 case GL_MODULATE: 503 518 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 504 GR_COMBINE_FACTOR_LOCAL,505 locala,506 GR_COMBINE_OTHER_TEXTURE,507 FXFALSE);519 GR_COMBINE_FACTOR_LOCAL, 520 locala, 521 GR_COMBINE_OTHER_TEXTURE, 522 FXFALSE); 508 523 509 524 if(ifmt==GL_ALPHA) 510 525 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 511 GR_COMBINE_FACTOR_NONE,512 localc,513 GR_COMBINE_OTHER_NONE,514 FXFALSE);526 GR_COMBINE_FACTOR_NONE, 527 localc, 528 GR_COMBINE_OTHER_NONE, 529 FXFALSE); 515 530 else 516 531 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 517 GR_COMBINE_FACTOR_LOCAL,518 localc,519 GR_COMBINE_OTHER_TEXTURE,520 FXFALSE);532 GR_COMBINE_FACTOR_LOCAL, 533 localc, 534 GR_COMBINE_OTHER_TEXTURE, 535 FXFALSE); 521 536 break; 522 537 case GL_BLEND: 538 #if 0 523 539 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 524 GR_COMBINE_FACTOR_LOCAL,525 locala,526 GR_COMBINE_OTHER_TEXTURE,527 FXFALSE);540 GR_COMBINE_FACTOR_LOCAL, 541 locala, 542 GR_COMBINE_OTHER_TEXTURE, 543 FXFALSE); 528 544 if (ifmt==GL_ALPHA) 529 545 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 530 GR_COMBINE_FACTOR_NONE,531 localc,532 GR_COMBINE_OTHER_NONE,533 FXFALSE);546 GR_COMBINE_FACTOR_NONE, 547 localc, 548 GR_COMBINE_OTHER_NONE, 549 FXFALSE); 534 550 else 535 551 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, 536 GR_COMBINE_FACTOR_LOCAL, 537 localc, 538 GR_COMBINE_OTHER_TEXTURE, 539 FXTRUE); 540 /*ctx->Driver.MultipassFunc = fxMultipassBlend;*/ 552 GR_COMBINE_FACTOR_LOCAL, 553 localc, 554 GR_COMBINE_OTHER_TEXTURE, 555 FXTRUE); 556 ctx->Driver.MultipassFunc = fxMultipassBlend; 557 #else 558 #ifndef FX_SILENT 559 fprintf(stderr,"fx Driver: GL_BLEND not yet supported\n"); 560 #endif 561 #endif 541 562 break; 542 563 case GL_REPLACE: 543 564 if((ifmt==GL_RGB) || (ifmt==GL_LUMINANCE)) 544 565 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 545 GR_COMBINE_FACTOR_NONE,546 locala,547 GR_COMBINE_OTHER_NONE,548 FXFALSE);566 GR_COMBINE_FACTOR_NONE, 567 locala, 568 GR_COMBINE_OTHER_NONE, 569 FXFALSE); 549 570 else 550 571 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 551 GR_COMBINE_FACTOR_ONE,552 locala,553 GR_COMBINE_OTHER_TEXTURE,554 FXFALSE);555 572 GR_COMBINE_FACTOR_ONE, 573 locala, 574 GR_COMBINE_OTHER_TEXTURE, 575 FXFALSE); 576 556 577 if(ifmt==GL_ALPHA) 557 578 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 558 GR_COMBINE_FACTOR_NONE,559 localc,560 GR_COMBINE_OTHER_NONE,561 FXFALSE);579 GR_COMBINE_FACTOR_NONE, 580 localc, 581 GR_COMBINE_OTHER_NONE, 582 FXFALSE); 562 583 else 563 584 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 564 GR_COMBINE_FACTOR_ONE,565 localc,566 GR_COMBINE_OTHER_TEXTURE,567 FXFALSE);585 GR_COMBINE_FACTOR_ONE, 586 localc, 587 GR_COMBINE_OTHER_TEXTURE, 588 FXFALSE); 568 589 break; 569 590 default: … … 587 608 /************************* Double Texture Set ***************************/ 588 609 589 static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, 590 struct gl_texture_object *tObj0,591 struct gl_texture_object *tObj1)610 static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, 611 struct gl_texture_object *tObj0, 612 struct gl_texture_object *tObj1) 592 613 { 593 614 #define T0_NOT_IN_TMU 0x01 … … 601 622 tfxTexInfo *ti1=fxTMGetTexInfo(tObj1); 602 623 GLuint tstate=0; 624 int tmu0=0, tmu1=1; 603 625 604 626 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 606 628 } 607 629 608 if(ti0->isInTM) { 609 if(ti0->whichTMU==FX_TMU0) 630 /* We shouldn't need to do this. There is something wrong with 631 mutlitexturing when the TMUs are swapped. So, we're forcing 632 them to always be loaded correctly. !!! */ 633 if (ti0->whichTMU==FX_TMU1) 634 fxTMMoveOutTM_NoLock(fxMesa, tObj0); 635 if (ti1->whichTMU==FX_TMU0) 636 fxTMMoveOutTM_NoLock(fxMesa, tObj1); 637 638 if (ti0->isInTM) { 639 switch (ti0->whichTMU) { 640 case FX_TMU0: 610 641 tstate|=T0_IN_TMU0; 611 else if(ti0->whichTMU==FX_TMU1) 642 break; 643 case FX_TMU1: 612 644 tstate|=T0_IN_TMU1; 613 else { 614 fxTMMoveOutTM(fxMesa,tObj0); 645 break; 646 case FX_TMU_BOTH: 647 tstate|=T0_IN_TMU0|T0_IN_TMU1; 648 break; 649 case FX_TMU_SPLIT: 615 650 tstate|=T0_NOT_IN_TMU; 616 } 617 } else 618 tstate|=T0_NOT_IN_TMU; 619 620 if(ti1->isInTM) { 621 if(ti1->whichTMU==FX_TMU0) 651 break; 652 } 653 } else tstate|=T0_NOT_IN_TMU; 654 655 if (ti1->isInTM) { 656 switch (ti1->whichTMU) { 657 case FX_TMU0: 622 658 tstate|=T1_IN_TMU0; 623 else if(ti1->whichTMU==FX_TMU1) 659 break; 660 case FX_TMU1: 624 661 tstate|=T1_IN_TMU1; 625 else { 626 fxTMMoveOutTM(fxMesa,tObj1); 662 break; 663 case FX_TMU_BOTH: 664 tstate|=T1_IN_TMU0|T1_IN_TMU1; 665 break; 666 case FX_TMU_SPLIT: 627 667 tstate|=T1_NOT_IN_TMU; 628 }629 } else630 tstate|=T1_NOT_IN_TMU;668 break; 669 } 670 } else tstate|=T1_NOT_IN_TMU; 631 671 632 672 ti0->lastTimeUsed=fxMesa->texBindNumber; 633 673 ti1->lastTimeUsed=fxMesa->texBindNumber; 634 674 635 /* Move texture maps in TMUs */ 636 637 switch(tstate) { 638 case (T0_IN_TMU0 | T1_IN_TMU0): 639 fxTMMoveOutTM(fxMesa,tObj1); 640 641 fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1); 642 break; 643 644 case (T0_IN_TMU1 | T1_IN_TMU1): 645 fxTMMoveOutTM(fxMesa,tObj0); 646 647 fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0); 648 break; 649 650 case (T0_NOT_IN_TMU | T1_NOT_IN_TMU): 651 fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0); 652 fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1); 653 break; 654 655 /*** T0/T1 ***/ 656 657 case (T0_NOT_IN_TMU | T1_IN_TMU0): 658 fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU1); 659 break; 660 661 case (T0_NOT_IN_TMU | T1_IN_TMU1): 662 fxTMMoveInTM_NoLock(fxMesa,tObj0,FX_TMU0); 663 break; 664 665 case (T0_IN_TMU0 | T1_NOT_IN_TMU): 666 fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU1); 667 break; 668 669 case (T0_IN_TMU1 | T1_NOT_IN_TMU): 670 fxTMMoveInTM_NoLock(fxMesa,tObj1,FX_TMU0); 671 break; 672 673 /*** Best Case ***/ 674 675 case (T0_IN_TMU1 | T1_IN_TMU0): 676 case (T0_IN_TMU0 | T1_IN_TMU1): 677 break; 678 679 default: 680 fprintf(stderr,"fx Driver: internal error in fxSetupDoubleTMU()\n"); 681 fxCloseHardware(); 682 exit(-1); 683 break; 675 /* Move texture maps into TMUs */ 676 677 if (!(((tstate&T0_IN_TMU0) && (tstate&T1_IN_TMU1)) || 678 ((tstate&T0_IN_TMU1) && (tstate&T1_IN_TMU0)))) { 679 if (tObj0==tObj1) fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU_BOTH); 680 else { 681 /* Find the minimal way to correct the situation */ 682 if ((tstate&T0_IN_TMU0) || (tstate&T1_IN_TMU1)) { 683 /* We have one in the standard order, setup the other */ 684 if (tstate&T0_IN_TMU0) { /* T0 is in TMU0, put T1 in TMU1 */ 685 fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1); 686 } else { 687 fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0); 688 } 689 /* tmu0 and tmu1 are setup */ 690 } else if ((tstate&T0_IN_TMU1) || (tstate&T1_IN_TMU0)) { 691 /* we have one in the reverse order, setup the other */ 692 if (tstate&T1_IN_TMU0) { /* T1 is in TMU0, put T0 in TMU1 */ 693 fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU1); 694 } else { 695 fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0); 696 } 697 tmu0=1; 698 tmu1=0; 699 } else { /* Nothing is loaded */ 700 fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0); 701 fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1); 702 /* tmu0 and tmu1 are setup */ 703 } 704 } 684 705 } 685 706 … … 687 708 if (ti0->info.format==GR_TEXFMT_P_8) { 688 709 if (MESA_VERBOSE&VERBOSE_DRIVER) { 689 fprintf(stderr,"fxmesa: uploading texture palette TMU0\n");710 fprintf(stderr,"fxmesa: uploading texture palette TMU0\n"); 690 711 } 691 FX_grTexDownloadTable_NoLock(t i0->whichTMU,GR_TEXTABLE_PALETTE,&(ti0->palette));712 FX_grTexDownloadTable_NoLock(tmu0, GR_TEXTABLE_PALETTE, &(ti0->palette)); 692 713 } 693 714 694 715 if (ti1->info.format==GR_TEXFMT_P_8) { 695 716 if (MESA_VERBOSE&VERBOSE_DRIVER) { 696 fprintf(stderr,"fxmesa: uploading texture palette TMU1\n");717 fprintf(stderr,"fxmesa: uploading texture palette TMU1\n"); 697 718 } 698 FX_grTexDownloadTable_NoLock(ti1->whichTMU, GR_TEXTABLE_PALETTE,&(ti1->palette)); 699 } 700 } 701 702 FX_grTexSource_NoLock(ti0->whichTMU, 703 ti0->tm[ti0->whichTMU]->startAddr, 704 GR_MIPMAPLEVELMASK_BOTH,&(ti0->info)); 705 FX_grTexClampMode_NoLock(ti0->whichTMU,ti0->sClamp,ti0->tClamp); 706 FX_grTexFilterMode_NoLock(ti0->whichTMU,ti0->minFilt,ti0->maxFilt); 707 FX_grTexMipMapMode_NoLock(ti0->whichTMU,ti0->mmMode,FXFALSE); 708 709 FX_grTexSource_NoLock(ti1->whichTMU, 710 ti1->tm[ti1->whichTMU]->startAddr, 711 GR_MIPMAPLEVELMASK_BOTH,&(ti1->info)); 712 FX_grTexClampMode_NoLock(ti1->whichTMU,ti1->sClamp,ti1->tClamp); 713 FX_grTexFilterMode_NoLock(ti1->whichTMU,ti1->minFilt,ti1->maxFilt); 714 FX_grTexMipMapMode_NoLock(ti1->whichTMU,ti1->mmMode,FXFALSE); 719 FX_grTexDownloadTable_NoLock(tmu1, GR_TEXTABLE_PALETTE, &(ti1->palette)); 720 } 721 } 722 723 FX_grTexSource_NoLock(tmu0, ti0->tm[tmu0]->startAddr, 724 GR_MIPMAPLEVELMASK_BOTH, &(ti0->info)); 725 FX_grTexClampMode_NoLock(tmu0, ti0->sClamp, ti0->tClamp); 726 FX_grTexFilterMode_NoLock(tmu0, ti0->minFilt, ti0->maxFilt); 727 FX_grTexMipMapMode_NoLock(tmu0, ti0->mmMode, FXFALSE); 728 729 FX_grTexSource_NoLock(tmu1, ti1->tm[tmu1]->startAddr, 730 GR_MIPMAPLEVELMASK_BOTH, &(ti1->info)); 731 FX_grTexClampMode_NoLock(tmu1, ti1->sClamp, ti1->tClamp); 732 FX_grTexFilterMode_NoLock(tmu1, ti1->minFilt, ti1->maxFilt); 733 FX_grTexMipMapMode_NoLock(tmu1, ti1->mmMode, FXFALSE); 715 734 716 735 #undef T0_NOT_IN_TMU … … 730 749 struct gl_texture_object *tObj1=ctx->Texture.Unit[1].CurrentD[2]; 731 750 GLuint envmode,ifmt,unitsmode; 751 int tmu0=0, tmu1=1; 732 752 733 753 if (MESA_VERBOSE&VERBOSE_DRIVER) { … … 769 789 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE)) 770 790 fprintf(stderr, "fxMesa: fxSetupTextureDoubleTMU, envmode is %s/%s\n", 771 gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), 772 gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode)); 773 774 791 gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), 792 gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode)); 793 794 795 if ((ti0->whichTMU==FX_TMU1) || (ti1->whichTMU==FX_TMU0)) { 796 tmu0=1; 797 tmu1=0; 798 } 775 799 fxMesa->tmuSrc=FX_TMU_BOTH; 776 800 switch(envmode) { … … 780 804 781 805 if(ti0->baseLevelInternalFormat==GL_ALPHA) 782 isalpha[ti0->whichTMU]=GL_TRUE;806 isalpha[tmu0]=GL_TRUE; 783 807 else 784 isalpha[ti0->whichTMU]=GL_FALSE;808 isalpha[tmu0]=GL_FALSE; 785 809 786 810 if(ti1->baseLevelInternalFormat==GL_ALPHA) 787 isalpha[ti1->whichTMU]=GL_TRUE;811 isalpha[tmu1]=GL_TRUE; 788 812 else 789 isalpha[ti1->whichTMU]=GL_FALSE;790 813 isalpha[tmu1]=GL_FALSE; 814 791 815 if(isalpha[FX_TMU1]) 792 FX_grTexCombine_NoLock(GR_TMU1,793 GR_COMBINE_FUNCTION_ZERO,794 GR_COMBINE_FACTOR_NONE,795 GR_COMBINE_FUNCTION_LOCAL,796 GR_COMBINE_FACTOR_NONE,797 FXTRUE,FXFALSE);816 FX_grTexCombine_NoLock(GR_TMU1, 817 GR_COMBINE_FUNCTION_ZERO, 818 GR_COMBINE_FACTOR_NONE, 819 GR_COMBINE_FUNCTION_LOCAL, 820 GR_COMBINE_FACTOR_NONE, 821 FXTRUE,FXFALSE); 798 822 else 799 FX_grTexCombine_NoLock(GR_TMU1,800 GR_COMBINE_FUNCTION_LOCAL,801 GR_COMBINE_FACTOR_NONE,802 GR_COMBINE_FUNCTION_LOCAL,803 GR_COMBINE_FACTOR_NONE,804 FXFALSE,FXFALSE);823 FX_grTexCombine_NoLock(GR_TMU1, 824 GR_COMBINE_FUNCTION_LOCAL, 825 GR_COMBINE_FACTOR_NONE, 826 GR_COMBINE_FUNCTION_LOCAL, 827 GR_COMBINE_FACTOR_NONE, 828 FXFALSE,FXFALSE); 805 829 806 830 if(isalpha[FX_TMU0]) 807 FX_grTexCombine_NoLock(GR_TMU0,808 GR_COMBINE_FUNCTION_BLEND_OTHER,809 GR_COMBINE_FACTOR_ONE,810 GR_COMBINE_FUNCTION_BLEND_OTHER,811 GR_COMBINE_FACTOR_LOCAL,812 FXFALSE,FXFALSE);831 FX_grTexCombine_NoLock(GR_TMU0, 832 GR_COMBINE_FUNCTION_BLEND_OTHER, 833 GR_COMBINE_FACTOR_ONE, 834 GR_COMBINE_FUNCTION_BLEND_OTHER, 835 GR_COMBINE_FACTOR_LOCAL, 836 FXFALSE,FXFALSE); 813 837 else 814 FX_grTexCombine_NoLock(GR_TMU0,815 GR_COMBINE_FUNCTION_BLEND_OTHER,816 GR_COMBINE_FACTOR_LOCAL,817 GR_COMBINE_FUNCTION_BLEND_OTHER,818 GR_COMBINE_FACTOR_LOCAL,819 FXFALSE,FXFALSE);838 FX_grTexCombine_NoLock(GR_TMU0, 839 GR_COMBINE_FUNCTION_BLEND_OTHER, 840 GR_COMBINE_FACTOR_LOCAL, 841 GR_COMBINE_FUNCTION_BLEND_OTHER, 842 GR_COMBINE_FACTOR_LOCAL, 843 FXFALSE,FXFALSE); 820 844 821 845 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 822 GR_COMBINE_FACTOR_LOCAL,823 localc,824 GR_COMBINE_OTHER_TEXTURE,825 FXFALSE);846 GR_COMBINE_FACTOR_LOCAL, 847 localc, 848 GR_COMBINE_OTHER_TEXTURE, 849 FXFALSE); 826 850 827 851 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 828 GR_COMBINE_FACTOR_LOCAL,829 locala,830 GR_COMBINE_OTHER_TEXTURE,831 FXFALSE);852 GR_COMBINE_FACTOR_LOCAL, 853 locala, 854 GR_COMBINE_OTHER_TEXTURE, 855 FXFALSE); 832 856 break; 833 857 } 834 858 case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */ 835 if (ti1->whichTMU==FX_TMU1) {859 if (tmu1==FX_TMU1) { 836 860 FX_grTexCombine_NoLock(GR_TMU1, 837 GR_COMBINE_FUNCTION_LOCAL,838 GR_COMBINE_FACTOR_NONE,839 GR_COMBINE_FUNCTION_LOCAL,840 GR_COMBINE_FACTOR_NONE,841 FXTRUE,FXFALSE);842 861 GR_COMBINE_FUNCTION_LOCAL, 862 GR_COMBINE_FACTOR_NONE, 863 GR_COMBINE_FUNCTION_LOCAL, 864 GR_COMBINE_FACTOR_NONE, 865 FXTRUE,FXFALSE); 866 843 867 FX_grTexCombine_NoLock(GR_TMU0, 844 GR_COMBINE_FUNCTION_BLEND_OTHER,845 GR_COMBINE_FACTOR_LOCAL,846 GR_COMBINE_FUNCTION_BLEND_OTHER,847 GR_COMBINE_FACTOR_LOCAL,848 FXFALSE,FXFALSE);868 GR_COMBINE_FUNCTION_BLEND_OTHER, 869 GR_COMBINE_FACTOR_LOCAL, 870 GR_COMBINE_FUNCTION_BLEND_OTHER, 871 GR_COMBINE_FACTOR_LOCAL, 872 FXFALSE,FXFALSE); 849 873 } else { 850 874 FX_grTexCombine_NoLock(GR_TMU1, 851 GR_COMBINE_FUNCTION_LOCAL,852 GR_COMBINE_FACTOR_NONE,853 GR_COMBINE_FUNCTION_LOCAL,854 GR_COMBINE_FACTOR_NONE,855 FXFALSE,FXFALSE);856 875 GR_COMBINE_FUNCTION_LOCAL, 876 GR_COMBINE_FACTOR_NONE, 877 GR_COMBINE_FUNCTION_LOCAL, 878 GR_COMBINE_FACTOR_NONE, 879 FXFALSE,FXFALSE); 880 857 881 FX_grTexCombine_NoLock(GR_TMU0, 858 GR_COMBINE_FUNCTION_BLEND_OTHER,859 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,860 GR_COMBINE_FUNCTION_BLEND_OTHER,861 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,862 FXFALSE,FXFALSE);863 } 864 882 GR_COMBINE_FUNCTION_BLEND_OTHER, 883 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL, 884 GR_COMBINE_FUNCTION_BLEND_OTHER, 885 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL, 886 FXFALSE,FXFALSE); 887 } 888 865 889 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 866 GR_COMBINE_FACTOR_NONE,867 locala,868 GR_COMBINE_OTHER_NONE,869 FXFALSE);890 GR_COMBINE_FACTOR_NONE, 891 locala, 892 GR_COMBINE_OTHER_NONE, 893 FXFALSE); 870 894 871 895 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 872 GR_COMBINE_FACTOR_ONE,873 localc,874 GR_COMBINE_OTHER_TEXTURE,875 FXFALSE);896 GR_COMBINE_FACTOR_ONE, 897 localc, 898 GR_COMBINE_OTHER_TEXTURE, 899 FXFALSE); 876 900 break; 877 901 case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */ 878 if (ti1->whichTMU==FX_TMU1) {902 if (tmu1==FX_TMU1) { 879 903 FX_grTexCombine_NoLock(GR_TMU1, 880 GR_COMBINE_FUNCTION_LOCAL,881 GR_COMBINE_FACTOR_NONE,882 GR_COMBINE_FUNCTION_ZERO,883 GR_COMBINE_FACTOR_NONE,884 FXFALSE,FXTRUE);885 904 GR_COMBINE_FUNCTION_LOCAL, 905 GR_COMBINE_FACTOR_NONE, 906 GR_COMBINE_FUNCTION_ZERO, 907 GR_COMBINE_FACTOR_NONE, 908 FXFALSE,FXTRUE); 909 886 910 FX_grTexCombine_NoLock(GR_TMU0, 887 GR_COMBINE_FUNCTION_BLEND_OTHER,888 GR_COMBINE_FACTOR_LOCAL,889 GR_COMBINE_FUNCTION_BLEND_OTHER,890 GR_COMBINE_FACTOR_LOCAL,891 FXFALSE,FXFALSE);911 GR_COMBINE_FUNCTION_BLEND_OTHER, 912 GR_COMBINE_FACTOR_LOCAL, 913 GR_COMBINE_FUNCTION_BLEND_OTHER, 914 GR_COMBINE_FACTOR_LOCAL, 915 FXFALSE,FXFALSE); 892 916 893 917 } else { 894 918 FX_grTexCombine_NoLock(GR_TMU1, 895 GR_COMBINE_FUNCTION_LOCAL,896 GR_COMBINE_FACTOR_NONE,897 GR_COMBINE_FUNCTION_LOCAL,898 GR_COMBINE_FACTOR_NONE,899 FXFALSE,FXFALSE);900 919 GR_COMBINE_FUNCTION_LOCAL, 920 GR_COMBINE_FACTOR_NONE, 921 GR_COMBINE_FUNCTION_LOCAL, 922 GR_COMBINE_FACTOR_NONE, 923 FXFALSE,FXFALSE); 924 901 925 FX_grTexCombine_NoLock(GR_TMU0, 902 GR_COMBINE_FUNCTION_BLEND_OTHER,903 GR_COMBINE_FACTOR_LOCAL,904 GR_COMBINE_FUNCTION_BLEND_OTHER,905 GR_COMBINE_FACTOR_ONE,906 FXFALSE,FXFALSE);907 } 908 926 GR_COMBINE_FUNCTION_BLEND_OTHER, 927 GR_COMBINE_FACTOR_LOCAL, 928 GR_COMBINE_FUNCTION_BLEND_OTHER, 929 GR_COMBINE_FACTOR_ONE, 930 FXFALSE,FXFALSE); 931 } 932 909 933 if(ti0->baseLevelInternalFormat==GL_RGB) 910 934 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 911 GR_COMBINE_FACTOR_NONE,912 locala,913 GR_COMBINE_OTHER_NONE,914 FXFALSE);935 GR_COMBINE_FACTOR_NONE, 936 locala, 937 GR_COMBINE_OTHER_NONE, 938 FXFALSE); 915 939 else 916 940 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 917 GR_COMBINE_FACTOR_ONE,918 locala,919 GR_COMBINE_OTHER_NONE,920 FXFALSE);941 GR_COMBINE_FACTOR_ONE, 942 locala, 943 GR_COMBINE_OTHER_NONE, 944 FXFALSE); 921 945 922 946 923 947 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 924 GR_COMBINE_FACTOR_ONE,925 localc,926 GR_COMBINE_OTHER_TEXTURE,927 FXFALSE);928 break; 929 948 GR_COMBINE_FACTOR_ONE, 949 localc, 950 GR_COMBINE_OTHER_TEXTURE, 951 FXFALSE); 952 break; 953 930 954 931 955 case (FX_UM_E0_MODULATE | FX_UM_E1_ADD): /* Quake 3 Sky */ … … 934 958 935 959 if(ti0->baseLevelInternalFormat==GL_ALPHA) 936 isalpha[ti0->whichTMU]=GL_TRUE;960 isalpha[tmu0]=GL_TRUE; 937 961 else 938 isalpha[ti0->whichTMU]=GL_FALSE;962 isalpha[tmu0]=GL_FALSE; 939 963 940 964 if(ti1->baseLevelInternalFormat==GL_ALPHA) 941 isalpha[ti1->whichTMU]=GL_TRUE;965 isalpha[tmu1]=GL_TRUE; 942 966 else 943 isalpha[ti1->whichTMU]=GL_FALSE;944 967 isalpha[tmu1]=GL_FALSE; 968 945 969 if(isalpha[FX_TMU1]) 946 FX_grTexCombine_NoLock(GR_TMU1,947 GR_COMBINE_FUNCTION_ZERO,948 GR_COMBINE_FACTOR_NONE,949 GR_COMBINE_FUNCTION_LOCAL,950 GR_COMBINE_FACTOR_NONE,951 FXTRUE,FXFALSE);970 FX_grTexCombine_NoLock(GR_TMU1, 971 GR_COMBINE_FUNCTION_ZERO, 972 GR_COMBINE_FACTOR_NONE, 973 GR_COMBINE_FUNCTION_LOCAL, 974 GR_COMBINE_FACTOR_NONE, 975 FXTRUE,FXFALSE); 952 976 else 953 FX_grTexCombine_NoLock(GR_TMU1,954 GR_COMBINE_FUNCTION_LOCAL,955 GR_COMBINE_FACTOR_NONE,956 GR_COMBINE_FUNCTION_LOCAL,957 GR_COMBINE_FACTOR_NONE,958 FXFALSE,FXFALSE);977 FX_grTexCombine_NoLock(GR_TMU1, 978 GR_COMBINE_FUNCTION_LOCAL, 979 GR_COMBINE_FACTOR_NONE, 980 GR_COMBINE_FUNCTION_LOCAL, 981 GR_COMBINE_FACTOR_NONE, 982 FXFALSE,FXFALSE); 959 983 960 984 if(isalpha[FX_TMU0]) 961 FX_grTexCombine_NoLock(GR_TMU0,962 GR_COMBINE_FUNCTION_SCALE_OTHER,963 GR_COMBINE_FACTOR_ONE,964 GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,965 GR_COMBINE_FACTOR_ONE,966 FXFALSE,FXFALSE);985 FX_grTexCombine_NoLock(GR_TMU0, 986 GR_COMBINE_FUNCTION_SCALE_OTHER, 987 GR_COMBINE_FACTOR_ONE, 988 GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, 989 GR_COMBINE_FACTOR_ONE, 990 FXFALSE,FXFALSE); 967 991 else 968 FX_grTexCombine_NoLock(GR_TMU0,969 GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,970 GR_COMBINE_FACTOR_ONE,971 GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,972 GR_COMBINE_FACTOR_ONE,973 FXFALSE,FXFALSE);992 FX_grTexCombine_NoLock(GR_TMU0, 993 GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, 994 GR_COMBINE_FACTOR_ONE, 995 GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, 996 GR_COMBINE_FACTOR_ONE, 997 FXFALSE,FXFALSE); 974 998 975 999 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 976 GR_COMBINE_FACTOR_LOCAL,977 localc,978 GR_COMBINE_OTHER_TEXTURE,979 FXFALSE);1000 GR_COMBINE_FACTOR_LOCAL, 1001 localc, 1002 GR_COMBINE_OTHER_TEXTURE, 1003 FXFALSE); 980 1004 981 1005 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER, 982 GR_COMBINE_FACTOR_LOCAL, 983 locala, 984 GR_COMBINE_OTHER_TEXTURE, 985 FXFALSE); 986 break; 987 } 988 1006 GR_COMBINE_FACTOR_LOCAL, 1007 locala, 1008 GR_COMBINE_OTHER_TEXTURE, 1009 FXFALSE); 1010 break; 1011 } 1012 default: 1013 fprintf(stderr, "Unexpected dual texture mode encountered\n"); 1014 break; 989 1015 } 990 1016 … … 1012 1038 else 1013 1039 locala=GR_COMBINE_LOCAL_CONSTANT; 1014 1040 1015 1041 if(ctx->Light.ShadeModel==GL_SMOOTH) 1016 1042 localc=GR_COMBINE_LOCAL_ITERATED; 1017 1043 else 1018 1044 localc=GR_COMBINE_LOCAL_CONSTANT; 1019 1045 1020 1046 FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 1021 GR_COMBINE_FACTOR_NONE,1022 locala,1023 GR_COMBINE_OTHER_NONE,1024 FXFALSE);1047 GR_COMBINE_FACTOR_NONE, 1048 locala, 1049 GR_COMBINE_OTHER_NONE, 1050 FXFALSE); 1025 1051 1026 1052 FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL, 1027 GR_COMBINE_FACTOR_NONE,1028 localc,1029 GR_COMBINE_OTHER_NONE,1030 FXFALSE);1053 GR_COMBINE_FACTOR_NONE, 1054 localc, 1055 GR_COMBINE_OTHER_NONE, 1056 FXFALSE); 1031 1057 1032 1058 fxMesa->lastUnitsMode=FX_UM_NONE; … … 1037 1063 /************************************************************************/ 1038 1064 1039 void fxSetupTexture_NoLock(GLcontext *ctx)1065 static void fxSetupTexture_NoLock(GLcontext *ctx) 1040 1066 { 1041 1067 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; … … 1051 1077 1052 1078 /* Texture Combine, Color Combine and Alpha Combine. 1053 */ 1079 */ 1054 1080 tex2Denabled = (ctx->Texture.ReallyEnabled & TEXTURE0_2D); 1055 1081 1056 1082 if (fxMesa->emulateTwoTMUs) 1057 1083 tex2Denabled |= (ctx->Texture.ReallyEnabled & TEXTURE1_2D); 1058 1084 1059 1085 switch(tex2Denabled) { 1060 1086 case TEXTURE0_2D: 1061 fxSetupTextureSingleTMU_NoLock(ctx,0); 1087 fxSetupTextureSingleTMU_NoLock(ctx,0); 1062 1088 break; 1063 1089 case TEXTURE1_2D: … … 1066 1092 case (TEXTURE0_2D|TEXTURE1_2D): 1067 1093 if (fxMesa->haveTwoTMUs) 1068 fxSetupTextureDoubleTMU_NoLock(ctx);1094 fxSetupTextureDoubleTMU_NoLock(ctx); 1069 1095 else { 1070 if (MESA_VERBOSE&VERBOSE_DRIVER)1071 fprintf(stderr, "fxmesa: enabling fake multitexture\n");1072 1073 fxSetupTextureSingleTMU_NoLock(ctx,0);1074 ctx->Driver.MultipassFunc = fxMultipassTexture;1096 if (MESA_VERBOSE&VERBOSE_DRIVER) 1097 fprintf(stderr, "fxmesa: enabling fake multitexture\n"); 1098 1099 fxSetupTextureSingleTMU_NoLock(ctx,0); 1100 ctx->Driver.MultipassFunc = fxMultipassTexture; 1075 1101 } 1076 1102 break; … … 1081 1107 } 1082 1108 1083 void fxSetupTexture(GLcontext *ctx) {1109 static void fxSetupTexture(GLcontext *ctx) { 1084 1110 BEGIN_BOARD_LOCK(); 1085 1111 fxSetupTexture_NoLock(ctx); … … 1181 1207 break; 1182 1208 case GL_DST_ALPHA: 1183 dfact=GR_BLEND_DST_ALPHA; 1209 /* dfact=GR_BLEND_DST_ALPHA; */ 1210 /* We can't do DST_ALPHA */ 1211 dfact=GR_BLEND_ONE; 1184 1212 adfact=GR_BLEND_ZERO; 1185 1213 break; 1186 1214 case GL_ONE_MINUS_DST_ALPHA: 1187 dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; 1215 /* dfact=GR_BLEND_ONE_MINUS_DST_ALPHA; */ 1216 /* We can't do DST_ALPHA */ 1217 dfact=GR_BLEND_ZERO; 1188 1218 adfact=GR_BLEND_ZERO; 1189 1219 break; … … 1215 1245 if(us->blendEnabled) 1216 1246 FX_grAlphaBlendFunction(us->blendSrcFuncRGB,us->blendDstFuncRGB, 1217 us->blendSrcFuncAlpha,us->blendDstFuncAlpha);1247 us->blendSrcFuncAlpha,us->blendDstFuncAlpha); 1218 1248 else 1219 1249 FX_grAlphaBlendFunction(GR_BLEND_ONE,GR_BLEND_ZERO,GR_BLEND_ONE,GR_BLEND_ZERO); 1220 1250 } 1221 1251 1222 1252 /************************************************************************/ 1223 1253 /************************** Alpha Test SetUp ****************************/ … … 1258 1288 fprintf(stderr,"fx Driver: internal error in fxDDAlphaFunc()\n"); 1259 1289 fxCloseHardware(); 1260 exit(-1);1290 EXIT(-1); 1261 1291 break; 1262 1292 } … … 1325 1355 fprintf(stderr,"fx Driver: internal error in fxDDDepthFunc()\n"); 1326 1356 fxCloseHardware(); 1327 exit(-1);1357 EXIT(-1); 1328 1358 break; 1329 1359 } … … 1366 1396 /************************************************************************/ 1367 1397 1368 GLboolean fxDDColorMask(GLcontext *ctx, 1369 GLboolean r, GLboolean g, 1370 GLboolean b, GLboolean a )1398 GLboolean fxDDColorMask(GLcontext *ctx, 1399 GLboolean r, GLboolean g, 1400 GLboolean b, GLboolean a ) 1371 1401 { 1372 1402 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; … … 1374 1404 ctx->Driver.RenderStart = fxSetupFXUnits; 1375 1405 (void) r; (void) g; (void) b; (void) a; 1376 return 1;1406 return GL_FALSE; 1377 1407 } 1378 1408 … … 1382 1412 1383 1413 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 1384 ctx->Color.ColorMask[GCOMP] ||1385 ctx->Color.ColorMask[BCOMP],1386 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);1414 ctx->Color.ColorMask[GCOMP] || 1415 ctx->Color.ColorMask[BCOMP], 1416 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 1387 1417 } 1388 1418 … … 1393 1423 /************************************************************************/ 1394 1424 1395 static void fxFogTableGenerate(GLcontext *ctx) 1396 { 1397 int i; 1398 float f,eyez; 1399 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 1400 1401 for(i=0;i<FX_grGetInteger(FX_FOG_TABLE_ENTRIES);i++) { 1402 eyez=guFogTableIndexToW(i); 1403 1404 switch(ctx->Fog.Mode) { 1405 case GL_LINEAR: 1406 f=(ctx->Fog.End-eyez)/(ctx->Fog.End-ctx->Fog.Start); 1407 break; 1408 case GL_EXP: 1409 f=exp(-ctx->Fog.Density*eyez); 1410 break; 1411 case GL_EXP2: 1412 f=exp(-ctx->Fog.Density*ctx->Fog.Density*eyez*eyez); 1413 break; 1414 default: /* That should never happen */ 1415 f=0.0f; 1416 break; 1417 } 1418 1419 fxMesa->fogTable[i]=(GrFog_t)((1.0f-CLAMP(f,0.0f,1.0f))*255.0f); 1420 } 1421 } 1422 1423 static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild) 1424 { 1425 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 1426 1427 if(ctx->Fog.Enabled && ctx->FogMode==FOG_FRAGMENT) { 1425 /* 1426 * This is called during state update in order to update the Glide fog state. 1427 */ 1428 static void fxSetupFog(GLcontext *ctx) 1429 { 1430 if (ctx->Fog.Enabled && ctx->FogMode==FOG_FRAGMENT) { 1431 fxMesaContext fxMesa = FX_CONTEXT(ctx); 1432 1433 /* update fog color */ 1428 1434 GLubyte col[4]; 1429 FX_grFogMode(GR_FOG_WITH_TABLE);1430 1431 1435 col[0]=(unsigned int)(255*ctx->Fog.Color[0]); 1432 1436 col[1]=(unsigned int)(255*ctx->Fog.Color[1]); 1433 col[2]=(unsigned int)(255*ctx->Fog.Color[2]); 1437 col[2]=(unsigned int)(255*ctx->Fog.Color[2]); 1434 1438 col[3]=(unsigned int)(255*ctx->Fog.Color[3]); 1435 1436 1439 FX_grFogColorValue(FXCOLOR4(col)); 1437 1440 1438 if(forceTableRebuild || 1439 (fxMesa->fogTableMode!=ctx->Fog.Mode) || 1440 (fxMesa->fogDensity!=ctx->Fog.Density)) { 1441 fxFogTableGenerate(ctx); 1442 1443 fxMesa->fogTableMode=ctx->Fog.Mode; 1444 fxMesa->fogDensity=ctx->Fog.Density; 1445 } 1446 1441 if(fxMesa->fogTableMode != ctx->Fog.Mode || 1442 fxMesa->fogDensity != ctx->Fog.Density || 1443 fxMesa->fogStart != ctx->Fog.Start || 1444 fxMesa->fogEnd != ctx->Fog.End) { 1445 /* reload the fog table */ 1446 switch (ctx->Fog.Mode) { 1447 case GL_LINEAR: 1448 guFogGenerateLinear(fxMesa->fogTable, ctx->Fog.Start, ctx->Fog.End); 1449 break; 1450 case GL_EXP: 1451 guFogGenerateExp(fxMesa->fogTable, ctx->Fog.Density); 1452 break; 1453 case GL_EXP2: 1454 guFogGenerateExp2(fxMesa->fogTable, ctx->Fog.Density); 1455 break; 1456 default: 1457 ; 1458 } 1459 fxMesa->fogTableMode = ctx->Fog.Mode; 1460 fxMesa->fogDensity = ctx->Fog.Density; 1461 fxMesa->fogStart = ctx->Fog.Start; 1462 fxMesa->fogEnd = ctx->Fog.End; 1463 } 1464 1447 1465 FX_grFogTable(fxMesa->fogTable); 1448 } else 1466 FX_grFogMode(GR_FOG_WITH_TABLE); 1467 } 1468 else { 1449 1469 FX_grFogMode(GR_FOG_DISABLE); 1470 } 1450 1471 } 1451 1472 … … 1486 1507 if (xmin<fxMesa->clipMinX) xmin=fxMesa->clipMinX; 1487 1508 if (xmax>fxMesa->clipMaxX) xmax=fxMesa->clipMaxX; 1488 if (ymin<fxMesa->screen_height-fxMesa->clipMaxY) 1509 if (ymin<fxMesa->screen_height-fxMesa->clipMaxY) 1489 1510 ymin=fxMesa->screen_height-fxMesa->clipMaxY; 1490 1511 if (ymax>fxMesa->screen_height-fxMesa->clipMinY) … … 1518 1539 (void) mode; 1519 1540 FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL; 1520 ctx->Driver.RenderStart = fxSetupFXUnits; 1541 ctx->Driver.RenderStart = fxSetupFXUnits; 1521 1542 } 1522 1543 … … 1525 1546 (void) mode; 1526 1547 FX_CONTEXT(ctx)->new_state |= FX_NEW_CULL; 1527 ctx->Driver.RenderStart = fxSetupFXUnits; 1548 ctx->Driver.RenderStart = fxSetupFXUnits; 1528 1549 } 1529 1550 … … 1531 1552 static void fxSetupCull(GLcontext *ctx) 1532 1553 { 1533 if(ctx->Polygon.CullFlag) {1534 switch(ctx->Polygon.CullFaceMode) {1535 case GL_BACK:1536 if(ctx->Polygon.FrontFace==GL_CCW)1537 FX_grCullMode(GR_CULL_NEGATIVE);1538 else1539 FX_grCullMode(GR_CULL_POSITIVE);1540 break;1541 case GL_FRONT:1542 if(ctx->Polygon.FrontFace==GL_CCW)1543 FX_grCullMode(GR_CULL_POSITIVE);1544 else1545 FX_grCullMode(GR_CULL_NEGATIVE);1546 break;1547 case GL_FRONT_AND_BACK:1548 FX_grCullMode(GR_CULL_DISABLE);1549 break;1550 default:1551 break;1552 }1553 } else1554 FX_grCullMode(GR_CULL_DISABLE);1554 if (ctx->Polygon.CullFlag) { 1555 switch (ctx->Polygon.CullFaceMode) { 1556 case GL_BACK: 1557 if (ctx->Polygon.FrontFace==GL_CCW) 1558 FX_CONTEXT(ctx)->cullMode=GR_CULL_NEGATIVE; 1559 else 1560 FX_CONTEXT(ctx)->cullMode=GR_CULL_POSITIVE; 1561 break; 1562 case GL_FRONT: 1563 if(ctx->Polygon.FrontFace==GL_CCW) 1564 FX_CONTEXT(ctx)->cullMode=GR_CULL_POSITIVE; 1565 else 1566 FX_CONTEXT(ctx)->cullMode=GR_CULL_NEGATIVE; 1567 break; 1568 case GL_FRONT_AND_BACK: 1569 FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; 1570 break; 1571 default: 1572 break; 1573 } 1574 } else FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; 1575 FX_grCullMode(FX_CONTEXT(ctx)->cullMode); 1555 1576 } 1556 1577 … … 1594 1615 fxMesa->new_state |= FX_NEW_SCISSOR; 1595 1616 ctx->Driver.RenderStart = fxSetupFXUnits; 1617 break; 1618 case GL_SHARED_TEXTURE_PALETTE_EXT: 1619 fxDDTexUseGlbPalette(ctx, state); 1596 1620 break; 1597 1621 case GL_FOG: … … 1604 1628 break; 1605 1629 case GL_LINE_SMOOTH: 1630 case GL_LINE_STIPPLE: 1606 1631 case GL_POINT_SMOOTH: 1607 1632 case GL_POLYGON_SMOOTH: … … 1612 1637 default: 1613 1638 ; /* XXX no-op? */ 1614 } 1639 } 1615 1640 } 1616 1641 … … 1636 1661 case GL_NEVER: 1637 1662 case GL_ALWAYS: 1638 break;1663 break; 1639 1664 default: 1640 fxDDDepthFunc(ctx, GL_EQUAL);1641 break;1665 fxDDDepthFunc(ctx, GL_EQUAL); 1666 break; 1642 1667 } 1643 1668 fxDDDepthMask(ctx, FALSE); … … 1646 1671 /* ? Set the Constant Color ? */ 1647 1672 fxDDEnable(ctx, GL_BLEND, GL_TRUE); 1648 fxDDBlendFunc(ctx, ?, ?);1649 fxSetupTextureSingleTMU(ctx, ?);1673 fxDDBlendFunc(ctx, XXX, XXX); 1674 fxSetupTextureSingleTMU(ctx, XXX); 1650 1675 fxSetupBlend(ctx); 1651 1676 fxSetupDepthTest(ctx); … … 1655 1680 /* Reset everything back to normal */ 1656 1681 fxMesa->unitsState = fxMesa->restoreUnitsState; 1657 fxMesa->setupdone &= ?;1658 fxSetupTextureSingleTMU(ctx, ?);1682 fxMesa->setupdone &= XXX; 1683 fxSetupTextureSingleTMU(ctx, XXX); 1659 1684 fxSetupBlend(ctx); 1660 1685 fxSetupDepthTest(ctx); … … 1676 1701 * support almost the same subset using multipass blending on the 1677 1702 * voodoo 1. In all other cases for both voodoo 1 and 2, we fall back 1678 * to software rendering, satisfying the spec if not the user. 1703 * to software rendering, satisfying the spec if not the user. 1679 1704 */ 1680 1705 static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass ) … … 1688 1713 case 1: 1689 1714 if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_TEXTURE)) 1690 fprintf(stderr, "fxmesa: Second texture pass\n");1715 fprintf(stderr, "fxmesa: Second texture pass\n"); 1691 1716 1692 1717 for ( ; v != last ; v++) { 1693 v->f[S0COORD] = v->f[S1COORD];1694 v->f[T0COORD] = v->f[T1COORD];1718 v->f[S0COORD] = v->f[S1COORD]; 1719 v->f[T0COORD] = v->f[T1COORD]; 1695 1720 } 1696 1721 1697 fxMesa->restoreUnitsState = fxMesa->unitsState; 1722 fxMesa->restoreUnitsState = fxMesa->unitsState; 1698 1723 fxMesa->tmu_source[0] = 1; 1699 1724 1700 1725 if (ctx->Depth.Mask) { 1701 switch (ctx->Depth.Func) {1702 case GL_NEVER:1703 case GL_ALWAYS:1704 break;1705 default:1706 fxDDDepthFunc( ctx, GL_EQUAL );1707 break;1708 }1709 1710 fxDDDepthMask( ctx, GL_FALSE ); 1726 switch (ctx->Depth.Func) { 1727 case GL_NEVER: 1728 case GL_ALWAYS: 1729 break; 1730 default: 1731 fxDDDepthFunc( ctx, GL_EQUAL ); 1732 break; 1733 } 1734 1735 fxDDDepthMask( ctx, GL_FALSE ); 1711 1736 } 1712 1737 1713 1738 if (ctx->Texture.Unit[1].EnvMode == GL_MODULATE) { 1714 fxDDEnable( ctx, GL_BLEND, GL_TRUE );1715 fxDDBlendFunc( ctx, GL_DST_COLOR, GL_ZERO );1739 fxDDEnable( ctx, GL_BLEND, GL_TRUE ); 1740 fxDDBlendFunc( ctx, GL_DST_COLOR, GL_ZERO ); 1716 1741 } 1717 1742 1718 fxSetupTextureSingleTMU( ctx, 1 ); 1743 fxSetupTextureSingleTMU( ctx, 1 ); 1719 1744 fxSetupBlend( ctx ); 1720 1745 fxSetupDepthTest( ctx ); … … 1722 1747 1723 1748 case 2: 1724 /* Restore original state. 1749 /* Restore original state. 1725 1750 */ 1726 1751 fxMesa->tmu_source[0] = 0; 1727 1752 fxMesa->unitsState = fxMesa->restoreUnitsState; 1728 1753 fxMesa->setupdone &= ~SETUP_TMU0; 1729 fxSetupTextureSingleTMU( ctx, 0 ); 1754 fxSetupTextureSingleTMU( ctx, 0 ); 1730 1755 fxSetupBlend( ctx ); 1731 1756 fxSetupDepthTest( ctx ); … … 1733 1758 } 1734 1759 1735 return pass == 1; 1760 return pass == 1; 1736 1761 } 1737 1762 … … 1757 1782 static void gl_print_fx_state_flags( const char *msg, GLuint flags ) 1758 1783 { 1759 fprintf(stderr, 1760 "%s: (0x%x) %s%s%s%s%s%s%s\n",1761 msg,1762 flags,1763 (flags & FX_NEW_TEXTURING) ? "texture, " : "",1764 (flags & FX_NEW_BLEND) ? "blend, " : "",1765 (flags & FX_NEW_ALPHA) ? "alpha, " : "",1766 (flags & FX_NEW_FOG) ? "fog, " : "",1767 (flags & FX_NEW_SCISSOR) ? "scissor, " : "",1768 (flags & FX_NEW_COLOR_MASK) ? "colormask, " : "",1769 (flags & FX_NEW_CULL) ? "cull, " : "");1784 fprintf(stderr, 1785 "%s: (0x%x) %s%s%s%s%s%s%s\n", 1786 msg, 1787 flags, 1788 (flags & FX_NEW_TEXTURING) ? "texture, " : "", 1789 (flags & FX_NEW_BLEND) ? "blend, " : "", 1790 (flags & FX_NEW_ALPHA) ? "alpha, " : "", 1791 (flags & FX_NEW_FOG) ? "fog, " : "", 1792 (flags & FX_NEW_SCISSOR) ? "scissor, " : "", 1793 (flags & FX_NEW_COLOR_MASK) ? "colormask, " : "", 1794 (flags & FX_NEW_CULL) ? "cull, " : ""); 1770 1795 } 1771 1796 … … 1780 1805 if (newstate) { 1781 1806 if (newstate & FX_NEW_TEXTURING) 1782 fxSetupTexture(ctx);1807 fxSetupTexture(ctx); 1783 1808 1784 1809 if (newstate & FX_NEW_BLEND) 1785 fxSetupBlend(ctx);1810 fxSetupBlend(ctx); 1786 1811 1787 1812 if (newstate & FX_NEW_ALPHA) 1788 fxSetupAlphaTest(ctx);1789 1813 fxSetupAlphaTest(ctx); 1814 1790 1815 if (newstate & FX_NEW_DEPTH) 1791 fxSetupDepthTest(ctx);1816 fxSetupDepthTest(ctx); 1792 1817 1793 1818 if (newstate & FX_NEW_FOG) 1794 fxSetupFog(ctx,GL_FALSE);1819 fxSetupFog(ctx); 1795 1820 1796 1821 if (newstate & FX_NEW_SCISSOR) 1797 fxSetupScissor(ctx);1822 fxSetupScissor(ctx); 1798 1823 1799 1824 if (newstate & FX_NEW_COLOR_MASK) 1800 fxSetupColorMask(ctx);1825 fxSetupColorMask(ctx); 1801 1826 1802 1827 if (newstate & FX_NEW_CULL) 1803 fxSetupCull(ctx); 1828 fxSetupCull(ctx); 1804 1829 1805 1830 fxMesa->new_state = 0; -
trunk/src/opengl/mesa/3dfx/fxstripdet.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. … … 52 52 #include "vbcull.h" 53 53 54 55 #define STRIP0(u,v) ((u1 == v1) && (u2 == v0))56 #define STRIP1(u,v) ((u0 == v0) && (u2 == v1))57 54 58 #define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ 59 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; 60 61 #define STRIPSLOCAL_VAR int sc = 0; 55 #define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) 56 #define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) 62 57 63 #define INIT(a) 58 #define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ 59 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; 64 60 65 #define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) 66 #define FLUSHTRI() /* No-Op */ 67 #define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } 68 #define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } 69 #define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb) 61 #define STRIPSLOCAL_VAR int sc = 0; 70 62 71 #define CLIPPED(a,b,c) 0 72 #define CULLED(a,b,c) 0 73 #define SENDCLIPTRI(a,b,c) /* NoOp */ 63 #define INIT(a) 74 64 75 #define TAG(x) x##_fx 65 #define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) 66 #define FLUSHTRI() /* No-Op */ 67 #define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } 68 #define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } 69 #define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb) 70 71 #define CLIPPED(a,b,c) 0 72 #define CULLED(a,b,c) 0 73 #define SENDCLIPTRI(a,b,c) /* NoOp */ 74 75 #define TAG(x) x##_fx 76 76 77 77 #include "fxsdettmp.h" … … 79 79 80 80 /* Clipped but no userclip */ 81 #define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2]82 #define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2]81 #define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2] 82 #define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2] 83 83 84 #define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ 85 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ 86 const GLubyte *const clipmask = VB->ClipMask; \ 87 const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 88 const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 89 90 #define STRIPSLOCAL_VAR int sc = 0; 84 #define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ 85 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ 86 const GLubyte *const clipmask = VB->ClipMask; \ 87 const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 88 const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 91 89 92 #define INIT(a)90 #define STRIPSLOCAL_VAR int sc = 0; 93 91 94 #define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) 95 #define FLUSHTRI() /* No-Op */ 96 #define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } 97 #define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } 98 #define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb) 92 #define INIT(a) 99 93 100 #define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) 101 #define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2]) 102 #define SENDCLIPTRI(u0,u1,u2) { \ 103 GLuint vl[3]; \ 104 ASSIGN_3V(vl, u0, u1, u2 ); \ 105 cliptri(VB,vl,clipmask[u0] | clipmask[u1] | clipmask[u2]); \ 106 } 107 108 #define TAG(x) x##_fx_view_clipped 94 #define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) 95 #define FLUSHTRI() /* No-Op */ 96 #define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } 97 #define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } 98 #define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb) 99 100 #define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) 101 #define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2]) 102 #define SENDCLIPTRI(u0,u1,u2) { \ 103 GLuint vl[3]; \ 104 ASSIGN_3V(vl, u0, u1, u2 ); \ 105 cliptri(VB,vl,clipmask[u0] | clipmask[u1] | clipmask[u2]); \ 106 } 107 108 #define TAG(x) x##_fx_view_clipped 109 109 110 110 #include "fxsdettmp.h" 111 111 112 112 /* Clipped and might be userclip */ 113 #define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2]114 #define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2]113 #define STRIP0(u,v) ((u1 == v1) && (u2 == v0)) && !clipmask[v2] 114 #define STRIP1(u,v) ((u0 == v0) && (u2 == v1)) && !clipmask[v2] 115 115 116 #define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ 117 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ 118 const GLubyte *const clipmask = VB->ClipMask; \ 119 const GLubyte *userclipmask = VB->UserClipMask; \ 120 const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 121 const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 122 123 #define STRIPSLOCAL_VAR int sc = 0; 116 #define LOCAL_VARS fxVertex* gWin = FX_DRIVER_DATA(VB)->verts; \ 117 GrVertex** sb = FX_DRIVER_DATA(VB)->strips_b; \ 118 const GLubyte *const clipmask = VB->ClipMask; \ 119 const GLubyte *userclipmask = VB->UserClipMask; \ 120 const fxMesaContext fxMesa=(fxMesaContext)VB->ctx->DriverCtx; \ 121 const tfxTriClipFunc cliptri = fxMesa->clip_tri_stride; 124 122 125 #define INIT(a)123 #define STRIPSLOCAL_VAR int sc = 0; 126 124 127 #define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) 128 #define FLUSHTRI() /* No-Op */ 129 #define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } 130 #define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } 131 #define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb) 125 #define INIT(a) 132 126 133 #define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) 134 #define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2] & CLIP_ALL_BITS) 135 #define SENDCLIPTRI(u0,u1,u2) { \ 136 GLuint vl[3]; \ 137 GLuint imask = (clipmask[u0] | clipmask[u1] | clipmask[u2]); \ 138 \ 139 if (imask & CLIP_USER_BIT) { \ 140 if (!(userclipmask[u2] & userclipmask[u1] & userclipmask[u0])) \ 141 { ASSIGN_3V(vl, u2, u1, u0 ); \ 142 imask |= (userclipmask[u2] | userclipmask[u1] | userclipmask[u0]) << 8; \ 143 cliptri( VB, vl, imask );} \ 144 } \ 145 else { ASSIGN_3V(vl, u2, u1, u0 ); \ 146 cliptri( VB, vl, imask ); } \ 147 } 148 149 #define TAG(x) x##_fx_clipped 127 #define SENDTRI(u0,u1,u2) FX_grDrawTriangle((GrVertex*)&(gWin[u0].f),(GrVertex*)&(gWin[u1].f),(GrVertex*)&(gWin[u2].f)) 128 #define FLUSHTRI() /* No-Op */ 129 #define STARTSTRIPS(u0,u1,u2) { sb[sc++] = (GrVertex*)&(gWin[u0].f); sb[sc++] = (GrVertex*)&(gWin[u1].f); sb[sc++] = (GrVertex*)&(gWin[u2].f); } 130 #define SENDSTRIPS(v2) { sb[sc++] = (GrVertex*)&(gWin[v2].f); } 131 #define FLUSHSTRIPS() FX_grDrawVertexArray(GR_TRIANGLE_STRIP,sc,sb) 132 133 #define CLIPPED(u0,u1,u2) (clipmask[u0] | clipmask[u1] | clipmask[u2]) 134 #define CULLED(u0,u1,u2) (clipmask[u0] & clipmask[u1] & clipmask[u2] & CLIP_ALL_BITS) 135 #define SENDCLIPTRI(u0,u1,u2) { \ 136 GLuint vl[3]; \ 137 GLuint imask = (clipmask[u0] | clipmask[u1] | clipmask[u2]); \ 138 \ 139 if (imask & CLIP_USER_BIT) { \ 140 if (!(userclipmask[u2] & userclipmask[u1] & userclipmask[u0])) \ 141 { ASSIGN_3V(vl, u2, u1, u0 ); \ 142 imask |= (userclipmask[u2] | userclipmask[u1] | userclipmask[u0]) << 8; \ 143 cliptri( VB, vl, imask );} \ 144 } \ 145 else { ASSIGN_3V(vl, u2, u1, u0 ); \ 146 cliptri( VB, vl, imask ); } \ 147 } 148 149 #define TAG(x) x##_fx_clipped 150 150 151 151 #include "fxsdettmp.h" -
trunk/src/opengl/mesa/3dfx/fxtexman.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. … … 55 55 #include "fxdrv.h" 56 56 57 int texSwaps=0; 58 57 59 #define FX_2MB_SPLIT 0x200000 58 60 59 61 static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa, 60 int tmu);62 int tmu); 61 63 62 64 … … 82 84 fubar(); 83 85 } 84 if (prev && (prev->startAddr>=tmp->startAddr || 85 prev->endAddr>tmp->startAddr)) {86 if (prev && (prev->startAddr>=tmp->startAddr || 87 prev->endAddr>tmp->startAddr)) { 86 88 fprintf(stderr, "Sorting fubar\n"); 87 89 fubar(); … … 101 103 fubar(); 102 104 } 103 if (prev && (prev->startAddr>=tmp->startAddr || 104 prev->endAddr>tmp->startAddr)) {105 if (prev && (prev->startAddr>=tmp->startAddr || 106 prev->endAddr>tmp->startAddr)) { 105 107 fprintf(stderr, "Sorting fubar\n"); 106 108 fubar(); … … 122 124 fprintf(stderr, "fxDriver: out of memory!\n"); 123 125 fxCloseHardware(); 124 exit(-1);126 EXIT(-1); 125 127 } 126 128 } … … 162 164 if(fxMesa->verbose) 163 165 fprintf(stderr," %07u-%07u\n", 164 (unsigned int)blockstart,(unsigned int)blockend);166 (unsigned int)blockstart,(unsigned int)blockend); 165 167 166 168 tmn=fxTMNewRangeNode(fxMesa, blockstart, blockend); … … 186 188 while (tmp) { 187 189 if (tmp->endAddr-tmp->startAddr>=size) { /* Fits here */ 188 result=tmp->startAddr;189 tmp->startAddr+=size;190 if (tmp->startAddr==tmp->endAddr) { /* Empty */191 if (prev) {192 prev->next=tmp->next;193 } else {194 fxMesa->tmFree[tmu]=tmp->next;195 }196 fxTMDeleteRangeNode(fxMesa, tmp);197 }198 fxMesa->freeTexMem[tmu]-=size;199 return result;190 result=tmp->startAddr; 191 tmp->startAddr+=size; 192 if (tmp->startAddr==tmp->endAddr) { /* Empty */ 193 if (prev) { 194 prev->next=tmp->next; 195 } else { 196 fxMesa->tmFree[tmu]=tmp->next; 197 } 198 fxTMDeleteRangeNode(fxMesa, tmp); 199 } 200 fxMesa->freeTexMem[tmu]-=size; 201 return result; 200 202 } 201 203 prev=tmp; … … 209 211 } 210 212 fxTMMoveOutTM(fxMesa, obj); 213 texSwaps++; 211 214 } 212 215 } … … 234 237 range->next=tmp; 235 238 if (tmp) { 236 if (range->endAddr==tmp->startAddr && tmp->startAddr&(FX_2MB_SPLIT-1)) { 239 if (range->endAddr==tmp->startAddr && tmp->startAddr&(FX_2MB_SPLIT-1)) { 237 240 /* Combine */ 238 241 tmp->startAddr=range->startAddr; … … 242 245 } 243 246 if (prev) { 244 if (prev->endAddr==range->startAddr && range->startAddr&(FX_2MB_SPLIT-1)) { 247 if (prev->endAddr==range->startAddr && range->startAddr&(FX_2MB_SPLIT-1)) { 245 248 /* Combine */ 246 249 prev->endAddr=range->endAddr; … … 254 257 255 258 static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa, 256 int tmu)259 int tmu) 257 260 { 258 261 GLuint age, old, lasttime, bindnumber; … … 270 273 271 274 if (info && info->isInTM && 272 (info->whichTMU==tmu || info->whichTMU==FX_TMU_BOTH || 273 info->whichTMU==FX_TMU_SPLIT)) {275 ((info->whichTMU==tmu) || (info->whichTMU==FX_TMU_BOTH) || 276 (info->whichTMU==FX_TMU_SPLIT))) { 274 277 lasttime=info->lastTimeUsed; 275 278 276 279 if (lasttime>bindnumber) 277 age=bindnumber+(UINT_MAX-lasttime+1); /* TO DO: check wrap around */280 age=bindnumber+(UINT_MAX-lasttime+1); /* TO DO: check wrap around */ 278 281 else 279 age=bindnumber-lasttime;282 age=bindnumber-lasttime; 280 283 281 284 if (age>=old) { 282 old=age;283 obj=tmp;285 old=age; 286 obj=tmp; 284 287 } 285 288 } … … 289 292 } 290 293 291 static MemRange *fxTMAddObj(fxMesaContext fxMesa, 292 struct gl_texture_object *tObj,293 GLint tmu, int texmemsize)294 static MemRange *fxTMAddObj(fxMesaContext fxMesa, 295 struct gl_texture_object *tObj, 296 GLint tmu, int texmemsize) 294 297 { 295 298 FxU32 startAddr; … … 319 322 fprintf(stderr,"fx Driver: internal error in fxTMMoveInTM() -> not validated\n"); 320 323 fxCloseHardware(); 321 exit(-1); 322 } 323 324 if (ti->isInTM) return; 324 EXIT(-1); 325 } 326 327 if (ti->isInTM) { 328 if (ti->whichTMU==where) return; 329 if (where==FX_TMU_SPLIT || ti->whichTMU==FX_TMU_SPLIT) 330 fxTMMoveOutTM_NoLock(fxMesa, tObj); 331 else { 332 if (ti->whichTMU==FX_TMU_BOTH) return; 333 where=FX_TMU_BOTH; 334 } 335 } 325 336 326 337 if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_TEXTURE)) { … … 334 345 case FX_TMU1: 335 346 texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, 336 &(ti->info));347 &(ti->info)); 337 348 ti->tm[where]=fxTMAddObj(fxMesa, tObj, where, texmemsize); 338 349 fxMesa->stats.memTexUpload+=texmemsize; 339 350 340 351 for (i=FX_largeLodValue(ti->info), l=ti->minLevel; 341 i<=FX_smallLodValue(ti->info);342 i++,l++)352 i<=FX_smallLodValue(ti->info); 353 i++,l++) 343 354 FX_grTexDownloadMipMapLevel_NoLock(where, 344 ti->tm[where]->startAddr,345 FX_valueToLod(i),346 FX_largeLodLog2(ti->info),347 FX_aspectRatioLog2(ti->info),348 ti->info.format,349 GR_MIPMAPLEVELMASK_BOTH,350 ti->mipmapLevel[l].data);351 break; 352 case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */355 ti->tm[where]->startAddr, 356 FX_valueToLod(i), 357 FX_largeLodLog2(ti->info), 358 FX_aspectRatioLog2(ti->info), 359 ti->info.format, 360 GR_MIPMAPLEVELMASK_BOTH, 361 ti->mipmapLevel[l].data); 362 break; 363 case FX_TMU_SPLIT: 353 364 texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD, 354 &(ti->info));365 &(ti->info)); 355 366 ti->tm[FX_TMU0]=fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize); 356 367 fxMesa->stats.memTexUpload+=texmemsize; 357 368 358 369 texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN, 359 &(ti->info));370 &(ti->info)); 360 371 ti->tm[FX_TMU1]=fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize); 361 372 fxMesa->stats.memTexUpload+=texmemsize; 362 373 363 374 for (i=FX_largeLodValue(ti->info),l=ti->minLevel; 364 i<=FX_smallLodValue(ti->info);365 i++,l++) {375 i<=FX_smallLodValue(ti->info); 376 i++,l++) { 366 377 FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, 367 ti->tm[FX_TMU0]->startAddr,368 FX_valueToLod(i),369 FX_largeLodLog2(ti->info),370 FX_aspectRatioLog2(ti->info),371 ti->info.format,372 GR_MIPMAPLEVELMASK_ODD,373 ti->mipmapLevel[l].data);378 ti->tm[FX_TMU0]->startAddr, 379 FX_valueToLod(i), 380 FX_largeLodLog2(ti->info), 381 FX_aspectRatioLog2(ti->info), 382 ti->info.format, 383 GR_MIPMAPLEVELMASK_ODD, 384 ti->mipmapLevel[l].data); 374 385 375 386 FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, 376 ti->tm[FX_TMU1]->startAddr, 377 FX_valueToLod(i), 378 FX_largeLodLog2(ti->info), 379 FX_aspectRatioLog2(ti->info), 380 ti->info.format, 381 GR_MIPMAPLEVELMASK_EVEN, 382 ti->mipmapLevel[l].data); 387 ti->tm[FX_TMU1]->startAddr, 388 FX_valueToLod(i), 389 FX_largeLodLog2(ti->info), 390 FX_aspectRatioLog2(ti->info), 391 ti->info.format, 392 GR_MIPMAPLEVELMASK_EVEN, 393 ti->mipmapLevel[l].data); 394 } 395 break; 396 case FX_TMU_BOTH: 397 texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, 398 &(ti->info)); 399 ti->tm[FX_TMU0]=fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize); 400 fxMesa->stats.memTexUpload+=texmemsize; 401 402 texmemsize=(int)FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH, 403 &(ti->info)); 404 ti->tm[FX_TMU1]=fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize); 405 fxMesa->stats.memTexUpload+=texmemsize; 406 407 for (i=FX_largeLodValue(ti->info),l=ti->minLevel; 408 i<=FX_smallLodValue(ti->info); 409 i++,l++) { 410 FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0, 411 ti->tm[FX_TMU0]->startAddr, 412 FX_valueToLod(i), 413 FX_largeLodLog2(ti->info), 414 FX_aspectRatioLog2(ti->info), 415 ti->info.format, 416 GR_MIPMAPLEVELMASK_BOTH, 417 ti->mipmapLevel[l].data); 418 419 FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1, 420 ti->tm[FX_TMU1]->startAddr, 421 FX_valueToLod(i), 422 FX_largeLodLog2(ti->info), 423 FX_aspectRatioLog2(ti->info), 424 ti->info.format, 425 GR_MIPMAPLEVELMASK_BOTH, 426 ti->mipmapLevel[l].data); 383 427 } 384 428 break; … … 386 430 fprintf(stderr,"fx Driver: internal error in fxTMMoveInTM() -> wrong tmu (%d)\n",where); 387 431 fxCloseHardware(); 388 exit(-1);432 EXIT(-1); 389 433 } 390 434 … … 409 453 fprintf(stderr,"fx Driver: internal error in fxTMReloadMipMapLevel() -> not validated\n"); 410 454 fxCloseHardware(); 411 exit(-1);455 EXIT(-1); 412 456 } 413 457 … … 416 460 417 461 fxTexGetInfo(ti->mipmapLevel[0].width,ti->mipmapLevel[0].height, 418 &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 419 462 &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 463 464 #ifdef FX_GLIDE3 465 lodlevel-=level; 466 #else 467 lodlevel+=level; 468 #endif 420 469 switch(tmu) { 421 470 case FX_TMU0: 422 471 case FX_TMU1: 423 472 FX_grTexDownloadMipMapLevel(tmu, 424 ti->tm[tmu]->startAddr,425 FX_valueToLod(FX_lodToValue(lodlevel)+level),426 FX_largeLodLog2(ti->info),427 FX_aspectRatioLog2(ti->info),428 ti->info.format,429 GR_MIPMAPLEVELMASK_BOTH,430 ti->mipmapLevel[level].data);431 break; 432 case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */473 ti->tm[tmu]->startAddr, 474 FX_valueToLod(FX_lodToValue(lodlevel)), 475 FX_largeLodLog2(ti->info), 476 FX_aspectRatioLog2(ti->info), 477 ti->info.format, 478 GR_MIPMAPLEVELMASK_BOTH, 479 ti->mipmapLevel[level].data); 480 break; 481 case FX_TMU_SPLIT: 433 482 FX_grTexDownloadMipMapLevel(GR_TMU0, 434 ti->tm[GR_TMU0]->startAddr,435 FX_valueToLod(FX_lodToValue(lodlevel)+level),436 FX_largeLodLog2(ti->info),437 FX_aspectRatioLog2(ti->info),438 ti->info.format,439 GR_MIPMAPLEVELMASK_ODD,440 ti->mipmapLevel[level].data);441 483 ti->tm[GR_TMU0]->startAddr, 484 FX_valueToLod(FX_lodToValue(lodlevel)), 485 FX_largeLodLog2(ti->info), 486 FX_aspectRatioLog2(ti->info), 487 ti->info.format, 488 GR_MIPMAPLEVELMASK_ODD, 489 ti->mipmapLevel[level].data); 490 442 491 FX_grTexDownloadMipMapLevel(GR_TMU1, 443 ti->tm[GR_TMU1]->startAddr, 444 FX_valueToLod(FX_lodToValue(lodlevel)+level), 445 FX_largeLodLog2(ti->info), 446 FX_aspectRatioLog2(ti->info), 447 ti->info.format, 448 GR_MIPMAPLEVELMASK_EVEN, 449 ti->mipmapLevel[level].data); 450 break; 492 ti->tm[GR_TMU1]->startAddr, 493 FX_valueToLod(FX_lodToValue(lodlevel)), 494 FX_largeLodLog2(ti->info), 495 FX_aspectRatioLog2(ti->info), 496 ti->info.format, 497 GR_MIPMAPLEVELMASK_EVEN, 498 ti->mipmapLevel[level].data); 499 break; 500 case FX_TMU_BOTH: 501 FX_grTexDownloadMipMapLevel(GR_TMU0, 502 ti->tm[GR_TMU0]->startAddr, 503 FX_valueToLod(FX_lodToValue(lodlevel)), 504 FX_largeLodLog2(ti->info), 505 FX_aspectRatioLog2(ti->info), 506 ti->info.format, 507 GR_MIPMAPLEVELMASK_BOTH, 508 ti->mipmapLevel[level].data); 509 510 FX_grTexDownloadMipMapLevel(GR_TMU1, 511 ti->tm[GR_TMU1]->startAddr, 512 FX_valueToLod(FX_lodToValue(lodlevel)), 513 FX_largeLodLog2(ti->info), 514 FX_aspectRatioLog2(ti->info), 515 ti->info.format, 516 GR_MIPMAPLEVELMASK_BOTH, 517 ti->mipmapLevel[level].data); 518 break; 519 451 520 default: 452 521 fprintf(stderr,"fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n",tmu); 453 522 fxCloseHardware(); 454 exit(-1);455 } 456 } 457 458 void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, 459 struct gl_texture_object *tObj,460 GLint level, GLint yoffset, GLint height)523 EXIT(-1); 524 } 525 } 526 527 void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, 528 struct gl_texture_object *tObj, 529 GLint level, GLint yoffset, GLint height) 461 530 { 462 531 tfxTexInfo *ti=fxTMGetTexInfo(tObj); … … 468 537 fprintf(stderr,"fx Driver: internal error in fxTMReloadSubMipMapLevel() -> not validated\n"); 469 538 fxCloseHardware(); 470 exit(-1);539 EXIT(-1); 471 540 } 472 541 … … 475 544 476 545 fxTexGetInfo(ti->mipmapLevel[0].width, ti->mipmapLevel[0].height, 477 &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);546 &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 478 547 479 548 if((ti->info.format==GR_TEXFMT_INTENSITY_8) || … … 488 557 case FX_TMU1: 489 558 FX_grTexDownloadMipMapLevelPartial(tmu, 490 ti->tm[tmu]->startAddr,491 FX_valueToLod(FX_lodToValue(lodlevel)+level),492 FX_largeLodLog2(ti->info),493 FX_aspectRatioLog2(ti->info),494 ti->info.format,495 GR_MIPMAPLEVELMASK_BOTH,496 data,497 yoffset,yoffset+height-1);498 break; 499 case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */559 ti->tm[tmu]->startAddr, 560 FX_valueToLod(FX_lodToValue(lodlevel)+level), 561 FX_largeLodLog2(ti->info), 562 FX_aspectRatioLog2(ti->info), 563 ti->info.format, 564 GR_MIPMAPLEVELMASK_BOTH, 565 data, 566 yoffset,yoffset+height-1); 567 break; 568 case FX_TMU_SPLIT: 500 569 FX_grTexDownloadMipMapLevelPartial(GR_TMU0, 501 ti->tm[FX_TMU0]->startAddr,502 FX_valueToLod(FX_lodToValue(lodlevel)+level),503 FX_largeLodLog2(ti->info),504 FX_aspectRatioLog2(ti->info),505 ti->info.format,506 GR_MIPMAPLEVELMASK_ODD,507 data,508 yoffset,yoffset+height-1);570 ti->tm[FX_TMU0]->startAddr, 571 FX_valueToLod(FX_lodToValue(lodlevel)+level), 572 FX_largeLodLog2(ti->info), 573 FX_aspectRatioLog2(ti->info), 574 ti->info.format, 575 GR_MIPMAPLEVELMASK_ODD, 576 data, 577 yoffset,yoffset+height-1); 509 578 510 579 FX_grTexDownloadMipMapLevelPartial(GR_TMU1, 511 ti->tm[FX_TMU1]->startAddr, 512 FX_valueToLod(FX_lodToValue(lodlevel)+level), 513 FX_largeLodLog2(ti->info), 514 FX_aspectRatioLog2(ti->info), 515 ti->info.format, 516 GR_MIPMAPLEVELMASK_EVEN, 517 data, 518 yoffset,yoffset+height-1); 580 ti->tm[FX_TMU1]->startAddr, 581 FX_valueToLod(FX_lodToValue(lodlevel)+level), 582 FX_largeLodLog2(ti->info), 583 FX_aspectRatioLog2(ti->info), 584 ti->info.format, 585 GR_MIPMAPLEVELMASK_EVEN, 586 data, 587 yoffset,yoffset+height-1); 588 break; 589 case FX_TMU_BOTH: 590 FX_grTexDownloadMipMapLevelPartial(GR_TMU0, 591 ti->tm[FX_TMU0]->startAddr, 592 FX_valueToLod(FX_lodToValue(lodlevel)+level), 593 FX_largeLodLog2(ti->info), 594 FX_aspectRatioLog2(ti->info), 595 ti->info.format, 596 GR_MIPMAPLEVELMASK_BOTH, 597 data, 598 yoffset,yoffset+height-1); 599 600 FX_grTexDownloadMipMapLevelPartial(GR_TMU1, 601 ti->tm[FX_TMU1]->startAddr, 602 FX_valueToLod(FX_lodToValue(lodlevel)+level), 603 FX_largeLodLog2(ti->info), 604 FX_aspectRatioLog2(ti->info), 605 ti->info.format, 606 GR_MIPMAPLEVELMASK_BOTH, 607 data, 608 yoffset,yoffset+height-1); 519 609 break; 520 610 default: 521 611 fprintf(stderr,"fx Driver: internal error in fxTMReloadSubMipMapLevel() -> wrong tmu (%d)\n",tmu); 522 612 fxCloseHardware(); 523 exit(-1);613 EXIT(-1); 524 614 } 525 615 } … … 541 631 break; 542 632 case FX_TMU_SPLIT: 633 case FX_TMU_BOTH: 543 634 fxTMRemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]); 544 635 fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]); … … 547 638 fprintf(stderr,"fx Driver: internal error in fxTMMoveOutTM()\n"); 548 639 fxCloseHardware(); 549 exit(-1);640 EXIT(-1); 550 641 } 551 642 … … 563 654 for(i=0; i<MAX_TEXTURE_LEVELS; i++) { 564 655 if (ti->mipmapLevel[i].used && 565 ti->mipmapLevel[i].translated)656 ti->mipmapLevel[i].translated) 566 657 FREE(ti->mipmapLevel[i].data); 567 658 … … 618 709 } 619 710 620 void fxTMRestore_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)621 {622 tfxTexInfo *ti=fxTMGetTexInfo(tObj);623 int i,l, where;624 625 if (MESA_VERBOSE&VERBOSE_DRIVER) {626 fprintf(stderr,"fxmesa: fxRestore(%d)\n",tObj->Name);627 }628 629 if (!ti->validated) {630 fprintf(stderr,"fxDriver: internal error in fxRestore -> not validated\n");631 fxCloseHardware();632 exit(-1);633 }634 635 where=ti->whichTMU;636 if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_TEXTURE)) {637 fprintf(stderr,"fxmesa: reloading %x (%d) in texture memory in %d\n",638 (GLuint)tObj, tObj->Name, where);639 }640 641 switch(where) {642 case FX_TMU0:643 case FX_TMU1:644 for (i=FX_largeLodValue_NoLock(ti->info), l=ti->minLevel;645 i<=FX_smallLodValue_NoLock(ti->info);646 i++,l++)647 if (ti->mipmapLevel[l].data)648 FX_grTexDownloadMipMapLevel_NoLock(where,649 ti->tm[where]->startAddr,650 FX_valueToLod(i),651 FX_largeLodLog2(ti->info),652 FX_aspectRatioLog2(ti->info),653 ti->info.format,654 GR_MIPMAPLEVELMASK_BOTH,655 ti->mipmapLevel[l].data);656 break;657 case FX_TMU_SPLIT: /* TO DO: alternate even/odd TMU0/TMU1 */658 for (i=FX_largeLodValue_NoLock(ti->info),l=ti->minLevel;659 i<=FX_smallLodValue_NoLock(ti->info);660 i++,l++) {661 if (ti->mipmapLevel[l].data) {662 FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,663 ti->tm[FX_TMU0]->startAddr,664 FX_valueToLod(i),665 FX_largeLodLog2(ti->info),666 FX_aspectRatioLog2(ti->info),667 ti->info.format,668 GR_MIPMAPLEVELMASK_ODD,669 ti->mipmapLevel[l].data);670 FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1,671 ti->tm[FX_TMU1]->startAddr,672 FX_valueToLod(i),673 FX_largeLodLog2(ti->info),674 FX_aspectRatioLog2(ti->info),675 ti->info.format,676 GR_MIPMAPLEVELMASK_EVEN,677 ti->mipmapLevel[l].data);678 }679 }680 break;681 default:682 fprintf(stderr,"fxDriver: internal error in fxRestore -> bad tmu (%d)\n",683 where);684 fxCloseHardware();685 exit(-1);686 }687 }688 689 711 void 690 fxTMRestoreTextures (fxMesaContext ctx) {712 fxTMRestoreTextures_NoLock(fxMesaContext ctx) { 691 713 tfxTexInfo *ti; 692 714 struct gl_texture_object *tObj; 693 int i ;715 int i, where; 694 716 695 717 tObj=ctx->glCtx->Shared->TexObjectList; … … 698 720 if (ti && ti->isInTM) { 699 721 for (i=0; i<MAX_TEXTURE_UNITS; i++) 700 if (ctx->glCtx->Texture.Unit[i].Current==tObj) { 701 /* Force the texture onto the board, as it could be in use */ 702 fxTMRestore_NoLock(ctx, tObj); 703 break; 704 } 722 if (ctx->glCtx->Texture.Unit[i].Current==tObj) { 723 /* Force the texture onto the board, as it could be in use */ 724 where=ti->whichTMU; 725 fxTMMoveOutTM_NoLock(ctx, tObj); 726 fxTMMoveInTM_NoLock(ctx, tObj, where); 727 break; 728 } 705 729 if (i==MAX_TEXTURE_UNITS) /* Mark the texture as off the board */ 706 fxTMMoveOutTM(ctx, tObj);730 fxTMMoveOutTM_NoLock(ctx, tObj); 707 731 } 708 732 tObj=tObj->Next; -
trunk/src/opengl/mesa/3dfx/fxtrifuncs.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. … … 58 58 59 59 60 /* Is this enough? Do we need more triangle funcs? 60 /* Is this enough? Do we need more triangle funcs? 61 61 */ 62 62 static triangle_func tri_tab[0x40]; /* only 0x20 actually used */ … … 129 129 #include "fxtritmp.h" 130 130 131 /* We don't actually do antialiasing correctly. Geometry has to be 132 sorted for glide's antialiasing to operate */ 133 #if 0 131 134 #define IND (FX_ANTIALIAS) 132 135 #define TAG(x) x##_aa … … 192 195 #define TAG(x) x##_aa_flat_front_back_twoside_offset 193 196 #include "fxtritmp.h" 194 195 196 void fxDDTrifuncInit() 197 #endif 198 199 void fxDDTrifuncInit() 197 200 { 198 201 init(); … … 212 215 init_flat_front_back_twoside(); 213 216 init_flat_front_back_twoside_offset(); 217 #if 0 214 218 init_aa(); 215 219 init_aa_offset(); … … 228 232 init_aa_flat_front_back_twoside(); 229 233 init_aa_flat_front_back_twoside_offset(); 234 #endif 230 235 } 231 236 … … 233 238 { 234 239 fprintf(stderr, "%s: (%x) %s%s%s%s%s%s\n", 235 msg, state,236 (state & FX_ANTIALIAS) ? "antialias, " : "",237 (state & FX_FLAT) ? "flat, " : "",238 (state & FX_TWOSIDE) ? "twoside, " : "",239 (state & FX_OFFSET) ? "offset, " : "",240 (state & FX_FRONT_BACK) ? "front-back, " : "",241 (state & FX_FALLBACK) ? "fallback" : "");240 msg, state, 241 (state & FX_ANTIALIAS) ? "antialias, " : "", 242 (state & FX_FLAT) ? "flat, " : "", 243 (state & FX_TWOSIDE) ? "twoside, " : "", 244 (state & FX_OFFSET) ? "offset, " : "", 245 (state & FX_FRONT_BACK) ? "front-back, " : "", 246 (state & FX_FALLBACK) ? "fallback" : ""); 242 247 } 243 248 … … 246 251 { 247 252 fprintf(stderr, "%s: (%x) %s %s%s %s%s\n", 248 msg, state,249 (state & GR_STWHINT_W_DIFF_FBI) ? "w-fbi, " : "",250 (state & GR_STWHINT_W_DIFF_TMU0) ? "w-tmu0, " : "",251 (state & GR_STWHINT_ST_DIFF_TMU0) ? "st-tmu0, " : "",252 (state & GR_STWHINT_W_DIFF_TMU1) ? "w-tmu1, " : "",253 (state & GR_STWHINT_ST_DIFF_TMU1) ? "st-tmu1, " : "");253 msg, state, 254 (state & GR_STWHINT_W_DIFF_FBI) ? "w-fbi, " : "", 255 (state & GR_STWHINT_W_DIFF_TMU0) ? "w-tmu0, " : "", 256 (state & GR_STWHINT_ST_DIFF_TMU0) ? "st-tmu0, " : "", 257 (state & GR_STWHINT_W_DIFF_TMU1) ? "w-tmu1, " : "", 258 (state & GR_STWHINT_ST_DIFF_TMU1) ? "st-tmu1, " : ""); 254 259 255 260 } … … 265 270 266 271 if (flags) { 267 if (fxMesa->render_index & FX_OFFSET) 268 FX_grDepthBiasLevel(0);272 if (fxMesa->render_index & FX_OFFSET) 273 FX_grDepthBiasLevel(0); 269 274 270 275 if (flags & (DD_SELECT|DD_FEEDBACK)) { 271 fxMesa->PointsFunc = 0; 272 fxMesa->LineFunc = 0; 273 fxMesa->TriangleFunc = 0; 274 fxMesa->QuadFunc = 0; 275 fxMesa->render_index = FX_FALLBACK; 276 ctx->IndirectTriangles |= DD_SW_RASTERIZE; 277 return; 276 fxMesa->PointsFunc = 0; 277 fxMesa->LineFunc = 0; 278 fxMesa->TriangleFunc = 0; 279 fxMesa->QuadFunc = 0; 280 fxMesa->render_index = FX_FALLBACK; 281 ctx->IndirectTriangles |= DD_SW_RASTERIZE; 282 #if 0 283 fprintf(stderr, "Fallback select|feeback\n"); 284 #endif 285 return; 278 286 } 279 287 280 288 if (flags & DD_FLATSHADE) ind |= FX_FLAT; 281 289 if (flags & DD_TRI_LIGHT_TWOSIDE) ind |= FX_TWOSIDE; 282 290 if (flags & DD_MULTIDRAW) ind |= FX_FRONT_BACK; 283 if (flags & DD_POINT_SMOOTH) ind |= FX_ANTIALIAS; 284 if (flags & (DD_POINT_SIZE|DD_POINT_ATTEN)) ind |= FX_FALLBACK; 291 if (flags & (DD_POINT_ATTEN|DD_POINT_SMOOTH)) { 292 ind |= FX_FALLBACK; 293 #if 0 294 if (flags&DD_POINT_ATTEN) 295 fprintf(stderr, "Fallback point atten\n"); 296 if (flags&DD_POINT_SMOOTH) 297 fprintf(stderr, "Fallback point smooth\n"); 298 #endif 299 } 285 300 286 301 fxMesa->render_index = ind; 287 302 fxMesa->PointsFunc = points_tab[ind]; 288 303 if (ind&FX_FALLBACK) 289 ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE;304 ctx->IndirectTriangles |= DD_POINT_SW_RASTERIZE; 290 305 ind &= ~(FX_ANTIALIAS|FX_FALLBACK); 291 306 292 if (flags & DD_LINE_SMOOTH) ind |= FX_ANTIALIAS; 293 if (flags & (DD_LINE_WIDTH|DD_LINE_STIPPLE)) ind |= FX_FALLBACK; 307 if (flags & (DD_LINE_STIPPLE|DD_LINE_SMOOTH)) { 308 ind |= FX_FALLBACK; 309 #if 0 310 if (flags&DD_LINE_STIPPLE) 311 fprintf(stderr, "Fallback line stipple\n"); 312 if (flags&DD_LINE_SMOOTH) 313 fprintf(stderr, "Fallback line smooth\n"); 314 #endif 315 } 294 316 295 317 fxMesa->render_index |= ind; 296 318 fxMesa->LineFunc = line_tab[ind]; 297 319 if (ind&FX_FALLBACK) 298 ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE;320 ctx->IndirectTriangles |= DD_LINE_SW_RASTERIZE; 299 321 ind &= ~(FX_ANTIALIAS|FX_FALLBACK); 300 322 301 if (flags & DD_TRI_SMOOTH) ind |= FX_ANTIALIAS;302 323 if (flags & DD_TRI_OFFSET) ind |= FX_OFFSET; 303 if (flags & (DD_TRI_UNFILLED|DD_TRI_STIPPLE)) ind |= FX_FALLBACK; 324 if (flags & (DD_TRI_UNFILLED|DD_TRI_STIPPLE|DD_TRI_SMOOTH)) { 325 ind |= FX_FALLBACK; 326 #if 0 327 if (flags&DD_TRI_UNFILLED) 328 fprintf(stderr, "Fallback tri unfilled\n"); 329 if (flags&DD_TRI_STIPPLE) 330 fprintf(stderr, "Fallback tri stippled\n"); 331 if (flags&DD_TRI_SMOOTH) 332 fprintf(stderr, "Fallback tri smooth\n"); 333 #endif 334 } 304 335 305 336 fxMesa->render_index |= ind; … … 308 339 309 340 if (ind&FX_FALLBACK) 310 ctx->IndirectTriangles |= DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE;311 } 341 ctx->IndirectTriangles |= DD_TRI_SW_RASTERIZE | DD_QUAD_SW_RASTERIZE; 342 } 312 343 else if (fxMesa->render_index) 313 344 { 314 if (fxMesa->render_index & FX_OFFSET) 315 FX_grDepthBiasLevel(0);345 if (fxMesa->render_index & FX_OFFSET) 346 FX_grDepthBiasLevel(0); 316 347 317 348 fxMesa->render_index = 0; … … 333 364 */ 334 365 366 extern int gl_fx_dummy_function_tris(void); 335 367 int gl_fx_dummy_function_tris(void) 336 368 { -
trunk/src/opengl/mesa/3dfx/fxtritmp.h
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. … … 49 49 struct vertex_buffer *VB=ctx->VB; 50 50 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; 51 GrVertex *v1 = (GrVertex *)gWin[e1].f; 51 GrVertex *v1 = (GrVertex *)gWin[e1].f; 52 52 GrVertex *v2 = (GrVertex *)gWin[e2].f; 53 53 GrVertex *v3 = (GrVertex *)gWin[e3].f; … … 55 55 (void) fxMesa; 56 56 57 if (IND & (FX_TWOSIDE|FX_OFFSET)) 57 if (IND & (FX_TWOSIDE|FX_OFFSET)) 58 58 { 59 59 GLfloat ex = v1->x - v3->x; … … 62 62 GLfloat fy = v2->y - v3->y; 63 63 GLfloat c = ex*fy-ey*fx; 64 64 65 65 if (IND & FX_TWOSIDE) { 66 GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit;67 GLubyte (*color)[4] = VB->Color[facing]->data;68 if (IND & FX_FLAT) {69 FX_VB_COLOR(fxMesa, color[pv]);70 } else {71 GOURAUD2(v1,color[e1]); 72 GOURAUD2(v2,color[e2]); 73 GOURAUD2(v3,color[e3]); 74 }75 } 76 66 GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit; 67 GLubyte (*color)[4] = VB->Color[facing]->data; 68 if (IND & FX_FLAT) { 69 FX_VB_COLOR(fxMesa, color[pv]); 70 } else { 71 GOURAUD2(v1,color[e1]); 72 GOURAUD2(v2,color[e2]); 73 GOURAUD2(v3,color[e3]); 74 } 75 } 76 77 77 /* Should apply a factor to ac to compensate for different x/y 78 78 * scaling introduced in the Viewport matrix. … … 81 81 */ 82 82 if (IND & FX_OFFSET) { 83 GLfloat offset = ctx->Polygon.OffsetUnits;84 85 if (c * c > 1e-16) {86 GLfloat factor = ctx->Polygon.OffsetFactor;87 GLfloat ez = v1->ooz - v3->ooz;88 GLfloat fz = v2->ooz - v3->ooz;89 GLfloat a = ey*fz-ez*fy;90 GLfloat b = ez*fx-ex*fz;91 GLfloat ic = 1.0 / c;92 GLfloat ac = a * ic;93 GLfloat bc = b * ic;94 if (ac<0.0F) ac = -ac;95 if (bc<0.0F) bc = -bc;96 offset += MAX2( ac, bc ) * factor;97 }98 /* Probably a lot quicker just to nudge the z values and put99 * them back afterwards.100 */101 FX_grDepthBiasLevel((int)offset);83 GLfloat offset = ctx->Polygon.OffsetUnits; 84 85 if (c * c > 1e-16) { 86 GLfloat factor = ctx->Polygon.OffsetFactor; 87 GLfloat ez = v1->ooz - v3->ooz; 88 GLfloat fz = v2->ooz - v3->ooz; 89 GLfloat a = ey*fz-ez*fy; 90 GLfloat b = ez*fx-ex*fz; 91 GLfloat ic = 1.0 / c; 92 GLfloat ac = a * ic; 93 GLfloat bc = b * ic; 94 if (ac<0.0F) ac = -ac; 95 if (bc<0.0F) bc = -bc; 96 offset += MAX2( ac, bc ) * factor; 97 } 98 /* Probably a lot quicker just to nudge the z values and put 99 * them back afterwards. 100 */ 101 FX_grDepthBiasLevel((int)offset); 102 102 } 103 103 } … … 109 109 if (IND & FX_FRONT_BACK) { 110 110 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 111 ctx->Color.ColorMask[GCOMP] ||112 ctx->Color.ColorMask[BCOMP],113 FXFALSE);111 ctx->Color.ColorMask[GCOMP] || 112 ctx->Color.ColorMask[BCOMP], 113 FXFALSE); 114 114 115 115 FX_grDepthMask(FXFALSE); … … 117 117 } 118 118 119 if (IND & FX_ANTIALIAS) 119 if (IND & FX_ANTIALIAS) 120 120 FX_grAADrawTriangle(v1, v2, v3, FXTRUE, FXTRUE, FXTRUE); 121 else 121 else 122 122 FX_grDrawTriangle(v1, v2, v3); 123 123 … … 126 126 if (IND & FX_FRONT_BACK) { 127 127 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 128 ctx->Color.ColorMask[GCOMP] ||129 ctx->Color.ColorMask[BCOMP],130 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 128 ctx->Color.ColorMask[GCOMP] || 129 ctx->Color.ColorMask[BCOMP], 130 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 131 131 132 132 if(ctx->Depth.Mask) FX_grDepthMask(FXTRUE); … … 135 135 136 136 if (IND & FX_ANTIALIAS) 137 FX_grAADrawTriangle(v1,v2,v3, FXTRUE,FXTRUE,FXTRUE);137 FX_grAADrawTriangle(v1,v2,v3, FXTRUE,FXTRUE,FXTRUE); 138 138 else 139 FX_grDrawTriangle(v1, v2, v3);140 } 139 FX_grDrawTriangle(v1, v2, v3); 140 } 141 141 } 142 142 … … 145 145 */ 146 146 static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, 147 GLuint e4, GLuint pv)147 GLuint e4, GLuint pv) 148 148 { 149 149 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; 150 150 struct vertex_buffer *VB=ctx->VB; 151 151 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; 152 GrVertex *v1 = (GrVertex *)gWin[e1].f; 152 GrVertex *v1 = (GrVertex *)gWin[e1].f; 153 153 GrVertex *v2 = (GrVertex *)gWin[e2].f; 154 154 GrVertex *v3 = (GrVertex *)gWin[e3].f; … … 157 157 (void) fxMesa; 158 158 159 if (IND & (FX_TWOSIDE|FX_OFFSET)) 159 if (IND & (FX_TWOSIDE|FX_OFFSET)) 160 160 { 161 161 GLfloat ex = v3->x - v1->x; … … 164 164 GLfloat fy = v4->y - v2->y; 165 165 GLfloat c = ex*fy-ey*fx; 166 166 167 167 if (IND & FX_TWOSIDE) { 168 GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit;169 GLubyte (*color)[4] = VB->Color[facing]->data;170 if (IND & FX_FLAT) {171 FX_VB_COLOR(fxMesa, color[pv]);172 } else {173 GOURAUD2(v1,color[e1]); 174 GOURAUD2(v2,color[e2]); 175 GOURAUD2(v3,color[e3]); 176 GOURAUD2(v4,color[e4]); 177 }178 } 179 168 GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit; 169 GLubyte (*color)[4] = VB->Color[facing]->data; 170 if (IND & FX_FLAT) { 171 FX_VB_COLOR(fxMesa, color[pv]); 172 } else { 173 GOURAUD2(v1,color[e1]); 174 GOURAUD2(v2,color[e2]); 175 GOURAUD2(v3,color[e3]); 176 GOURAUD2(v4,color[e4]); 177 } 178 } 179 180 180 /* Should apply a factor to ac to compensate for different x/y 181 181 * scaling introduced in the Viewport matrix. … … 184 184 */ 185 185 if (IND & FX_OFFSET) { 186 GLfloat offset = ctx->Polygon.OffsetUnits;187 188 if (c * c > 1e-16) {189 GLfloat factor = ctx->Polygon.OffsetFactor;190 GLfloat ez = v3->ooz - v1->ooz;191 GLfloat fz = v4->ooz - v2->ooz;192 GLfloat a = ey*fz-ez*fy;193 GLfloat b = ez*fx-ex*fz;194 GLfloat ic = 1.0 / c;195 GLfloat ac = a * ic;196 GLfloat bc = b * ic;197 if (ac<0.0F) ac = -ac;198 if (bc<0.0F) bc = -bc;199 offset += MAX2( ac, bc ) * factor;200 }201 /* Probably a lot quicker just to nudge the z values and put202 * them back afterwards.203 */204 FX_grDepthBiasLevel((int)offset);186 GLfloat offset = ctx->Polygon.OffsetUnits; 187 188 if (c * c > 1e-16) { 189 GLfloat factor = ctx->Polygon.OffsetFactor; 190 GLfloat ez = v3->ooz - v1->ooz; 191 GLfloat fz = v4->ooz - v2->ooz; 192 GLfloat a = ey*fz-ez*fy; 193 GLfloat b = ez*fx-ex*fz; 194 GLfloat ic = 1.0 / c; 195 GLfloat ac = a * ic; 196 GLfloat bc = b * ic; 197 if (ac<0.0F) ac = -ac; 198 if (bc<0.0F) bc = -bc; 199 offset += MAX2( ac, bc ) * factor; 200 } 201 /* Probably a lot quicker just to nudge the z values and put 202 * them back afterwards. 203 */ 204 FX_grDepthBiasLevel((int)offset); 205 205 } 206 206 } … … 212 212 if (IND & FX_FRONT_BACK) { 213 213 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 214 ctx->Color.ColorMask[GCOMP] ||215 ctx->Color.ColorMask[BCOMP],216 FXFALSE);214 ctx->Color.ColorMask[GCOMP] || 215 ctx->Color.ColorMask[BCOMP], 216 FXFALSE); 217 217 218 218 FX_grDepthMask(FXFALSE); … … 232 232 if (IND & FX_FRONT_BACK) { 233 233 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 234 ctx->Color.ColorMask[GCOMP] ||235 ctx->Color.ColorMask[BCOMP],236 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 234 ctx->Color.ColorMask[GCOMP] || 235 ctx->Color.ColorMask[BCOMP], 236 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 237 237 238 238 if(ctx->Depth.Mask) FX_grDepthMask(FXTRUE); … … 241 241 242 242 if (IND & FX_ANTIALIAS) { 243 FX_grAADrawTriangle(v1, v2, v4, FXTRUE, FXTRUE, FXTRUE);244 FX_grAADrawTriangle(v2, v3, v4, FXTRUE, FXTRUE, FXTRUE);243 FX_grAADrawTriangle(v1, v2, v4, FXTRUE, FXTRUE, FXTRUE); 244 FX_grAADrawTriangle(v2, v3, v4, FXTRUE, FXTRUE, FXTRUE); 245 245 } else { 246 FX_grDrawTriangle(v1, v2, v4);247 FX_grDrawTriangle(v2, v3, v4);248 } 249 } 246 FX_grDrawTriangle(v1, v2, v4); 247 FX_grDrawTriangle(v2, v3, v4); 248 } 249 } 250 250 } 251 251 252 253 252 #define DRAW_LINE(tmp0, tmp1, width) \ 253 do { \ 254 GrVertex verts[4]; \ 255 float dx, dy, wx, wy; \ 256 \ 257 dx = tmp0->x - tmp1->x; \ 258 dy = tmp0->y - tmp1->y; \ 259 \ 260 if (dx * dx > dy * dy) { \ 261 wx = 0; \ 262 wy = width; \ 263 } else { \ 264 wx = width; \ 265 wy = 0; \ 266 } \ 267 \ 268 verts[0] = *tmp0; \ 269 verts[1] = *tmp0; \ 270 verts[2] = *tmp1; \ 271 verts[3] = *tmp1; \ 272 \ 273 verts[0].x = tmp0->x - wx; \ 274 verts[0].y = tmp0->y - wy; \ 275 \ 276 verts[1].x = tmp0->x + wx; \ 277 verts[1].y = tmp0->y + wy; \ 278 \ 279 verts[2].x = tmp1->x + wx; \ 280 verts[2].y = tmp1->y + wy; \ 281 \ 282 verts[3].x = tmp1->x - wx; \ 283 verts[3].y = tmp1->y - wy; \ 284 \ 285 FX_grDrawPolygonVertexList(4, verts); \ 286 } while (0) 254 287 255 288 #if (IND & FX_OFFSET) == 0 … … 260 293 fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; 261 294 GLubyte (* const color)[4] = VB->Color[0]->data; 262 GrVertex *v1 = (GrVertex *)gWin[e1].f; 295 GrVertex *v1 = (GrVertex *)gWin[e1].f; 263 296 GrVertex *v2 = (GrVertex *)gWin[e2].f; 264 265 if (IND & FX_FLAT) 297 GLfloat w = ctx->Line.Width*.5; 298 299 if (IND & FX_FLAT) 266 300 { 267 301 FX_VB_COLOR(fxMesa, color[pv]); … … 271 305 GLuint v1argb = v1->argb; 272 306 GLuint v2argb = v2->argb; 273 v1->argb = (color[pv][ACOMP] << 24) | (v1argb & 0x00FFFFFF);274 v2->argb = (color[pv][ACOMP] << 24) | (v2argb & 0x00FFFFFF);307 v1->argb = (color[pv][ACOMP] << 24) | (v1argb & 0x00FFFFFF); 308 v2->argb = (color[pv][ACOMP] << 24) | (v2argb & 0x00FFFFFF); 275 309 } 276 310 #else 277 v1->a = v2->a = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][3]);278 #endif 279 } 280 else if (IND & FX_TWOSIDE) 311 v1->a = v2->a = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][3]); 312 #endif 313 } 314 else if (IND & FX_TWOSIDE) 281 315 { 282 GOURAUD2(v1,color[e1]); 283 GOURAUD2(v2,color[e2]); 284 } 285 286 if (IND & FX_FRONT_BACK) { 287 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 288 ctx->Color.ColorMask[GCOMP] ||289 ctx->Color.ColorMask[BCOMP],290 FXFALSE);316 GOURAUD2(v1,color[e1]); 317 GOURAUD2(v2,color[e2]); 318 } 319 320 if (IND & FX_FRONT_BACK) { 321 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 322 ctx->Color.ColorMask[GCOMP] || 323 ctx->Color.ColorMask[BCOMP], 324 FXFALSE); 291 325 FX_grDepthMask(FXFALSE); 292 326 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); … … 296 330 FX_grAADrawLine(v1,v2); 297 331 else 298 FX_grDrawLine(v1,v2);299 300 if (IND & FX_FRONT_BACK) 332 DRAW_LINE(v1,v2,w); 333 334 if (IND & FX_FRONT_BACK) 301 335 { 302 336 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 303 ctx->Color.ColorMask[GCOMP] ||304 ctx->Color.ColorMask[BCOMP],305 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 337 ctx->Color.ColorMask[GCOMP] || 338 ctx->Color.ColorMask[BCOMP], 339 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 306 340 307 341 if(ctx->Depth.Mask) 308 FX_grDepthMask(FXTRUE);342 FX_grDepthMask(FXTRUE); 309 343 310 344 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 311 345 312 346 if (IND & FX_ANTIALIAS) 313 FX_grAADrawLine(v1,v2);347 FX_grAADrawLine(v1,v2); 314 348 else 315 FX_grDrawLine(v1,v2);349 DRAW_LINE(v1,v2,w); 316 350 } 317 351 } … … 336 370 #endif 337 371 338 #if IND & FX_ANTIALIAS 339 #define DRAW_POINT(i) FX_grAADrawPoint((GrVertex *)gWin[i].f); 340 #else 341 #define DRAW_POINT(i) FX_grDrawPoint((GrVertex *)gWin[i].f); 342 #endif 343 372 373 #define DRAW_POINT(i, sz) \ 374 do { \ 375 GrVertex verts[4], *tmp; \ 376 \ 377 tmp = (GrVertex*)gWin[i].f; \ 378 verts[0] = *tmp; \ 379 verts[1] = *tmp; \ 380 verts[2] = *tmp; \ 381 verts[3] = *tmp; \ 382 verts[0].x = verts[3].x = tmp->x + sz; \ 383 verts[0].y = verts[1].y = tmp->y + sz; \ 384 verts[2].x = verts[1].x = tmp->x - sz; \ 385 verts[2].y = verts[3].y = tmp->y - sz; \ 386 \ 387 FX_grDrawPolygonVertexList(4, verts); \ 388 } while (0) 344 389 345 390 static void TAG(fx_points)(GLcontext *ctx, GLuint first, GLuint last) … … 350 395 GLubyte (*color)[4] = VB->ColorPtr->data; 351 396 GLuint i; 397 GLfloat sz = ctx->Point.Size * .5; 352 398 353 399 (void) color; (void) fxMesa; … … 355 401 if (IND & FX_FRONT_BACK) { 356 402 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 357 ctx->Color.ColorMask[GCOMP] ||358 ctx->Color.ColorMask[BCOMP],359 FXFALSE);403 ctx->Color.ColorMask[GCOMP] || 404 ctx->Color.ColorMask[BCOMP], 405 FXFALSE); 360 406 361 407 FX_grDepthMask(FXFALSE); … … 365 411 if(!VB->ClipOrMask) { 366 412 for(i=first;i<=last;i++) { 367 FLAT_COLOR(fxMesa, color[i]);368 DRAW_POINT(i);413 FLAT_COLOR(fxMesa, color[i]); 414 DRAW_POINT(i, sz); 369 415 } 370 416 } else { 371 417 for(i=first;i<=last;i++) { 372 if(VB->ClipMask[i]==0) {373 FLAT_COLOR(fxMesa, color[i]);374 DRAW_POINT(i);375 }376 } 377 } 378 379 if (IND & FX_FRONT_BACK) { 380 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 381 ctx->Color.ColorMask[GCOMP] ||382 ctx->Color.ColorMask[BCOMP],383 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 418 if(VB->ClipMask[i]==0) { 419 FLAT_COLOR(fxMesa, color[i]); 420 DRAW_POINT(i, sz); 421 } 422 } 423 } 424 425 if (IND & FX_FRONT_BACK) { 426 FX_grColorMask(ctx->Color.ColorMask[RCOMP] || 427 ctx->Color.ColorMask[GCOMP] || 428 ctx->Color.ColorMask[BCOMP], 429 ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); 384 430 if(ctx->Depth.Mask) 385 FX_grDepthMask(FXTRUE);431 FX_grDepthMask(FXTRUE); 386 432 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); 387 433 388 434 389 435 if(!VB->ClipOrMask) { 390 for(i=first;i<=last;i++) {391 FLAT_COLOR(fxMesa, color[i]);392 DRAW_POINT(i);393 }436 for(i=first;i<=last;i++) { 437 FLAT_COLOR(fxMesa, color[i]); 438 DRAW_POINT(i, sz); 439 } 394 440 } else { 395 for(i=first;i<=last;i++) {396 if(VB->ClipMask[i]==0) {397 FLAT_COLOR(fxMesa, color[i]);398 DRAW_POINT(i);399 }400 }441 for(i=first;i<=last;i++) { 442 if(VB->ClipMask[i]==0) { 443 FLAT_COLOR(fxMesa, color[i]); 444 DRAW_POINT(i, sz); 445 } 446 } 401 447 } 402 448 } … … 412 458 quad_tab[IND] = TAG(fx_quad); 413 459 414 #if ((IND & FX_OFFSET) == 0) 460 #if ((IND & FX_OFFSET) == 0) 415 461 line_tab[IND] = TAG(fx_line); 416 462 points_tab[IND] = TAG(fx_points); 417 #else 463 #else 418 464 line_tab[IND] = line_tab[IND & ~FX_OFFSET]; 419 465 points_tab[IND] = points_tab[IND & ~FX_OFFSET]; -
trunk/src/opengl/mesa/3dfx/fxvs_tmp.h
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. … … 122 122 fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; 123 123 124 if (fxMesa->new_state) 124 if (fxMesa->new_state) 125 125 fxSetupFXUnits( ctx ); 126 126 … … 137 137 138 138 if (VB->ClipOrMask) { 139 GLubyte *clipmask = &VB->ClipMask[start];140 for (;v!=vend;v+=16,clipmask++ INCR) {141 if (*clipmask == 0) {142 DO_SETUP;143 }144 }145 } else 146 for (;v!=vend;v+=16 INCR) {147 DO_SETUP;148 }139 GLubyte *clipmask = &VB->ClipMask[start]; 140 for (;v!=vend;v+=16,clipmask++ INCR) { 141 if (*clipmask == 0) { 142 DO_SETUP; 143 } 144 } 145 } else 146 for (;v!=vend;v+=16 INCR) { 147 DO_SETUP; 148 } 149 149 150 150 /* rare - I hope */ -
trunk/src/opengl/mesa/3dfx/fxvsetup.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. … … 61 61 { 62 62 fprintf(stderr, "%s: %d %s%s%s%s%s%s\n", 63 msg,64 flags,65 (flags & SETUP_XY) ? " xy," : "", 66 (flags & SETUP_Z) ? " z," : "",67 (flags & SETUP_W) ? " w," : "",68 (flags & SETUP_RGBA) ? " rgba," : "",69 (flags & SETUP_TMU0) ? " tmu0," : "",70 (flags & SETUP_TMU1) ? " tmu1," : "");63 msg, 64 flags, 65 (flags & SETUP_XY) ? " xy," : "", 66 (flags & SETUP_Z) ? " z," : "", 67 (flags & SETUP_W) ? " w," : "", 68 (flags & SETUP_RGBA) ? " rgba," : "", 69 (flags & SETUP_TMU0) ? " tmu0," : "", 70 (flags & SETUP_TMU1) ? " tmu1," : ""); 71 71 } 72 72 73 73 static void project_texcoords( struct vertex_buffer *VB, 74 GLuint tmu_nr, GLuint tc_nr,75 GLuint start, GLuint count )76 { 74 GLuint tmu_nr, GLuint tc_nr, 75 GLuint start, GLuint count ) 76 { 77 77 fxVertex *v = FX_DRIVER_DATA(VB)->verts + start; 78 78 GrTmuVertex *tmu = &(((GrVertex *)v->f)->tmuvtx[tmu_nr]); … … 86 86 tmu->oow = v->f[OOWCOORD] * data[3]; 87 87 tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex)); 88 } 88 } 89 89 } 90 90 91 91 92 92 static void copy_w( struct vertex_buffer *VB, 93 GLuint tmu_nr, 94 GLuint start, GLuint count )95 { 93 GLuint tmu_nr, 94 GLuint start, GLuint count ) 95 { 96 96 fxVertex *v = FX_DRIVER_DATA(VB)->verts + start; 97 97 GrTmuVertex *tmu = &(((GrVertex *)v->f)->tmuvtx[tmu_nr]); … … 101 101 tmu->oow = v->f[OOWCOORD]; 102 102 tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex)); 103 } 103 } 104 104 } 105 105 … … 303 303 setupindex |= SETUP_RGBA|SETUP_W; 304 304 305 if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D|TEXTURE0_3D)) == TEXTURE0_2D) 305 if ((ctx->Texture.ReallyEnabled & (TEXTURE0_2D|TEXTURE0_3D)) == TEXTURE0_2D) 306 306 { 307 if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) 308 setupindex &= ~SETUP_RGBA;307 if (ctx->Texture.Unit[0].EnvMode == GL_REPLACE) 308 setupindex &= ~SETUP_RGBA; 309 309 310 310 setupindex |= SETUP_TMU0|SETUP_W; … … 313 313 if ((ctx->Texture.ReallyEnabled & (TEXTURE1_2D|TEXTURE1_3D)) == TEXTURE1_2D) 314 314 { 315 if (setupindex & SETUP_TMU0) { 316 struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2]; 317 tfxTexInfo *ti=fxTMGetTexInfo(tObj); 318 319 setupindex |= SETUP_TMU1|SETUP_W; 320 321 if(ti->whichTMU!=FX_TMU0) { 322 fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0; 323 fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1; 324 } 325 } else { 326 setupindex |= SETUP_TMU0|SETUP_W; 327 fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0; 328 /* not used: */ 329 fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1; 330 } 315 setupindex |= SETUP_TMU1|SETUP_W; 316 if (setupindex & SETUP_TMU0) { /* both TMUs in use */ 317 struct gl_texture_object *tObj=ctx->Texture.Unit[0].CurrentD[2]; 318 tfxTexInfo *ti=fxTMGetTexInfo(tObj); 319 320 if (ti->whichTMU!=FX_TMU0) { /* TMU0 and TMU1 are swapped */ 321 fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[1] = SETUP_TMU0; 322 fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[0] = SETUP_TMU1; 323 } 324 } 331 325 } 332 326 … … 335 329 336 330 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE)) 337 fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); 331 fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); 338 332 339 333 fxMesa->setupindex = setupindex; … … 353 347 return; 354 348 } 355 356 if (VB->Type == VB_CVA_PRECALC) 349 350 if (VB->Type == VB_CVA_PRECALC) 357 351 fxDDPartialRasterSetup( VB ); 358 else 352 else 359 353 ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count ); 360 354 } … … 366 360 * we get a forbidden input in the elt pipeline - and therefore need to check 367 361 * whether we have one *now*. Similarly need to know if state changes cause 368 * size4 texcoords to be introduced. 362 * size4 texcoords to be introduced. 369 363 */ 370 364 void fxDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) … … 375 369 d->type = 0; 376 370 d->pre_forbidden_inputs = 0; 377 fxMesa->setupdone = 0; /* cleared if we return */378 379 /* Indirect triangles must be rendered via the immediate pipeline. 380 * If all rasterization is software, no need to set up. 371 fxMesa->setupdone = 0; /* cleared if we return */ 372 373 /* Indirect triangles must be rendered via the immediate pipeline. 374 * If all rasterization is software, no need to set up. 381 375 */ 382 376 if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) 383 377 return; 384 378 385 379 if ((ctx->IndirectTriangles & DD_SW_SETUP) || 386 (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) 380 (ctx->IndirectTriangles & DD_SW_RASTERIZE) == DD_SW_RASTERIZE) 387 381 return; 388 382 … … 391 385 { 392 386 if (ctx->TextureMatrix[0].type == MATRIX_GENERAL || 393 ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE ||394 (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT))395 return;387 ctx->TextureMatrix[0].type == MATRIX_PERSPECTIVE || 388 (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT)) 389 return; 396 390 397 391 d->pre_forbidden_inputs |= VERT_TEX0_4; … … 402 396 { 403 397 if (ctx->TextureMatrix[1].type == MATRIX_GENERAL || 404 ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE ||405 (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT))406 return;398 ctx->TextureMatrix[1].type == MATRIX_PERSPECTIVE || 399 (ctx->Texture.Unit[1].TexGenEnabled & Q_BIT)) 400 return; 407 401 408 402 d->pre_forbidden_inputs |= VERT_TEX1_4; 409 403 } 410 404 411 405 412 406 fxMesa->setupdone = tmp; 413 407 d->inputs = 0; … … 444 438 if ((newout & VERT_WIN) == 0) 445 439 ind &= ~(fxMesa->setupdone & SETUP_W); 446 440 447 441 fxMesa->setupdone &= ~ind; 448 442 ind &= fxMesa->setupindex; … … 451 445 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE)) { 452 446 gl_print_vert_flags("new outputs", VB->pipeline->new_outputs); 453 fxPrintSetupFlags("fxmesa: partial setup function", ind); 454 } 455 456 if (ind) 457 setupfuncs[ind]( VB, VB->Start, VB->Count ); 447 fxPrintSetupFlags("fxmesa: partial setup function", ind); 448 } 449 450 if (ind) 451 setupfuncs[ind]( VB, VB->Start, VB->Count ); 458 452 } 459 453 … … 472 466 FREE( fvb->vert_store ); 473 467 fvb->vert_store = MALLOC( sizeof(fxVertex) * fvb->size + 31); 474 if (!fvb->vert_store || !VB->ClipMask) 468 if (!fvb->vert_store || !VB->ClipMask) 475 469 { 476 470 fprintf(stderr,"fx Driver: out of memory !\n"); 477 471 fxCloseHardware(); 478 exit(-1);472 EXIT(-1); 479 473 } 480 474 fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31); … … 482 476 gl_vector1ui_free( &fvb->clipped_elements ); 483 477 gl_vector1ui_alloc( &fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32 ); 484 478 485 479 if (!fvb->clipped_elements.start) goto memerror; 486 480 487 481 return; 488 memerror: 482 memerror: 489 483 fprintf(stderr,"fx Driver: out of memory !\n"); 490 484 fxCloseHardware(); 491 exit(-1);485 EXIT(-1); 492 486 } 493 487 … … 507 501 fvb->vert_store = MALLOC( sizeof(fxVertex) * fvb->size + 31); 508 502 if (!fvb->vert_store) goto memerror; 509 #if defined(FX_GLIDE3) 503 #if defined(FX_GLIDE3) 510 504 fvb->triangle_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 511 505 if (!fvb->triangle_b) goto memerror; 512 506 fvb->strips_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 513 if (!fvb->strips_b ) goto memerror; 514 #endif 507 if (!fvb->strips_b ) goto memerror; 508 #endif 515 509 fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31); 516 510 gl_vector1ui_alloc( &fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32 ); … … 519 513 FREE( VB->ClipMask ); 520 514 VB->ClipMask = (GLubyte *)MALLOC(sizeof(GLubyte) * fvb->size); 521 if (!VB->ClipMask) goto memerror;515 if (!VB->ClipMask) goto memerror; 522 516 523 517 } else { 524 518 fvb->vert_store = MALLOC( sizeof(fxVertex) * (VB->Size + 12) + 31); 525 519 if (!fvb->vert_store) goto memerror; 526 #if defined(FX_GLIDE3) 520 #if defined(FX_GLIDE3) 527 521 fvb->triangle_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 528 522 if (!fvb->triangle_b) goto memerror; 529 523 fvb->strips_b = MALLOC( sizeof(GrVertex*) *4* fvb->size+ 31); 530 if (!fvb->strips_b ) goto memerror; 531 #endif 524 if (!fvb->strips_b ) goto memerror; 525 #endif 532 526 fvb->verts = (fxVertex *)(((unsigned long)fvb->vert_store + 31) & ~31); 533 527 fvb->size = VB->Size + 12; 534 528 } 535 529 536 530 537 531 VB->driver_data = fvb; 538 532 return; … … 540 534 fprintf(stderr,"fx Driver: out of memory !\n"); 541 535 fxCloseHardware(); 542 exit(-1);536 EXIT(-1); 543 537 } 544 538 … … 546 540 { 547 541 struct tfxMesaVertexBuffer *fvb = FX_DRIVER_DATA(VB); 548 542 549 543 if (fvb) { 550 544 if (fvb->vert_store) FREE(fvb->vert_store); … … 553 547 #if defined(FX_GLIDE3) 554 548 if (fvb->strips_b) 555 FREE(fvb->strips_b);549 FREE(fvb->strips_b); 556 550 if (fvb->triangle_b) 557 FREE(fvb->triangle_b);551 FREE(fvb->triangle_b); 558 552 #endif 559 553 VB->driver_data = 0; 560 } 554 } 561 555 } 562 556 -
trunk/src/opengl/mesa/3dfx/fxvsetup.h
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. … … 48 48 49 49 50 #define VARS_W 50 #define VARS_W 51 51 52 52 #define VARS_Z 53 53 54 #define VARS_TMU0 \55 GLuint tmu0_source = fxMesa->tmu_source[0]; \56 GLfloat *tmu0_data = VEC_ELT(VB->TexCoordPtr[tmu0_source], \57 GLfloat, start);\58 GLuint tmu0_stride = VB->TexCoordPtr[tmu0_source]->stride; \59 GLuint tmu0_sz = VB->TexCoordPtr[tmu0_source]->size; \60 struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \61 GLfloat sscale0 = FX_TEXTURE_DATA(t0)->sScale; \54 #define VARS_TMU0 \ 55 GLuint tmu0_source = fxMesa->tmu_source[0]; \ 56 GLfloat *tmu0_data = VEC_ELT(VB->TexCoordPtr[tmu0_source], \ 57 GLfloat, start); \ 58 GLuint tmu0_stride = VB->TexCoordPtr[tmu0_source]->stride; \ 59 GLuint tmu0_sz = VB->TexCoordPtr[tmu0_source]->size; \ 60 struct gl_texture_unit *t0 = &ctx->Texture.Unit[tmu0_source]; \ 61 GLfloat sscale0 = FX_TEXTURE_DATA(t0)->sScale; \ 62 62 GLfloat tscale0 = FX_TEXTURE_DATA(t0)->tScale; 63 63 64 #define VARS_TMU1 \65 GLuint tmu1_source = fxMesa->tmu_source[1]; \66 GLfloat *tmu1_data = VEC_ELT(VB->TexCoordPtr[tmu1_source], \67 GLfloat, start);\68 GLuint tmu1_stride = VB->TexCoordPtr[tmu1_source]->stride; \69 GLuint tmu1_sz = VB->TexCoordPtr[tmu1_source]->size; \70 struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \71 GLfloat sscale1 = FX_TEXTURE_DATA(t1)->sScale; \64 #define VARS_TMU1 \ 65 GLuint tmu1_source = fxMesa->tmu_source[1]; \ 66 GLfloat *tmu1_data = VEC_ELT(VB->TexCoordPtr[tmu1_source], \ 67 GLfloat, start); \ 68 GLuint tmu1_stride = VB->TexCoordPtr[tmu1_source]->stride; \ 69 GLuint tmu1_sz = VB->TexCoordPtr[tmu1_source]->size; \ 70 struct gl_texture_unit *t1 = &ctx->Texture.Unit[tmu1_source]; \ 71 GLfloat sscale1 = FX_TEXTURE_DATA(t1)->sScale; \ 72 72 GLfloat tscale1 = FX_TEXTURE_DATA(t1)->tScale; 73 73 74 #define VARS_RGBA \75 GLubyte *color = VEC_ELT(VB->ColorPtr, GLubyte, start); \76 GLuint col_stride = VB->ColorPtr->stride; 74 #define VARS_RGBA \ 75 GLubyte *color = VEC_ELT(VB->ColorPtr, GLubyte, start); \ 76 GLuint col_stride = VB->ColorPtr->stride; 77 77 78 #define VARS_XY GLfloat *win = VB->Win.data[start]; 78 #define VARS_XY GLfloat *win = VB->Win.data[start]; 79 79 80 80 #define INCR_XY win += 4 … … 82 82 83 83 #ifdef FX_V2 84 # define DO_SETUP_XY \85 v[XCOORD]=win[0]; \86 v[YCOORD]=win[1]; 84 # define DO_SETUP_XY \ 85 v[XCOORD]=win[0]; \ 86 v[YCOORD]=win[1]; 87 87 #else 88 88 #ifdef DRIVERTS 89 # define DO_SETUP_XY \90 v[XCOORD]=win[0]+fxMesa->x_offset; \91 v[YCOORD]=win[1]+fxMesa->y_delta; 89 # define DO_SETUP_XY \ 90 v[XCOORD]=win[0]+fxMesa->x_offset; \ 91 v[YCOORD]=win[1]+fxMesa->y_delta; 92 92 #else 93 93 # if (defined(__linux__) && defined(__i386__)) || defined(macintosh) 94 # define DO_SETUP_XY { \95 GLfloat t1 = win[0] + snapper; \96 GLfloat t2 = win[1] + snapper; \97 v[XCOORD] = t1 - snapper; \98 v[YCOORD] = t2 - snapper; \94 # define DO_SETUP_XY { \ 95 GLfloat t1 = win[0] + snapper; \ 96 GLfloat t2 = win[1] + snapper; \ 97 v[XCOORD] = t1 - snapper; \ 98 v[YCOORD] = t2 - snapper; \ 99 99 } 100 100 # else 101 # define DO_SETUP_XY { \102 /* trunc (x,y) to multiple of 1/16 */ \103 v[XCOORD]=((int)(win[0]*16.0f))*(1.0f/16.0f); \104 v[YCOORD]=((int)(win[1]*16.0f))*(1.0f/16.0f); \101 # define DO_SETUP_XY { \ 102 /* trunc (x,y) to multiple of 1/16 */ \ 103 v[XCOORD]=((int)(win[0]*16.0f))*(1.0f/16.0f); \ 104 v[YCOORD]=((int)(win[1]*16.0f))*(1.0f/16.0f); \ 105 105 } 106 106 # endif … … 109 109 110 110 111 #define DO_SETUP_W { \112 v[OOWCOORD]=win[3]; \111 #define DO_SETUP_W { \ 112 v[OOWCOORD]=win[3]; \ 113 113 } 114 114 115 115 #define DO_SETUP_Z v[ZCOORD]=win[2]; 116 116 117 #define DO_SETUP_TMU0 \118 { \119 v[S0COORD]=sscale0*tmu0_data[0]*v[OOWCOORD]; \120 v[T0COORD]=tscale0*tmu0_data[1]*v[OOWCOORD]; \121 } 117 #define DO_SETUP_TMU0 \ 118 { \ 119 v[S0COORD]=sscale0*tmu0_data[0]*v[OOWCOORD]; \ 120 v[T0COORD]=tscale0*tmu0_data[1]*v[OOWCOORD]; \ 121 } 122 122 123 123 #define INCR_TMU0 STRIDE_F(tmu0_data, tmu0_stride) 124 124 125 #define DO_SETUP_TMU1 \126 { \127 v[S1COORD]=sscale1*tmu1_data[0]*v[OOWCOORD]; \128 v[T1COORD]=tscale1*tmu1_data[1]*v[OOWCOORD]; \125 #define DO_SETUP_TMU1 \ 126 { \ 127 v[S1COORD]=sscale1*tmu1_data[0]*v[OOWCOORD]; \ 128 v[T1COORD]=tscale1*tmu1_data[1]*v[OOWCOORD]; \ 129 129 } 130 130 … … 132 132 133 133 #if FX_USE_PARGB 134 #define DO_SETUP_RGBA \134 #define DO_SETUP_RGBA \ 135 135 { GET_PARGB(v) = color[ACOMP] << 24 | color[RCOMP] << 16 | color[GCOMP] << 8 | color[BCOMP];} 136 136 137 137 #else 138 #define DO_SETUP_RGBA \139 { \140 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[RCOORD], color[0]); \141 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[GCOORD], color[1]); \142 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[BCOORD], color[2]); \143 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[ACOORD], color[3]); \138 #define DO_SETUP_RGBA \ 139 { \ 140 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[RCOORD], color[0]); \ 141 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[GCOORD], color[1]); \ 142 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[BCOORD], color[2]); \ 143 UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[ACOORD], color[3]); \ 144 144 } 145 145 #endif … … 148 148 149 149 150 #define _FIXUP_PRE \151 GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 | \152 GR_STWHINT_W_DIFF_TMU1);150 #define _FIXUP_PRE \ 151 GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 | \ 152 GR_STWHINT_W_DIFF_TMU1); 153 153 154 #define _FIXUP_TMU0 \155 if (tmu0_sz == 4) { \156 project_texcoords( VB, 0, tmu0_source, start, end ); \157 hs |= GR_STWHINT_W_DIFF_TMU0; \158 } 154 #define _FIXUP_TMU0 \ 155 if (tmu0_sz == 4) { \ 156 project_texcoords( VB, 0, tmu0_source, start, end ); \ 157 hs |= GR_STWHINT_W_DIFF_TMU0; \ 158 } 159 159 160 160 161 #define _FIXUP_TMU1 \162 if (tmu1_sz == 4) { \163 project_texcoords( VB, 1, tmu1_source, start, end ); \164 hs |= GR_STWHINT_W_DIFF_TMU1; \165 } 161 #define _FIXUP_TMU1 \ 162 if (tmu1_sz == 4) { \ 163 project_texcoords( VB, 1, tmu1_source, start, end ); \ 164 hs |= GR_STWHINT_W_DIFF_TMU1; \ 165 } 166 166 167 167 168 #define _FIXUP_TMU01 \169 if (tmu0_sz == 4) { \170 project_texcoords( VB, 0, tmu0_source, start, end ); \171 if (tmu1_sz == 4) \172 project_texcoords( VB, 1, tmu1_source, start, end );\173 else \174 copy_w( VB, 1, start, end );\175 hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1); \176 } else if (tmu1_sz == 4) { \177 project_texcoords( VB, 1, tmu1_source, start, end ); \178 hs |= GR_STWHINT_W_DIFF_TMU1; \168 #define _FIXUP_TMU01 \ 169 if (tmu0_sz == 4) { \ 170 project_texcoords( VB, 0, tmu0_source, start, end ); \ 171 if (tmu1_sz == 4) \ 172 project_texcoords( VB, 1, tmu1_source, start, end ); \ 173 else \ 174 copy_w( VB, 1, start, end ); \ 175 hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1); \ 176 } else if (tmu1_sz == 4) { \ 177 project_texcoords( VB, 1, tmu1_source, start, end ); \ 178 hs |= GR_STWHINT_W_DIFF_TMU1; \ 179 179 } 180 180 181 #define _FIXUP_POST \182 if (hs != fxMesa->stw_hint_state) { \183 fxMesa->stw_hint_state = hs; \184 FX_grHints(GR_HINT_STWHINT, hs); \181 #define _FIXUP_POST \ 182 if (hs != fxMesa->stw_hint_state) { \ 183 fxMesa->stw_hint_state = hs; \ 184 FX_grHints(GR_HINT_STWHINT, hs); \ 185 185 } 186 186 -
trunk/src/opengl/mesa/3dfx/fxwgl.c
r2977 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. … … 51 51 52 52 #if defined(__WIN32__) || defined(__WIN32OS2__) 53 54 53 #ifdef __cplusplus 55 54 extern "C" { … … 90 89 91 90 #ifdef GL_EXT_polygon_offset 92 { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT"},91 { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, 93 92 #endif 94 { (PROC)glBlendEquationEXT, "glBlendEquationEXT"},95 { (PROC)glBlendColorEXT, "glBlendColorExt"},96 { (PROC)glVertexPointerEXT, "glVertexPointerEXT"},97 { (PROC)glNormalPointerEXT, "glNormalPointerEXT"},98 { (PROC)glColorPointerEXT, "glColorPointerEXT"},99 { (PROC)glIndexPointerEXT, "glIndexPointerEXT"},100 { (PROC)glTexCoordPointerEXT, "glTexCoordPointer"},101 { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT"},102 { (PROC)glGetPointervEXT, "glGetPointervEXT"},103 { (PROC)glArrayElementEXT, "glArrayElementEXT"},104 { (PROC)glDrawArraysEXT, "glDrawArrayEXT"},105 { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT"},106 { (PROC)glBindTextureEXT, "glBindTextureEXT"},107 { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT"},108 { (PROC)glGenTexturesEXT, "glGenTexturesEXT"},109 { (PROC)glIsTextureEXT, "glIsTextureEXT"},110 { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT"},111 { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT"},112 { (PROC)glTexImage3DEXT, "glTexImage3DEXT"},113 { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT"},114 { (PROC)gl3DfxSetPaletteEXT, "3DFX_set_global_palette"},115 { (PROC)glColorTableEXT, "glColorTableEXT"},116 { (PROC)glColorSubTableEXT, "glColorSubTableEXT"},117 { (PROC)glGetColorTableEXT, "glGetColorTableEXT"},118 { (PROC)glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT"},119 { (PROC)glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT"},120 { (PROC)glPointParameterfEXT, "glPointParameterfEXT"},121 { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT"},122 { (PROC)glBlendFuncSeparateINGR, "glBlendFuncSeparateINGR"},123 { (PROC)glActiveTextureARB, "glActiveTextureARB" },124 { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },125 { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },126 { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },127 { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },128 { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },129 { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },130 { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },131 { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },132 { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },133 { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },134 { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },135 { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },136 { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },137 { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },138 { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },139 { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },140 { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },141 { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },142 { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },143 { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },144 { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },145 { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },146 { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },147 { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },148 { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },149 { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },150 { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },151 { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },152 { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },153 { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },154 { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },155 { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },156 { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },157 { (PROC)glLockArraysEXT, "glLockArraysEXT"},158 { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT"}93 { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, 94 { (PROC)glBlendColorEXT, "glBlendColorExt" }, 95 { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, 96 { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, 97 { (PROC)glColorPointerEXT, "glColorPointerEXT" }, 98 { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, 99 { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, 100 { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, 101 { (PROC)glGetPointervEXT, "glGetPointervEXT" }, 102 { (PROC)glArrayElementEXT, "glArrayElementEXT" }, 103 { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, 104 { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, 105 { (PROC)glBindTextureEXT, "glBindTextureEXT" }, 106 { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, 107 { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, 108 { (PROC)glIsTextureEXT, "glIsTextureEXT" }, 109 { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, 110 { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, 111 { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, 112 { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, 113 { (PROC)gl3DfxSetPaletteEXT, "3DFX_set_global_palette" }, 114 { (PROC)glColorTableEXT, "glColorTableEXT" }, 115 { (PROC)glColorSubTableEXT, "glColorSubTableEXT" }, 116 { (PROC)glGetColorTableEXT, "glGetColorTableEXT" }, 117 { (PROC)glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT" }, 118 { (PROC)glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT" }, 119 { (PROC)glPointParameterfEXT, "glPointParameterfEXT" }, 120 { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" }, 121 { (PROC)glBlendFuncSeparateINGR, "glBlendFuncSeparateINGR" }, 122 { (PROC)glActiveTextureARB, "glActiveTextureARB" }, 123 { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" }, 124 { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" }, 125 { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" }, 126 { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" }, 127 { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" }, 128 { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" }, 129 { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" }, 130 { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" }, 131 { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" }, 132 { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" }, 133 { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" }, 134 { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" }, 135 { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" }, 136 { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" }, 137 { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" }, 138 { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" }, 139 { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" }, 140 { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" }, 141 { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" }, 142 { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" }, 143 { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" }, 144 { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" }, 145 { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" }, 146 { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" }, 147 { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" }, 148 { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" }, 149 { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" }, 150 { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" }, 151 { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" }, 152 { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" }, 153 { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" }, 154 { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" }, 155 { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" }, 156 { (PROC)glLockArraysEXT, "glLockArraysEXT" }, 157 { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" } 159 158 }; 160 159 … … 745 744 746 745 int GLAPIENTRY ChoosePixelFormat(HDC hdc, 747 CONST PIXELFORMATDESCRIPTOR *ppfd)746 CONST PIXELFORMATDESCRIPTOR *ppfd) 748 747 { 749 748 return wglChoosePixelFormat(hdc,ppfd); … … 770 769 771 770 int GLAPIENTRY DescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes, 772 LPPIXELFORMATDESCRIPTOR ppfd)771 LPPIXELFORMATDESCRIPTOR ppfd) 773 772 { 774 773 return wglDescribePixelFormat(hdc,iPixelFormat,nBytes,ppfd); … … 861 860 } 862 861 #endif 863 862 864 863 BitBlt(hdcScreen, 0, 0, 865 864 width, height, -
trunk/src/opengl/mesa/3dfx/makefile
r3090 r3598 1 # $Id: makefile,v 1. 8 2000-03-11 17:30:54 birdExp $1 # $Id: makefile,v 1.9 2000-05-23 20:41:24 jeroen Exp $ 2 2 # 3 3 # Odin32 API … … 15 15 # Compiler, tools, and interference rules. 16 16 !include $(PDWIN32_INCLUDE)/pdwin32.mk 17 MESADEFS= -DNO_PARALLEL -DNO_STEREO -DGL_MESA_window_pos -D THREADS \18 -DUSE_X86_ASM _NOT -DUSE_MMX_ASM_NOT-DUSE_3DNOW_ASM_NOT \19 -DFX -DFX_V2 -DFX_SILENT -DBUILD_GL32 17 MESADEFS= -DNO_PARALLEL -DNO_STEREO -DGL_MESA_window_pos -DOS2_THREADS \ 18 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM_NOT \ 19 -DFX -DFX_V2 -DFX_SILENT -DBUILD_GL32 -DFAST_MATH 20 20 21 21 CFLAGS = -I.. -I..\GL $(CFLAGS_WIN32APP) -I..\..\glut -I..\..\glide\cvg\glide -I..\..\glide\swlibs\fxmisc -I..\..\glide\cvg\incsrc $(MESADEFS) /Wcnd- /Tdp 22 22 CXXFLAGS = -I.. -I..\GL $(CXXFLAGS_WIN32APP) -I..\..\glut -I..\..\glide\cvg\glide -I..\..\glide\swlibs\fxmisc -I..\..\glide\cvg\incsrc $(MESADEFS) 23 24 ASFLAGS=$(ASFLAGS) -Fdo:$(OBJDIR) 23 25 24 26 … … 28 30 {..}.c{$(OBJDIR)}.obj: 29 31 $(CC) $(CFLAGS) -c -Fo$(OBJDIR)\$(@B).obj $< 32 33 {..}.asm{$(OBJDIR)}.obj: 34 $(AS) $(ASFLAGS) -Fdo:$(OBJDIR) $< 30 35 31 36 … … 53 58 $(OBJDIR)\alpha.obj \ 54 59 $(OBJDIR)\alphabuf.obj \ 55 $(OBJDIR)\api1.obj \ 56 $(OBJDIR)\api2.obj \ 57 $(OBJDIR)\apiext.obj \ 60 $(OBJDIR)\glapi.obj \ 61 $(OBJDIR)\glapinoop.obj \ 58 62 $(OBJDIR)\attrib.obj \ 59 63 $(OBJDIR)\bbox.obj \ … … 76 80 $(OBJDIR)\fog.obj \ 77 81 $(OBJDIR)\get.obj \ 78 $(OBJDIR)\glmisc.obj \79 82 $(OBJDIR)\hash.obj \ 80 83 $(OBJDIR)\image.obj \ … … 85 88 $(OBJDIR)\matrix.obj \ 86 89 $(OBJDIR)\mmath.obj \ 87 $(OBJDIR)\mthreads.obj \ 90 $(OBJDIR)\glthread.obj \ 91 $(OBJDIR)\os2thread.obj \ 88 92 $(OBJDIR)\pb.obj \ 89 93 $(OBJDIR)\pipeline.obj \ 90 94 $(OBJDIR)\pixel.obj \ 91 $(OBJDIR)\pointers.obj \92 95 $(OBJDIR)\points.obj \ 93 96 $(OBJDIR)\polygon.obj \ … … 107 110 $(OBJDIR)\translate.obj \ 108 111 $(OBJDIR)\triangle.obj \ 112 $(OBJDIR)\aatriangle.obj \ 109 113 $(OBJDIR)\varray.obj \ 110 114 $(OBJDIR)\vb.obj \ … … 119 123 $(OBJDIR)\xform.obj \ 120 124 $(OBJDIR)\zoom.obj \ 121 $(OBJDIR)\osmesa.obj 125 $(OBJDIR)\osmesa.obj \ 126 $(OBJDIR)\dispatch.obj \ 127 $(OBJDIR)\imaging.obj \ 128 $(OBJDIR)\state.obj \ 129 $(OBJDIR)\hint.obj \ 130 $(OBJDIR)\buffers.obj \ 131 $(OBJDIR)\x86.obj \ 132 $(OBJDIR)\x86a.obj \ 133 $(OBJDIR)\common_x86.obj \ 134 $(OBJDIR)\mmx_blend.obj \ 135 $(OBJDIR)\vertex.obj 122 136 123 137
Note:
See TracChangeset
for help on using the changeset viewer.
