Skip to content

Commit 004318a

Browse files
committed
renderer: disable FXAA when MSAA is enabled (prefer MSAA)
1 parent f5707bf commit 004318a

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/engine/renderer/GLUtils.h

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

src/engine/renderer/gl_shader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static std::string GenEngineConstants() {
800800
AddDefine( str, "r_showLuminance", 1 );
801801
}
802802

803-
if ( r_FXAA.Get() )
803+
if ( glConfig.FXAA )
804804
{
805805
AddDefine( str, "r_FXAA", 1 );
806806

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 )
1606+
if ( !glConfig.FXAA || !gl_fxaaShader )
16071607
{
16081608
return;
16091609
}
@@ -1753,7 +1753,7 @@ void RB_CameraPostFX() {
17531753
GL_BindToTMU( 0, tr.currentRenderImage[backEnd.currentMainFBO] )
17541754
);
17551755

1756-
if ( r_FXAA.Get() && gl_fxaaShader )
1756+
if ( glConfig.FXAA && gl_fxaaShader )
17571757
{
17581758
// Swap main FBOs.
17591759
backEnd.currentMainFBO = 1 - backEnd.currentMainFBO;

src/engine/renderer/tr_shade.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ 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+
195203
glConfig.usingMaterialSystem = r_materialSystem.Get() && glConfig.materialSystemAvailable;
196204
glConfig.usingBindlessTextures = glConfig.usingMaterialSystem ||
197205
( r_preferBindlessTextures.Get() && glConfig.bindlessTexturesAvailable );

0 commit comments

Comments
 (0)