Page 1 of 1

Clearing the screen

Posted: Mon Jan 19, 2009 3:04 pm
by LBGSHI
Without using any specific graphics libraries (gsKit, gsLib, etc), I'd like to clear the screen in a little better way than I currently am.

I started out using init_screen(), but, noting the delay, tried replacing it with scr_clear(). To my dismay, this actually made the delay longer.

Is there another way I might clear the screen? And, any idea why clearing the screen would take longer than initializing it? That makes me question the usefulness of clear_scr at all...

Alternately, I suppose I could just accept using a graphics lib (I'll eventually do that anyway), if someone could point out a quick way to clear the screen in one.

Thanks in advance for any help.

Posted: Mon Jan 19, 2009 6:50 pm
by jbit
scr_clear() does not do what you think it does, it's part of the debug text library and basically draws lots and lots of blank characters on screen. And each character draw is doing it's very own DMA operations IIRC. So it's extremely slow. The functions you are using are not designed for interactive programs, they're designed for randomly throwing text on the screen in a reliable way regardless of current system state.

gskit has something like gsKit_clear(); which I'm pretty sure uses strips to clear the screen instead of one big sprite. But you'll need to init gsKit, etc before using it of course.

To clear the screen really really fast you need to use strips, if you just use one sprite the size of the screen you hit a million GS page cache misses and it becomes very very slow, if you use lots of 64pixel wide sprite strips you avoid any page cache misses on the horizontal scanning, so you pretty much hit the GS' peak pixel fill rate (which is fast, even by todays standards)

Posted: Tue Jan 20, 2009 1:39 am
by LBGSHI
OK, so utilize gsKit :) Thanks.