Page 1 of 1

GPU packets size

Posted: March 3rd, 2014, 10:18 pm
by jman
I see that PACKET_SIZE is sized in varying degrees in different sources, thus the resultant PACKET object defined can be sometimes very large or small.

I've noticed this issue because I tried to load an image with a defined PACKET object too small; everything crashed for no apparent reason; it was not easy to narrow down the culprit to an excessively small PACKET allocation.

Is there a rule of thumb to estimate how much this PACKET should be?

Thanks

Re: GPU packets size

Posted: April 10th, 2014, 1:04 am
by Yagotzirck
I wondered about the same thing a while ago: http://www.psxdev.net/forum/viewtopic.php?f=51&t=391
Though, nobody could give an exhaustive explanation :evil:
Your best bet is to increase values until they fit to your project(for how clunky it sounds), or maybe it's explained somewhere in psyq's documentation... i should dig a bit deeper about this

Re: GPU packets size

Posted: April 10th, 2014, 5:47 am
by jman
Yagotzirck wrote:I wondered about the same thing a while ago: http://www.psxdev.net/forum/viewtopic.php?f=51&t=391
Though, nobody could give an exhaustive explanation
Thanks for pointing me to your thread, it was interesting nonetheless

Re: GPU packets size

Posted: April 10th, 2014, 7:28 pm
by Shadow
Read LIBOVR46.PDF, Packet Preparation Function (Packet Buffer). Page 163.

LIBOVR46.PDF
The packet creation area is set by the GsSetWorkBase() function.
Packets increase and decrease depending on the type and number of polygons (flat/gouraud, with/without
texture). Only a rough estimate can be made of how much area should be maintained. If the area of an
actual packet is smaller than the packet created, it will destroy the area behind the packet area.
LIBGS.H

Code: Select all

/*
 * $PSLibId: Run-time Library Release 4.6$
 */

/*
 * libgs.h: Graphic Library Header 
 *
 *
 * Version 1.**	Apr,  8, 1994 
 *
 * Copyright (C) 1993 by Sony Corporation All rights Reserved 
 */

...

/*** packet peripheral pointer ***/
typedef unsigned char PACKET;
I usually keep it at 2048. So, 2048 bytes are set aside for use under GsSetWorkBase.
If your program is really simple, then you can even drop it as low as 300 bytes.
PACKET is a unsigned char, so just print it out and see what it contains ;)