GPU packets size

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
jman
Rookie Programmer
Rookie Programmer
Posts: 110
Joined: Aug 13, 2013

GPU packets size

Post by jman » March 3rd, 2014, 10:18 pm

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

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » April 10th, 2014, 1:04 am

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

jman
Rookie Programmer
Rookie Programmer
Posts: 110
Joined: Aug 13, 2013

Post by jman » April 10th, 2014, 5:47 am

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

User avatar
Shadow
Verified
Admin / PSXDEV
Admin / PSXDEV
Posts: 2670
Joined: Dec 31, 2012
PlayStation Model: H2000/5502
Discord: Shadow^PSXDEV

Post by Shadow » April 10th, 2014, 7:28 pm

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 ;)
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests