Clearing the screen

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Clearing the screen

Post 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.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
User avatar
jbit
Site Admin
Posts: 293
Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:

Post 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)
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

OK, so utilize gsKit :) Thanks.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
Post Reply