gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > 128KB Texture Limit?!?

#60323 - blaisef01 - Wed Nov 09, 2005 5:18 am

Morning all,

I have a problem if I try to load in more than 128KB worth of textures, my program doesn't work any more. So it's either
a) there's something weird going on with glTexImage or
b) I'm crap and can't code...

Anyone else having the same problem, If so how do you fix it and what the hell am i doing wrong?

Cheers

#60325 - natrium42 - Wed Nov 09, 2005 6:03 am

Well, check how your VRAM banks are mapped. Banks A,B,C,D have only 128KB each.
_________________
www.natrium42.com

#60409 - blaisef01 - Thu Nov 10, 2005 2:01 am

Banks A to D are mapped to texture.

Here's the commands i'm using to map the VRAM banks:

/* texture memory 4 X 128 KB */
vramSetBankA(VRAM_A_TEXTURE); // 128 KB
vramSetBankB(VRAM_B_TEXTURE); // 128 KB
vramSetBankC(VRAM_C_TEXTURE); // 128 KB
vramSetBankD(VRAM_D_TEXTURE); // 128 KB

/* pallete memory */
vramSetBankE(VRAM_E_TEX_PALETTE); // 64 KB
vramSetBankF(VRAM_F_TEX_PALETTE); // 16 KB

/* bg memory */
vramSetBankG(VRAM_G_MAIN_BG); // 16 KB
vramSetBankH(VRAM_H_SUB_BG); // 32 KB
vramSetBankI(VRAM_I_SUB_BG); // 16 kb

This is a list of files i'm trying to import:
02/11/2005 20:45 4,104 beam.tex
03/11/2005 02:29 32,776 bg0sm.tex
02/11/2005 20:45 4,104 colors.tex
07/11/2005 08:51 1,032 crosshair.tex
02/11/2005 20:45 32,776 explode1.tex
02/11/2005 20:45 264 hudbase.tex
02/11/2005 20:45 32,776 hudcolumn.tex
02/11/2005 20:45 264 hudtop.tex
02/11/2005 20:45 16,392 invader.tex
02/11/2005 20:45 1,032 invfeet.tex
02/11/2005 20:45 1,032 plyrship.tex
07/11/2005 12:00 32,776 title.tex

tex files are 16bit color [RGB + 1 Bit Alpha] raw image files with a 8 bytes header prepended to it to describe width, height etc. The header isn't loaded into VRAM.

So total data loaded into VRAM is about 156KB. But the combined VRAM of banks A to D is 512 KB. So shouldn't the glTexImage command be able to handle this or at least use the next VRAM bank along if the current one is getting filled to capacity?

Sorry for my rambling it's 1am, just done a 12 hour shift in the pub and i'm knackered...

#60422 - Freakker - Thu Nov 10, 2005 3:29 am

I am probably wrong, but I think when I was playing around with a textured cube I had to manualy change the banks when I wanted to access a texture stored in a different bank.

#60432 - blaisef01 - Thu Nov 10, 2005 4:45 am

i ran the devkit installer again and reinstalled it all and it seems to be fine now. i guess something must changed since the last time i ran it (last week)

cheers anyway