mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
- check the shader timer only once per frame, not once per draw call.
This commit is contained in:
parent
4de649d4d1
commit
83ce72db48
3 changed files with 14 additions and 7 deletions
|
@ -254,7 +254,9 @@ sector_t *FGLRenderer::RenderView(player_t* player)
|
|||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
// prepare all camera textures that have been used in the last frame
|
||||
level.canvasTextureInfo.UpdateAll([&](AActor *camera, FCanvasTexture *camtex, double fov)
|
||||
auto Level = player->mo->__GetLevel();
|
||||
gl_RenderState.CheckTimer(Level->ShaderStartTime);
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor *camera, FCanvasTexture *camtex, double fov)
|
||||
{
|
||||
RenderTextureView(camtex, camera, fov);
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ enum EPassType
|
|||
|
||||
class FGLRenderState : public FRenderState
|
||||
{
|
||||
uint64_t firstFrame = 0;
|
||||
|
||||
uint8_t mLastDepthClamp : 1;
|
||||
|
||||
float mGlossiness, mSpecularLevel;
|
||||
|
@ -102,6 +104,7 @@ public:
|
|||
void Apply();
|
||||
void ApplyBuffers();
|
||||
void ApplyBlendMode();
|
||||
void CheckTimer(uint64_t ShaderStartTime);
|
||||
|
||||
void ResetVertexBuffer()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue