mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-10 07:49:57 -04:00
Fix
This commit is contained in:
parent
b79176a854
commit
81fcb96b0b
@ -191,7 +191,7 @@ static cc_uint32 texmem_total_free(void) {
|
|||||||
cc_uint32 free = 0;
|
cc_uint32 free = 0;
|
||||||
for (cc_uint32 page = 0; page < texmem_pages; page++)
|
for (cc_uint32 page = 0; page < texmem_pages; page++)
|
||||||
{
|
{
|
||||||
if (!texmem_base[page]) free += TEXMEM_PAGE_SIZE;
|
if (!texmem_used[page]) free += TEXMEM_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
return free;
|
return free;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ static cc_uint32 texmem_total_used(void) {
|
|||||||
cc_uint32 used = 0;
|
cc_uint32 used = 0;
|
||||||
for (cc_uint32 page = 0; page < texmem_pages; page++)
|
for (cc_uint32 page = 0; page < texmem_pages; page++)
|
||||||
{
|
{
|
||||||
if (texmem_base[page]) used += TEXMEM_PAGE_SIZE;
|
if (texmem_used[page]) used += TEXMEM_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
@ -673,7 +673,7 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags,
|
|||||||
|
|
||||||
BitmapCol palette[MAX_PAL_ENTRIES];
|
BitmapCol palette[MAX_PAL_ENTRIES];
|
||||||
int pal_count = 0;
|
int pal_count = 0;
|
||||||
int pal_index = FindFreePalette(flags);
|
int pal_index = -1;//FindFreePalette(flags);
|
||||||
|
|
||||||
if (pal_index >= 0) {
|
if (pal_index >= 0) {
|
||||||
pal_count = CalcPalette(palette, bmp, rowWidth);
|
pal_count = CalcPalette(palette, bmp, rowWidth);
|
||||||
@ -681,6 +681,13 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags,
|
|||||||
}
|
}
|
||||||
Platform_Log2("%i, %i", &pal_index, &pal_count);
|
Platform_Log2("%i, %i", &pal_index, &pal_count);
|
||||||
|
|
||||||
|
int freeMem = texmem_total_free();
|
||||||
|
int usedMem = texmem_total_used();
|
||||||
|
|
||||||
|
float freeMemMB = freeMem / (1024.0 * 1024.0);
|
||||||
|
float usedMemMB = usedMem / (1024.0 * 1024.0);
|
||||||
|
Platform_Log2("Texture memory: %f2 MB used, %f2 MB free\n", &usedMemMB, &freeMemMB);
|
||||||
|
|
||||||
tex->width = bmp->width;
|
tex->width = bmp->width;
|
||||||
tex->height = bmp->height;
|
tex->height = bmp->height;
|
||||||
tex->format = pal_count > 0 ? (PVR_TXRFMT_PAL4BPP | PVR_TXRFMT_4BPP_PAL(pal_index)) : PVR_TXRFMT_ARGB4444;
|
tex->format = pal_count > 0 ? (PVR_TXRFMT_PAL4BPP | PVR_TXRFMT_4BPP_PAL(pal_index)) : PVR_TXRFMT_ARGB4444;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user