Archived

This topic is now archived and is closed to further replies.

styles_b

glFlush alternative

Recommended Posts

styles_b    122
On a game I made someone is reporting random crashing, and I''ve tracked to to what looks like the glFlush call. My guess is that it''s overfilling his buffer and crashing the game, has anyone encountered that problem with glFlush? I''m trying to find an alternative, as not having flush there will cause choppiness, using glFinish seems to cause more choppiness, and I want to avoid using video card specific functions...suggestions?

Share this post


Link to post
Share on other sites
benjamin bunny    838
As Myopic Rhino points out, glFlush makes no difference on most hardware. It''s definitely supported by all drivers/hardware though, being part of the 1.0 spec. The buffer is flushed implicitly by a call to swapbuffers anyway, so there''s no need to use glFlush or glFinish.

If you''re getting random crashing, it''s possible you''re doing something bad with unallocated memory somewhere. Such bugs can manifest themselves in very random ways; I really doubt glFlush is the cause. A couple of other possible causes are overheating, or faulty drivers on the card.

Share this post


Link to post
Share on other sites
styles_b    122
I have a GForce4 which I don''t consider obsolete, and there''s a huge difference between using flush(smooth), finish(choppy), and neither(less choppy then finish).

He''s running an AMD 700 Athlon, KT133 Via Motherboard, 512 MB SDRAM 133, SB Live 1024 (latest drivers / old), Geforce2 (Detonator NOT forceware drivers). I can''t blame the card because he can run other games just fine.

The old card is what led to my guess of it being glFlush, as from what I understand flush will queue things up and move on (so this queue could get overfilled maybe?), while glFinish will wait until the rendering finishes to return(I haven''t been able to get him to try the version using finish to test that theory). But overall, I notice a large difference between using flush/finish/none, and most the average consumer will as well as a GForce4 is better then average.

My log/debugging leads me to beleive it''s not a memory leak, along with the fact that I have gotten feedback from over 20 people using different systems that have had no such crashing at all (hence a weird video card or hardware error). Hopefully that explains things a little better, by choppiness I mean simply movement that isn''t smooth (that shouldn''t occur because everything in the game is timebased and it looks very smooth on all systems I''ve tested it on using glFlush).

Share this post


Link to post
Share on other sites
Promit    13246
quote:
Original post by styles_b
The old card is what led to my guess of it being glFlush, as from what I understand flush will queue things up and move on (so this queue could get overfilled maybe?), while glFinish will wait until the rendering finishes to return(I haven''t been able to get him to try the version using finish to test that theory).


glFlush is the opposite; it instructs the driver to empty the queue but returns immediately. glFinish does the same but does not return until the queue is actually empty.

Share this post


Link to post
Share on other sites
styles_b    122
That''s what I ment, glFlush() instructs the driver to queue things up (and empty the queue) but doesn''t execute the instructions automatically. So theoretically if you keep issuing draw commands and they keep queueing up, but they don''t actually occur and the buffer could overflow (this is a guess...). glFinish on the otherhand, will empty the queue before it returns.

Share this post


Link to post
Share on other sites