Changeset 16969 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_teximage.c
- Timestamp:
- Feb 20, 2009 11:25:55 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_teximage.c
r16939 r16969 544 544 tl->bytes = crImageSize(format, type, width, 1); 545 545 546 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 546 547 if (tl->bytes) 547 548 { … … 553 554 { 554 555 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, 555 556 "glTexImage1D out of memory"); 556 557 return; 557 558 } 558 559 if (pixels) 559 560 crPixelCopy1D((GLvoid *) tl->img, format, type, 560 pixels, format, type, width, &(c->unpack)); 561 } 561 pixels, format, type, width, &(c->unpack)); 562 } 563 #endif 562 564 563 565 tl->width = width; … … 594 596 void STATE_APIENTRY 595 597 crStateTexImage2D(GLenum target, GLint level, GLint internalFormat, 596 597 598 GLsizei width, GLsizei height, GLint border, 599 GLenum format, GLenum type, const GLvoid * pixels) 598 600 { 599 601 CRContext *g = GetCurrentContext(); … … 639 641 } 640 642 643 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 641 644 /* allocate the image buffer and fill it */ 642 645 if (tl->bytes) … … 649 652 { 650 653 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, 651 654 "glTexImage2D out of memory"); 652 655 return; 653 656 } … … 661 664 { 662 665 crPixelCopy2D(width, height, 663 664 666 (GLvoid *) tl->img, format, type, NULL, /* dst */ 667 pixels, format, type, &(c->unpack)); /* src */ 665 668 } 666 669 } 667 670 } 671 #endif 668 672 669 673 tl->width = width; … … 741 745 tl->bytes = crTextureSize(format, type, width, height, depth); 742 746 747 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 743 748 if (tl->bytes) 744 749 { … … 750 755 { 751 756 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, 752 757 "glTexImage3D out of memory"); 753 758 return; 754 759 } 755 760 if (pixels) 756 761 crPixelCopy3D(width, height, depth, (GLvoid *) (tl->img), format, type, 757 NULL, pixels, format, type, &(c->unpack)); 758 } 762 NULL, pixels, format, type, &(c->unpack)); 763 } 764 #endif 759 765 760 766 tl->internalFormat = internalFormat; … … 820 826 } 821 827 828 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 822 829 xoffset += tl->border; 823 830 824 831 crPixelCopy1D((void *) (tl->img + xoffset * tl->bytesPerPixel), 825 tl->format, tl->type, 826 pixels, format, type, width, &(c->unpack)); 832 tl->format, tl->type, 833 pixels, format, type, width, &(c->unpack)); 834 #endif 827 835 828 836 #ifdef CR_SGIS_generate_mipmap … … 844 852 void STATE_APIENTRY 845 853 crStateTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 846 847 854 GLsizei width, GLsizei height, 855 GLenum format, GLenum type, const GLvoid * pixels) 848 856 { 849 857 CRContext *g = GetCurrentContext(); … … 855 863 GLubyte *subimg = NULL; 856 864 GLubyte *img = NULL; 865 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 857 866 GLubyte *src; 858 867 int i; 868 #endif 859 869 860 870 FLUSH(); … … 869 879 CRASSERT(tl); 870 880 881 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 871 882 xoffset += tl->border; 872 883 yoffset += tl->border; 873 884 874 subimg = 875 (GLubyte *) crAlloc(crImageSize(tl->format, tl->type, width, height)); 885 subimg = (GLubyte *) crAlloc(crImageSize(tl->format, tl->type, width, height)); 876 886 877 887 crPixelCopy2D(width, height, subimg, tl->format, tl->type, NULL, /* dst */ 878 pixels, format, type, &(c->unpack));/* src */888 pixels, format, type, &(c->unpack)); /* src */ 879 889 880 890 img = tl->img + … … 892 902 893 903 crFree(subimg); 904 #endif 894 905 895 906 #ifdef CR_SGIS_generate_mipmap … … 925 936 GLubyte *subimg = NULL; 926 937 GLubyte *img = NULL; 938 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 927 939 GLubyte *src; 928 940 int i; 941 #endif 929 942 930 943 FLUSH(); … … 935 948 } 936 949 950 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 937 951 xoffset += tl->border; 938 952 yoffset += tl->border; … … 944 958 945 959 crPixelCopy3D(width, height, depth, subimg, tl->format, tl->type, NULL, 946 960 pixels, format, type, &(c->unpack)); 947 961 948 962 img = tl->img + xoffset * tl->bytesPerPixel + … … 961 975 962 976 crFree(subimg); 977 #endif 963 978 964 979 #ifdef CR_SGIS_generate_mipmap … … 1014 1029 tl->bytes = imageSize; 1015 1030 1031 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1016 1032 if (tl->bytes) 1017 1033 { … … 1023 1039 { 1024 1040 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, 1025 1041 "glTexImage1D out of memory"); 1026 1042 return; 1027 1043 } … … 1029 1045 crMemcpy(tl->img, data, imageSize); 1030 1046 } 1047 #endif 1031 1048 1032 1049 tl->width = width; … … 1059 1076 void STATE_APIENTRY 1060 1077 crStateCompressedTexImage2DARB(GLenum target, GLint level, 1061 1062 1063 1078 GLenum internalFormat, GLsizei width, 1079 GLsizei height, GLint border, 1080 GLsizei imageSize, const GLvoid * data) 1064 1081 { 1065 1082 CRContext *g = GetCurrentContext(); … … 1092 1109 tl->bytes = imageSize; 1093 1110 1111 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1094 1112 if (tl->bytes) 1095 1113 { … … 1101 1119 { 1102 1120 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, 1103 1121 "glTexImage2D out of memory"); 1104 1122 return; 1105 1123 } … … 1107 1125 crMemcpy(tl->img, data, imageSize); 1108 1126 } 1127 #endif 1109 1128 1110 1129 tl->width = width; … … 1171 1190 tl->bytes = imageSize; 1172 1191 1192 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1173 1193 if (tl->bytes) 1174 1194 { … … 1180 1200 { 1181 1201 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, 1182 1202 "glCompressedTexImage3D out of memory"); 1183 1203 return; 1184 1204 } … … 1186 1206 crMemcpy(tl->img, data, imageSize); 1187 1207 } 1208 #endif 1188 1209 1189 1210 tl->width = width; … … 1234 1255 } 1235 1256 1257 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1236 1258 xoffset += tl->border; 1237 1259 … … 1242 1264 else { 1243 1265 /* XXX this depends on the exact compression method */ 1244 } 1266 crWarning("Not implemented part crStateCompressedTexSubImage1DARB"); 1267 } 1268 #endif 1245 1269 1246 1270 #ifdef CR_SGIS_generate_mipmap … … 1281 1305 } 1282 1306 1307 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1283 1308 xoffset += tl->border; 1284 1309 yoffset += tl->border; 1285 1310 1286 if (xoffset == 0 && width == tl->width && 1287 yoffset == 0 && height == tl->height) { 1311 if (xoffset == 0 && width == tl->width 1312 && yoffset == 0 && height == tl->height) 1313 { 1288 1314 /* just memcpy */ 1289 1315 crMemcpy(tl->img, data, imageSize); … … 1291 1317 else { 1292 1318 /* XXX this depends on the exact compression method */ 1293 } 1319 crWarning("Not implemented part crStateCompressedTexSubImage2DARB"); 1320 } 1321 #endif 1294 1322 1295 1323 #ifdef CR_SGIS_generate_mipmap … … 1331 1359 } 1332 1360 1361 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1333 1362 xoffset += tl->border; 1334 1363 yoffset += tl->border; … … 1336 1365 1337 1366 if (xoffset == 0 && width == tl->width && 1338 1339 1367 yoffset == 0 && height == tl->height && 1368 zoffset == 0 && depth == tl->depth) { 1340 1369 /* just memcpy */ 1341 1370 crMemcpy(tl->img, data, imageSize); … … 1343 1372 else { 1344 1373 /* XXX this depends on the exact compression method */ 1345 } 1374 crWarning("Not implemented part crStateCompressedTexSubImage3DARB"); 1375 } 1376 #endif 1346 1377 1347 1378 #ifdef CR_SGIS_generate_mipmap … … 1388 1419 } 1389 1420 1421 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1390 1422 crMemcpy(img, tl->img, tl->bytes); 1423 #else 1424 diff_api.GetCompressedTexImageARB(target, level, img); 1425 #endif 1391 1426 } 1392 1427 … … 1394 1429 void STATE_APIENTRY 1395 1430 crStateGetTexImage(GLenum target, GLint level, GLenum format, 1396 1431 GLenum type, GLvoid * pixels) 1397 1432 { 1398 1433 CRContext *g = GetCurrentContext(); … … 1453 1488 } 1454 1489 1490 #ifndef CR_STATE_NO_TEXTURE_IMAGE_STORE 1455 1491 #ifdef CR_OPENGL_VERSION_1_2 1456 1492 if (target == GL_TEXTURE_3D) 1457 1493 { 1458 1494 crPixelCopy3D(tl->width, tl->height, tl->depth, (GLvoid *) pixels, format, 1459 1495 type, NULL, (tl->img), format, type, &(c->pack)); 1460 1496 } 1461 1497 else 1462 1498 #endif 1463 if ((target == GL_TEXTURE_ 2D) || (target == GL_TEXTURE_1D))1499 if ((target == GL_TEXTURE_1D) || (target == GL_TEXTURE_2D)) 1464 1500 { 1465 1501 crPixelCopy2D(tl->width, tl->height, (GLvoid *) pixels, format, type, NULL, /* dst */ 1466 (tl->img), format, type, &(c->pack)); /* src */ 1467 } 1468 } 1502 tl->img, format, type, &(c->pack)); /* src */ 1503 } 1504 #else 1505 diff_api.GetTexImage(target, level, format, type, pixels); 1506 #endif 1507 }
Note:
See TracChangeset
for help on using the changeset viewer.