Skip to content

Commit 9288399

Browse files
committed
renderer: disable FXAA when MSAA is enabled (prefer MSAA)
1 parent 7f59950 commit 9288399

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/engine/renderer/GLUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct GLConfig
156156
bool reflectionMappingAvailable;
157157
bool reflectionMapping;
158158
bool bloom;
159+
bool FXAA; // automatically disabled when MSAA is not null
159160
int MSAA; // 0 == disabled, otherwise used as sample count
160161
bool ssao;
161162
bool motionBlur;

src/engine/renderer/gl_shader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ static std::string GenEngineConstants() {
802802
AddDefine( str, "r_showLuma", 1 );
803803
}
804804

805-
if ( r_FXAA.Get() )
805+
if ( glConfig.FXAA )
806806
{
807807
AddDefine( str, "r_FXAA", 1 );
808808

src/engine/renderer/tr_backend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ void RB_RenderSSAO()
16031603

16041604
void RB_FXAA()
16051605
{
1606-
if ( !r_FXAA.Get() || !gl_fxaaShader || !glConfig.samplerObjectsAvailable )
1606+
if ( !glConfig.FXAA || !gl_fxaaShader )
16071607
{
16081608
return;
16091609
}
@@ -1728,7 +1728,7 @@ void RB_CameraPostFX() {
17281728
GL_BindToTMU( 0, tr.currentRenderImage[backEnd.currentMainFBO] )
17291729
);
17301730

1731-
if ( r_FXAA.Get() && gl_fxaaShader && glConfig.samplerObjectsAvailable )
1731+
if ( r_FXAA.Get() && gl_fxaaShader )
17321732
{
17331733
// Swap main FBOs.
17341734
backEnd.currentMainFBO = 1 - backEnd.currentMainFBO;

src/engine/renderer/tr_shade.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ static void EnableAvailableFeatures()
192192
Log::Warn( "MSAA unavailable because GL version is lower than required (%i.%i < %i.%i)", glConfig.glMajor, glConfig.glMinor, 3, 2 );
193193
}
194194

195+
glConfig.FXAA = r_FXAA.Get();
196+
197+
if ( glConfig.FXAA && glConfig.MSAA )
198+
{
199+
Log::Notice( "FXAA disabled because MSAA is enabled." );
200+
glConfig.FXAA = false;
201+
}
202+
203+
if ( glConfig.FXAA && !glConfig.samplerObjectsAvailable )
204+
{
205+
Log::Warn( "FXAA disabled because ARB_sampler_objects is not available." );
206+
glConfig.FXAA = false;
207+
}
208+
195209
glConfig.usingMaterialSystem = r_materialSystem.Get() && glConfig.materialSystemAvailable;
196210
glConfig.usingBindlessTextures = glConfig.usingMaterialSystem ||
197211
( r_preferBindlessTextures.Get() && glConfig.bindlessTexturesAvailable );
@@ -371,7 +385,7 @@ static void GLSL_InitGPUShadersOrError()
371385
gl_ssaoShader->MarkProgramForBuilding();
372386
}
373387

374-
if ( r_FXAA.Get() )
388+
if ( glConfig.FXAA )
375389
{
376390
gl_shaderManager.LoadShader( gl_fxaaShader );
377391

0 commit comments

Comments
 (0)