Skip to content

Commit c519f51

Browse files
committed
renderer: add r_showFXAA
1 parent 97329aa commit c519f51

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/engine/renderer/gl_shader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,11 @@ static std::string GenEngineConstants() {
805805
if ( r_FXAA.Get() )
806806
{
807807
AddDefine( str, "r_FXAA", 1 );
808+
809+
if ( r_showFXAA.Get() )
810+
{
811+
AddDefine( str, "r_showFXAA", 1 );
812+
}
808813
}
809814

810815
if ( r_highPrecisionRendering.Get() ) {

src/engine/renderer/glsl_source/fxaa_fp.glsl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,18 @@ void main()
7575
vec4(0.0) //not used
7676
);
7777

78+
#if defined(r_showFXAA)
79+
{
80+
vec4 originalColor = FxaaTexTop( u_ColorMap, gl_FragCoord.xy / r_FBufSize );
81+
82+
if ( color.r != originalColor.r
83+
|| color.g != originalColor.g
84+
|| color.b != originalColor.b )
85+
{
86+
color.rgb = vec3(1.0, 0.0, 0.0);
87+
}
88+
}
89+
#endif
90+
7891
outputColor = vec4( color.rgb, 1.0f );
7992
}

src/engine/renderer/tr_init.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ Cvar::Cvar<int> r_rendererAPI( "r_rendererAPI", "Renderer API: 0: OpenGL, 1: Vul
289289
Cvar::Cvar<bool> r_showLuma( "r_showLuma", "Show luminance", Cvar::CHEAT, false );
290290

291291
Cvar::Cvar<bool> r_FXAA( "r_FXAA", "Fast approximate anti-aliasing", Cvar::NONE, false );
292+
Cvar::Cvar<bool> r_showFXAA( "r_showFXAA", "Show pixels modified by FXAA", Cvar::CHEAT, false );
292293

293294
Cvar::Range<Cvar::Cvar<int>> r_msaa( "r_msaa", "Amount of MSAA samples. 0 to disable", Cvar::NONE, 0, 0, 64 );
294295

@@ -1215,6 +1216,7 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
12151216
Cvar::Latch( r_showLuma );
12161217

12171218
Cvar::Latch( r_FXAA );
1219+
Cvar::Latch( r_showFXAA );
12181220

12191221
Cvar::Latch( r_msaa );
12201222

src/engine/renderer/tr_local.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,6 +2784,7 @@ enum
27842784
extern Cvar::Cvar<bool> r_showLuma;
27852785

27862786
extern Cvar::Cvar<bool> r_FXAA;
2787+
extern Cvar::Cvar<bool> r_showFXAA;
27872788

27882789
extern Cvar::Range<Cvar::Cvar<int>> r_msaa;
27892790

0 commit comments

Comments
 (0)