OK, so a lot of you know about the BlitzMax DirectX 7 rendering pipeline lag problem, where if there's a lot going on, the frames get buffered and then rendered later. This results in an lag between user input and output on the screen which is unacceptable for action games or games with a mouse pointer (that's pretty much all games then).
Several fixes were proposed and the "final" proposed fix was this (to be placed after your Flip command):
Yep this works esp. in some code like this:
Use the Z and X keys to move left and right, you should the the square trying to catch up with you. Enable the fix and all is fine. Good.
Here's the *BUT*.
On certain Geforce cards (e.g. Ti4200, 6600, 6800 etc), this lag fix causes a rhymic jerkiness in my game framework (around once every second). Turning off the fix makes the game framework run fine. Bummer. The fix works fine on Radeons and other video cards.
I tried Indiepath's module tweak i.e. change the Flip method of TD3D7Device in d3d7graphics.bmx to:
and also change Method GetFlipStatus() in dd.bmx to Method GetFlipStatus(flags) then rebuild modules.
The idea behind this being it only outputs a frame when it can do thus saving processor cycles. However, this causes a problem with the square example above where it only seems to draw every second or so, so it looks really jerky.
So basically this issue is raised again as it is not yet solved unfortunately...
Several fixes were proposed and the "final" proposed fix was this (to be placed after your Flip command):
If TD3D7Max2DDriver(_max2dDriver) While DDERR_WASSTILLDRAWING = PrimaryDevice.PrimarySurface.GetBltStatus(DDGBS_ISBLTDONE) ; Wend EndIf
Yep this works esp. in some code like this:
'low poly and high fill rate causes the issue, solvable by flushing the driver's 'buffered frames using grab pixmap or locking a buffer with a large speed penalty. 'opengl is unaffected. 'change how many loops you do till you see the lag and not general slowdown 'this will vary from pc to pc 'SetGraphicsDriver GLMax2DDriver() Graphics 800,600,0 AutoMidHandle True Local fix = 0 mx = 300 my = 200 While Not KeyHit(KEY_ESCAPE) Cls If KeyHit(KEY_SPACE) Then fix = 1 - fix If KeyDown(KEY_Z) Then mx = mx - 10 If KeyDown(KEY_X) Then mx = mx + 10 For i = 0 To 2000 DrawRect mx,my,200,200 Next SetScale 1, 1 DrawText "Fix = " + fix, 12, 12 Flip If fix If TD3D7Max2DDriver(_max2dDriver) While DDERR_WASSTILLDRAWING = PrimaryDevice.PrimarySurface.GetBltStatus(DDGBS_ISBLTDONE) ; Wend EndIf EndIf Wend
Use the Z and X keys to move left and right, you should the the square trying to catch up with you. Enable the fix and all is fine. Good.
Here's the *BUT*.
On certain Geforce cards (e.g. Ti4200, 6600, 6800 etc), this lag fix causes a rhymic jerkiness in my game framework (around once every second). Turning off the fix makes the game framework run fine. Bummer. The fix works fine on Radeons and other video cards.
I tried Indiepath's module tweak i.e. change the Flip method of TD3D7Device in d3d7graphics.bmx to:
Device.EndScene() If state&DX7FULLSCREEN If PrimarySurface.GetFlipStatus(DDGFS_CANFLIP) = DD_OK PrimarySurface.Flip Null,flipflags EndIf Else If PrimarySurface.GetBltStatus(DDGBS_ISBLTDONE) = DD_OK Local src[]=[0,0,width,height] Local dest[]=[0,0,width,height] ClientToScreen hwnd,dest dest[2]:+dest[0] dest[3]:+dest[1] PrimarySurface.Blt dest,BackBuffer,src,0,Null EndIf EndIf Device.BeginScene()
and also change Method GetFlipStatus() in dd.bmx to Method GetFlipStatus(flags) then rebuild modules.
The idea behind this being it only outputs a frame when it can do thus saving processor cycles. However, this causes a problem with the square example above where it only seems to draw every second or so, so it looks really jerky.
So basically this issue is raised again as it is not yet solved unfortunately...