mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-22 09:39:17 +01:00
[XCX] further AA tweaks
This commit is contained in:
parent
edb182c491
commit
9bc060f481
@ -1,13 +1,59 @@
|
||||
<?php
|
||||
include 'Source/functions.php';
|
||||
$fullWidth = $argv[1];
|
||||
$fullHeight = $argv[2];
|
||||
$scaleFactorX = always_decimal_format($fullWidth / 1280.0);
|
||||
$scaleFactorY = always_decimal_format($fullHeight / 720.0);
|
||||
?>
|
||||
#version 420
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
const float sharpen_strength = 0.1;
|
||||
// shader 59df1c7e1806366c
|
||||
// aaremoval. Can't be combined with AA restore as they share the same shader.
|
||||
// aa-restore. Intial version
|
||||
//To - do //R2i.xyzw is possible a cemu bug. Replace with Alex FXAA
|
||||
const float resScale = <?=$scaleFactorX?>;
|
||||
//const float resScale = 3.0;
|
||||
uniform ivec4 uf_remappedPS[2];
|
||||
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0
|
||||
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0
|
||||
layout(location = 0) in vec4 passParameterSem0;
|
||||
layout(location = 1) in vec4 passParameterSem1;
|
||||
layout(location = 0) out vec4 passPixelColor0;
|
||||
|
||||
vec3 blurSample(in vec2 uv, in vec2 xoff, in vec2 yoff)
|
||||
{
|
||||
vec3 v11 = texture(textureUnitPS1, uv + xoff).rgb;
|
||||
vec3 v12 = texture(textureUnitPS1, uv + yoff).rgb;
|
||||
vec3 v21 = texture(textureUnitPS1, uv - xoff).rgb;
|
||||
vec3 v22 = texture(textureUnitPS1, uv - yoff).rgb;
|
||||
return (v11 + v12 + v21 + v22 + 2.0 * texture(textureUnitPS1, uv).rgb) * 0.166667;
|
||||
}
|
||||
|
||||
vec3 edgeStrength(in vec2 uv)
|
||||
{
|
||||
const float spread = 0.5;
|
||||
vec2 offset = vec2(1.0) / textureSize(textureUnitPS0, 0);
|
||||
vec2 up = vec2(0.0, offset.y) * spread;
|
||||
vec2 right = vec2(offset.x, 0.0) * spread;
|
||||
const float frad = 3.0;
|
||||
vec3 v11 = blurSample(uv + up - right, right, up);
|
||||
vec3 v12 = blurSample(uv + up, right, up);
|
||||
vec3 v13 = blurSample(uv + up + right, right, up);
|
||||
|
||||
vec3 v21 = blurSample(uv - right, right, up);
|
||||
vec3 v22 = blurSample(uv, right, up);
|
||||
vec3 v23 = blurSample(uv + right, right, up);
|
||||
|
||||
vec3 v31 = blurSample(uv - up - right, right, up);
|
||||
vec3 v32 = blurSample(uv - up, right, up);
|
||||
vec3 v33 = blurSample(uv - up + right, right, up);
|
||||
|
||||
vec3 laplacian_of_g = v11 * 0.0 + v12 * 1.0 + v13 * 0.0
|
||||
+ v21 * 1.0 + v22 * -4.0 + v23 * 1.0
|
||||
+ v31 * 0.0 + v32 * 1.0 + v33 * 0.0;
|
||||
laplacian_of_g = laplacian_of_g * 1.0;
|
||||
return laplacian_of_g.xyz;
|
||||
}
|
||||
uniform vec2 uf_fragCoordScale;
|
||||
int clampFI32(int v)
|
||||
{
|
||||
@ -46,19 +92,18 @@ activeMaskStackC[0] = true;
|
||||
activeMaskStackC[1] = true;
|
||||
vec3 cubeMapSTM;
|
||||
int cubeMapFaceId;
|
||||
/*
|
||||
R0i = floatBitsToInt(passParameterSem0);
|
||||
R1i = floatBitsToInt(passParameterSem1);
|
||||
if( activeMaskStackC[1] == true ) {
|
||||
R2i.xyzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R0i.zw)).xyzw);
|
||||
R0i.x = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).x);
|
||||
//R2i.xyzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R0i.zw)).xyzw); // cemu bug? Review later
|
||||
//R0i.x = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).x); // edge blur/chromatic
|
||||
}
|
||||
if( activeMaskStackC[1] == true ) {
|
||||
activeMaskStack[1] = activeMaskStack[0];
|
||||
activeMaskStackC[2] = activeMaskStackC[1];
|
||||
// 0
|
||||
backupReg0i = R2i.x;
|
||||
R2i.x = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(0x3b2aaaab));
|
||||
R2i.x = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(0x3aaaaaab)); //0.0026041667 / 2 0x3aaaaaab
|
||||
PV0i.x = R2i.x;
|
||||
R127i.y = floatBitsToInt(max(intBitsToFloat(R2i.y), intBitsToFloat(R2i.w)));
|
||||
R127i.z = floatBitsToInt(min(intBitsToFloat(R2i.y), intBitsToFloat(R2i.w)));
|
||||
@ -73,7 +118,7 @@ PV0i.z = R4i.z;
|
||||
// 3
|
||||
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)/resScale);
|
||||
PV1i.y = floatBitsToInt(max(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.y)));
|
||||
PV1i.z = floatBitsToInt(min(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.z)));
|
||||
// 4
|
||||
@ -129,8 +174,8 @@ R127i.w = floatBitsToInt(intBitsToFloat(R127i.y) * intBitsToFloat(PS1i));
|
||||
PV0i.w = R127i.w;
|
||||
// 5
|
||||
PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x))));
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.w) * intBitsToFloat(uf_remappedPS[1].y));
|
||||
PV1i.z = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_remappedPS[1].x));
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.w) * intBitsToFloat(uf_remappedPS[1].y)/ resScale);
|
||||
PV1i.z = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_remappedPS[1].x)/ resScale);
|
||||
PV1i.w = floatBitsToInt(max(intBitsToFloat(PV0i.w), -(intBitsToFloat(PV0i.w))));
|
||||
// 6
|
||||
R0i.x = floatBitsToInt(intBitsToFloat(R1i.x) + -(intBitsToFloat(PV1i.z)));
|
||||
@ -140,7 +185,7 @@ R2i.w = floatBitsToInt(intBitsToFloat(R1i.x) + intBitsToFloat(PV1i.z));
|
||||
R2i.y = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(PV1i.y));
|
||||
PS0i = R2i.y;
|
||||
// 7
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.z) * intBitsToFloat(uf_remappedPS[0].z));
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.z) * intBitsToFloat(uf_remappedPS[0].z)/ resScale);
|
||||
// 8
|
||||
PS0i = floatBitsToInt(1.0 / intBitsToFloat(PV1i.y));
|
||||
// 9
|
||||
@ -153,8 +198,8 @@ PV0i.y = floatBitsToInt(max(intBitsToFloat(PV1i.w), intBitsToFloat(0xc0000000)))
|
||||
PV1i.z = floatBitsToInt(min(intBitsToFloat(PV0i.x), 2.0));
|
||||
PV1i.w = floatBitsToInt(min(intBitsToFloat(PV0i.y), 2.0));
|
||||
// 12
|
||||
PV0i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(uf_remappedPS[1].w));
|
||||
PV0i.w = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(uf_remappedPS[1].z));
|
||||
PV0i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(uf_remappedPS[1].w)/ resScale);
|
||||
PV0i.w = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(uf_remappedPS[1].z)/ resScale);
|
||||
// 13
|
||||
backupReg0i = R1i.x;
|
||||
backupReg1i = R1i.y;
|
||||
@ -208,7 +253,11 @@ R4i.x = ((PV0i.w == 0)?(R127i.x):(R127i.z));
|
||||
R4i.y = ((PV0i.w == 0)?(R127i.w):(R126i.y));
|
||||
R4i.z = ((PV0i.w == 0)?(R126i.z):(R126i.w));
|
||||
}
|
||||
//vec2 uv = gl_FragCoord.xy / textureSize(textureUnitPS1, 0);
|
||||
//vec4 sharpColour = vec4(texture(textureUnitPS1, uv).xyz - edgeStrength(uv) * sharpen_strength, 1.0);
|
||||
|
||||
// export
|
||||
passPixelColor0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w));
|
||||
*/
|
||||
//passPixelColor0 = mix(sharpColour, vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w)), 0.5);
|
||||
|
||||
}
|
||||
|
@ -1,59 +1,13 @@
|
||||
<?php
|
||||
include 'Source/functions.php';
|
||||
$fullWidth = $argv[1];
|
||||
$fullHeight = $argv[2];
|
||||
$scaleFactorX = always_decimal_format($fullWidth / 1280.0);
|
||||
$scaleFactorY = always_decimal_format($fullHeight / 720.0);
|
||||
?>
|
||||
#version 420
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
const float sharpen_strength = 0.1;
|
||||
// shader 59df1c7e1806366c
|
||||
// aa-restore. Intial version
|
||||
//To - do //R2i.xyzw is possible a cemu bug. Replace with Alex FXAA
|
||||
const float resScale = <?=$scaleFactorX?>;
|
||||
//const float resScale = 3.0;
|
||||
// aaremoval. Can't be combined with AA restore as they share the same shader.
|
||||
uniform ivec4 uf_remappedPS[2];
|
||||
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0
|
||||
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0
|
||||
layout(location = 0) in vec4 passParameterSem0;
|
||||
layout(location = 1) in vec4 passParameterSem1;
|
||||
layout(location = 0) out vec4 passPixelColor0;
|
||||
|
||||
vec3 blurSample(in vec2 uv, in vec2 xoff, in vec2 yoff)
|
||||
{
|
||||
vec3 v11 = texture(textureUnitPS1, uv + xoff).rgb;
|
||||
vec3 v12 = texture(textureUnitPS1, uv + yoff).rgb;
|
||||
vec3 v21 = texture(textureUnitPS1, uv - xoff).rgb;
|
||||
vec3 v22 = texture(textureUnitPS1, uv - yoff).rgb;
|
||||
return (v11 + v12 + v21 + v22 + 2.0 * texture(textureUnitPS1, uv).rgb) * 0.166667;
|
||||
}
|
||||
|
||||
vec3 edgeStrength(in vec2 uv)
|
||||
{
|
||||
const float spread = 0.5;
|
||||
vec2 offset = vec2(1.0) / textureSize(textureUnitPS0, 0);
|
||||
vec2 up = vec2(0.0, offset.y) * spread;
|
||||
vec2 right = vec2(offset.x, 0.0) * spread;
|
||||
const float frad = 3.0;
|
||||
vec3 v11 = blurSample(uv + up - right, right, up);
|
||||
vec3 v12 = blurSample(uv + up, right, up);
|
||||
vec3 v13 = blurSample(uv + up + right, right, up);
|
||||
|
||||
vec3 v21 = blurSample(uv - right, right, up);
|
||||
vec3 v22 = blurSample(uv, right, up);
|
||||
vec3 v23 = blurSample(uv + right, right, up);
|
||||
|
||||
vec3 v31 = blurSample(uv - up - right, right, up);
|
||||
vec3 v32 = blurSample(uv - up, right, up);
|
||||
vec3 v33 = blurSample(uv - up + right, right, up);
|
||||
|
||||
vec3 laplacian_of_g = v11 * 0.0 + v12 * 1.0 + v13 * 0.0
|
||||
+ v21 * 1.0 + v22 * -4.0 + v23 * 1.0
|
||||
+ v31 * 0.0 + v32 * 1.0 + v33 * 0.0;
|
||||
laplacian_of_g = laplacian_of_g * 1.0;
|
||||
return laplacian_of_g.xyz;
|
||||
}
|
||||
uniform vec2 uf_fragCoordScale;
|
||||
int clampFI32(int v)
|
||||
{
|
||||
@ -92,18 +46,19 @@ activeMaskStackC[0] = true;
|
||||
activeMaskStackC[1] = true;
|
||||
vec3 cubeMapSTM;
|
||||
int cubeMapFaceId;
|
||||
/*
|
||||
R0i = floatBitsToInt(passParameterSem0);
|
||||
R1i = floatBitsToInt(passParameterSem1);
|
||||
if( activeMaskStackC[1] == true ) {
|
||||
//R2i.xyzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R0i.zw)).xyzw); // cemu bug? Review later
|
||||
//R0i.x = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).x); // edge blur/chromatic
|
||||
R2i.xyzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R0i.zw)).xyzw);
|
||||
R0i.x = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).x);
|
||||
}
|
||||
if( activeMaskStackC[1] == true ) {
|
||||
activeMaskStack[1] = activeMaskStack[0];
|
||||
activeMaskStackC[2] = activeMaskStackC[1];
|
||||
// 0
|
||||
backupReg0i = R2i.x;
|
||||
R2i.x = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(0x3aaaaaab)); //0.0026041667 / 2 0x3aaaaaab
|
||||
R2i.x = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(0x3b2aaaab));
|
||||
PV0i.x = R2i.x;
|
||||
R127i.y = floatBitsToInt(max(intBitsToFloat(R2i.y), intBitsToFloat(R2i.w)));
|
||||
R127i.z = floatBitsToInt(min(intBitsToFloat(R2i.y), intBitsToFloat(R2i.w)));
|
||||
@ -118,7 +73,7 @@ PV0i.z = R4i.z;
|
||||
// 3
|
||||
backupReg0i = R0i.x;
|
||||
backupReg0i = R0i.x;
|
||||
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.y) * intBitsToFloat(uf_remappedPS[0].x)/resScale);
|
||||
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.y) * intBitsToFloat(uf_remappedPS[0].x));
|
||||
PV1i.y = floatBitsToInt(max(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.y)));
|
||||
PV1i.z = floatBitsToInt(min(intBitsToFloat(backupReg0i), intBitsToFloat(PV0i.z)));
|
||||
// 4
|
||||
@ -174,8 +129,8 @@ R127i.w = floatBitsToInt(intBitsToFloat(R127i.y) * intBitsToFloat(PS1i));
|
||||
PV0i.w = R127i.w;
|
||||
// 5
|
||||
PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x))));
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.w) * intBitsToFloat(uf_remappedPS[1].y)/ resScale);
|
||||
PV1i.z = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_remappedPS[1].x)/ resScale);
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.w) * intBitsToFloat(uf_remappedPS[1].y));
|
||||
PV1i.z = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(uf_remappedPS[1].x));
|
||||
PV1i.w = floatBitsToInt(max(intBitsToFloat(PV0i.w), -(intBitsToFloat(PV0i.w))));
|
||||
// 6
|
||||
R0i.x = floatBitsToInt(intBitsToFloat(R1i.x) + -(intBitsToFloat(PV1i.z)));
|
||||
@ -185,7 +140,7 @@ R2i.w = floatBitsToInt(intBitsToFloat(R1i.x) + intBitsToFloat(PV1i.z));
|
||||
R2i.y = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(PV1i.y));
|
||||
PS0i = R2i.y;
|
||||
// 7
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.z) * intBitsToFloat(uf_remappedPS[0].z)/ resScale);
|
||||
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.z) * intBitsToFloat(uf_remappedPS[0].z));
|
||||
// 8
|
||||
PS0i = floatBitsToInt(1.0 / intBitsToFloat(PV1i.y));
|
||||
// 9
|
||||
@ -198,8 +153,8 @@ PV0i.y = floatBitsToInt(max(intBitsToFloat(PV1i.w), intBitsToFloat(0xc0000000)))
|
||||
PV1i.z = floatBitsToInt(min(intBitsToFloat(PV0i.x), 2.0));
|
||||
PV1i.w = floatBitsToInt(min(intBitsToFloat(PV0i.y), 2.0));
|
||||
// 12
|
||||
PV0i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(uf_remappedPS[1].w)/ resScale);
|
||||
PV0i.w = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(uf_remappedPS[1].z)/ resScale);
|
||||
PV0i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(uf_remappedPS[1].w));
|
||||
PV0i.w = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(uf_remappedPS[1].z));
|
||||
// 13
|
||||
backupReg0i = R1i.x;
|
||||
backupReg1i = R1i.y;
|
||||
@ -253,11 +208,7 @@ R4i.x = ((PV0i.w == 0)?(R127i.x):(R127i.z));
|
||||
R4i.y = ((PV0i.w == 0)?(R127i.w):(R126i.y));
|
||||
R4i.z = ((PV0i.w == 0)?(R126i.z):(R126i.w));
|
||||
}
|
||||
vec2 uv = gl_FragCoord.xy / textureSize(textureUnitPS1, 0);
|
||||
vec4 sharpColour = vec4(texture(textureUnitPS1, uv).xyz - edgeStrength(uv) * sharpen_strength, 1.0);
|
||||
|
||||
// export
|
||||
//passPixelColor0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w));
|
||||
passPixelColor0 = mix(sharpColour, vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w)), 0.5);
|
||||
|
||||
passPixelColor0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w));
|
||||
*/
|
||||
}
|
@ -104,8 +104,8 @@ overwriteHeight = <?=round($scaleFactorY*288)?>
|
||||
[TextureRedefine] # Fog
|
||||
width = 426
|
||||
height = 240
|
||||
overwriteWidth = <?=round($scaleFactorX*426)?>
|
||||
overwriteHeight = <?=round($scaleFactorY*240)?>
|
||||
overwriteWidth = <?=round($scaleFactorX*640)?>
|
||||
overwriteHeight = <?=round($scaleFactorY*360)?>
|
||||
|
||||
[TextureRedefine] # q-res alpha (Previously not added due to potential conflict, please remove rule when using Xeno GCN4 workaround)
|
||||
width = 320
|
||||
|
Loading…
Reference in New Issue
Block a user