mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-26 01:41:49 +01:00
168 lines
5.7 KiB
Plaintext
168 lines
5.7 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 840947e29015aa9a
|
||
|
// cutscene DOF, reveal talk BG
|
||
|
// To-do Review multi pass performance and bokeh depth
|
||
|
const float resScale = <?=$scaleFactorX?>;
|
||
|
//const float resScale = 3;
|
||
|
uniform ivec4 uf_remappedPS[3];
|
||
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf470a000 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 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 0xf4386000 res 1280x720x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 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;
|
||
|
uniform vec2 uf_fragCoordScale;
|
||
|
|
||
|
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
|
||
|
vec4 color = vec4(0.0);
|
||
|
vec2 off1 = vec2(1.3846153846) * direction;
|
||
|
vec2 off2 = vec2(3.2307692308) * direction;
|
||
|
color += texture2D(image, uv) * 0.2270270270;
|
||
|
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
|
||
|
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
|
||
|
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
|
||
|
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
|
||
|
return color;
|
||
|
}
|
||
|
|
||
|
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 R6f = vec4(0.0);
|
||
|
vec4 R7f = vec4(0.0);
|
||
|
vec4 R8f = vec4(0.0);
|
||
|
vec4 R123f = 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;
|
||
|
R1f = passParameterSem1;
|
||
|
// 0
|
||
|
R2f.x = R1f.x + (intBitsToFloat(uf_remappedPS[0].x)/ resScale);
|
||
|
R2f.y = R1f.y + (intBitsToFloat(uf_remappedPS[0].y)/ resScale);
|
||
|
R0f.z = R1f.x + (intBitsToFloat(uf_remappedPS[0].z)/ resScale);
|
||
|
R0f.w = R1f.y + (intBitsToFloat(uf_remappedPS[0].w)/ resScale);
|
||
|
// 1
|
||
|
backupReg0f = R1f.x;
|
||
|
backupReg1f = R1f.y;
|
||
|
backupReg0f = R1f.x;
|
||
|
backupReg1f = R1f.y;
|
||
|
R1f.xyz = vec3(backupReg0f,backupReg1f,backupReg0f) + vec3(intBitsToFloat(uf_remappedPS[1].x)/ resScale,intBitsToFloat(uf_remappedPS[1].y)/ resScale,intBitsToFloat(uf_remappedPS[1].z)/ resScale);
|
||
|
R1f.w = backupReg1f + intBitsToFloat(uf_remappedPS[1].w)/ resScale;
|
||
|
|
||
|
vec2 texsizetest = vec2(1280.0, 720.0);
|
||
|
//R4f = blur9(textureUnitPS0, R1f.xy, texsizetest, vec2(1.0, 1.0));
|
||
|
//R3f = blur9(textureUnitPS0, R0f.zw, texsizetest, vec2(1.0, 1.0));
|
||
|
|
||
|
//R3f.xyz = (texture(textureUnitPS1, R2f.xy).xyz);
|
||
|
R3f = (blur9(textureUnitPS1, R2f.xy, texsizetest, vec2(1.0, 1.0))); // remove, redundant, blur on next step
|
||
|
R4f = (blur9(textureUnitPS1, R0f.zw, texsizetest, vec2(1.0, 1.0)));
|
||
|
R5f = (blur9(textureUnitPS1, R1f.xy, texsizetest, vec2(1.0, 1.0)));
|
||
|
R6f = (blur9(textureUnitPS1, R1f.zw, texsizetest, vec2(1.0, 1.0)));
|
||
|
R2f.xyz = (texture(textureUnitPS0, R2f.xy).xyz);
|
||
|
R7f.xyz = (texture(textureUnitPS0, R0f.zw).xyz);
|
||
|
R8f.xyz = (texture(textureUnitPS0, R1f.xy).xyz);
|
||
|
R1f.xyz = (texture(textureUnitPS0, R1f.zw).xyz);
|
||
|
// 0
|
||
|
tempf.x = dot(vec4(R3f.x,R3f.y,R3f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
|
||
|
PV0f.x = tempf.x;
|
||
|
PV0f.y = tempf.x;
|
||
|
PV0f.z = tempf.x;
|
||
|
PV0f.w = tempf.x;
|
||
|
R127f.w = tempf.x;
|
||
|
R127f.z = R2f.x + R7f.x;
|
||
|
PS0f = R127f.z;
|
||
|
// 1
|
||
|
tempf.x = dot(vec4(R4f.x,R4f.y,R4f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
|
||
|
PV1f.x = tempf.x;
|
||
|
PV1f.y = tempf.x;
|
||
|
PV1f.z = tempf.x;
|
||
|
PV1f.w = tempf.x;
|
||
|
R127f.y = R2f.y + R7f.y;
|
||
|
PS1f = R127f.y;
|
||
|
// 2
|
||
|
tempf.x = dot(vec4(R5f.x,R5f.y,R5f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
|
||
|
PV0f.x = tempf.x;
|
||
|
PV0f.y = tempf.x;
|
||
|
PV0f.z = tempf.x;
|
||
|
PV0f.w = tempf.x;
|
||
|
PS0f = R127f.w + PV1f.x;
|
||
|
// 3
|
||
|
tempf.x = dot(vec4(R6f.x,R6f.y,R6f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
|
||
|
PV1f.x = tempf.x;
|
||
|
PV1f.y = tempf.x;
|
||
|
PV1f.z = tempf.x;
|
||
|
PV1f.w = tempf.x;
|
||
|
PS1f = PS0f + PV0f.x;
|
||
|
// 4
|
||
|
PV0f.y = PS1f + PV1f.x;
|
||
|
PV0f.z = R127f.y + R8f.y;
|
||
|
PV0f.w = R2f.z + R7f.z;
|
||
|
// 5
|
||
|
R123f.x = (PV0f.y * 0.25 + -(R0f.x));
|
||
|
PV1f.x = R123f.x;
|
||
|
PV1f.y = R127f.z + R8f.x;
|
||
|
PV1f.z = PV0f.z + R1f.y;
|
||
|
PV1f.w = PV0f.w + R8f.z;
|
||
|
// 6
|
||
|
PV0f.x = PV1f.y + R1f.x;
|
||
|
PV0f.y = PV1f.w + R1f.z;
|
||
|
PV0f.z = PV1f.z * 0.25;
|
||
|
PV0f.w = max(PV1f.x, -(PV1f.x));
|
||
|
// 7
|
||
|
backupReg0f = R0f.y;
|
||
|
PV1f.x = PV0f.x * 0.25;
|
||
|
PV1f.y = PV0f.y * 0.25;
|
||
|
PV1f.z = backupReg0f * PV0f.w;
|
||
|
PV1f.z = clamp(PV1f.z, 0.0, 1.0);
|
||
|
PV1f.w = max(PV0f.z, 0.0);
|
||
|
// 8
|
||
|
PV0f.x = max(PV1f.y, 0.0);
|
||
|
R0f.y = min(PV1f.w, 4.0);
|
||
|
PV0f.z = max(PV1f.x, 0.0);
|
||
|
tempResultf = log2(PV1f.z);
|
||
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
||
|
PS0f = tempResultf;
|
||
|
// 9
|
||
|
PV1f.x = PS0f * intBitsToFloat(uf_remappedPS[2].w);
|
||
|
R0f.z = min(PV0f.x, 4.0);
|
||
|
R0f.x = min(PV0f.z, 4.0);
|
||
|
PS1f = R0f.x;
|
||
|
// 10
|
||
|
PS0f = exp2(PV1f.x);
|
||
|
// 11
|
||
|
R0f.w = PS0f * intBitsToFloat(uf_remappedPS[2].z);
|
||
|
// export
|
||
|
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
|
||
|
}
|