| View previous topic :: View next topic |
| Author |
Message |
ninjadave
Joined: 04 Jul 2005 Posts: 8 Location: London
|
Posted: Tue Oct 04, 2005 7:25 am Post subject: use of "sceGuStart" |
|
|
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 |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Tue Oct 04, 2005 8:53 am Post subject: |
|
|
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 |
|
 |
ninjadave
Joined: 04 Jul 2005 Posts: 8 Location: London
|
Posted: Wed Oct 05, 2005 2:32 am Post subject: |
|
|
262144 * sizeof( unsigned int ) = 1048576 = 1MB
I see!!
Cheers! |
|
| Back to top |
|
 |
|