#167145 - Kath - Tue Mar 03, 2009 4:52 pm
Hi again,
I'm having a problem with getting corrupted textures when loading them after glResetTextures() has been called. I have banks A and B assigned to textures. The first game state loads 224k of textures and this works fine. When this state ends it calls glResetTextures() and then the next state loads it's textures. However as this state starts getting close to the end of VRAM_A (128k) the first texture loaded starts getting corrupted, I can see the shape of the last texture uploaded appear on the first.
It seems that after calling glResetTextures() only Bank A is used and as it gets filled libnds goes back to the start of it. If I set the second state to be the first it loads the same textures without a problem. I've been trying to figure this out for a few hours so here are all of the textures I load (in the order they are loaded):
In the first game state I load:
256x256 (256col) (64k) ~ 64k
256x256 (256col) (64k) ~ 128k - VRAM_A full.
256x256 (256col) (64k) ~ 192k - Starts in VRAM_B.
256x256 (16col) (32k) ~ 224k
In the second game state I load:
256x256 (256col) (64k) ~ 64k
256x256 (16col) (32k) ~ 96k
128x128 (16col) (8k) ~ 104k
128x128 (16col) (8k) ~ 112k
128x128 (16col) (8k) ~ 120k <- Corruption starts here.
I thought it might have been my texture manager but it all seems to be updating properly, the handles/addresses it gets for each state are:
First state:
- Texture name: 1
- Texture name: 2
- Texture name: 3
- Texture name: 4
- Palette address: 0
- Palette address: 512
- Palette address: 1024
- Palette address: 1536
Second state:
- Texture name: 1
- Texture name: 2
- Texture name: 3
- Texture name: 4
- Texture name: 5
- Palette address: 0
- Palette address: 512
- Palette address: 544
- Palette address: 576
- Palette address: 608
Sorry about the long post, thought more information would be helpful. Is there anything else I should be doing other than clearing my saved names and calling glResetTextures()? Thanks for any pokes in the right direction.
I'm having a problem with getting corrupted textures when loading them after glResetTextures() has been called. I have banks A and B assigned to textures. The first game state loads 224k of textures and this works fine. When this state ends it calls glResetTextures() and then the next state loads it's textures. However as this state starts getting close to the end of VRAM_A (128k) the first texture loaded starts getting corrupted, I can see the shape of the last texture uploaded appear on the first.
It seems that after calling glResetTextures() only Bank A is used and as it gets filled libnds goes back to the start of it. If I set the second state to be the first it loads the same textures without a problem. I've been trying to figure this out for a few hours so here are all of the textures I load (in the order they are loaded):
In the first game state I load:
256x256 (256col) (64k) ~ 64k
256x256 (256col) (64k) ~ 128k - VRAM_A full.
256x256 (256col) (64k) ~ 192k - Starts in VRAM_B.
256x256 (16col) (32k) ~ 224k
In the second game state I load:
256x256 (256col) (64k) ~ 64k
256x256 (16col) (32k) ~ 96k
128x128 (16col) (8k) ~ 104k
128x128 (16col) (8k) ~ 112k
128x128 (16col) (8k) ~ 120k <- Corruption starts here.
I thought it might have been my texture manager but it all seems to be updating properly, the handles/addresses it gets for each state are:
First state:
- Texture name: 1
- Texture name: 2
- Texture name: 3
- Texture name: 4
- Palette address: 0
- Palette address: 512
- Palette address: 1024
- Palette address: 1536
Second state:
- Texture name: 1
- Texture name: 2
- Texture name: 3
- Texture name: 4
- Texture name: 5
- Palette address: 0
- Palette address: 512
- Palette address: 544
- Palette address: 576
- Palette address: 608
Sorry about the long post, thought more information would be helpful. Is there anything else I should be doing other than clearing my saved names and calling glResetTextures()? Thanks for any pokes in the right direction.