My homebrew needs to load a high number of images that are quite big.
I have a cache mechanism that allows me to have 5~7 of these images in RAM at a given time, but I'm trying to improve that.
I'm considering using S3 compression as mentioned here : http://forums.ps2dev.org/viewtopic.php?t=11509
But I think I could also reduce memory usage if I was using 16 bit rather than 32 bit textures in RAM.
I'm currently using 8888 textures, what would be the pros and cons of switching to a 16 bit mode such as 5551 ?
Some of my textures are simple jpeg images with no alpha information (although I want them to sometimes appear semi-transparent on the screen), other ones are png images with alpha information. Will switching to 16 bit still work with such requirements ?
Don't hesitate to state the obvious, I have pretty much no clue what I'm talking about here, so even the basics of what 5551 and 8888 are will be fine.
5551 VS 8888
Using 5551 instead of 8888 uses half the memory. You generally won't notice a difference in quality. If you don't need the single bit for alpha, you could use 5650 instead of 5551. If you need more than 1 bit for the alpha, you could use 4444 instead. All these modes use half the ram. Using compressed textures uses 1/4 or 1/8 the ram, but the quality will be lower. You'll just have to try a few things and see what works best for what you're doing.
-
- Posts: 107
- Joined: Sat Jan 13, 2007 11:50 am
Thanks for the reply.
Is there a way to use 5551 for some textures, and 8888 for others ?
right now the library I use (JGE) goes like this:
Would it make sense (as in: 1-Would it work? and 2-Do people usually do that?) to have the following contiguous calls:
i.e. to have one 16 bit texture and one 32 bits texture ?
Or, if I go with compressed textures, some of them compressed, some others uncompressed ?
Is there a way to use 5551 for some textures, and 8888 for others ?
right now the library I use (JGE) goes like this:
Code: Select all
sceGuTexMode(GU_PSM_8888, 0, 0, mSwizzle);
for (all Textures) {
sceGuTexImage(...);
sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
}
Would it make sense (as in: 1-Would it work? and 2-Do people usually do that?) to have the following contiguous calls:
Code: Select all
sceGuTexMode(GU_PSM_8888, 0, 0, mSwizzle);
sceGuTexImage(image1,...);
sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
sceGuTexMode(GU_PSM_5551, 0, 0, mSwizzle);
sceGuTexImage(image2,...);
sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|GU_COLOR_5551|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
Or, if I go with compressed textures, some of them compressed, some others uncompressed ?
Not with graphics.c or some of the pre-done libs... they're all coded for 8888. You'd have to write your own or modify one of the existing ones. As far as the PSP is concerned, textures can be any of the available modes. You can mix LUT with compressed with 16bit with 32bit... no big deal.willow :--) wrote:Thanks for the reply.
Is there a way to use 5551 for some textures, and 8888 for others ?
If you look at my example for compressed textures, I allow you to pass in the texture mode, but it only looks for 8888 or one of the compressed mode. If you added 5551 and 5650 to it, it would be what you're thinking of.
Yes, that's all fine. The PSP can handle that. You don't have to have them all the same mode.right now the library I use (JGE) goes like this:
Code: Select all
sceGuTexMode(GU_PSM_8888, 0, 0, mSwizzle); for (all Textures) { sceGuTexImage(...); sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices); }
Would it make sense (as in: 1-Would it work? and 2-Do people usually do that?) to have the following contiguous calls:
i.e. to have one 16 bit texture and one 32 bits texture ?Code: Select all
sceGuTexMode(GU_PSM_8888, 0, 0, mSwizzle); sceGuTexImage(image1,...); sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices); sceGuTexMode(GU_PSM_5551, 0, 0, mSwizzle); sceGuTexImage(image2,...); sceGuDrawArray(GU_TRIANGLE_STRIP,GU_TEXTURE_32BITF|GU_COLOR_5551|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 4, 0, vertices);
Or, if I go with compressed textures, some of them compressed, some others uncompressed ?
-
- Posts: 107
- Joined: Sat Jan 13, 2007 11:50 am
Thanks.
I'm trying to update JGE for more flexibility, but I'm running into weird issues. The library supposedly accepts to run in 5551 or 4444 modes (default is 8888), but they don't look good (screen flickers in 5551 mode, and gradient colors look simply awful in 4444 mode...maybe this one is normal?)
I realized the code for loading jpegs worked only in 8888 mode so I patched it (now it doesn't crash anymore but I have color issues).
Anyways I will try to focus on adding a way to store textures in whatever format I want.
I'll also post screenshots of the issues I currently have with JGE in 4444 and 5551 modes, maybe people with more experience than me will be able to tell what I could be doing wrong just by seeing the screenshots.
Edit: I was able to solve most of my problems. By storing textures in various formats according to their usage, and optimizing other things in my code, I'm happy to say that I can now have up to 45 pictures in cache, which is a great improvement.
Thanks J.F. :)
For those interested, the JGE library available in Wagic's svn now allows to choose how to store textures when they are created (including 5551 or 8888).
Compressed textures are not available yet, but they might in a near future.
Edit2: I also want to confirm that loading JPEG images in 5551 make NO difference to my eyes compared to 8888. I guess it might be different for PNG images with an alpha channel, but I've come to the conclusion that there is no reason to store jpegs in 32bits.
I'm trying to update JGE for more flexibility, but I'm running into weird issues. The library supposedly accepts to run in 5551 or 4444 modes (default is 8888), but they don't look good (screen flickers in 5551 mode, and gradient colors look simply awful in 4444 mode...maybe this one is normal?)
I realized the code for loading jpegs worked only in 8888 mode so I patched it (now it doesn't crash anymore but I have color issues).
Anyways I will try to focus on adding a way to store textures in whatever format I want.
I'll also post screenshots of the issues I currently have with JGE in 4444 and 5551 modes, maybe people with more experience than me will be able to tell what I could be doing wrong just by seeing the screenshots.
Edit: I was able to solve most of my problems. By storing textures in various formats according to their usage, and optimizing other things in my code, I'm happy to say that I can now have up to 45 pictures in cache, which is a great improvement.
Thanks J.F. :)
For those interested, the JGE library available in Wagic's svn now allows to choose how to store textures when they are created (including 5551 or 8888).
Compressed textures are not available yet, but they might in a near future.
Edit2: I also want to confirm that loading JPEG images in 5551 make NO difference to my eyes compared to 8888. I guess it might be different for PNG images with an alpha channel, but I've come to the conclusion that there is no reason to store jpegs in 32bits.