Path: chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.beginners Subject: Re: DrawSync confusion. Date: Tue, 04 Aug 1998 13:05:59 +0100 Organization: Sony Computer Entertainment Europe Lines: 43 Message-ID: <35C6F927.4765EF18@scee.sony.co.uk> References: <35c6f063.10719834@news.playstation.co.uk> NNTP-Posting-Host: mailgate.scee.sony.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5b1 [en] (Win95; I) X-Accept-Language: en Doug Roberts wrote: > > Can anyone please explain to me how when and how often to use the > drawsync function? Some of the source I've look at uses it often, > after all the all the functions like LoadImage etc, and some just in > the main loop before the VSync function. DrawSync(0) waits for the Graphics Processing Unit to finish processing all the commands that have been sent to it. There are two reasons that you'd want to call it: 1) When you're loading TIMs into VRAM using LoadImage, the GPU will queue up the LoadImage command (which means that it doesn't get executed immmediately). When it gets around to processing it, it will use the values in the RECT structure that exists at the time of the GPU processing, rather than the values that were in the RECT when you did the LoadImage. Thus doing this: setRect(&myRect,1,2,3,4); LoadImage(&myRect,&myTimData); setRect(&myRect,5,6,7,8); is more likely to use the _latter_ rectangle instead of the intended former rectangle. To get around this, it is advisable to do a DrawSync(0) directly after the LoadImage instruction, which guarantees that the values the GPU will use will be the ones you intend. 2) In a double buffering situation, you are supposed to swap screens when 1) The GPU has completed drawing the last frame, and 2) in the Vertical Blank. Thus you will see programs do this: DrawSync(0); // Wait for GPU to finish Vsync(0); // Wait for the vertical blank GsSwapDispBuff(); //Swap the display buffers. Cheers, James -- == James_Russell@scee.sony.co.uk +44 (171) 447-1626 == Developer Support Engineer - Sony Computer Entertainment Europe Scorpio: "This is my death ray. Which country would you like to destroy, Homer? France or Italy?" Homer: "Ummmm.... France." Scorpio: "Hehe... No-one ever says Italy."