From 5b05e7a95d0cb7dc502eb59034b2297bce3eb51d Mon Sep 17 00:00:00 2001 From: myT <> Date: Thu, 31 Oct 2024 03:14:56 +0100 Subject: [PATCH] made r_mode 1 behave like 0 when using the CRP --- changelog.txt | 1 + code/renderer/srp_main.cpp | 2 +- code/renderer/tr_gui.cpp | 2 +- code/renderer/tr_init.cpp | 28 +++++++++++++++------------- code/renderer/tr_local.h | 6 +++++- code/renderer/tr_shader.cpp | 2 +- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/changelog.txt b/changelog.txt index 40c7204..aa3820b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -152,6 +152,7 @@ chg: reworked renderer with 2 new rendering pipelines - shadowed point lights and sunlight - volumetric lighting: fog and NanoVDB animations lit by ambient light, point lights and sunlight - all corresponding CVars have the "crp_" prefix + - the CRP doesn't currently support software video scaling: r_mode 1 will behave like r_mode 0 chg: removed cl_drawMouseLag, r_backend, r_frameSleep, r_gpuMipGen, r_alphaToCoverage, r_alphaToCoverageMipBoost removed r_d3d11_syncOffsets, r_d3d11_presentMode, r_gl3_geoStream, r_ignoreGLErrors, r_finish, r_khr_debug diff --git a/code/renderer/srp_main.cpp b/code/renderer/srp_main.cpp index 1d69d47..f4a0aac 100644 --- a/code/renderer/srp_main.cpp +++ b/code/renderer/srp_main.cpp @@ -224,7 +224,7 @@ uint32_t AlphaTestShaderConstFromStateBits(unsigned int stateBits) void R_SelectRenderPipeline() { - if(r_pipeline->integer == 0) + if(r_pipeline->integer == PIPELINE_GAMEPLAY) { renderPipeline = grpp; FS_EnableCNQ3Folder(qfalse); diff --git a/code/renderer/tr_gui.cpp b/code/renderer/tr_gui.cpp index 914e225..5a09247 100644 --- a/code/renderer/tr_gui.cpp +++ b/code/renderer/tr_gui.cpp @@ -1926,7 +1926,7 @@ void RE_DrawMainMenuBarInfo() frameCount = 0; } - const char* const pipeline = r_pipeline->integer == 1 ? "CRP" : "GRP"; + const char* const pipeline = r_pipeline->integer == PIPELINE_CINEMATIC ? "CRP" : "GRP"; const char* const info = va( "%s | %s | %s | %3d FPS", pipeline, rhiInfo.adapter, Com_FormatBytes(rhiInfo.allocatedByteCount), displayedFPS); diff --git a/code/renderer/tr_init.cpp b/code/renderer/tr_init.cpp index b7f745f..0f88b2f 100644 --- a/code/renderer/tr_init.cpp +++ b/code/renderer/tr_init.cpp @@ -131,31 +131,33 @@ int max_polyverts; void R_ConfigureVideoMode( int desktopWidth, int desktopHeight ) { glInfo.winFullscreen = !!r_fullscreen->integer; - glInfo.vidFullscreen = r_fullscreen->integer && r_mode->integer == VIDEOMODE_CHANGE; + glInfo.vidFullscreen = !!r_fullscreen->integer && r_mode->integer == VIDEOMODE_CHANGE; - if (r_fullscreen->integer && r_mode->integer == VIDEOMODE_DESKTOPRES) { + // the CRP doesn't support VIDEOMODE_UPSCALE, so we force VIDEOMODE_DESKTOPRES instead + const qbool fullScreen = r_fullscreen->integer != 0; + const qbool crp = r_pipeline->integer == PIPELINE_CINEMATIC; + const qbool desktopResMode = r_mode->integer == VIDEOMODE_DESKTOPRES; + const qbool upscaleMode = r_mode->integer == VIDEOMODE_UPSCALE; + + if (fullScreen && (desktopResMode || (upscaleMode && crp))) { glConfig.vidWidth = desktopWidth; glConfig.vidHeight = desktopHeight; glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight; glInfo.winWidth = desktopWidth; glInfo.winHeight = desktopHeight; - return; - } - - if (r_fullscreen->integer && r_mode->integer == VIDEOMODE_UPSCALE) { + } else if (fullScreen && upscaleMode) { glConfig.vidWidth = r_width->integer; glConfig.vidHeight = r_height->integer; glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight; glInfo.winWidth = desktopWidth; glInfo.winHeight = desktopHeight; - return; + } else { + glConfig.vidWidth = r_width->integer; + glConfig.vidHeight = r_height->integer; + glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight; + glInfo.winWidth = r_width->integer; + glInfo.winHeight = r_height->integer; } - - glConfig.vidWidth = r_width->integer; - glConfig.vidHeight = r_height->integer; - glConfig.windowAspect = (float)glConfig.vidWidth / (float)glConfig.vidHeight; - glInfo.winWidth = r_width->integer; - glInfo.winHeight = r_height->integer; } diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index 77de7f7..90a0889 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -1050,7 +1050,7 @@ extern trGlobals_t tr; // -// cvars +// CVars // // r_mode @@ -1078,6 +1078,10 @@ extern trGlobals_t tr; #define GPUPREF_NONE 2 #define GPUPREF_MAX 2 +// r_pipeline +#define PIPELINE_GAMEPLAY 0 +#define PIPELINE_CINEMATIC 1 + extern cvar_t *r_lodbias; // push/pull LOD transitions extern cvar_t *r_lodscale; diff --git a/code/renderer/tr_shader.cpp b/code/renderer/tr_shader.cpp index e1dca70..6578e76 100644 --- a/code/renderer/tr_shader.cpp +++ b/code/renderer/tr_shader.cpp @@ -2418,7 +2418,7 @@ static shader_t* FinishShader( shader_t* sh = NULL ) } // it's fine if there's polygonoffset, the effect on the depth buffer is acceptable - if ( r_pipeline->integer == 1 ) { + if ( r_pipeline->integer == PIPELINE_CINEMATIC ) { const int blendBits = stages[0].stateBits & GLS_BLEND_BITS; if ( blendBits == 0 || blendBits == (GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO) ) { shader.sort = SS_OPAQUE;