Skip to content

Commit 994ef7a

Browse files
committed
feat: cleanup
Signed-off-by: Michael Pollind <[email protected]>
1 parent 0bf842b commit 994ef7a

File tree

8 files changed

+35
-34
lines changed

8 files changed

+35
-34
lines changed

source/qcommon/common.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ void Com_Printf( const char *format, ... )
230230
Q_vsnprintfz( msg, sizeof( msg ), format, argptr );
231231
va_end( argptr );
232232

233-
printf("%s", msg);
234-
235233
QMutex_Lock( com_print_mutex );
236234

237235
if( rd_target )

source/qcommon/snap_write.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,6 @@ static bool SNAP_SnapCullEntity( cmodel_state_t *cms, edict_t *ent, edict_t *cle
909909
if( frame->allentities )
910910
return false;
911911

912-
if(ent->s.type == ET_PLAYER || ent->s.type == ET_CORPSE)
913-
return false;
914912

915913
// filters: transmit only to clients in the same team as this entity
916914
// broadcasting is less important than team specifics

source/ref_gl/r_backend.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ void RB_StatsMessage( char *msg, size_t size )
145145
);
146146
}
147147

148-
void RB_SetStencilFunc( int func, int ref, int mask ) {
148+
void RB_SetStencilFunc( int func, int ref, int mask )
149+
{
150+
if( !glConfig.stencilBits )
151+
return;
149152
if( rb.gl.stencilFunc == func && rb.gl.stencilRef == ref && rb.gl.stencilFuncMask == mask )
150153
return;
151154

@@ -155,7 +158,10 @@ void RB_SetStencilFunc( int func, int ref, int mask ) {
155158
rb.gl.stencilFuncMask = mask;
156159
}
157160

158-
void RB_SetStencilOp( int sfail, int dpfail, int dppass ) {
161+
void RB_SetStencilOp( int sfail, int dpfail, int dppass )
162+
{
163+
if( !glConfig.stencilBits )
164+
return;
159165
if( rb.gl.stencilSFail == sfail && rb.gl.stencilDPFail == dpfail && rb.gl.stencilDPPass == dppass )
160166
return;
161167

@@ -165,14 +171,16 @@ void RB_SetStencilOp( int sfail, int dpfail, int dppass ) {
165171
rb.gl.stencilDPPass = dppass;
166172
}
167173

168-
void RB_SetStencilMask( int mask ) {
169-
if( rb.gl.stencilMask == mask )
170-
return;
174+
void RB_SetStencilMask( int mask )
175+
{
176+
if( !glConfig.stencilBits )
177+
return;
178+
if( rb.gl.stencilMask == mask )
179+
return;
171180
qglStencilMask( mask );
172181
rb.gl.stencilMask = mask;
173182
}
174183

175-
176184
/*
177185
* RB_SetGLDefaults
178186
*/
@@ -364,7 +372,7 @@ void RB_Cull( int cull )
364372
void RB_SetState( int state )
365373
{
366374

367-
int diff = rb.gl.state ^ state;
375+
const int diff = rb.gl.state ^ state;
368376
if( !diff )
369377
return;
370378

@@ -493,7 +501,7 @@ void RB_SetState( int state )
493501

494502
if( diff & GLSTATE_STENCIL_TEST )
495503
{
496-
// if( glConfig.stencilBits )
504+
if( glConfig.stencilBits )
497505
{
498506
if( state & GLSTATE_STENCIL_TEST )
499507
qglEnable( GL_STENCIL_TEST );

source/ref_gl/r_backend_program.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,23 @@ static void RB_InitBuiltinPasses( void )
110110
pass->rgbgen.type = RGB_GEN_OUTLINE;
111111
pass->alphagen.type = ALPHA_GEN_OUTLINE;
112112
pass->tcgen = TC_GEN_NONE;
113-
pass->program_type = GLSL_PROGRAM_TYPE_OUTLINE_0;
113+
pass->program_type = GLSL_PROGRAM_TYPE_OUTLINE_STENCIL_BACK;
114114

115115
// overlay outline
116116
pass = &r_GLSLpasses[BUILTIN_GLSLPASS_OVERLAY_OUTLINE_1];
117117
pass->flags = 0;
118118
pass->rgbgen.type = RGB_GEN_OUTLINE;
119119
pass->alphagen.type = ALPHA_GEN_OUTLINE;
120120
pass->tcgen = TC_GEN_NONE;
121-
pass->program_type = GLSL_PROGRAM_TYPE_OUTLINE_1;
121+
pass->program_type = GLSL_PROGRAM_TYPE_OUTLINE_STENCIL_FRONT;
122122

123123
// overlay outline
124124
pass = &r_GLSLpasses[BUILTIN_GLSLPASS_OVERLAY_OUTLINE_2];
125125
pass->flags = 0;
126126
pass->rgbgen.type = RGB_GEN_OUTLINE;
127127
pass->alphagen.type = ALPHA_GEN_OUTLINE;
128128
pass->tcgen = TC_GEN_NONE;
129-
pass->program_type = GLSL_PROGRAM_TYPE_OUTLINE_2;
129+
pass->program_type = GLSL_PROGRAM_TYPE_OUTLINE_GHOST_FINAL;
130130

131131

132132
// skybox
@@ -1391,10 +1391,6 @@ static void RB_RenderMeshGLSL_Shadowmap( const shaderpass_t *pass, r_glslfeat_t
13911391
RB_Scissor( old_scissor[0], old_scissor[1], old_scissor[2], old_scissor[3] );
13921392
}
13931393

1394-
1395-
/*
1396-
* RB_RenderMeshGLSL_Outline
1397-
*/
13981394
static void RB_RenderMeshGLSL_StencilOutline_0( const shaderpass_t *pass, r_glslfeat_t programFeatures )
13991395
{
14001396
Vector4Copy( rb.currentEntity->outlineColorGhost, rb.entityOutlineColor );
@@ -1425,7 +1421,7 @@ static void RB_RenderMeshGLSL_StencilOutline_0( const shaderpass_t *pass, r_glsl
14251421
RB_SetStencilOp( GL_REPLACE, GL_ZERO, GL_REPLACE);
14261422
RB_SetStencilFunc( GL_ALWAYS, 1, 0xFF );
14271423

1428-
RB_SetShaderpassState( pass->flags | GLSTATE_STENCIL_TEST | GLSTATE_DEPTHFUNC_GT);// | GLSTATE_NO_COLORWRITE );
1424+
RB_SetShaderpassState( pass->flags | GLSTATE_STENCIL_TEST | GLSTATE_DEPTHFUNC_GT);;
14291425
RP_UpdateOutlineUniforms( program, rb.currentEntity->outlineGhost);
14301426
RB_DrawElementsReal( &rb.drawElements );
14311427
}
@@ -2024,13 +2020,13 @@ void RB_RenderMeshGLSLProgrammed( const shaderpass_t *pass, int programType )
20242020
case GLSL_PROGRAM_TYPE_SHADOWMAP:
20252021
RB_RenderMeshGLSL_Shadowmap( pass, features );
20262022
break;
2027-
case GLSL_PROGRAM_TYPE_OUTLINE_0:
2023+
case GLSL_PROGRAM_TYPE_OUTLINE_STENCIL_BACK:
20282024
RB_RenderMeshGLSL_StencilOutline_0(pass, features );
20292025
break;
2030-
case GLSL_PROGRAM_TYPE_OUTLINE_1:
2026+
case GLSL_PROGRAM_TYPE_OUTLINE_STENCIL_FRONT:
20312027
RB_RenderMeshGLSL_StencilOutline_1(pass, features );
20322028
break;
2033-
case GLSL_PROGRAM_TYPE_OUTLINE_2:
2029+
case GLSL_PROGRAM_TYPE_OUTLINE_GHOST_FINAL:
20342030
RB_RenderMeshGLSL_StencilOutline_2(pass, features );
20352031
break;
20362032
case GLSL_PROGRAM_TYPE_OUTLINE:
@@ -2543,7 +2539,7 @@ void RB_DrawShadedElements( void )
25432539
if( addGLSLOutline )
25442540
RB_RenderPass( &r_GLSLpasses[BUILTIN_GLSLPASS_OUTLINE] );
25452541

2546-
if(rb.currentEntity->outlineGhost)
2542+
if(rb.currentEntity->outlineGhost && glConfig.stencilBits)
25472543
RB_RenderPass( &r_GLSLpasses[BUILTIN_GLSLPASS_OVERLAY_OUTLINE_2] );
25482544

25492545
// fog

source/ref_gl/r_image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,8 +2426,8 @@ static void R_InitScreenImagePair( const char *name, image_t **color, image_t **
24262426

24272427
assert( !depth || glConfig.ext.depth_texture );
24282428

2429-
//if( !glConfig.stencilBits )
2430-
// stencil = false;
2429+
if( !glConfig.stencilBits )
2430+
stencil = false;
24312431

24322432
flags = IT_SPECIAL;
24332433

source/ref_gl/r_program.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ enum
5454
GLSL_PROGRAM_TYPE_FXAA,
5555
GLSL_PROGRAM_TYPE_YUV,
5656
GLSL_PROGRAM_TYPE_COLORCORRECTION,
57-
GLSL_PROGRAM_TYPE_OUTLINE_0,
58-
GLSL_PROGRAM_TYPE_OUTLINE_1,
59-
GLSL_PROGRAM_TYPE_OUTLINE_2,
57+
GLSL_PROGRAM_TYPE_OUTLINE_STENCIL_BACK,
58+
GLSL_PROGRAM_TYPE_OUTLINE_STENCIL_FRONT,
59+
GLSL_PROGRAM_TYPE_OUTLINE_GHOST_FINAL,
6060

6161
GLSL_PROGRAM_TYPE_MAXTYPE
6262
};

source/ref_gl/r_scene.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ void R_AddEntityToScene( const entity_t *ent )
118118
tent.renderfx |= RF_OUTLINE_STENCIL_0;
119119
R_AddEntityToScene( &tent );
120120
}
121+
if(glConfig.stencilBits)
121122
{
122123
entity_t tent = *ent;
123124
tent.renderfx |= RF_OUTLINE_STENCIL_1;

source/ref_gl/r_skm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,11 +1471,11 @@ bool R_AddSkeletalModelToDrawList( const entity_t *e )
14711471
}
14721472

14731473
if( shader ) {
1474-
int order = 0;
1475-
if( shader->sort == SHADER_SORT_OPAQUE ) {
1476-
order = R_PackOpaqueOrder(e, shader, false, false);
1477-
}
1478-
R_AddSurfToDrawList( rn.meshlist, e, fog, shader, distance, order, NULL, skmodel->drawSurfs + i );
1474+
int order = 0;
1475+
if( shader->sort == SHADER_SORT_OPAQUE ) {
1476+
order = R_PackOpaqueOrder( e, shader, false, false );
1477+
}
1478+
R_AddSurfToDrawList( rn.meshlist, e, fog, shader, distance, order, NULL, skmodel->drawSurfs + i );
14791479
}
14801480
}
14811481

0 commit comments

Comments
 (0)