From a36694d1f854f5b94dd167f1238975388a37e4f3 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 24 Feb 2023 12:24:24 -0800 Subject: [PATCH] Client: Add shader precache fix for dlights/rtlights, this should eliminate the first shot of any game causing any stuttering --- src/client/defs.h | 2 ++ src/client/entry.qc | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/client/defs.h b/src/client/defs.h index 3f7ee69a..af8514df 100644 --- a/src/client/defs.h +++ b/src/client/defs.h @@ -96,6 +96,8 @@ #define PRINT_HIGH 2 #define PRINT_CHAT 3 +var bool g_dlight_cached = false; + const float MASK_GLOWS = 16; var bool g_focus; bool Util_IsFocused(void); diff --git a/src/client/entry.qc b/src/client/entry.qc index 82756031..f1dabf72 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -291,6 +291,11 @@ CSQC_UpdateView(float w, float h, float focus) else g_view.SetViewMode(VIEWMODE_FPS); + if (g_dlight_cached == false) { + g_dlight_cached = true; + dynamiclight_add(g_view.GetCameraOrigin(), 16, [0.1,0.1,0.1]); + } + g_view.UpdateView(); /* 2D calls happen here, after rendering is done */