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 

use of "sceGuStart"

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



Joined: 04 Jul 2005
Posts: 8
Location: London

PostPosted: Tue Oct 04, 2005 7:25 am    Post subject: use of "sceGuStart" Reply with quote

I'm trying to get to grips with the SDK, and I'm working on some GU stuff. One of the first things I've noticed in the GU samples is the code:
Code:

static unsigned int __attribute__((aligned(16))) list[262144];
...
sceGuStart(GU_DIRECT,list);


Why is the magic number 262144? It's just a bit more than 32 bits at 480x272 bytes.

Also, as it seems to be a momory pointer, wouldn't the Sony bods have not had a 'size' parameter in the function call?

If it's to pass it a chunck of RAM to use as a buffer or something, I'd have expected the hardware to have dedicated space??

I'm sure I must be missing something obvious, but a search didn't throw much up, plus I've been looking at code at work all day and it's Monday so my brain is a bit frazzled.
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Tue Oct 04, 2005 8:53 am    Post subject: Reply with quote

The number is just the size of the commandbuffer that you use to send your graphics-commands to the GE. This memory block can reside in either normal system ram or vram. The number 262144 was chosen to give the gu functions 1MB of memory to play with. You can change the size to whatever you need, but keep in mind that if you overrun the buffer length, it's game over.

From the register usage, I did not find any size-parameter. Adding one could and probably should be done, and linking with a debug-version during development so that you can catch any buffer overruns. I have not had time to do this yet.
_________________
GE Dominator
Back to top
View user's profile Send private message
ninjadave



Joined: 04 Jul 2005
Posts: 8
Location: London

PostPosted: Wed Oct 05, 2005 2:32 am    Post subject: Reply with quote

262144 * sizeof( unsigned int ) = 1048576 = 1MB
I see!!

Cheers!
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