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
122 lines
3.3 KiB
Plaintext
122 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 5b5c7c2a52ed1459
|
|
// AO step 2 horizontal blur
|
|
const float resScale = <?=$scaleFactorX?>;
|
|
//const float resScale = 4.0;
|
|
uniform ivec4 uf_remappedPS[2];
|
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf589e000 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 R5f = 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].x) / resScale);
|
|
PV0f.x /= 2.0 ;
|
|
PV0f.y = 0.0;
|
|
R126f.z = 0.0;
|
|
PV0f.z = R126f.z;
|
|
PV0f.w = intBitsToFloat(uf_remappedPS[0].x) / resScale * intBitsToFloat(0xbfc00000) ; //-1.5
|
|
R127f.z = intBitsToFloat(uf_remappedPS[0].x) / resScale;
|
|
R127f.z /= 2.0 ;
|
|
PS0f = R127f.z ;
|
|
// 1
|
|
R1f.x = R0f.x + PV0f.w ;
|
|
R1f.y = R0f.y + PV0f.z ;
|
|
R0f.z = R0f.x + PV0f.x ;
|
|
R0f.w = R0f.y + PV0f.y ;
|
|
PS1f = 0.0;
|
|
// 2
|
|
backupReg0f = R0f.x;
|
|
backupReg1f = R0f.y;
|
|
PV0f.x = intBitsToFloat(uf_remappedPS[1].z) * 0.25;
|
|
PV0f.y = intBitsToFloat(uf_remappedPS[1].z) * intBitsToFloat(0x40100000); //2.25
|
|
R1f.z = backupReg0f + R127f.z;
|
|
R1f.w = backupReg1f + PS1f;
|
|
PS0f = intBitsToFloat(uf_remappedPS[0].x) / resScale*1.5;// *1.5;
|
|
// 3
|
|
R3f.x = -(PV0f.x) * intBitsToFloat(0x3fb8aa3b); //1.442695
|
|
R2f.y = R0f.y + R126f.z;
|
|
R2f.z = R0f.x + PS0f;
|
|
R2f.w = -(PV0f.y) * intBitsToFloat(0x3fb8aa3b); //1.442695
|
|
R5f.y = 0.0;
|
|
PS1f = R5f.y;
|
|
|
|
|
|
R1f.x = (texture(textureUnitPS0, R1f.xy).x);
|
|
R0f.x = (texture(textureUnitPS0, R0f.zw).x);
|
|
R2f.x = (texture(textureUnitPS0, R1f.zw).x);
|
|
R4f.x = (texture(textureUnitPS0, R2f.zy).x);
|
|
// 0
|
|
R127f.x = -(R2f.x) + 1.0;
|
|
PV0f.z = -(R1f.x) + 1.0;
|
|
R127f.w = -(R0f.x) + 1.0;
|
|
R126f.x = exp2(R2f.w);
|
|
PS0f = R126f.x;
|
|
// 1
|
|
R125f.x = -(R4f.x) + 1.0;
|
|
R123f.y = (PV0f.z * PS0f + 0.0);
|
|
PV1f.y = R123f.y;
|
|
PV1f.z = PS0f + 0.0;
|
|
R5f.w = 1.0;
|
|
R126f.z = exp2(R3f.x);
|
|
PS1f = R126f.z;
|
|
// 2
|
|
R123f.y = (R127f.w * PS1f + PV1f.y);
|
|
PV0f.y = R123f.y;
|
|
PV0f.w = PV1f.z + PS1f;
|
|
// 3
|
|
R123f.y = (R126f.z * R127f.x + PV0f.y);
|
|
PV1f.y = R123f.y;
|
|
PV1f.z = R126f.z + PV0f.w;
|
|
// 4
|
|
PV0f.y = R126f.x + PV1f.z;
|
|
R127f.w = (R126f.x * R125f.x + PV1f.y);
|
|
// 5
|
|
PS1f = 1.0 / PV0f.y;
|
|
// 6
|
|
PV0f.z = R127f.w * PS1f;
|
|
// 7
|
|
R5f.x = -(PV0f.z) + 1.0;
|
|
// export
|
|
passPixelColor0 = vec4(R5f.x, R5f.y, R5f.y, R5f.w);
|
|
}
|