BOTW : Fixed up Inventory Native AA and FXAA World AA (#287)

* Update 0f2b9ee517917425_00000000000003c9_ps.txt
Resolution pack Inventory AA

* Update f14bb57cd5c9cb77_00000000000003c9_ps.txt
Resolution pack World AA

* Update 0f2b9ee517917425_00000000000003c9_ps.txt
AA Pack

* Update f14bb57cd5c9cb77_00000000000003c9_ps.txt
AA Pack

* Update rules.txt
AA Pack

Fixed up Inventory Native AA and FXAA World AA
This commit is contained in:
Skal Fate 2018-12-02 22:05:15 -07:00 committed by GitHub
parent 906839bf6c
commit 3ff3c36a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 164 additions and 108 deletions

View File

@ -1,12 +1,15 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
#extension GL_EXT_gpu_shader4 : enable #extension GL_EXT_gpu_shader4 : enable
// shader 0f2b9ee517917425
// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation in inventory screen // shader 0f2b9ee517917425 - dumped 1.15
// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation to link in inventory screen
#define preset $preset #define preset $preset
#define aaSharper $aaSharper
#define aaBlurrier $aaBlurrier
#if (preset == 0) #if (preset == 0) // Disabled
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(location = 0) in vec4 passParameterSem2; layout(location = 0) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0; layout(location = 0) out vec4 passPixelColor0;
@ -17,16 +20,18 @@ passPixelColor0 = texture(textureUnitPS0, passParameterSem2.xy);
} }
#endif #endif
#if (preset == 1) #if (preset == 1) // Enabled
uniform ivec4 uf_remappedPS[2]; uniform ivec4 uf_remappedPS[2];
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 0x387f8000 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 0x37b40000 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(location = 0) in vec4 passParameterSem2; 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);
const int resXScale = int( float(resDim.x)/1280 + 0.5 ); //We need to round up vec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float
const int resYScale = int( float(resDim.y)/720 + 0.5 ); //We need to round up const float resX = ( (resDim.x/1280) + aaSharper ) - aaBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper
const float resY = ( (resDim.y/720) + aaSharper ) - aaBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier
int clampFI32(int v) int clampFI32(int v)
{ {
if( v == 0x7FFFFFFF ) if( v == 0x7FFFFFFF )
@ -35,7 +40,7 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0); return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0)); return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
} }
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; } float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));}
void main() void main()
{ {
ivec4 R0i = ivec4(0); ivec4 R0i = ivec4(0);
@ -51,7 +56,7 @@ ivec4 R125i = ivec4(0);
ivec4 R126i = ivec4(0); ivec4 R126i = ivec4(0);
ivec4 R127i = ivec4(0); ivec4 R127i = ivec4(0);
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i; int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
ivec4 PV0i = ivec4(0), PV1i = ivec4(0); ivec4 PV0i = ivec4(0), PV1i = ivec4(0); // These variables make the difference
int PS0i = 0, PS1i = 0; int PS0i = 0, PS1i = 0;
ivec4 tempi = ivec4(0); ivec4 tempi = ivec4(0);
float tempResultf; float tempResultf;
@ -79,21 +84,21 @@ R1i.y = floatBitsToInt(textureOffset(textureUnitPS1, intBitsToFloat(R0i.xy),ivec
if( activeMaskStackC[1] == true ) { if( activeMaskStackC[1] == true ) {
activeMaskStack[1] = activeMaskStack[0]; activeMaskStack[1] = activeMaskStack[0];
activeMaskStackC[2] = activeMaskStackC[1]; activeMaskStackC[2] = activeMaskStackC[1];
// 0 // 0 --- Point of Interest 1
PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) / resX ); // Divide looks better for minimum - Must place the varaibles in that location of the round brackets to use floats correctly
PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z)) * resY ); // Multiply looks beeter for max - Must place the varaibles in that location of the round brackets to use floats correctly
PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) * resX ); // Multiply looks better for max - Must place the varaibles in that location of the round brackets to use floats correctly
PV0i.w = floatBitsToInt(min(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); PV0i.w = floatBitsToInt(min(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z)));
// 1 // 1 ---Point of Interest 2
PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y))); PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y)));
PV1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.w))); PV1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.w)));
// 2 // 2
PV0i.z = floatBitsToInt(min(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.y))); PV0i.z = floatBitsToInt(min(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.y)));
PV0i.w = floatBitsToInt(max(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.x))); PV0i.w = floatBitsToInt(max(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.x)));
// 3 // 3
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x))); PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x)));
R1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + -(intBitsToFloat(PV0i.z))); R1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + -(intBitsToFloat(PV0i.z)));
// 4 // 4
R2i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y))); R2i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y)));
// 5 // 5
predResult = (intBitsToFloat(R1i.w) >= intBitsToFloat(R2i.y)); predResult = (intBitsToFloat(R1i.w) >= intBitsToFloat(R2i.y));
@ -153,7 +158,7 @@ PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.x) + intBitsToFloat(PV0i.z));
PV1i.y = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(R126i.z)); PV1i.y = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(R126i.z));
PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 2.0); PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 2.0);
R127i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w)); R127i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w));
R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); // Rli.w * 2 has the same affect as line 85------------------------------------------------------
PS1i = R127i.y; PS1i = R127i.y;
// 6 // 6
PV0i.x = floatBitsToInt(intBitsToFloat(R126i.w) + intBitsToFloat(PV1i.y)); PV0i.x = floatBitsToInt(intBitsToFloat(R126i.w) + intBitsToFloat(PV1i.y));
@ -167,17 +172,17 @@ R4i.z = ((PV1i.x == 0)?(0x3f800000):(0));
PV0i.z = R4i.z; PV0i.z = R4i.z;
R5i.w = ((PV1i.x == 0)?(0):(0x3f800000)); R5i.w = ((PV1i.x == 0)?(0):(0x3f800000));
PV0i.w = R5i.w; PV0i.w = R5i.w;
// 9 // 9 --- Point fo Interest
R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here
PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x)))); PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x))));
R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y)/resYScale)); R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y))); // Default implmentation division took place here
PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(PV0i.z))); PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(PV0i.z)));
// 10 // 10 --- Point of Interest
R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); // Divide looks good same as below line ----------------------------------------------------------------------
R127i.x = clampFI32(R127i.x); R127i.x = clampFI32(R127i.x); // Divide looks good same as above line----------------------------------------------------------------------------------------------------
PV0i.x = R127i.x; PV0i.x = R127i.x;
R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)/resYScale) + intBitsToFloat(PV1i.y))); R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)) + intBitsToFloat(PV1i.y))); // Default implmentation division took place here
R127i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(R5i.w)) + intBitsToFloat(PS1i))); R127i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(R5i.w)) + intBitsToFloat(PS1i)));
PV0i.z = R127i.z; PV0i.z = R127i.z;
PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.z), intBitsToFloat(R4i.z))); PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.z), intBitsToFloat(R4i.z)));
@ -206,9 +211,9 @@ PV1i.x = R6i.x;
R123i.z = ((PV0i.w == 0)?(R126i.x):(R125i.x)); R123i.z = ((PV0i.w == 0)?(R126i.x):(R125i.x));
PV1i.z = R123i.z; PV1i.z = R123i.z;
PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV0i.x))); PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV0i.x)));
// 16 // 16 --- Point of Interest
PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R4i.z), intBitsToFloat(PV1i.x))); PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R4i.z), intBitsToFloat(PV1i.x)));
PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); // Important Doubling improves curves and clarity
R123i.y = ((R126i.w == 0)?(R124i.x):(R127i.z)); R123i.y = ((R126i.w == 0)?(R124i.x):(R127i.z));
PV0i.y = R123i.y; PV0i.y = R123i.y;
R3i.z = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(0x3f400000)); R3i.z = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(0x3f400000));
@ -667,23 +672,27 @@ activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
// export // export
passPixelColor0 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFloat(R3i.z), intBitsToFloat(R3i.w)); passPixelColor0 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFloat(R3i.z), intBitsToFloat(R3i.w));
} }
#endif #endif
#if (preset == 2) #if (preset == 2) / FXAA
/*-----------------------------settings-------------------------------------*/ /*-----------------------------settings-------------------------------------*/
#define Subpix 1.00 //[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 0.125 //[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 0.0625 //[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 FxaaAdjust $fxaaAdjust //[0.0 to 4.0] Adjusts how smooth or sharp you want AA to be.
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
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 0x387f8000 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
layout(location = 0) in vec4 passParameterSem2; 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;
vec2 resolution = textureSize2D(textureUnitPS0,0);
#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
@ -1009,7 +1018,7 @@ FxaaFloat4 FxaaPixelShader(
} }
vec2 RcpFrame = vec2(1.0 / 1280.0, 1.0 / 720.0) * uf_fragCoordScale; vec2 RcpFrame = vec2(1.0 / resolution.x, 1.0 / resolution.y) * uf_fragCoordScale * FxaaAdjust;
void main() void main()
{ {
passPixelColor0 = FxaaPixelShader(passParameterSem2.xy, textureUnitPS0, textureUnitPS1, RcpFrame, Subpix, EdgeThreshold, EdgeThresholdMin); passPixelColor0 = FxaaPixelShader(passParameterSem2.xy, textureUnitPS0, textureUnitPS1, RcpFrame, Subpix, EdgeThreshold, EdgeThresholdMin);

View File

@ -1,10 +1,14 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
#extension GL_EXT_gpu_shader4 : enable #extension GL_EXT_gpu_shader4 : enable
// shader f14bb57cd5c9cb77
// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation in inventory screen // shader f14bb57cd5c9cb77 - dumped 1.15
// Used for: Removing/Restoring the native BotW World Anti-Aliasing Implementation
#define preset $preset #define preset $preset
#define aaSharper $aaSharper
#define aaBlurrier $aaBlurrier
#if (preset == 0) #if (preset == 0)
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
@ -18,14 +22,16 @@ passPixelColor0 = texture(textureUnitPS0, passParameterSem2.xy);
#if (preset == 1) #if (preset == 1)
uniform ivec4 uf_remappedPS[4]; uniform ivec4 uf_remappedPS[4];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4713800 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 0xf462d000 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 0x387f8000 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
layout(location = 0) in vec4 passParameterSem2; 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);
const float resXScale = float(resDim.x)/1280; vec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float
const float resYScale = float(resDim.y)/720; const float resX = ( (resDim.x/1280) + aaSharper ) - aaBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper
const float resY = ( (resDim.y/720) + aaSharper ) - aaBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier
int clampFI32(int v) int clampFI32(int v)
{ {
if( v == 0x7FFFFFFF ) if( v == 0x7FFFFFFF )
@ -34,13 +40,13 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0); return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0)); return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
} }
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; } float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));}
void main() void main()
{ {
vec4 R0f = vec4(0.0); vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0); vec4 R1f = vec4(0.0); // Important variable
vec4 R2f = vec4(0.0); vec4 R2f = vec4(0.0);
vec4 R3f = vec4(0.0); vec4 R3f = vec4(0.0); // Important variable
vec4 R123f = vec4(0.0); vec4 R123f = vec4(0.0);
vec4 R126f = vec4(0.0); vec4 R126f = vec4(0.0);
vec4 R127f = vec4(0.0); vec4 R127f = vec4(0.0);
@ -98,19 +104,19 @@ PV1f.x = mul_nonIEEE(PS0f, intBitsToFloat(uf_remappedPS[1].x));
PV1f.y = max(PV0f.z, PS0f); PV1f.y = max(PV0f.z, PS0f);
PV1f.z = min(PV0f.z, PV0f.w); PV1f.z = min(PV0f.z, PV0f.w);
PV1f.w = min(PV0f.y, PV0f.x); PV1f.w = min(PV0f.y, PV0f.x);
// 4 // 4 ---Point of Interest
R1f.x = -(PV1f.z) + PV1f.y; R1f.x = -(PV1f.z) + PV1f.y;
R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); // Important - Divide looks blurrier/fuzzy and multiply looks sharper good
PS0f = 1.0 / PV1f.w; PS0f = 1.0 / PV1f.w; // Important line affects aliasing strongly, increasing it is blurier and decreasing sharpens
// 5 // 5
PV1f.x = mul_nonIEEE(R127f.z, PS0f); PV1f.x = mul_nonIEEE(R127f.z, PS0f);
PV1f.y = mul_nonIEEE(R126f.w, PS0f); PV1f.y = mul_nonIEEE(R126f.w, PS0f);
// 6 // 6
PV0f.z = max(PV1f.x, -(intBitsToFloat(uf_remappedPS[2].y))); PV0f.z = max(PV1f.x, -(intBitsToFloat(uf_remappedPS[2].y)));
PV0f.w = max(PV1f.y, -(intBitsToFloat(uf_remappedPS[2].y))); PV0f.w = max(PV1f.y, -(intBitsToFloat(uf_remappedPS[2].y)));
// 7 // 7 --- Point of Interest
R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy
R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy
// 8 // 8
predResult = (R1f.x > R0f.z); predResult = (R1f.x > R0f.z);
activeMaskStack[1] = predResult; activeMaskStack[1] = predResult;
@ -124,13 +130,13 @@ if( activeMaskStackC[2] == true ) {
// 0 // 0
backupReg0f = R3f.x; backupReg0f = R3f.x;
backupReg0f = R3f.x; backupReg0f = R3f.x;
R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resXScale) + R0f.x); R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resX) + R0f.x); // Original Implementation divided x
R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resYScale) + R0f.y); R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resY) + R0f.y); // Original Implementation divided y
R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resXScale)) + R0f.x); R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resX)) + R0f.x); // Original Implementation divided x
PS0f = R1f.x; PS0f = R1f.x;
// 1 // 1
backupReg0f = R1f.y; backupReg0f = R1f.y;
R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resYScale)) + R0f.y); R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resY)) + R0f.y); // Original Implementation divided y
} }
if( activeMaskStackC[2] == true ) { if( activeMaskStackC[2] == true ) {
R0f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw); R0f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw);
@ -170,18 +176,21 @@ passPixelColor0 = vec4(R2f.x, R2f.y, R2f.z, R2f.w);
#if (preset == 2) #if (preset == 2)
/*-----------------------------settings-------------------------------------*/ /*-----------------------------settings-------------------------------------*/
#define Subpix 0.70 //[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 0.125 //[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 0.0625 //[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 FxaaAdjust $fxaaAdjust //[0.0 to 4.0] Adjusts how smooth or sharp you want AA to be.
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
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 0x387f8000 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
layout(location = 0) in vec4 passParameterSem2; 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;
vec2 resolution = textureSize2D(textureUnitPS0,0); // Retrieve Texture Dimensions in float data type so we dont need to convert
#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
@ -507,9 +516,9 @@ FxaaFloat4 FxaaPixelShader(
} }
vec2 RcpFrame = vec2(1.0 / 1280.0, 1.0 / 720.0) * uf_fragCoordScale; vec2 RcpFrame = vec2(1.0 / resolution.x, 1.0 / resolution.y) * uf_fragCoordScale * FxaaAdjust; // This is where the dimensions are used, Fxaaadjust can make it sharp to blurry
void main() void main()
{ {
passPixelColor0 = FxaaPixelShader(passParameterSem2.xy, textureUnitPS0, textureUnitPS1, RcpFrame, Subpix, EdgeThreshold, EdgeThresholdMin); passPixelColor0 = FxaaPixelShader(passParameterSem2.xy, textureUnitPS0, textureUnitPS1, RcpFrame, Subpix, EdgeThreshold, EdgeThresholdMin);
} }
#endif #endif

