Frees all the memory used by the texture cache
| 874 | |
| 875 | // Frees all the memory used by the texture cache |
| 876 | void d3d_FreeTextureCache() { |
| 877 | int i; |
| 878 | |
| 879 | if (UploadSurfaces) { |
| 880 | for (i = 0; i < NUM_TEXTURE_CLASSES; i++) { |
| 881 | UploadSurfaces[i]->Release(); |
| 882 | } |
| 883 | |
| 884 | mem_free(UploadSurfaces); |
| 885 | UploadSurfaces = NULL; |
| 886 | } |
| 887 | |
| 888 | if (Upload4444Surfaces) { |
| 889 | for (i = 0; i < NUM_TEXTURE_CLASSES; i++) { |
| 890 | Upload4444Surfaces[i]->Release(); |
| 891 | } |
| 892 | |
| 893 | mem_free(Upload4444Surfaces); |
| 894 | Upload4444Surfaces = NULL; |
| 895 | } |
| 896 | |
| 897 | if (BitmapTextureSurfaces) { |
| 898 | for (i = 0; i < MAX_BITMAPS; i++) { |
| 899 | if (GameBitmaps[i].cache_slot != -1) { |
| 900 | if (GameBitmaps[i].cache_slot != i) { |
| 901 | mprintf(0, "Error cache slot is %d when it should be %d!\n", GameBitmaps[i].cache_slot, i); |
| 902 | } |
| 903 | |
| 904 | ASSERT(GameBitmaps[i].cache_slot == i); |
| 905 | |
| 906 | d3d_FreePreUploadedTexture(i, MAP_TYPE_BITMAP); |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | mem_free(BitmapTextureSurfaces); |
| 911 | BitmapTextureSurfaces = NULL; |
| 912 | } |
| 913 | |
| 914 | if (BumpmapTextureSurfaces) { |
| 915 | for (i = 0; i < MAX_BUMPMAPS; i++) { |
| 916 | if (GameBumpmaps[i].cache_slot != -1) { |
| 917 | ASSERT(GameBumpmaps[i].cache_slot == i); |
| 918 | d3d_FreePreUploadedTexture(i, MAP_TYPE_BUMPMAP); |
| 919 | } |
| 920 | } |
| 921 | mem_free(BumpmapTextureSurfaces); |
| 922 | BumpmapTextureSurfaces = NULL; |
| 923 | } |
| 924 | |
| 925 | if (LightmapTextureSurfaces) { |
| 926 | for (i = 0; i < MAX_LIGHTMAPS; i++) { |
| 927 | if (GameLightmaps[i].cache_slot != -1) { |
| 928 | ASSERT(GameLightmaps[i].cache_slot == i); |
| 929 | d3d_FreePreUploadedTexture(i, MAP_TYPE_LIGHTMAP); |
| 930 | } |
| 931 | } |
| 932 | mem_free(LightmapTextureSurfaces); |
| 933 | LightmapTextureSurfaces = NULL; |
no test coverage detected