BotW AA and XenobladeX AA, Removed the need for Shader4 Extension and More (#319)

* Update and rename Enhancements/BreathOfTheWild_!AntiAliasing/0f2b9ee517917425_00000000000003c9_ps.txt to Enhancements/BreathOfTheWild_AntiAliasing/0f2b9ee517917425_00000000000003c9_ps.txt

Removed the need for the extra shader4 extension and other fixups

* Update and rename Enhancements/BreathOfTheWild_!AntiAliasing/f14bb57cd5c9cb77_00000000000003c9_ps.txt to Enhancements/BreathOfTheWild_AntiAliasing/f14bb57cd5c9cb77_00000000000003c9_ps.txt

Removed the need for the extra shader4 extension and other fixups

* Update 59df1c7e1806366c_00000000000003c9_ps.txt

Improved Native AA and Removed the need for the extra shader4 extension and other fixups

* Update rules.txt

Setup Nvidia FXAA as Default as is the best looking.

* Update rules.txt

Setup Nvidia FXAA as the Default Preset as it's the best looking.

* Rename Enhancements/BreathOfTheWild_!AntiAliasing/rules.txt to Enhancements/BreathOfTheWild_AntiAliasing/rules.txt
This commit is contained in:
Skal Fate 2019-01-06 15:46:59 -07:00 committed by GitHub
parent dd38247ef6
commit 33c0a88ef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 568 additions and 571 deletions

View File

@ -1,6 +1,5 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
#extension GL_EXT_gpu_shader4 : enable
// shader 0f2b9ee517917425 - dumped 1.15 // shader 0f2b9ee517917425 - dumped 1.15
// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation to link in inventory screen // Used for: Removing/Restoring the native BotW Anti-Aliasing implementation to link in inventory screen
@ -28,9 +27,9 @@ layout(location = 0) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale; uniform vec2 uf_fragCoordScale;
ivec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float ivec2 resDim = textureSize(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float
float iresX = ( (float(resDim.x)/1280.0) + iSharper ) - iBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper float iresX = ( (float(resDim.x)/float(1280)) + iSharper ) - iBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper
float iresY = ( (float(resDim.y)/720.0) + iSharper ) - iBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier float iresY = ( (float(resDim.y)/float(720)) + iSharper ) - iBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier
int clampFI32(int v) int clampFI32(int v)
{ {
@ -676,13 +675,13 @@ passPixelColor0 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFl
#endif #endif
#if (preset == 2) // FXAA #if (preset == 2) // FXAA
/*-----------------------------settings-------------------------------------*/ //-----------------------------settings-------------------------------------//
#define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. #define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal.
#define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. #define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm.
#define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. #define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks.
/*--------------------------------------------------------------------------*/ //--------------------------------------------------------------------------//
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37f40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37f40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1
@ -690,21 +689,19 @@ layout(location = 0) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale; uniform vec2 uf_fragCoordScale;
ivec2 resolution = textureSize2D(textureUnitPS0,0); #define FXAA_QUALITY_PS 12
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_P1 1.0
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P2 1.0
#define FXAA_QUALITY__P1 1.0 #define FXAA_QUALITY_P3 1.0
#define FXAA_QUALITY__P2 1.0 #define FXAA_QUALITY_P4 1.0
#define FXAA_QUALITY__P3 1.0 #define FXAA_QUALITY_P5 1.5
#define FXAA_QUALITY__P4 1.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P5 1.5 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_P11 8.0
#define FXAA_QUALITY__P10 4.0
#define FXAA_QUALITY__P11 8.0
#define FxaaBool bool #define FxaaBool bool
#define FxaaDiscard discard #define FxaaDiscard discard
@ -809,11 +806,11 @@ FxaaFloat4 FxaaPixelShader(
if(!horzSpan) posB.x += lengthSign * 0.5; if(!horzSpan) posB.x += lengthSign * 0.5;
if( horzSpan) posB.y += lengthSign * 0.5; if( horzSpan) posB.y += lengthSign * 0.5;
FxaaFloat2 posN; FxaaFloat2 posN;
posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
FxaaFloat2 posP; FxaaFloat2 posP;
posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaTexTop(lum, posN).x; FxaaFloat lumaEndN = FxaaTexTop(lum, posN).x;
FxaaFloat subpixE = subpixC * subpixC; FxaaFloat subpixE = subpixC * subpixC;
@ -827,11 +824,11 @@ FxaaFloat4 FxaaPixelShader(
lumaEndP -= lumaNN * 0.5; lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled; FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled; FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
FxaaBool doneNP = (!doneN) || (!doneP); FxaaBool doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -839,12 +836,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
#if (FXAA_QUALITY__PS > 3) #if (FXAA_QUALITY_PS > 3)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -852,12 +849,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
#if (FXAA_QUALITY__PS > 4) #if (FXAA_QUALITY_PS > 4)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -865,12 +862,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
#if (FXAA_QUALITY__PS > 5) #if (FXAA_QUALITY_PS > 5)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -878,12 +875,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
#if (FXAA_QUALITY__PS > 6) #if (FXAA_QUALITY_PS > 6)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -891,12 +888,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
#if (FXAA_QUALITY__PS > 7) #if (FXAA_QUALITY_PS > 7)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -904,12 +901,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
#if (FXAA_QUALITY__PS > 8) #if (FXAA_QUALITY_PS > 8)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -917,12 +914,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
#if (FXAA_QUALITY__PS > 9) #if (FXAA_QUALITY_PS > 9)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -930,12 +927,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
#if (FXAA_QUALITY__PS > 10) #if (FXAA_QUALITY_PS > 10)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -943,12 +940,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
#if (FXAA_QUALITY__PS > 11) #if (FXAA_QUALITY_PS > 11)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -956,12 +953,12 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
#if (FXAA_QUALITY__PS > 12) #if (FXAA_QUALITY_PS > 12)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x; if(!doneN) lumaEndN = FxaaTexTop(lum, posN.xy).x;
if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x; if(!doneP) lumaEndP = FxaaTexTop(lum, posP.xy).x;
@ -969,11 +966,11 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
} }
#endif #endif
} }
@ -1016,7 +1013,7 @@ FxaaFloat4 FxaaPixelShader(
return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM); return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
} }
ivec2 resolution = textureSize(textureUnitPS0,0);
vec2 RcpFrame = vec2(1.0 / float(resolution.x), 1.0 / float(resolution.y)); vec2 RcpFrame = vec2(1.0 / float(resolution.x), 1.0 / float(resolution.y));
void main() void main()
{ {

View File

@ -1,6 +1,5 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
#extension GL_EXT_gpu_shader4 : enable
// shader f14bb57cd5c9cb77 - dumped 1.15 // shader f14bb57cd5c9cb77 - dumped 1.15
// Used for: Removing/Restoring the native BotW World Anti-Aliasing Implementation // Used for: Removing/Restoring the native BotW World Anti-Aliasing Implementation
@ -27,9 +26,9 @@ layout(location = 0) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale; uniform vec2 uf_fragCoordScale;
ivec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float ivec2 resDim = textureSize(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float
float wresX = ( (float(resDim.x)/1280.0) + wSharper ) - wBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper float wresX = ( (float(resDim.x)/float(1280)) + wSharper ) - wBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper
float wresY = ( (float(resDim.y)/720.0) + wSharper ) - wBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier float wresY = ( (float(resDim.y)/float(720)) + wSharper ) - wBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier
int clampFI32(int v) int clampFI32(int v)
{ {
@ -173,17 +172,17 @@ passPixelColor0 = vec4(R2f.x, R2f.y, R2f.z, R2f.w);
#endif #endif
#if (preset == 2) // FXAA #if (preset == 2) // FXAA
/*-----------------------------settings-------------------------------------*/ //-----------------------------settings-------------------------------------//
#define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. #define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal.
#define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. #define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm.
#define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. #define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks.
/*--------------------------------------------------------------------------*/ //--------------------------------------------------------------------------//
#define FXAA_PC 1 #define FXAA_PC 1
#define FXAA_GLSL_130 1 #define FXAA_GLSL_130 1
#define FXAA_QUALITY__PRESET 14 #define FXAA_QUALITY_PRESET 14
#define FXAA_GREEN_AS_LUMA 1 #define FXAA_GREEN_AS_LUMA 1
#define FXAA_DISCARD 0 #define FXAA_DISCARD 0
@ -295,7 +294,7 @@ passPixelColor0 = vec4(R2f.x, R2f.y, R2f.z, R2f.w);
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
NOTE the other tuning knobs are now in the shader function inputs! NOTE the other tuning knobs are now in the shader function inputs!
============================================================================*/ ============================================================================*/
#ifndef FXAA_QUALITY__PRESET #ifndef FXAA_QUALITY_PRESET
// //
// Choose the quality preset. // Choose the quality preset.
// This needs to be compiled into the shader as it effects code. // This needs to be compiled into the shader as it effects code.
@ -316,7 +315,7 @@ NOTE the other tuning knobs are now in the shader function inputs!
// _ = the lowest digit is directly related to performance // _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style // _ = the highest digit is directly related to style
// //
#define FXAA_QUALITY__PRESET 12 #define FXAA_QUALITY_PRESET 12
#endif #endif
@ -329,198 +328,198 @@ NOTE the other tuning knobs are now in the shader function inputs!
/*============================================================================ /*============================================================================
FXAA QUALITY - MEDIUM DITHER PRESETS FXAA QUALITY - MEDIUM DITHER PRESETS
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 10) #if (FXAA_QUALITY_PRESET == 10)
#define FXAA_QUALITY__PS 3 #define FXAA_QUALITY_PS 3
#define FXAA_QUALITY__P0 1.5 #define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY__P1 3.0 #define FXAA_QUALITY_P1 3.0
#define FXAA_QUALITY__P2 12.0 #define FXAA_QUALITY_P2 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 11) #if (FXAA_QUALITY_PRESET == 11)
#define FXAA_QUALITY__PS 4 #define FXAA_QUALITY_PS 4
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 3.0 #define FXAA_QUALITY_P2 3.0
#define FXAA_QUALITY__P3 12.0 #define FXAA_QUALITY_P3 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 12) #if (FXAA_QUALITY_PRESET == 12)
#define FXAA_QUALITY__PS 5 #define FXAA_QUALITY_PS 5
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 4.0 #define FXAA_QUALITY_P3 4.0
#define FXAA_QUALITY__P4 12.0 #define FXAA_QUALITY_P4 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 13) #if (FXAA_QUALITY_PRESET == 13)
#define FXAA_QUALITY__PS 6 #define FXAA_QUALITY_PS 6
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 4.0 #define FXAA_QUALITY_P4 4.0
#define FXAA_QUALITY__P5 12.0 #define FXAA_QUALITY_P5 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 14) #if (FXAA_QUALITY_PRESET == 14)
#define FXAA_QUALITY__PS 7 #define FXAA_QUALITY_PS 7
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 4.0 #define FXAA_QUALITY_P5 4.0
#define FXAA_QUALITY__P6 12.0 #define FXAA_QUALITY_P6 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 15) #if (FXAA_QUALITY_PRESET == 15)
#define FXAA_QUALITY__PS 8 #define FXAA_QUALITY_PS 8
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 4.0 #define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY__P7 12.0 #define FXAA_QUALITY_P7 12.0
#endif #endif
/*============================================================================ /*============================================================================
FXAA QUALITY - LOW DITHER PRESETS FXAA QUALITY - LOW DITHER PRESETS
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 20) #if (FXAA_QUALITY_PRESET == 20)
#define FXAA_QUALITY__PS 3 #define FXAA_QUALITY_PS 3
#define FXAA_QUALITY__P0 1.5 #define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY__P1 2.0 #define FXAA_QUALITY_P1 2.0
#define FXAA_QUALITY__P2 8.0 #define FXAA_QUALITY_P2 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 21) #if (FXAA_QUALITY_PRESET == 21)
#define FXAA_QUALITY__PS 4 #define FXAA_QUALITY_PS 4
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 8.0 #define FXAA_QUALITY_P3 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 22) #if (FXAA_QUALITY_PRESET == 22)
#define FXAA_QUALITY__PS 5 #define FXAA_QUALITY_PS 5
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 8.0 #define FXAA_QUALITY_P4 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 23) #if (FXAA_QUALITY_PRESET == 23)
#define FXAA_QUALITY__PS 6 #define FXAA_QUALITY_PS 6
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 8.0 #define FXAA_QUALITY_P5 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 24) #if (FXAA_QUALITY_PRESET == 24)
#define FXAA_QUALITY__PS 7 #define FXAA_QUALITY_PS 7
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 3.0 #define FXAA_QUALITY_P5 3.0
#define FXAA_QUALITY__P6 8.0 #define FXAA_QUALITY_P6 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 25) #if (FXAA_QUALITY_PRESET == 25)
#define FXAA_QUALITY__PS 8 #define FXAA_QUALITY_PS 8
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 4.0 #define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY__P7 8.0 #define FXAA_QUALITY_P7 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 26) #if (FXAA_QUALITY_PRESET == 26)
#define FXAA_QUALITY__PS 9 #define FXAA_QUALITY_PS 9
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 4.0 #define FXAA_QUALITY_P7 4.0
#define FXAA_QUALITY__P8 8.0 #define FXAA_QUALITY_P8 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 27) #if (FXAA_QUALITY_PRESET == 27)
#define FXAA_QUALITY__PS 10 #define FXAA_QUALITY_PS 10
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 4.0 #define FXAA_QUALITY_P8 4.0
#define FXAA_QUALITY__P9 8.0 #define FXAA_QUALITY_P9 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 28) #if (FXAA_QUALITY_PRESET == 28)
#define FXAA_QUALITY__PS 11 #define FXAA_QUALITY_PS 11
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P9 4.0 #define FXAA_QUALITY_P9 4.0
#define FXAA_QUALITY__P10 8.0 #define FXAA_QUALITY_P10 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 29) #if (FXAA_QUALITY_PRESET == 29)
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_PS 12
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY__P10 4.0 #define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY__P11 8.0 #define FXAA_QUALITY_P11 8.0
#endif #endif
/*============================================================================ /*============================================================================
FXAA QUALITY - EXTREME QUALITY FXAA QUALITY - EXTREME QUALITY
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 39) #if (FXAA_QUALITY_PRESET == 39)
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_PS 12
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.0 #define FXAA_QUALITY_P1 1.0
#define FXAA_QUALITY__P2 1.0 #define FXAA_QUALITY_P2 1.0
#define FXAA_QUALITY__P3 1.0 #define FXAA_QUALITY_P3 1.0
#define FXAA_QUALITY__P4 1.0 #define FXAA_QUALITY_P4 1.0
#define FXAA_QUALITY__P5 1.5 #define FXAA_QUALITY_P5 1.5
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY__P10 4.0 #define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY__P11 8.0 #define FXAA_QUALITY_P11 8.0
#endif #endif
@ -618,7 +617,7 @@ FxaaFloat4 FxaaPixelShader(
FxaaFloat2 fxaaQualityRcpFrame, FxaaFloat2 fxaaQualityRcpFrame,
// //
// Only used on FXAA Quality. // Only used on FXAA Quality.
// This used to be the FXAA_QUALITY__SUBPIX define. // This used to be the FXAA_QUALITY_SUBPIX define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// Choose the amount of sub-pixel aliasing removal. // Choose the amount of sub-pixel aliasing removal.
// This can effect sharpness. // This can effect sharpness.
@ -630,7 +629,7 @@ FxaaFloat4 FxaaPixelShader(
FxaaFloat fxaaQualitySubpix, FxaaFloat fxaaQualitySubpix,
// //
// Only used on FXAA Quality. // Only used on FXAA Quality.
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// The minimum amount of local contrast required to apply algorithm. // The minimum amount of local contrast required to apply algorithm.
// 0.333 - too little (faster) // 0.333 - too little (faster)
@ -641,7 +640,7 @@ FxaaFloat4 FxaaPixelShader(
FxaaFloat fxaaQualityEdgeThreshold, FxaaFloat fxaaQualityEdgeThreshold,
// //
// Only used on FXAA Quality. // Only used on FXAA Quality.
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// Trims the algorithm from processing darks. // Trims the algorithm from processing darks.
// 0.0833 - upper limit (default, the start of visible unfiltered edges) // 0.0833 - upper limit (default, the start of visible unfiltered edges)
@ -777,11 +776,11 @@ FxaaFloat4 FxaaPixelShader(
if( horzSpan) posB.y += lengthSign * 0.5; if( horzSpan) posB.y += lengthSign * 0.5;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
FxaaFloat2 posN; FxaaFloat2 posN;
posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
FxaaFloat2 posP; FxaaFloat2 posP;
posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
FxaaFloat subpixE = subpixC * subpixC; FxaaFloat subpixE = subpixC * subpixC;
@ -797,11 +796,11 @@ FxaaFloat4 FxaaPixelShader(
lumaEndP -= lumaNN * 0.5; lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled; FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled; FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
FxaaBool doneNP = (!doneN) || (!doneP); FxaaBool doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
@ -810,13 +809,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 3) #if (FXAA_QUALITY_PS > 3)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -824,13 +823,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 4) #if (FXAA_QUALITY_PS > 4)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -838,13 +837,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 5) #if (FXAA_QUALITY_PS > 5)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -852,13 +851,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 6) #if (FXAA_QUALITY_PS > 6)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -866,13 +865,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 7) #if (FXAA_QUALITY_PS > 7)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -880,13 +879,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 8) #if (FXAA_QUALITY_PS > 8)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -894,13 +893,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 9) #if (FXAA_QUALITY_PS > 9)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -908,13 +907,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 10) #if (FXAA_QUALITY_PS > 10)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -922,13 +921,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 11) #if (FXAA_QUALITY_PS > 11)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -936,13 +935,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 12) #if (FXAA_QUALITY_PS > 12)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -950,11 +949,11 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
} }
#endif #endif
@ -1059,8 +1058,7 @@ layout(location = 0) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale; uniform vec2 uf_fragCoordScale;
ivec2 resolution = textureSize2D(textureUnitPS0,0); // Retrieve Texture Dimensions in float data type so we dont need to convert ivec2 resolution = textureSize(textureUnitPS0,0); // Retrieve Texture Dimensions in float data type so we dont need to convert
float wresRatio = float(resolution.x)/1280; // Needed in multiplying
precision highp float; precision highp float;

View File

@ -6,17 +6,17 @@ description = Enables or Disables Native Botw Anti-Aliasing. Also includes an al
version = 3 version = 3
[Preset] [Preset]
name = Disable Native AA name = Nvidias FXAA
$preset:int = 0 $preset:int = 2
# #
$inventorySharper = 0.0 # Ignore $inventorySharper = 0.0 # Ignore
$inventoryBlurrier = 0.0 # Ignore $inventoryBlurrier = 0.0 # Ignore
$worldSharper = 0.0 # Ignore $worldSharper = 0.0 # Ignore
$worldBlurrier = 0.0 # Ignore $worldBlurrier = 0.0 # Ignore
# #
$subPix = 0.75 # Ignore $subPix = 1.0
$edgeThreshold = 0.166 # Ignore $edgeThreshold = 0.125
$edgeThresholdMin = 0.0312 # Ignore $edgeThresholdMin = 0.0156
[Preset] [Preset]
name = Enable Native AA name = Enable Native AA
@ -31,18 +31,19 @@ $subPix = 0.75 # Ignore
$edgeThreshold = 0.166 # Ignore $edgeThreshold = 0.166 # Ignore
$edgeThresholdMin = 0.0312 # Ignore $edgeThresholdMin = 0.0312 # Ignore
[Preset] [Preset]
name = Nvidias FXAA name = Disable Native AA
$preset:int = 2 $preset:int = 0
# #
$inventorySharper = 0.0 # Ignore $inventorySharper = 0.0 # Ignore
$inventoryBlurrier = 0.0 # Ignore $inventoryBlurrier = 0.0 # Ignore
$worldSharper = 0.0 # Ignore $worldSharper = 0.0 # Ignore
$worldBlurrier = 0.0 # Ignore $worldBlurrier = 0.0 # Ignore
# #
$subPix = 1.0 $subPix = 0.75 # Ignore
$edgeThreshold = 0.125 $edgeThreshold = 0.166 # Ignore
$edgeThresholdMin = 0.0156 $edgeThresholdMin = 0.0312 # Ignore
# Adjust native AA implmentation - Only applies to Enabled preset # Adjust native AA implmentation - Only applies to Enabled preset

View File

@ -1,12 +1,11 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
#extension GL_EXT_gpu_shader4 : enable
// shader 59df1c7e1806366c - Anti-aliasing Shader - Dumped 1.14 // shader 59df1c7e1806366c - Anti-aliasing Shader - Dumped 1.14
#define preset $Preset #define preset 1
#define moreaa $MoreAA #define moreaa 0.0
#define lessaa $LessAA #define lessaa 0.0
#if (preset == 0) // Native AA Disabled #if (preset == 0) // Native AA Disabled
@ -27,7 +26,7 @@ return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); } float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
void main() void main()
{ {
passPixelColor0 = texture(textureUnitPS1, passParameterSem1.xy); // textureunitps1 as that is the one with all the colors vs unitps0 which is red viewport passPixelColor0 = texture(textureUnitPS1, passParameterSem1.xy); // textureunitps1 is the one with all the colors vs unitps0 which is red viewport
} }
#endif #endif
@ -41,8 +40,10 @@ layout(location = 1) in vec4 passParameterSem1;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale; uniform vec2 uf_fragCoordScale;
ivec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions ivec2 resDim = textureSize(textureUnitPS0,0); // Retrieve texture dimensions
float resRatio = ( (float(resDim.x)/1280.0) + moreaa ) - lessaa; // retrieve resolution ratio, and calculate the total float resRatio = ( (float(resDim.x)/1280.0) + moreaa ) - lessaa; // retrieve resolution ratio, and calculate the total
float resX = (float(resDim.x)/1280.0);
float resY = (float(resDim.y)/720.0);
int clampFI32(int v) int clampFI32(int v)
{ {
@ -81,11 +82,11 @@ activeMaskStackC[0] = true;
activeMaskStackC[1] = true; activeMaskStackC[1] = true;
vec3 cubeMapSTM; vec3 cubeMapSTM;
int cubeMapFaceId; int cubeMapFaceId;
R0i = floatBitsToInt(passParameterSem0 / resRatio); R0i = floatBitsToInt(passParameterSem0 / resRatio); // Important line
R1i = floatBitsToInt(passParameterSem1); R1i = floatBitsToInt(passParameterSem1);
if( activeMaskStackC[1] == true ) { if( activeMaskStackC[1] == true ) {
R2i.xyzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R0i.zw)).xyzw); R2i.xyzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R0i.zw)).xyzw * resRatio); // Important line
R0i.x = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).x); R0i.x = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).x / resRatio); // Important line
} }
if( activeMaskStackC[1] == true ) { if( activeMaskStackC[1] == true ) {
activeMaskStack[1] = activeMaskStack[0]; activeMaskStack[1] = activeMaskStack[0];
@ -107,12 +108,12 @@ PV0i.z = R4i.z;
// 3 // 3
backupReg0i = R0i.x; backupReg0i = R0i.x;
backupReg0i = R0i.x; backupReg0i = R0i.x;
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.y) * intBitsToFloat(uf_remappedPS[0].x)); PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.y) * intBitsToFloat(uf_remappedPS[0].x) / resX); // Important line
PV1i.y = floatBitsToInt(max(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.y))); PV1i.y = floatBitsToInt(max(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.y)));
PV1i.z = floatBitsToInt(min(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.z))); PV1i.z = floatBitsToInt(min(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.z)));
// 4 // 4
R0i.x = floatBitsToInt(-(intBitsToFloat(PV1i.z)) + intBitsToFloat(PV1i.y)); R0i.x = floatBitsToInt(-(intBitsToFloat(PV1i.z)) + intBitsToFloat(PV1i.y));
R0i.w = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y))); R0i.w = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y) / resY)); // Important line
// 5 // 5
backupReg0i = R0i.x; backupReg0i = R0i.x;
predResult = (intBitsToFloat(R0i.w) > intBitsToFloat(backupReg0i)); predResult = (intBitsToFloat(R0i.w) > intBitsToFloat(backupReg0i));
@ -252,15 +253,15 @@ passPixelColor0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFl
/*-----------------------------settings-------------------------------------*/ /*-----------------------------settings-------------------------------------*/
#define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. #define Subpix 0.75 //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal.
#define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. #define EdgeThreshold 0.166 //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm.
#define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. #define EdgeThresholdMin 0.0312 //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks.
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#define FXAA_PC 1 #define FXAA_PC 1
#define FXAA_GLSL_130 1 #define FXAA_GLSL_130 1
#define FXAA_QUALITY__PRESET 14 #define FXAA_QUALITY_PRESET 14
#define FXAA_GREEN_AS_LUMA 1 #define FXAA_GREEN_AS_LUMA 1
#define FXAA_DISCARD 0 #define FXAA_DISCARD 0
@ -372,7 +373,7 @@ passPixelColor0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFl
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
NOTE the other tuning knobs are now in the shader function inputs! NOTE the other tuning knobs are now in the shader function inputs!
============================================================================*/ ============================================================================*/
#ifndef FXAA_QUALITY__PRESET #ifndef FXAA_QUALITY_PRESET
// //
// Choose the quality preset. // Choose the quality preset.
// This needs to be compiled into the shader as it effects code. // This needs to be compiled into the shader as it effects code.
@ -393,7 +394,7 @@ NOTE the other tuning knobs are now in the shader function inputs!
// _ = the lowest digit is directly related to performance // _ = the lowest digit is directly related to performance
// _ = the highest digit is directly related to style // _ = the highest digit is directly related to style
// //
#define FXAA_QUALITY__PRESET 12 #define FXAA_QUALITY_PRESET 12
#endif #endif
@ -406,198 +407,198 @@ NOTE the other tuning knobs are now in the shader function inputs!
/*============================================================================ /*============================================================================
FXAA QUALITY - MEDIUM DITHER PRESETS FXAA QUALITY - MEDIUM DITHER PRESETS
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 10) #if (FXAA_QUALITY_PRESET == 10)
#define FXAA_QUALITY__PS 3 #define FXAA_QUALITY_PS 3
#define FXAA_QUALITY__P0 1.5 #define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY__P1 3.0 #define FXAA_QUALITY_P1 3.0
#define FXAA_QUALITY__P2 12.0 #define FXAA_QUALITY_P2 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 11) #if (FXAA_QUALITY_PRESET == 11)
#define FXAA_QUALITY__PS 4 #define FXAA_QUALITY_PS 4
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 3.0 #define FXAA_QUALITY_P2 3.0
#define FXAA_QUALITY__P3 12.0 #define FXAA_QUALITY_P3 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 12) #if (FXAA_QUALITY_PRESET == 12)
#define FXAA_QUALITY__PS 5 #define FXAA_QUALITY_PS 5
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 4.0 #define FXAA_QUALITY_P3 4.0
#define FXAA_QUALITY__P4 12.0 #define FXAA_QUALITY_P4 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 13) #if (FXAA_QUALITY_PRESET == 13)
#define FXAA_QUALITY__PS 6 #define FXAA_QUALITY_PS 6
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 4.0 #define FXAA_QUALITY_P4 4.0
#define FXAA_QUALITY__P5 12.0 #define FXAA_QUALITY_P5 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 14) #if (FXAA_QUALITY_PRESET == 14)
#define FXAA_QUALITY__PS 7 #define FXAA_QUALITY_PS 7
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 4.0 #define FXAA_QUALITY_P5 4.0
#define FXAA_QUALITY__P6 12.0 #define FXAA_QUALITY_P6 12.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 15) #if (FXAA_QUALITY_PRESET == 15)
#define FXAA_QUALITY__PS 8 #define FXAA_QUALITY_PS 8
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 4.0 #define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY__P7 12.0 #define FXAA_QUALITY_P7 12.0
#endif #endif
/*============================================================================ /*============================================================================
FXAA QUALITY - LOW DITHER PRESETS FXAA QUALITY - LOW DITHER PRESETS
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 20) #if (FXAA_QUALITY_PRESET == 20)
#define FXAA_QUALITY__PS 3 #define FXAA_QUALITY_PS 3
#define FXAA_QUALITY__P0 1.5 #define FXAA_QUALITY_P0 1.5
#define FXAA_QUALITY__P1 2.0 #define FXAA_QUALITY_P1 2.0
#define FXAA_QUALITY__P2 8.0 #define FXAA_QUALITY_P2 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 21) #if (FXAA_QUALITY_PRESET == 21)
#define FXAA_QUALITY__PS 4 #define FXAA_QUALITY_PS 4
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 8.0 #define FXAA_QUALITY_P3 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 22) #if (FXAA_QUALITY_PRESET == 22)
#define FXAA_QUALITY__PS 5 #define FXAA_QUALITY_PS 5
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 8.0 #define FXAA_QUALITY_P4 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 23) #if (FXAA_QUALITY_PRESET == 23)
#define FXAA_QUALITY__PS 6 #define FXAA_QUALITY_PS 6
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 8.0 #define FXAA_QUALITY_P5 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 24) #if (FXAA_QUALITY_PRESET == 24)
#define FXAA_QUALITY__PS 7 #define FXAA_QUALITY_PS 7
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 3.0 #define FXAA_QUALITY_P5 3.0
#define FXAA_QUALITY__P6 8.0 #define FXAA_QUALITY_P6 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 25) #if (FXAA_QUALITY_PRESET == 25)
#define FXAA_QUALITY__PS 8 #define FXAA_QUALITY_PS 8
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 4.0 #define FXAA_QUALITY_P6 4.0
#define FXAA_QUALITY__P7 8.0 #define FXAA_QUALITY_P7 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 26) #if (FXAA_QUALITY_PRESET == 26)
#define FXAA_QUALITY__PS 9 #define FXAA_QUALITY_PS 9
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 4.0 #define FXAA_QUALITY_P7 4.0
#define FXAA_QUALITY__P8 8.0 #define FXAA_QUALITY_P8 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 27) #if (FXAA_QUALITY_PRESET == 27)
#define FXAA_QUALITY__PS 10 #define FXAA_QUALITY_PS 10
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 4.0 #define FXAA_QUALITY_P8 4.0
#define FXAA_QUALITY__P9 8.0 #define FXAA_QUALITY_P9 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 28) #if (FXAA_QUALITY_PRESET == 28)
#define FXAA_QUALITY__PS 11 #define FXAA_QUALITY_PS 11
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P9 4.0 #define FXAA_QUALITY_P9 4.0
#define FXAA_QUALITY__P10 8.0 #define FXAA_QUALITY_P10 8.0
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PRESET == 29) #if (FXAA_QUALITY_PRESET == 29)
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_PS 12
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.5 #define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY__P2 2.0 #define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY__P3 2.0 #define FXAA_QUALITY_P3 2.0
#define FXAA_QUALITY__P4 2.0 #define FXAA_QUALITY_P4 2.0
#define FXAA_QUALITY__P5 2.0 #define FXAA_QUALITY_P5 2.0
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY__P10 4.0 #define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY__P11 8.0 #define FXAA_QUALITY_P11 8.0
#endif #endif
/*============================================================================ /*============================================================================
FXAA QUALITY - EXTREME QUALITY FXAA QUALITY - EXTREME QUALITY
============================================================================*/ ============================================================================*/
#if (FXAA_QUALITY__PRESET == 39) #if (FXAA_QUALITY_PRESET == 39)
#define FXAA_QUALITY__PS 12 #define FXAA_QUALITY_PS 12
#define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY__P1 1.0 #define FXAA_QUALITY_P1 1.0
#define FXAA_QUALITY__P2 1.0 #define FXAA_QUALITY_P2 1.0
#define FXAA_QUALITY__P3 1.0 #define FXAA_QUALITY_P3 1.0
#define FXAA_QUALITY__P4 1.0 #define FXAA_QUALITY_P4 1.0
#define FXAA_QUALITY__P5 1.5 #define FXAA_QUALITY_P5 1.5
#define FXAA_QUALITY__P6 2.0 #define FXAA_QUALITY_P6 2.0
#define FXAA_QUALITY__P7 2.0 #define FXAA_QUALITY_P7 2.0
#define FXAA_QUALITY__P8 2.0 #define FXAA_QUALITY_P8 2.0
#define FXAA_QUALITY__P9 2.0 #define FXAA_QUALITY_P9 2.0
#define FXAA_QUALITY__P10 4.0 #define FXAA_QUALITY_P10 4.0
#define FXAA_QUALITY__P11 8.0 #define FXAA_QUALITY_P11 8.0
#endif #endif
@ -695,7 +696,7 @@ FxaaFloat4 FxaaPixelShader(
FxaaFloat2 fxaaQualityRcpFrame, FxaaFloat2 fxaaQualityRcpFrame,
// //
// Only used on FXAA Quality. // Only used on FXAA Quality.
// This used to be the FXAA_QUALITY__SUBPIX define. // This used to be the FXAA_QUALITY_SUBPIX define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// Choose the amount of sub-pixel aliasing removal. // Choose the amount of sub-pixel aliasing removal.
// This can effect sharpness. // This can effect sharpness.
@ -707,7 +708,7 @@ FxaaFloat4 FxaaPixelShader(
FxaaFloat fxaaQualitySubpix, FxaaFloat fxaaQualitySubpix,
// //
// Only used on FXAA Quality. // Only used on FXAA Quality.
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// The minimum amount of local contrast required to apply algorithm. // The minimum amount of local contrast required to apply algorithm.
// 0.333 - too little (faster) // 0.333 - too little (faster)
@ -718,7 +719,7 @@ FxaaFloat4 FxaaPixelShader(
FxaaFloat fxaaQualityEdgeThreshold, FxaaFloat fxaaQualityEdgeThreshold,
// //
// Only used on FXAA Quality. // Only used on FXAA Quality.
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
// It is here now to allow easier tuning. // It is here now to allow easier tuning.
// Trims the algorithm from processing darks. // Trims the algorithm from processing darks.
// 0.0833 - upper limit (default, the start of visible unfiltered edges) // 0.0833 - upper limit (default, the start of visible unfiltered edges)
@ -854,11 +855,11 @@ FxaaFloat4 FxaaPixelShader(
if( horzSpan) posB.y += lengthSign * 0.5; if( horzSpan) posB.y += lengthSign * 0.5;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
FxaaFloat2 posN; FxaaFloat2 posN;
posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
FxaaFloat2 posP; FxaaFloat2 posP;
posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
FxaaFloat subpixE = subpixC * subpixC; FxaaFloat subpixE = subpixC * subpixC;
@ -874,11 +875,11 @@ FxaaFloat4 FxaaPixelShader(
lumaEndP -= lumaNN * 0.5; lumaEndP -= lumaNN * 0.5;
FxaaBool doneN = abs(lumaEndN) >= gradientScaled; FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
FxaaBool doneP = abs(lumaEndP) >= gradientScaled; FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
FxaaBool doneNP = (!doneN) || (!doneP); FxaaBool doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
@ -887,13 +888,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 3) #if (FXAA_QUALITY_PS > 3)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -901,13 +902,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 4) #if (FXAA_QUALITY_PS > 4)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -915,13 +916,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 5) #if (FXAA_QUALITY_PS > 5)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -929,13 +930,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 6) #if (FXAA_QUALITY_PS > 6)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -943,13 +944,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 7) #if (FXAA_QUALITY_PS > 7)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -957,13 +958,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 8) #if (FXAA_QUALITY_PS > 8)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -971,13 +972,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 9) #if (FXAA_QUALITY_PS > 9)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -985,13 +986,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 10) #if (FXAA_QUALITY_PS > 10)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -999,13 +1000,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 11) #if (FXAA_QUALITY_PS > 11)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -1013,13 +1014,13 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#if (FXAA_QUALITY__PS > 12) #if (FXAA_QUALITY_PS > 12)
if(doneNP) { if(doneNP) {
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
@ -1027,11 +1028,11 @@ FxaaFloat4 FxaaPixelShader(
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
doneN = abs(lumaEndN) >= gradientScaled; doneN = abs(lumaEndN) >= gradientScaled;
doneP = abs(lumaEndP) >= gradientScaled; doneP = abs(lumaEndP) >= gradientScaled;
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
doneNP = (!doneN) || (!doneP); doneNP = (!doneN) || (!doneP);
if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
} }
#endif #endif
@ -1137,7 +1138,7 @@ layout(location = 1) in vec4 passParameterSem1;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale; uniform vec2 uf_fragCoordScale;
ivec2 resolution = textureSize2D(textureUnitPS0,0); // Retrieve Texture Dimensions ivec2 resolution = textureSize(textureUnitPS0,0); // Retrieve Texture Dimensions
precision highp float; precision highp float;

View File

@ -6,15 +6,15 @@ description = Enables or Disables Native Anti-Aliasing. Also includes an alterna
version = 3 version = 3
[Preset] [Preset]
name = Disable Native AA name = Nvidias FXAA
$Preset:int = 0 $Preset:int = 2
# #
$LessAA = 0.0 # Ignore $LessAA = 0.0 # Ignore
$MoreAA = 0.0 # Ignore $MoreAA = 0.0 # Ignore
# #
$subPix = 0.75 # Ignore $subPix = 1.0
$edgeThreshold = 0.166 # Ignore $edgeThreshold = 0.125
$edgeThresholdMin = 0.0312 # Ignore $edgeThresholdMin = 0.0156
[Preset] [Preset]
name = Enable Native AA name = Enable Native AA
@ -39,15 +39,15 @@ $edgeThreshold = 0.166 # Ignore
$edgeThresholdMin = 0.0312 # Ignore $edgeThresholdMin = 0.0312 # Ignore
[Preset] [Preset]
name = Nvidias FXAA name = Disable Native AA
$Preset:int = 2 $Preset:int = 0
# #
$LessAA = 0.0 # Ignore $LessAA = 0.0 # Ignore
$MoreAA = 0.0 # Ignore $MoreAA = 0.0 # Ignore
# #
$subPix = 1.0 $subPix = 0.75 # Ignore
$edgeThreshold = 0.125 $edgeThreshold = 0.166 # Ignore
$edgeThresholdMin = 0.0156 $edgeThresholdMin = 0.0312 # Ignore
# Adjust native AA implmentation - Only applies to Enabled preset # Adjust native AA implmentation - Only applies to Enabled preset