forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

24-bit texture swizzling?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
gotmilk065



Joined: 28 Nov 2009
Posts: 25

PostPosted: Sat Nov 28, 2009 11:01 am    Post subject: 24-bit texture swizzling? Reply with quote

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?
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Sun Nov 29, 2009 4:04 am    Post subject: Reply with quote

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:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
gotmilk065



Joined: 28 Nov 2009
Posts: 25

PostPosted: Sun Nov 29, 2009 3:28 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
gotmilk065



Joined: 28 Nov 2009
Posts: 25

PostPosted: Tue Dec 01, 2009 12:47 pm    Post subject: Reply with quote

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..
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Wed Dec 02, 2009 2:13 am    Post subject: Reply with quote

http://wiki.ps2dev.org/psp:ge_faq
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
gotmilk065



Joined: 28 Nov 2009
Posts: 25

PostPosted: Wed Dec 02, 2009 11:43 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Wed Dec 02, 2009 2:37 pm    Post subject: Reply with quote

That should do the trick, also don't forget to tell the GPU that the texture is swizzled when binding it.
_________________
Code:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Fri Dec 04, 2009 7:58 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
gotmilk065



Joined: 28 Nov 2009
Posts: 25

PostPosted: Tue Dec 08, 2009 8:59 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Dec 10, 2009 1:46 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Thu Dec 10, 2009 6:41 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Dec 10, 2009 7:13 am    Post subject: Reply with quote

Hi,

thanks. I've found what I need ;o)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group