Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Scott Cartier Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Too many GsSortSprites? Date: Sun, 03 Aug 1997 22:38:40 -0700 Organization: SCEA Net Yaroze News Lines: 94 Message-ID: <33E56AE0.5E30@concentric.net> References: <33E3C5DF.2C76@concentric.net> <33e40a7b.25419987@205.149.189.29> Reply-To: dsyaroze@concentric.net NNTP-Posting-Host: ts020d01.cup-ca.concentric.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0C-GZone (Win95; I) Scott reads Mario's suggestion and scratches his head. It couldn't be *that* could it? Oh well he tries it anyway just to satisfy his curiosity. Wouldn't you know it worked? I've been killing myself for a couple months on this problem and it turns out to be such a simple solution. I actually remember when I changed my code from the ordering below (which works) to the other ordering (which didn't work all the time - but it worked enough of the time for me to just grit my teeth and deal with it). I though I was making it better since I was grouping all the double buffer routines together instead of breaking them up into two pieces (one at the beginning of the loop and one at the end). Looking at it now I wonder how my incorrect code worked at all. The first time through my loop my GsSortClear and GsDrawOt were being called without activeBuff containing a value. Of *course* that's going to cause problems. Muchas gracias Senor Perdue! I'm so glad I'm not alone with this Yaroze thing! Scott > >Hi all, > > > >I'm having a locking up problem that I've been tearing my hair to > >figure out. I've had this problem for some time and have run out > >of ideas for debugging. It seems rather simple. > > > >I have an array of sprites which represent my game objects. Every > >frame I loop through this array and use GsSortSprite to put them > >on the screen. Whenver this loop is greater than about 6 my > >program locks up. The only thing I could think of is that I'm > >overloading the GPU with packets. So I tried adding a DrawSync(0) > >after each GsSortSprite call, but no luck. Here's my basic flow: > > > > initialize_sprites(); > > > > while(pad_state[PAD_SELECT] == 0) { > > move_sprites(); > > > > for (i = 0; i < num_sprites; i++) > > GsSortSprite(&sprt_array[i], &WorldOT[activeBuff], 2); > > > > cnt = VSync(0); > > ResetGraph(1); // hi-res mode > > GsSwapDispBuff(); > > > > GsSortClear(0, 0, 0, &WorldOT[activeBuff]); > > > > GsDrawOt(&WorldOT[activeBuff]); > > activeBuff = GsGetActiveBuff(); > > GsSetWorkBase((PACKET *)GpuPacketArea[activeBuff]); > > GsClearOt(0, 0, &WorldOT[activeBuff]); > > > > compute_new_sprite_pos(); > > } > > > >This is over simplified of course, but you get the idea. Is there > >anything obvious that I'm doing wrong? > > Scott, > > I'd try something more like this: > > initialize_sprites(); > > while(pad_state[PAD_SELECT] == 0) > { > activeBuff = GsGetActiveBuff(); > GsSetWorkBase((PACKET *)GpuPacketArea[activeBuff]); > GsClearOt(0, 0, &WorldOT[activeBuff]); > > compute_new_sprite_pos(); > > move_sprites(); > > for (i = 0; i < num_sprites; i++) > GsSortSprite(&sprt_array[i], &WorldOT[activeBuff], 2); > > DrawSync(0); > cnt = VSync(0); > > GsSwapDispBuff(); > GsSortClear(0, 0, 0, &WorldOT[activeBuff]); > GsDrawOt(&WorldOT[activeBuff]); > } > > ResetGraph(1); // hi-res mode > > Mario