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 

GU questions about cachewriteback and other things...

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



Joined: 17 Jul 2007
Posts: 29

PostPosted: Thu Aug 30, 2007 6:21 pm    Post subject: GU questions about cachewriteback and other things... Reply with quote

I'm doing my first little tests of the GU. I found some samples, and got things going. However I had some major problems when I started to do dynamic changes to my vertex buffer, some changes never seemed to make it through.

After much testing I found out that adding a sceKernelDcacheWritebackAll() before the sceGumDrawArray() call solved it. So is that the way it should be done - flushing the cache after every change, or am doing something stupid?

Another question, the "display list" or whatever you call it that you set up with
sceGuStart(GU_DIRECT,dList):
After adding some stuff my program started crashing and I soon realised that the dlist that was allocated was too small. So I increased it and it worked.
However, is this just guess work how big it should be? The example program I started out with used memalign( 16, 1024 ), and I increased it to 65536 and things worked again, but I have no real grasp on how much drawing operations corresponds to how much display list space.
How much do you allocate normally?
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Thu Aug 30, 2007 6:47 pm    Post subject: Reply with quote

If you're just writing to the vertexbuffer every time you should do your memory accesses uncached, which should give you much better performance than flushing the cache. You do this by ORing the pointer with 0x40000000. That makes sure that writes are pushed to memory directly and won't linger in the cache, just make sure you don't need to read from the same memory (uncached reads have a huge penalty, and cached reads might not see what you have written uncached to the same location).

The displaylist should be enough to contain all drawing commands between one sceGuStart()/sceGuFinish() pair. You can check how much memory you are currently using by calling sceGuCheckList(), which returns number of bytes currently in use. If you overflow this list you are basically screwed, since it will have written into memory it does not own. A good size is 512kB for most needs.

Most sceGu*()-commands use around 4-16 bytes per call, but there are exceptions like sceGuSetMatrix() that can use up to 70 bytes per call since it needs to inline the matrix in the display list. Also, all calls to sceGuGetMemory() will allocate from the display list, so if you call that a lot you will see a lot more list usage.
_________________
GE Dominator
Back to top
View user's profile Send private message
Sdw



Joined: 17 Jul 2007
Posts: 29

PostPosted: Thu Aug 30, 2007 7:00 pm    Post subject: Reply with quote

Thanks chp, excellent answers!
Back to top
View user's profile Send private message
flatmush



Joined: 07 Aug 2007
Posts: 28
Location: Here

PostPosted: Thu Aug 30, 2007 7:33 pm    Post subject: Reply with quote

One thing that I always wondered is, is it faster to use cached memory for a texture that you swizzle and leave and just do a writeback on it, or is it faster to use uncached memory.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
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