@@ -31,7 +31,8 @@ int r_framecount; // used for dlight push checking
3131mplane_t frustum [4 ];
3232
3333qboolean render_warp ;
34- int render_scale ;
34+ int render_scale = 1 ; // used ( > 1 ) when r_simplescale = 0, done in screen effects from a full res main view
35+ int simple_scale = 1 ; // used ( > 1 ) when r_simplescale = 1, done adjusting the viewport size and upsacaling after screen effects
3536
3637// johnfitz -- rendering statistics
3738atomic_uint32_t rs_brushpolys , rs_aliaspolys , rs_skypolys , rs_particles , rs_fogpolys ;
@@ -109,6 +110,7 @@ float map_fallbackalpha;
109110qboolean r_drawworld_cheatsafe , r_fullbright_cheatsafe , r_lightmap_cheatsafe ; // johnfitz
110111
111112cvar_t r_scale = {"r_scale" , "1" , CVAR_ARCHIVE };
113+ cvar_t r_simplescale = {"r_simplescale" , "1" , CVAR_ARCHIVE };
112114
113115cvar_t r_gpulightmapupdate = {"r_gpulightmapupdate" , "1" , CVAR_NONE };
114116cvar_t r_rtshadows = {"r_rtshadows" , "1" , CVAR_ARCHIVE };
@@ -352,7 +354,8 @@ R_SetupContext
352354*/
353355static void R_SetupContext (cb_context_t * cbx )
354356{
355- GL_Viewport (cbx , r_refdef .vrect .x , glheight - r_refdef .vrect .y - r_refdef .vrect .height , r_refdef .vrect .width , r_refdef .vrect .height , 0.0f , 1.0f );
357+ GL_Viewport_Scale (
358+ cbx , r_refdef .vrect .x , glheight - r_refdef .vrect .y - r_refdef .vrect .height , r_refdef .vrect .width , r_refdef .vrect .height , 0.0f , 1.0f , simple_scale );
356359 R_BindPipeline (cbx , VK_PIPELINE_BIND_POINT_GRAPHICS , vulkan_globals .basic_blend_pipeline [cbx -> render_pass_index ]);
357360 R_PushConstants (cbx , VK_SHADER_STAGE_ALL_GRAPHICS , 0 , 16 * sizeof (float ), vulkan_globals .view_projection_matrix );
358361}
@@ -384,7 +387,6 @@ static void R_SetupViewBeforeMark (void *unused)
384387 r_fovx = r_refdef .fov_x ;
385388 r_fovy = r_refdef .fov_y ;
386389 render_warp = false;
387- render_scale = (int )r_scale .value ;
388390
389391 if (r_waterwarp .value )
390392 {
@@ -554,14 +556,16 @@ void R_DrawViewModel (cb_context_t *cbx)
554556 R_BeginDebugUtilsLabel (cbx , "View Model" );
555557
556558 // hack the depth range to prevent view model from poking into walls
557- GL_Viewport (cbx , r_refdef .vrect .x , glheight - r_refdef .vrect .y - r_refdef .vrect .height , r_refdef .vrect .width , r_refdef .vrect .height , 0.7f , 1.0f );
559+ GL_Viewport_Scale (
560+ cbx , r_refdef .vrect .x , glheight - r_refdef .vrect .y - r_refdef .vrect .height , r_refdef .vrect .width , r_refdef .vrect .height , 0.7f , 1.0f , simple_scale );
558561
559562 int aliaspolys = 0 ;
560563 R_DrawAliasModel (cbx , currententity , & aliaspolys );
561564 Atomic_AddUInt32 (& rs_aliaspolys , aliaspolys );
562565 Atomic_IncrementUInt32 (& rs_aliaspasses );
563566
564- GL_Viewport (cbx , r_refdef .vrect .x , glheight - r_refdef .vrect .y - r_refdef .vrect .height , r_refdef .vrect .width , r_refdef .vrect .height , 0.0f , 1.0f );
567+ GL_Viewport_Scale (
568+ cbx , r_refdef .vrect .x , glheight - r_refdef .vrect .y - r_refdef .vrect .height , r_refdef .vrect .width , r_refdef .vrect .height , 0.0f , 1.0f , simple_scale );
565569
566570 R_EndDebugUtilsLabel (cbx );
567571}
0 commit comments