- track level start time for the shader system, reset the shaders.

This commit is contained in:
Rachael Alexanderson 2017-11-15 11:06:21 -05:00
parent d2bc24737b
commit ab32cb4c88
4 changed files with 7 additions and 2 deletions

View File

@ -362,7 +362,7 @@ struct level_info_t
int outsidefogdensity; int outsidefogdensity;
int skyfog; int skyfog;
float pixelstretch; float pixelstretch;
// Redirection: If any player is carrying the specified item, then // Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one. // you go to the RedirectMap instead of this one.
FName RedirectType; FName RedirectType;

View File

@ -67,6 +67,8 @@ struct FLevelLocals
FString F1Pic; FString F1Pic;
EMapType maptype; EMapType maptype;
uint64_t ShaderStartTime = 0; // tell the shader system when we started the level (forces a timer restart)
TArray<vertex_t> vertexes; TArray<vertex_t> vertexes;
TArray<sector_t> sectors; TArray<sector_t> sectors;
TArray<line_t*> linebuffer; // contains the line lists for the sectors. TArray<line_t*> linebuffer; // contains the line lists for the sectors.

View File

@ -37,6 +37,7 @@
#include "gl/renderer/gl_colormap.h" #include "gl/renderer/gl_colormap.h"
#include "gl/dynlights//gl_lightbuffer.h" #include "gl/dynlights//gl_lightbuffer.h"
#include "gl/renderer/gl_renderbuffers.h" #include "gl/renderer/gl_renderbuffers.h"
#include "g_levellocals.h"
void gl_SetTextureMode(int type); void gl_SetTextureMode(int type);
@ -121,7 +122,7 @@ bool FRenderState::ApplyShader()
static uint64_t firstFrame = 0; static uint64_t firstFrame = 0;
// if firstFrame is not yet initialized, initialize it to current time // 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 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; firstFrame = screen->FrameTime;
static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f }; static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f };

View File

@ -3627,6 +3627,8 @@ void P_SetupLevel (const char *lumpname, int position)
bool buildmap; bool buildmap;
const int *oldvertextable = NULL; const int *oldvertextable = NULL;
level.ShaderStartTime = I_msTime(); // indicate to the shader system that the level just started
// This is motivated as follows: // This is motivated as follows:
bool RequireGLNodes = Renderer->RequireGLNodes() || am_textured; bool RequireGLNodes = Renderer->RequireGLNodes() || am_textured;