Skip to content

Commit 0431a67

Browse files
committed
Add r_forceRendererTime
When set to >= 0, the value of this cvar (in milliseconds) will be used for time-based shader effects.
1 parent d5a7987 commit 0431a67

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/engine/renderer/tr_init.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
271271
"(-1 to profile all stages/materials, rendered in their usual order); "
272272
"for materials, material IDs start from opaque materials, depth pre-pass materials are ignored", Cvar::NONE, -1 );
273273

274+
Cvar::Cvar<int> r_forceRendererTime( "r_forceRendererTime", "Set a specific time (in ms, since the start of the map) for time-based shader effects; -1 to disable", Cvar::CHEAT, -1 );
275+
274276
cvar_t *r_vboFaces;
275277
cvar_t *r_vboCurves;
276278
cvar_t *r_vboTriangles;

src/engine/renderer/tr_local.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,6 +3047,8 @@ enum class shaderProfilerRenderSubGroupsMode {
30473047
extern Cvar::Cvar<bool> r_materialDebug;
30483048
extern cvar_t *r_showParallelShadowSplits;
30493049

3050+
extern Cvar::Cvar<int> r_forceRendererTime;
3051+
30503052
extern Cvar::Cvar<bool> r_profilerRenderSubGroups;
30513053
extern Cvar::Range<Cvar::Cvar<int>> r_profilerRenderSubGroupsMode;
30523054
extern Cvar::Cvar<int> r_profilerRenderSubGroupsStage;

src/engine/renderer/tr_scene.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,11 @@ void RE_RenderScene( const refdef_t *fd )
564564
}
565565

566566
// derived info
567-
tr.refdef.floatTime = float(double(tr.refdef.time) * 0.001);
567+
if ( r_forceRendererTime.Get() >= 0 ) {
568+
tr.refdef.floatTime = float( double( r_forceRendererTime.Get() ) * 0.001 );
569+
} else {
570+
tr.refdef.floatTime = float( double( tr.refdef.time ) * 0.001 );
571+
}
568572

569573
tr.refdef.numDrawSurfs = r_firstSceneDrawSurf;
570574
tr.refdef.drawSurfs = backEndData[ tr.smpFrame ]->drawSurfs;

0 commit comments

Comments
 (0)