use of "sceGuStart"

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

Moderators: cheriff, TyRaNiD

Post Reply
ninjadave
Posts: 8
Joined: Mon Jul 04, 2005 7:54 pm
Location: London

use of "sceGuStart"

Post by ninjadave »

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: Select all

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.
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

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
ninjadave
Posts: 8
Joined: Mon Jul 04, 2005 7:54 pm
Location: London

Post by ninjadave »

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

Cheers!
Post Reply