Possible unnecessary screen clearing

If you've had any problems with Nexuiz, or would like to report bugs, post here.

Moderators: Nexuiz Moderators, Moderators

Possible unnecessary screen clearing

Postby xoltra » Thu Jul 20, 2006 4:24 am

I've noticed that darkplaces clears the screen each frame which may not be necessary. Normally the color buffer only needs to be cleared if there is some chance that the entire screen will not be written to. Since most correct non-leaky maps should always paint the entire screen not clearing the color buffer each frame should not be a problem.

I've tried removing the GL_COLOR_BUFFER_BIT flag from all calls to GL_Clear() and qglClear() other than the one time call in GL_Init(). The rendering is not noticeably changed other than the fact that leaks in leaky maps are no longer black, but just not painted. Also the Alien Trap logo was not removed perfectly.
xoltra
Member
 
Posts: 19
Joined: Sat Jul 15, 2006 11:03 pm
Location: Austin TX USA

Re: Possible unnecessary screen clearing

Postby LordHavoc » Fri Jul 21, 2006 7:30 am

xoltra wrote:I've noticed that darkplaces clears the screen each frame which may not be necessary. Normally the color buffer only needs to be cleared if there is some chance that the entire screen will not be written to. Since most correct non-leaky maps should always paint the entire screen not clearing the color buffer each frame should not be a problem.

I've tried removing the GL_COLOR_BUFFER_BIT flag from all calls to GL_Clear() and qglClear() other than the one time call in GL_Init(). The rendering is not noticeably changed other than the fact that leaks in leaky maps are no longer black, but just not painted. Also the Alien Trap logo was not removed perfectly.


In my testing I've found no noteworthy slowdown from clearing the color buffer (something like 0.1% loss).

And your testing was not thorough enough - try reducing the viewsize below 100 and then watching notify lines stack up on the uncleared areas of the screen around the view..

This is also an issue if there is no view (such as when disconnected).
LordHavoc
Site Admin
 
Posts: 191
Joined: Wed Mar 29, 2006 7:39 am
Location: western Oregon, USA

Postby xoltra » Sat Jul 22, 2006 3:47 pm

I'm glad that you've thought about it and tested it more thoroughly than I have. I only brought it up because another game I'm familiar with (Sauerbraten) avoids clearing the color buffer each frame, but if in your testing the impact is that small then there is no need to worry about it.
xoltra
Member
 
Posts: 19
Joined: Sat Jul 15, 2006 11:03 pm
Location: Austin TX USA

Postby kyre » Wed Aug 09, 2006 12:37 am

Actually, due to color buffer (bandwidth) compression on newer graphics cards clearing the screen every frame can be faster than not clearing it at all.

Same with Z-buffer clears, chips with hierarchal z buffers/fast clears usually run slower with the old quake z-trick (which avoids clearing the buffer by chopping the buffer in half and alternating the comparison direction each frame), than just clearing each frame.

It all boils down to which alternative happen to use the least amount of memory accesses on a particular chip.
Whenever You go, then You aren't.
kyre
Alien
 
Posts: 118
Joined: Tue Jun 13, 2006 8:56 pm
Location: Sweden

Postby Tei » Thu Aug 10, 2006 9:39 pm

On Telejano I just disable to ability to change clear, and force clear always. This able to make maps withouth sky or with a invisible sky. I even tint the color clearing to the fog color, so the infinite as the color of fog.
Tei
Member
 
Posts: 31
Joined: Thu Aug 10, 2006 5:45 pm


Return to Nexuiz - Support / Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron