Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxapi.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
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 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 786 const GLint attribList[]) 798 787 { 799 788 GrScreenRefresh_t refresh; … … 887 876 switch (attribList[i]) { 888 877 case FXMESA_DOUBLEBUFFER: 889 890 878 doubleBuffer=GL_TRUE; 879 break; 891 880 case FXMESA_ALPHA_SIZE: 892 893 894 895 896 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 905 906 895 i++; 896 stencilSize=attribList[i]; 897 break; 907 898 case FXMESA_ACCUM_SIZE: 908 909 910 911 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 915 916 917 918 919 920 905 i++; 906 { 907 const void *vPtr = &attribList[i]; 908 GLcontext **ctx = (GLcontext **) vPtr; 909 shareCtx = *ctx; 910 } 911 break; 921 912 default: 922 923 924 925 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 1028 1029 1030 1031 1032 1033 1034 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 1042 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 1085 FX_grSstWinClose(fxMesa->glideContext); 1087 1086 fxMesa->glideContext = 0; 1088 1089 if (fxMesa->state) 1090 1087 1088 if (fxMesa->state) 1089 free(fxMesa->state); 1091 1090 if (fxMesa->fogTable) 1092 1091 free(fxMesa->fogTable); 1093 1092 if (fxMesa->glBuffer) 1094 1093 gl_destroy_framebuffer(fxMesa->glBuffer); 1095 1094 if (fxMesa->glVis) 1096 1095 gl_destroy_visual(fxMesa->glVis); 1097 1096 if (fxMesa->glCtx) 1098 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 }
Note:
See TracChangeset
for help on using the changeset viewer.