Archived

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

asmLOCK

Interrupts & DONOTWAIT

Recommended Posts

asmLOCK    122
I was wondering if anyone knows what some of the implications are of using the DONOTWAIT flag in Lock() and Flip(). I know what it basically does, but why would I not want to use it...I get a considerable speed increase. Also, before I do any drawing to the backbuffer, I clear interrupts: asm cli; //do drawing //blah blah asm sti; ...this also appears to give me a boost in frame rate. Would disabling the interrupts interfere with GetTickCount()''s accuracy and hence, giving me false framerate values? Thanks for any help. When life hands you lemons, throw them at God's head.

Share this post


Link to post
Share on other sites
Syzygy    122
I think I know what''s happening. Passing the DONOTWAIT flag to Lock() or Flip() tells them that it''s OK to return the DDERR_SURFACEBUSY instead of doing the actual Lock or Flip. In the case of Flip(), this means that no new image is presented to the player. I''m guessing that you just increment your frame-counter once for each call to Flip. If this is true, then by using this flag, you''re measuring how many frames your program can output, but not how many the viewer is actually seeing. This may be OK for you, but it can possibly cause inconsistencies in visible frame rate (since some frames are lost). You may also want to try going to a triple-buffered primary mechanism just to see what happens.

As for the interrupt stuff. It makes sense that you can do stuff faster when you''re not being interrupted. However, I think it’s generally a bad idea to do anything major with interrupts disabled. After all, you are refusing to give any time to anything other than your code.

Share this post


Link to post
Share on other sites