View File

@ -2,20 +2,48 @@
titleIds = 00050000101C9300,00050000101C9400,00050000101C9500 titleIds = 00050000101C9300,00050000101C9400,00050000101C9500
name = Anti-Aliasing name = Anti-Aliasing
path = "The Legend of Zelda: Breath of the Wild/Graphics/Anti-Aliasing" path = "The Legend of Zelda: Breath of the Wild/Graphics/Anti-Aliasing"
description = Enables and Disables Anti-Aliasing processing. FXAA is better alternative and customizable. Check the "!GameTitleHere_Anti-Aliasing/rules.txt" file in your graphicPack folder for info about the individual settings. description = Enables and Disables Native Botw Anti-Aliasing. Also includes an alternative FXAA implementation. Check the "Anti-Aliasing/rules.txt" file in your Botw AA graphicPack folder for info about the individual settings.
version = 3 version = 3
[Preset] [Preset]
name = Disabled name = Disable Native AA
$preset:int = 0 $preset:int = 0
#
$aaSharper = 0.5 # Ignore
$aaBlurrier = 0.0 # Ignore
#
$subPix = 0.75 # Ignore
$edgeThreshold = 0.0166 # Ignore
$edgeThresholdMin = 0.0833 # Ignore
$fxaaAdjust = 1.0 # Ignore
[Preset] [Preset]
name = Enabled name = Enable Native AA
$preset:int = 1 $preset:int = 1
#
$aaSharper = 0.5
$aaBlurrier = 0.0
#
$subPix = 0.75 # Ignore
$edgeThreshold = 0.0166 # Ignore
$edgeThresholdMin = 0.0833 # Ignore
$fxaaAdjust = 1.0 # Ignore
[Preset] [Preset]
name = FXAA name = FXAA
$preset:int = 2 $preset:int = 2
#
$aaSharper = 0.5 # Ignore
$aaBlurrier = 0.0 # Ignore
#
$subPix = 1.0
$edgeThreshold = 0.0125
$edgeThresholdMin = 0.0625
$fxaaAdjust = 2.0
# aaSharper / aaBlurrier - Only applies to enabled preset
# Adjusts native AA implmentation
# Values - [0.0 - 1.0] - keep one of the varaibles at 0 while adjusting the other one
# Subpix: # Subpix:
# Choose the amount of sub-pixel aliasing removal. # Choose the amount of sub-pixel aliasing removal.
@ -40,5 +68,9 @@ $preset:int = 2
# 0.0625 - high quality (faster) # 0.0625 - high quality (faster)
# 0.0312 - visible limit (slower) # 0.0312 - visible limit (slower)
# FxaaAdjust
# Makes FXAA more clearer or blurrier
# [0.0 - 1.0] values are used to divide by Var x 0.2
# [1.0 - 4.0] are used to multiply by Var x 2.0
# Credit: Kiri, NAVras # Credit: Kiri, NAVras
# Credit: SkalFate for proper V3 Import. # Credit: SkalFate for proper V3 Import.

