Skip to content

Commit d7013c8

Browse files
committed
renderer: add r_showFXAA
1 parent d0dd4e0 commit d7013c8

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/engine/renderer/gl_shader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,11 @@ static std::string GenEngineConstants() {
803803
if ( r_FXAA.Get() )
804804
{
805805
AddDefine( str, "r_FXAA", 1 );
806+
807+
if ( r_showFXAA.Get() )
808+
{
809+
AddDefine( str, "r_showFXAA", 1 );
810+
}
806811
}
807812

808813
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_showLuminance( "r_showLuminance", "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_showLuminance );
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
@@ -2783,6 +2783,7 @@ enum
27832783
extern Cvar::Cvar<bool> r_showLuminance;
27842784

27852785
extern Cvar::Cvar<bool> r_FXAA;
2786+
extern Cvar::Cvar<bool> r_showFXAA;
27862787

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

0 commit comments

Comments
 (0)