version 1.2 | | version 1.3 |
---|
| | |
* Routines to cache merged textures. | | * Routines to cache merged textures. |
* | | * |
* $Log$ | | * $Log$ |
| | * Revision 1.3 1999/10/07 21:08:36 donut |
| | * OGL alternate texmerge |
| | * |
* Revision 1.2 1999/09/21 04:05:55 donut | | * Revision 1.2 1999/09/21 04:05:55 donut |
* mostly complete OGL implementation (still needs bitmap handling (reticle), and door/fan textures are corrupt) | | * mostly complete OGL implementation (still needs bitmap handling (reticle), and door/fan textures are corrupt) |
* | | * |
| | |
| | |
//resending textures into video ram is very slow, so cache more (worst case, the ogl driver will swap out some itself, probably doing a better job) -MM | | //resending textures into video ram is very slow, so cache more (worst case, the ogl driver will swap out some itself, probably doing a better job) -MM |
#ifdef OGL | | #ifdef OGL |
| | #include "ogl_init.h" |
#define MAX_NUM_CACHE_BITMAPS 200 | | #define MAX_NUM_CACHE_BITMAPS 200 |
#else | | #else |
#define MAX_NUM_CACHE_BITMAPS 50 | | #define MAX_NUM_CACHE_BITMAPS 50 |
| | |
| | |
return Cache[least_recently_used].bitmap; | | return Cache[least_recently_used].bitmap; |
} | | } |
| | |
| | #ifndef NMONO |
| | grs_bitmap * usedp[500]; |
| | int usedc[500]; |
| | int usedn,usedna,usedg,usedgc; |
| | void addused(grs_bitmap *bm){ |
| | int u; |
| | for (u=0;u<usedn;u++) |
| | if (usedp[u]==bm){ |
| | usedc[u]++; |
| | return; |
| | } |
| | usedp[usedn]=bm; |
| | usedc[usedn]=1; |
| | usedn++; |
| | if (!(bm->bm_flags&BM_FLAG_SUPER_TRANSPARENT)) |
| | usedna++; |
| | #ifdef OGL |
| | if (bm->gltexture>0) |
| | usedg++; |
| | #endif |
| | } |
| | void merge_textures_stats(void){ |
| | int i,num=0,numu=0,strans=0; |
| | usedn=usedna=usedg=usedgc=0; |
| | for (i=0; i<num_cache_entries; i++ ){ |
| | if (Cache[i].last_frame_used<0){ |
| | numu++; |
| | continue; |
| | } |
| | num++; |
| | if (Cache[i].top_bmp->bm_flags&BM_FLAG_SUPER_TRANSPARENT) |
| | strans++; |
| | addused(Cache[i].top_bmp); |
| | addused(Cache[i].bottom_bmp); |
| | #ifdef OGL |
| | if (Cache[i].bitmap->gltexture>0) |
| | usedgc++; |
| | #endif |
| | } |
| | mprintf((0,"texmerge: %i(%ig, %igc, %i left), strans:%i, uniq:%i(%i)\n",num,usedg,usedgc,numu,strans,usedn,usedna)); |
| | } |
| | #endif //!NMONO |
| | |
void merge_textures_new( int type, grs_bitmap * bottom_bmp, grs_bitmap * top_bmp, ubyte * dest_data ) | | void merge_textures_new( int type, grs_bitmap * bottom_bmp, grs_bitmap * top_bmp, ubyte * dest_data ) |
{ | | { |