mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #737 from Azaezel/queryStallPrevention
Query Stall Prevention
This commit is contained in:
commit
4716f76d5e
3 changed files with 15 additions and 4 deletions
|
|
@ -124,9 +124,16 @@ GFXD3D9OcclusionQuery::OcclusionQueryStatus GFXD3D9OcclusionQuery::getStatus( bo
|
||||||
DWORD dwOccluded = 0;
|
DWORD dwOccluded = 0;
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ GFXDevice::GFXDevice()
|
||||||
|
|
||||||
// Initialize our drawing utility.
|
// Initialize our drawing utility.
|
||||||
mDrawer = NULL;
|
mDrawer = NULL;
|
||||||
|
mFrameTime = PlatformTimer::create();
|
||||||
// Add a few system wide shader macros.
|
// Add a few system wide shader macros.
|
||||||
GFXShader::addGlobalMacro( "TORQUE", "1" );
|
GFXShader::addGlobalMacro( "TORQUE", "1" );
|
||||||
GFXShader::addGlobalMacro( "TORQUE_VERSION", String::ToString(getVersionNumber()) );
|
GFXShader::addGlobalMacro( "TORQUE_VERSION", String::ToString(getVersionNumber()) );
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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]; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue