prevents an infinite while loop by putting a cap of 4MS on occlusion queries.

This commit is contained in:
Azaezel 2014-07-18 00:40:11 -05:00
parent 8390c4159f
commit 4f3be25699
3 changed files with 14 additions and 3 deletions

View file

@ -126,7 +126,14 @@ GFXD3D9OcclusionQuery::OcclusionQueryStatus GFXD3D9OcclusionQuery::getStatus( bo
if ( block ) if ( block )
{ {
while( ( hRes = mQuery->GetData( &dwOccluded, sizeof(DWORD), D3DGETDATA_FLUSH ) ) == S_FALSE ) while( ( hRes = mQuery->GetData( &dwOccluded, sizeof(DWORD), D3DGETDATA_FLUSH ) ) == S_FALSE )
; {
//If we're stalled out, proceed with worst-case scenario -BJR
if(GFX->mFrameTime->getElapsedMs()>4)
{
this->end();
return NotOccluded;
}
}
} }
else else
{ {

View file

@ -804,7 +804,7 @@ inline bool GFXDevice::beginScene()
// Send the start of frame signal. // Send the start of frame signal.
getDeviceEventSignal().trigger( GFXDevice::deStartOfFrame ); getDeviceEventSignal().trigger( GFXDevice::deStartOfFrame );
mFrameTime->reset();
return beginSceneInternal(); return beginSceneInternal();
} }

View file

@ -54,6 +54,9 @@
#include "math/util/frustum.h" #include "math/util/frustum.h"
#endif #endif
#ifndef _PLATFORM_PLATFORMTIMER_H_
#include "platform/platformTimer.h"
#endif
class FontRenderBatcher; class FontRenderBatcher;
class GFont; class GFont;
@ -743,6 +746,7 @@ public:
virtual void endScene(); virtual void endScene();
virtual void beginField(); virtual void beginField();
virtual void endField(); virtual void endField();
PlatformTimer *mFrameTime;
virtual GFXTexHandle & getFrontBuffer(){ return mFrontBuffer[mCurrentFrontBufferIdx]; } virtual GFXTexHandle & getFrontBuffer(){ return mFrontBuffer[mCurrentFrontBufferIdx]; }