Skip to content

Commit

Permalink
- track level start time for the shader system, reset the shaders.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachael Alexanderson committed Nov 15, 2017
1 parent d2bc247 commit ab32cb4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/g_level.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ struct level_info_t
int outsidefogdensity;
int skyfog;
float pixelstretch;

// Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one.
FName RedirectType;
Expand Down
2 changes: 2 additions & 0 deletions src/g_levellocals.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ struct FLevelLocals
FString F1Pic;
EMapType maptype;

uint64_t ShaderStartTime = 0; // tell the shader system when we started the level (forces a timer restart)

TArray<vertex_t> vertexes;
TArray<sector_t> sectors;
TArray<line_t*> linebuffer; // contains the line lists for the sectors.
Expand Down
3 changes: 2 additions & 1 deletion src/gl/renderer/gl_renderstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "gl/renderer/gl_colormap.h"
#include "gl/dynlights//gl_lightbuffer.h"
#include "gl/renderer/gl_renderbuffers.h"
#include "g_levellocals.h"

void gl_SetTextureMode(int type);

Expand Down Expand Up @@ -121,7 +122,7 @@ bool FRenderState::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))
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 };
Expand Down
2 changes: 2 additions & 0 deletions src/p_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3627,6 +3627,8 @@ void P_SetupLevel (const char *lumpname, int position)
bool buildmap;
const int *oldvertextable = NULL;

level.ShaderStartTime = I_msTime(); // indicate to the shader system that the level just started

// This is motivated as follows:

bool RequireGLNodes = Renderer->RequireGLNodes() || am_textured;
Expand Down

0 comments on commit ab32cb4

Please sign in to comment.