View File

@ -1,16 +1,18 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
// shader 0f2b9ee517917425 // shader 0f2b9ee517917425 - dumped cemu 1.15
// Used for: Restoring the native BotW Anti-Aliasing implementation in inventory screen // Used for: Restoring the native BotW Anti-Aliasing implementation in inventory screen
const float resXScale = $width/1280;
const float resYScale = $height/720; const float resX = $width/1280;
const float resY = $height/720;
uniform ivec4 uf_remappedPS[2]; uniform ivec4 uf_remappedPS[2];
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 0x387f8000 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 0x37b40000 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(location = 0) in vec4 passParameterSem2; 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;
int clampFI32(int v) int clampFI32(int v)
{ {
if( v == 0x7FFFFFFF ) if( v == 0x7FFFFFFF )
@ -19,7 +21,7 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0); return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0)); return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
} }
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; } float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));}
void main() void main()
{ {
ivec4 R0i = ivec4(0); ivec4 R0i = ivec4(0);
@ -35,7 +37,7 @@ ivec4 R125i = ivec4(0);
ivec4 R126i = ivec4(0); ivec4 R126i = ivec4(0);
ivec4 R127i = ivec4(0); ivec4 R127i = ivec4(0);
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i; int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
ivec4 PV0i = ivec4(0), PV1i = ivec4(0); ivec4 PV0i = ivec4(0), PV1i = ivec4(0); // These variables make the difference
int PS0i = 0, PS1i = 0; int PS0i = 0, PS1i = 0;
ivec4 tempi = ivec4(0); ivec4 tempi = ivec4(0);
float tempResultf; float tempResultf;
@ -63,21 +65,21 @@ R1i.y = floatBitsToInt(textureOffset(textureUnitPS1, intBitsToFloat(R0i.xy),ivec
if( activeMaskStackC[1] == true ) { if( activeMaskStackC[1] == true ) {
activeMaskStack[1] = activeMaskStack[0]; activeMaskStack[1] = activeMaskStack[0];
activeMaskStackC[2] = activeMaskStackC[1]; activeMaskStackC[2] = activeMaskStackC[1];
// 0 // 0 --- Point of Interest 1
PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) / resX ); // Divide looks better for minimum - Must place the varaibles in that location of the round brackets to use floats correctly
PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z)) * resY ); // Multiply looks beeter for max - Must place the varaibles in that location of the round brackets to use floats correctly
PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) * resX ); // Multiply looks better for max - Must place the varaibles in that location of the round brackets to use floats correctly
PV0i.w = floatBitsToInt(min(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); PV0i.w = floatBitsToInt(min(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z)));
// 1 // 1 ---Point of Interest 2
PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y))); PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y)));
PV1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.w))); PV1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.w)));
// 2 // 2
PV0i.z = floatBitsToInt(min(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.y))); PV0i.z = floatBitsToInt(min(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.y)));
PV0i.w = floatBitsToInt(max(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.x))); PV0i.w = floatBitsToInt(max(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.x)));
// 3 // 3
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x))); PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x)));
R1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + -(intBitsToFloat(PV0i.z))); R1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + -(intBitsToFloat(PV0i.z)));
// 4 // 4
R2i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y))); R2i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y)));
// 5 // 5
predResult = (intBitsToFloat(R1i.w) >= intBitsToFloat(R2i.y)); predResult = (intBitsToFloat(R1i.w) >= intBitsToFloat(R2i.y));
@ -137,7 +139,7 @@ PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.x) + intBitsToFloat(PV0i.z));
PV1i.y = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(R126i.z)); PV1i.y = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(R126i.z));
PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 2.0); PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 2.0);
R127i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w)); R127i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w));
R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); // Rli.w * 2 has the same affect as line 85------------------------------------------------------
PS1i = R127i.y; PS1i = R127i.y;
// 6 // 6
PV0i.x = floatBitsToInt(intBitsToFloat(R126i.w) + intBitsToFloat(PV1i.y)); PV0i.x = floatBitsToInt(intBitsToFloat(R126i.w) + intBitsToFloat(PV1i.y));
@ -151,17 +153,17 @@ R4i.z = ((PV1i.x == 0)?(0x3f800000):(0));
PV0i.z = R4i.z; PV0i.z = R4i.z;
R5i.w = ((PV1i.x == 0)?(0):(0x3f800000)); R5i.w = ((PV1i.x == 0)?(0):(0x3f800000));
PV0i.w = R5i.w; PV0i.w = R5i.w;
// 9 // 9 --- Point fo Interest
R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here
PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x)))); PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x))));
R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y)/resYScale)); R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y))); // Default implmentation division took place here
PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(PV0i.z))); PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(PV0i.z)));
// 10 // 10 --- Point of Interest
R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); // Divide looks good same as below line ----------------------------------------------------------------------
R127i.x = clampFI32(R127i.x); R127i.x = clampFI32(R127i.x); // Divide looks good same as above line----------------------------------------------------------------------------------------------------
PV0i.x = R127i.x; PV0i.x = R127i.x;
R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)/resYScale) + intBitsToFloat(PV1i.y))); R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)) + intBitsToFloat(PV1i.y))); // Default implmentation division took place here
R127i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(R5i.w)) + intBitsToFloat(PS1i))); R127i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(R5i.w)) + intBitsToFloat(PS1i)));
PV0i.z = R127i.z; PV0i.z = R127i.z;
PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.z), intBitsToFloat(R4i.z))); PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.z), intBitsToFloat(R4i.z)));
@ -190,9 +192,9 @@ PV1i.x = R6i.x;
R123i.z = ((PV0i.w == 0)?(R126i.x):(R125i.x)); R123i.z = ((PV0i.w == 0)?(R126i.x):(R125i.x));
PV1i.z = R123i.z; PV1i.z = R123i.z;
PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV0i.x))); PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV0i.x)));
// 16 // 16 --- Point of Interest
PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R4i.z), intBitsToFloat(PV1i.x))); PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R4i.z), intBitsToFloat(PV1i.x)));
PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); // Important Doubling improves curves and clarity
R123i.y = ((R126i.w == 0)?(R124i.x):(R127i.z)); R123i.y = ((R126i.w == 0)?(R124i.x):(R127i.z));
PV0i.y = R123i.y; PV0i.y = R123i.y;
R3i.z = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(0x3f400000)); R3i.z = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(0x3f400000));

