- check the shader timer only once per frame, not once per draw call.

This commit is contained in:
Christoph Oelckers 2019-01-06 13:35:31 +01:00
commit 83ce72db48
3 changed files with 14 additions and 7 deletions

View file

@ -93,12 +93,6 @@ void FGLRenderState::Reset()
bool FGLRenderState::ApplyShader()
{
static uint64_t firstFrame = 0;
// if firstFrame is not yet initialized, initialize it to current time
// if we're going to overflow a float (after ~4.6 hours, or 24 bits), re-init to regain precision
if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1<<24) || level.ShaderStartTime >= firstFrame)
firstFrame = screen->FrameTime;
static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f };
if (mSpecialEffect > EFF_NONE)
{
@ -595,4 +589,12 @@ bool FGLRenderState::SetDepthClamp(bool on)
return res;
}
void FGLRenderState::CheckTimer(uint64_t ShaderStartTime)
{
// if firstFrame is not yet initialized, initialize it to current time
// if we're going to overflow a float (after ~4.6 hours, or 24 bits), re-init to regain precision
if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1 << 24) || ShaderStartTime >= firstFrame)
firstFrame = screen->FrameTime;
}
}