Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: mperdue@hrtc.net (Mario Perdue) Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Too many GsSortSprites? Date: Sun, 03 Aug 1997 04:41:26 GMT Organization: SCEA Net Yaroze News Lines: 72 Message-ID: <33e40a7b.25419987@205.149.189.29> References: <33E3C5DF.2C76@concentric.net> NNTP-Posting-Host: firewall.hrtc.net X-Newsreader: Forte Free Agent 1.1/32.230 On Sat, 02 Aug 1997 16:42:23 -0700, Scott Cartier wrote: >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