mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-29 11:21:49 +01:00
5f6725df66
Add - Scaling of AO noise, blur steps and partial coverage
119 lines
3.3 KiB
Plaintext
119 lines
3.3 KiB
Plaintext
<?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
|
|
// shader 5098356af9ebfe85
|
|
//AO pass 3 vertical blur
|
|
const float resScale = <?=$scaleFactorX?>;
|
|
//const float resScale = 4.0;
|
|
uniform ivec4 uf_remappedPS[2];
|
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5911000 res 640x360x1 dim 1 tm: 4 format 0007 compSel: 0 1 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0
|
|
layout(location = 0) in vec4 passParameterSem0;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
uniform vec2 uf_fragCoordScale;
|
|
int clampFI32(int v)
|
|
{
|
|
if( v == 0x7FFFFFFF )
|
|
return floatBitsToInt(1.0);
|
|
else if( v == 0xFFFFFFFF )
|
|
return floatBitsToInt(0.0);
|
|
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)); }
|
|
void main()
|
|
{
|
|
vec4 R0f = vec4(0.0);
|
|
vec4 R1f = vec4(0.0);
|
|
vec4 R2f = vec4(0.0);
|
|
vec4 R3f = vec4(0.0);
|
|
vec4 R4f = vec4(0.0);
|
|
vec4 R123f = vec4(0.0);
|
|
vec4 R125f = vec4(0.0);
|
|
vec4 R126f = vec4(0.0);
|
|
vec4 R127f = vec4(0.0);
|
|
float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
|
|
vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
|
|
float PS0f = 0.0, PS1f = 0.0;
|
|
vec4 tempf = vec4(0.0);
|
|
float tempResultf;
|
|
int tempResulti;
|
|
ivec4 ARi = ivec4(0);
|
|
bool predResult = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0f = passParameterSem0;
|
|
// 0
|
|
PV0f.x = -(intBitsToFloat(uf_remappedPS[0].y)/ resScale);
|
|
PV0f.x /= 2.0;
|
|
R127f.y = intBitsToFloat(uf_remappedPS[0].y) / resScale;
|
|
R127f.y /= 2.0;
|
|
R127f.z = 0.0;
|
|
PV0f.z = R127f.z;
|
|
PV0f.w = intBitsToFloat(uf_remappedPS[0].y) / resScale * intBitsToFloat(0xbfc00000);
|
|
R126f.z = intBitsToFloat(uf_remappedPS[0].y) / resScale*1.5;// *1.5;
|
|
PS0f = R126f.z;
|
|
// 1
|
|
R1f.x = PV0f.z + R0f.x;
|
|
R1f.y = PV0f.w + R0f.y;
|
|
R0f.z = PV0f.z + R0f.x;
|
|
R0f.w = PV0f.x + R0f.y;
|
|
R2f.x = PV0f.z + R0f.x;
|
|
PS1f = R2f.x;
|
|
// 2
|
|
backupReg0f = R0f.x;
|
|
R0f.x = intBitsToFloat(uf_remappedPS[1].z) * intBitsToFloat(0x40100000);
|
|
R2f.y = R127f.y + R0f.y;
|
|
R1f.z = intBitsToFloat(uf_remappedPS[1].z) * 0.25;
|
|
R3f.w = R127f.z + backupReg0f;
|
|
R3f.y = R126f.z + R0f.y;
|
|
PS0f = R3f.y;
|
|
R1f.x = (texture(textureUnitPS0, R1f.xy).x);
|
|
R3f.x = (texture(textureUnitPS0, R0f.zw).x);
|
|
R2f.x = (texture(textureUnitPS0, R2f.xy).x);
|
|
R4f.x = (texture(textureUnitPS0, R3f.wy).x);
|
|
// 0
|
|
R127f.x = -(R1f.x) + 1.0;
|
|
R127f.y = -(R1f.z) * intBitsToFloat(0x3fb8aa3b);
|
|
PV0f.z = -(R0f.x) * intBitsToFloat(0x3fb8aa3b);
|
|
R127f.w = -(R3f.x) + 1.0;
|
|
R0f.w = 1.0;
|
|
PS0f = R0f.w;
|
|
// 1
|
|
R126f.x = -(R2f.x) + 1.0;
|
|
R126f.y = -(R4f.x) + 1.0;
|
|
R125f.w = exp2(PV0f.z);
|
|
PS1f = R125f.w;
|
|
// 2
|
|
PV0f.y = PS1f + 0.0;
|
|
R123f.z = (R127f.x * PS1f + 0.0);
|
|
PV0f.z = R123f.z;
|
|
R126f.w = exp2(R127f.y);
|
|
PS0f = R126f.w;
|
|
// 3
|
|
R123f.y = (R127f.w * PS0f + PV0f.z);
|
|
PV1f.y = R123f.y;
|
|
PV1f.z = PV0f.y + PS0f;
|
|
// 4
|
|
PV0f.z = R126f.w + PV1f.z;
|
|
R123f.w = (R126f.w * R126f.x + PV1f.y);
|
|
PV0f.w = R123f.w;
|
|
// 5
|
|
backupReg0f = R125f.w;
|
|
PV1f.x = R125f.w + PV0f.z;
|
|
R125f.w = (backupReg0f * R126f.y + PV0f.w);
|
|
// 6
|
|
PS0f = 1.0 / PV1f.x;
|
|
// 7
|
|
PV1f.y = R125f.w * PS0f;
|
|
// 8
|
|
R0f.x = (-(PV1f.y) * intBitsToFloat(uf_remappedPS[1].y) + 1.0);
|
|
R0f.x = clamp(R0f.x, 0.0, 1.0);
|
|
// export
|
|
passPixelColor0 = vec4(R0f.x, R0f.x, R0f.x, R0f.w);
|
|
}
|