24-bit texture swizzling?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
gotmilk065
Posts: 21
Joined: Sat Nov 28, 2009 10:56 am

24-bit texture swizzling?

Post by gotmilk065 »

Is it even possible to swizzle a 24-bit image?

I think I'm misunderstanding the concept entirely.. In all the examples I see, it's only being done to paletted images.

If you can, does it yield a performance increase?
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

The psp's gpu does not support 24 bit images. You will need to upsample it to to 32bit or down sample it to 16 or palletted. And yes you can swizzle 32 and 16bit unpalletted.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
gotmilk065
Posts: 21
Joined: Sat Nov 28, 2009 10:56 am

Post by gotmilk065 »

a_noob wrote:The psp's gpu does not support 24 bit images. You will need to upsample it to to 32bit or down sample it to 16 or palletted. And yes you can swizzle 32 and 16bit unpalletted.
Right, 32-bit images.

Do I use the same function I use for an 8-bit paletted image (GU_PSM_T8) for swizzling it? It doesn't work correctly.. Show's up with weird artifacts all over it, can't even be recognized as the same image.
gotmilk065
Posts: 21
Joined: Sat Nov 28, 2009 10:56 am

Post by gotmilk065 »

Sorry for any bump, but I'd really like to understand why swizzling works and how to do it with a 32-bit image being rendered with GU_PSM_8888..
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

Code: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
gotmilk065
Posts: 21
Joined: Sat Nov 28, 2009 10:56 am

Post by gotmilk065 »

From what I gather, I should swizzle it with the width parameter multiplied by four, since it's a 32-bit image..?

Please correct me if I'm wrong; I'm trying to understand this to my fullest.
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

That should do the trick, also don't forget to tell the GPU that the texture is swizzled when binding it.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

To add up on a_noobs reply (hi there btw :):
the swizzle function doesn't know, nor care about pixelformats. It only works on raw bytes and "swizzles" them around, hence it needs a byte-width as parameter, rather than pixel-width... everything else is cared for by the GU when unswizzling for rendering.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
gotmilk065
Posts: 21
Joined: Sat Nov 28, 2009 10:56 am

Post by gotmilk065 »

Raphael wrote:To add up on a_noobs reply (hi there btw :):
the swizzle function doesn't know, nor care about pixelformats. It only works on raw bytes and "swizzles" them around, hence it needs a byte-width as parameter, rather than pixel-width... everything else is cared for by the GU when unswizzling for rendering.
Thanks, guys! Everything's working out, now :D
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Hi there,

I would like to have swizzled textures as well. How do I do this ? Is there code part of the SDK i was unable to locate or do someone have the code this thread is referring to ?

Thanks for the help.
AnMaBaGiMa
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Basically every available graphics engine (OSL, triEngine, JGE, ...) and even a lot of graphics sample codes have a swizzling function included. Doing a search on the forum would have helped too.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Hi,

thanks. I've found what I need ;o)
Post Reply