Skip to content

Commit

Permalink
Add r_materialSystemSkip
Browse files Browse the repository at this point in the history
This makes debugging issues that are present on material system but no core renderer much faster, since it can be changed without any sort of restart.
  • Loading branch information
VReaperV committed Jan 11, 2025
1 parent f88b91a commit 3135902
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,10 @@ void MaterialSystem::RenderMaterials( const shaderSort_t fromSort, const shaderS
return;
}

if ( r_materialSystemSkip.Get() ) {
return;
}

if ( frameStart ) {
renderedMaterials.clear();
UpdateDynamicSurfaces();
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4764,7 +4764,7 @@ This is done so various debugging facilities will work properly
*/
static void RB_RenderPostProcess()
{
if ( glConfig2.usingMaterialSystem ) {
if ( glConfig2.usingMaterialSystem && !r_materialSystemSkip.Get() ) {
// Dispatch the cull compute shaders for queued once we're done with post-processing
// We'll only use the results from those shaders in the next frame so we don't block the pipeline
materialSystem.CullSurfaces();
Expand Down
1 change: 1 addition & 0 deletions src/engine/renderer/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Cvar::Cvar<bool> r_materialSystem( "r_materialSystem", "Use Material System", Cvar::NONE, false );
Cvar::Cvar<bool> r_gpuFrustumCulling( "r_gpuFrustumCulling", "Use frustum culling on the GPU for the Material System", Cvar::NONE, true );
Cvar::Cvar<bool> r_gpuOcclusionCulling( "r_gpuOcclusionCulling", "Use occlusion culling on the GPU for the Material System", Cvar::NONE, false );
Cvar::Cvar<bool> r_materialSystemSkip( "r_materialSystemSkip", "Temporarily skip Material System rendering, using only core renderer instead", Cvar::NONE, false );
cvar_t *r_lightStyles;
cvar_t *r_exportTextures;
cvar_t *r_heatHaze;
Expand Down
1 change: 1 addition & 0 deletions src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2907,6 +2907,7 @@ enum class shaderProfilerRenderSubGroupsMode {
extern Cvar::Cvar<bool> r_materialSystem;
extern Cvar::Cvar<bool> r_gpuFrustumCulling;
extern Cvar::Cvar<bool> r_gpuOcclusionCulling;
extern Cvar::Cvar<bool> r_materialSystemSkip;
extern cvar_t *r_lightStyles;
extern cvar_t *r_exportTextures;
extern cvar_t *r_heatHaze;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/renderer/tr_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ static void R_SortDrawSurfs()
// check for any pass through drawing, which
// may cause another view to be rendered first
// Material system does its own handling of portal surfaces
if ( glConfig2.usingMaterialSystem ) {
if ( glConfig2.usingMaterialSystem && !r_materialSystemSkip.Get() ) {
if ( tr.viewParms.portalLevel == 0 ) {
materialSystem.AddPortalSurfaces();
currentView = 0;
Expand Down Expand Up @@ -2524,7 +2524,7 @@ void R_RenderView( viewParms_t *parms )

R_SetupFrustum();

if ( glConfig2.usingMaterialSystem ) {
if ( glConfig2.usingMaterialSystem && !r_materialSystemSkip.Get() ) {
tr.viewParms.viewID = tr.viewCount;
materialSystem.QueueSurfaceCull( tr.viewCount, tr.viewParms.pvsOrigin, (frustum_t*) tr.viewParms.frustums[0] );
materialSystem.AddAutospriteSurfaces();
Expand Down

0 comments on commit 3135902

Please sign in to comment.