View File

@ -1,16 +1,20 @@
#version 420 #version 420
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
// shader f14bb57cd5c9cb77 #extension GL_ARB_separate_shader_objects : enable
// Used for: Restoring the native BotW Anti-Aliasing implementation
const float resXScale = $width/1280; // shader f14bb57cd5c9cb77 - dumped 1.15
const float resYScale = $height/720; // Used for: Removing/Restoring the native BotW World Anti-Aliasing implementation
const float resX = $width/1280;
const float resY = $height/720;
uniform ivec4 uf_remappedPS[4]; uniform ivec4 uf_remappedPS[4];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4713800 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 0xf462d000 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 0x387f8000 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
layout(location = 0) in vec4 passParameterSem2; 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;
int clampFI32(int v) int clampFI32(int v)
{ {
if( v == 0x7FFFFFFF ) if( v == 0x7FFFFFFF )
@ -19,13 +23,13 @@ else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0); return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0)); return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
} }
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; } float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));}
void main() void main()
{ {
vec4 R0f = vec4(0.0); vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0); vec4 R1f = vec4(0.0); // Important variable
vec4 R2f = vec4(0.0); vec4 R2f = vec4(0.0);
vec4 R3f = vec4(0.0); vec4 R3f = vec4(0.0); // Important variable
vec4 R123f = vec4(0.0); vec4 R123f = vec4(0.0);
vec4 R126f = vec4(0.0); vec4 R126f = vec4(0.0);
vec4 R127f = vec4(0.0); vec4 R127f = vec4(0.0);
@ -56,7 +60,7 @@ if( activeMaskStackC[1] == true ) {
activeMaskStack[1] = activeMaskStack[0]; activeMaskStack[1] = activeMaskStack[0];
activeMaskStackC[2] = activeMaskStackC[1]; activeMaskStackC[2] = activeMaskStackC[1];
// 0 // 0
PV0f.x = R1f.w + -(R1f.x); PV0f.x = R1f.w + -(R1f.x);
PV0f.y = R1f.z + -(R1f.y); PV0f.y = R1f.z + -(R1f.y);
PV0f.z = mul_nonIEEE(R2f.x, intBitsToFloat(uf_remappedPS[0].x)); PV0f.z = mul_nonIEEE(R2f.x, intBitsToFloat(uf_remappedPS[0].x));
R127f.w = min(R1f.z, R1f.x); R127f.w = min(R1f.z, R1f.x);
@ -85,17 +89,17 @@ PV1f.z = min(PV0f.z, PV0f.w);
PV1f.w = min(PV0f.y, PV0f.x); PV1f.w = min(PV0f.y, PV0f.x);
// 4 // 4
R1f.x = -(PV1f.z) + PV1f.y; R1f.x = -(PV1f.z) + PV1f.y;
R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); // Important - Divide looks blurrier/fuzzy and multiply looks sharper good
PS0f = 1.0 / PV1f.w; PS0f = 1.0 / PV1f.w; // Important line affects aliasing strongly, increasing it is blurier and decreasing sharpens
// 5 // 5
PV1f.x = mul_nonIEEE(R127f.z, PS0f); PV1f.x = mul_nonIEEE(R127f.z, PS0f);
PV1f.y = mul_nonIEEE(R126f.w, PS0f); PV1f.y = mul_nonIEEE(R126f.w, PS0f);
// 6 // 6
PV0f.z = max(PV1f.x, -(intBitsToFloat(uf_remappedPS[2].y))); PV0f.z = max(PV1f.x, -(intBitsToFloat(uf_remappedPS[2].y)));
PV0f.w = max(PV1f.y, -(intBitsToFloat(uf_remappedPS[2].y))); PV0f.w = max(PV1f.y, -(intBitsToFloat(uf_remappedPS[2].y)));
// 7 // 7 - another way to do it other than the original implmentation
R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy
R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy
// 8 // 8
predResult = (R1f.x > R0f.z); predResult = (R1f.x > R0f.z);
activeMaskStack[1] = predResult; activeMaskStack[1] = predResult;
@ -109,13 +113,13 @@ if( activeMaskStackC[2] == true ) {
// 0 // 0
backupReg0f = R3f.x; backupReg0f = R3f.x;
backupReg0f = R3f.x; backupReg0f = R3f.x;
R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resXScale) + R0f.x); R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resX) + R0f.x); // Original Implementation
R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resYScale) + R0f.y); R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resY) + R0f.y); // Original Implementation
R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resXScale)) + R0f.x); R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resX)) + R0f.x); // Original Implementation
PS0f = R1f.x; PS0f = R1f.x;
// 1 // 1
backupReg0f = R1f.y; backupReg0f = R1f.y;
R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resYScale)) + R0f.y); R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resY)) + R0f.y); // Original Implementation
} }
if( activeMaskStackC[2] == true ) { if( activeMaskStackC[2] == true ) {
R0f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw); R0f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw);