Skip to content

Commit c92bc3e

Browse files
committed
refactor(renderer): clean up debug logging and improve code clarity
- Removed unnecessary debug logging related to frame calls in SCR_DrawScreenField and SCR_UpdateScreen functions, streamlining the rendering process. - Enhanced readability by clarifying variable declarations and conditions, particularly regarding anaglyph mode checks. - Added forward declarations for static particle functions in the Vulkan renderer to improve code organization and maintainability. This commit focuses on improving code clarity and reducing clutter in the rendering logic, contributing to better maintainability.
1 parent 156be23 commit c92bc3e

2 files changed

Lines changed: 7 additions & 19 deletions

File tree

src/client/cl_scrn.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,6 @@ This will be called twice if rendering in stereo mode
523523
static void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
524524
qboolean uiFullscreen;
525525

526-
// Debug: Log when BeginFrame is called (first few times only)
527-
static int begin_frame_count = 0;
528-
if (begin_frame_count < 3 && com_developer && com_developer->integer) {
529-
Com_Printf("DEBUG: SCR_UpdateScreen calling re.BeginFrame (call #%d)\n", ++begin_frame_count);
530-
} else {
531-
begin_frame_count++;
532-
}
533526
re.BeginFrame( stereoFrame );
534527

535528
uiFullscreen = (uivm && VM_Call( uivm, 0, UI_IS_FULLSCREEN ));
@@ -640,23 +633,14 @@ void SCR_UpdateScreen( void ) {
640633
// Check if renderer interface is available and properly initialized
641634
// This prevents crashes during early startup before CL_InitRef completes
642635
extern qboolean re_initialized;
643-
extern cvar_t *com_developer;
644-
if ( !FS_StartupInProgress() && com_developer && com_developer->integer ) {
645-
Com_Printf( "DEBUG: SCR_UpdateScreen called, re_initialized=%d\n", re_initialized );
646-
}
647636
if ( !re_initialized || !re.GetConfig || !re.BeginFrame || !re.EndFrame ) {
648637
// Renderer not fully initialized yet or failed to initialize, skip rendering
649-
if ( !FS_StartupInProgress() && com_developer && com_developer->integer ) {
650-
Com_Printf( "DEBUG: SCR_UpdateScreen - renderer not ready (re_initialized=%d, GetConfig=%p, BeginFrame=%p, EndFrame=%p), skipping\n",
651-
re_initialized, (void*)re.GetConfig, (void*)re.BeginFrame, (void*)re.EndFrame );
652-
}
653638
// Even if renderer isn't ready, try calling BeginFrame once to trigger recovery if device is lost
654639
// This ensures recovery attempts happen even during initialization
655640
if ( re_initialized && re.BeginFrame ) {
656641
static int recovery_attempt_count = 0;
657642
if ( recovery_attempt_count < 3 ) {
658643
recovery_attempt_count++;
659-
Com_Printf( "DEBUG: SCR_UpdateScreen - attempting BeginFrame call for recovery (attempt %d)\n", recovery_attempt_count );
660644
re.BeginFrame( STEREO_CENTER );
661645
}
662646
}
@@ -684,10 +668,10 @@ void SCR_UpdateScreen( void ) {
684668
// If neither UI VM nor UI initialization exists, stop the renderer
685669
if ( uivm || cls.uiStarted )
686670
{
687-
// XXX
688-
int in_anaglyphMode = Cvar_VariableIntegerValue("r_anaglyphMode");
671+
// Check for anaglyph mode (red/cyan 3D glasses)
672+
const int in_anaglyphMode = Cvar_VariableIntegerValue("r_anaglyphMode");
689673
// if running in stereo, we need to draw the frame twice
690-
if ( cls.glconfig.stereoEnabled || in_anaglyphMode) {
674+
if ( cls.glconfig.stereoEnabled || in_anaglyphMode ) {
691675
SCR_DrawScreenField( STEREO_LEFT );
692676
SCR_DrawScreenField( STEREO_RIGHT );
693677
} else {

src/renderers/vulkan/tr_scene.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ static cpu_particle_t cpu_particles[MAX_CPU_PARTICLES];
5757
static int cpu_particle_count = 0;
5858
static float last_particle_update_time = 0.0f;
5959

60+
// Forward declarations for static particle functions
61+
static void R_ProcessCPUParticles( float deltaTime );
62+
static void R_RenderCPUParticles( void );
63+
6064

6165
/*
6266
====================

0 commit comments

Comments
 (0)