Changeset 3598 for trunk/src/opengl/mesa/3dfx/fxddtex.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 62 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 71 if (ti->tm[1]) 72 fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr, 73 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 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 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 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 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 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 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 1063 1064 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 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 1290 1291 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 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 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
Note:
See TracChangeset
for help on using the changeset viewer.