-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathfxaa_fp.glsl
More file actions
97 lines (82 loc) · 2.92 KB
/
fxaa_fp.glsl
File metadata and controls
97 lines (82 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
===========================================================================
Daemon BSD Source Code
Copyright (c) 2013 Daemon Developers
All rights reserved.
This file is part of the Daemon BSD Source Code (Daemon Source Code).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Daemon developers nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
===========================================================================
*/
/* fxaa_fp.glsl */
// Control knobs.
#if __VERSION__ == 120
#define FXAA_GLSL_120 1
#else
#define FXAA_GLSL_130 1
#endif
#define FXAA_PC 1
#define FXAA_QUALITY_PRESET 12
#define FXAA_GREEN_AS_LUMA 0
#insert fxaa3_11_fp
#if defined(HAVE_ARB_bindless_texture)
uniform sampler2D u_ColorMap_linear;
#define u_ColorMap u_ColorMap_linear
#else
uniform sampler2D u_ColorMap;
#endif
#if __VERSION__ > 120
out vec4 outputColor;
#else
#define outputColor gl_FragColor
#endif
void main()
{
vec4 color = FxaaPixelShader(
gl_FragCoord.xy / r_FBufSize, //pos
vec4(0.0), //not used
u_ColorMap, //tex
u_ColorMap, //not used
u_ColorMap, //not used
1 / r_FBufSize, //fxaaQualityRcpFrame
vec4(0.0), //not used
vec4(0.0), //not used
vec4(0.0), //not used
r_FXAASubPix, //fxaaQualitySubpix
r_FXAAEdgeThreshold, //fxaaQualityEdgeThreshold
r_FXAAEdgeThresholdMin, //fxaaQualityEdgeThresholdMin
0.0, //not used
0.0, //not used
0.0, //not used
vec4(0.0) //not used
);
#if defined(r_showFXAA)
{
vec4 originalColor = FxaaTexTop( u_ColorMap, gl_FragCoord.xy / r_FBufSize );
if ( color.r != originalColor.r
|| color.g != originalColor.g
|| color.b != originalColor.b )
{
color.rgb = vec3(1.0, 0.0, 0.0);
}
}
#endif
outputColor = vec4( color.rgb, 1.0f );
}