mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-29 21:04:14 +01:00
906839bf6c
need more people to test other resolutions with native render
322 lines
10 KiB
GLSL
322 lines
10 KiB
GLSL
#version 420
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
// shader b2fecd8319ee0096
|
|
// Used for: DoF In-game
|
|
const float resXScale = ($width*($gameWidth/$renderWidth)/$gameWidth);
|
|
const float resYScale = ($height/$gameHeight);
|
|
|
|
uniform ivec4 uf_remappedPS[4];
|
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4603800 res 960x720x1 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 = 2) uniform sampler2D textureUnitPS2;// Tex2 addr 0xf413c800 res 120x72x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler2 ClampX/Y/Z: 2 2 2 border: 0
|
|
layout(binding = 4) uniform sampler2D textureUnitPS4;// Tex4 addr 0xf41f9800 res 480x288x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler4 ClampX/Y/Z: 2 2 2 border: 0
|
|
layout(binding = 5) uniform sampler2D textureUnitPS5;// Tex5 addr 0xf415c000 res 128x72x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler5 ClampX/Y/Z: 2 2 2 border: 0
|
|
layout(binding = 6) uniform sampler2D textureUnitPS6;// Tex6 addr 0xf4166800 res 128x72x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler6 ClampX/Y/Z: 2 2 2 border: 0
|
|
layout(location = 0) in vec4 passParameterSem130;
|
|
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){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
|
|
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 R9f = vec4(0.0);
|
|
vec4 R122f = vec4(0.0);
|
|
vec4 R123f = vec4(0.0);
|
|
vec4 R124f = 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 = passParameterSem130;
|
|
R5f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
|
|
R1f.xyz = (texture(textureUnitPS5, R0f.xy).xyz);
|
|
R2f.xyz = (texture(textureUnitPS6, R0f.xy).xyz);
|
|
R7f.xyzw = (texture(textureUnitPS4, R0f.xy).xyzw);
|
|
R8f.xyz = (texture(textureUnitPS2, R0f.xy).xyz);
|
|
// 0
|
|
PV0f.x = (intBitsToFloat(uf_remappedPS[0].z) * 1.5) / resXScale;
|
|
R3f.y = R0f.y;
|
|
R4f.z = R0f.y;
|
|
R127f.w = (intBitsToFloat(uf_remappedPS[0].w) * 1.5) / resYScale; // Not sure if this is correct for widescreen.
|
|
PS0f = R1f.x + -(1.0);
|
|
// 1
|
|
R3f.x = R0f.x + -(PV0f.x);
|
|
R4f.y = R0f.x + PV0f.x;
|
|
PV1f.z = R1f.z + -(1.0);
|
|
PV1f.w = R1f.y + -(1.0);
|
|
R6f.y = (mul_nonIEEE(PS0f,intBitsToFloat(uf_remappedPS[1].y)) + 1.0);
|
|
PS1f = R6f.y;
|
|
// 2
|
|
R1f.x = (mul_nonIEEE(PV1f.w,intBitsToFloat(uf_remappedPS[1].y)) + 1.0);
|
|
R1f.y = mul_nonIEEE(intBitsToFloat(uf_remappedPS[1].y), R2f.y);
|
|
R1f.z = mul_nonIEEE(intBitsToFloat(uf_remappedPS[1].y), R2f.x);
|
|
R0f.w = (mul_nonIEEE(PV1f.z,intBitsToFloat(uf_remappedPS[1].y)) + 1.0);
|
|
R6f.x = mul_nonIEEE(intBitsToFloat(uf_remappedPS[1].y), R2f.z);
|
|
PS0f = R6f.x;
|
|
// 3
|
|
R2f.x = R0f.x;
|
|
R2f.y = R0f.y + -(R127f.w);
|
|
R9f.w = 1.0;
|
|
R1f.w = 1.0 / intBitsToFloat(uf_remappedPS[2].w);
|
|
PS1f = R1f.w;
|
|
// 4
|
|
backupReg0f = R0f.y;
|
|
R0f.y = backupReg0f + R127f.w;
|
|
R2f.xyz = (texture(textureUnitPS0, R2f.xy).xyz);
|
|
R0f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
|
|
R3f.xyz = (texture(textureUnitPS0, R3f.xy).xyz);
|
|
R4f.xyz = (texture(textureUnitPS0, R4f.yz).xyz);
|
|
// 0
|
|
R125f.x = R2f.x + R0f.x;
|
|
R125f.x *= 2.0;
|
|
PV0f.x = R125f.x;
|
|
R126f.z = R2f.z + R0f.z;
|
|
R126f.z *= 2.0;
|
|
R126f.w = R2f.y + R0f.y;
|
|
R126f.w *= 2.0;
|
|
PV0f.w = R126f.w;
|
|
// 1
|
|
R127f.x = (-(R5f.x) * 4.0 + PV0f.x);
|
|
R127f.y = R3f.z + R4f.z;
|
|
R127f.y *= 2.0;
|
|
PV1f.y = R127f.y;
|
|
R127f.z = R3f.y + R4f.y;
|
|
R127f.z *= 2.0;
|
|
PV1f.z = R127f.z;
|
|
R127f.w = R3f.x + R4f.x;
|
|
R127f.w *= 2.0;
|
|
PV1f.w = R127f.w;
|
|
R122f.x = (-(R5f.y) * 4.0 + PV0f.w);
|
|
PS1f = R122f.x;
|
|
// 2
|
|
R123f.x = (R5f.x * 2.0 + PV1f.w);
|
|
PV0f.x = R123f.x;
|
|
R123f.y = (R5f.y * 2.0 + PV1f.z);
|
|
PV0f.y = R123f.y;
|
|
R123f.z = (-(R5f.z) * 4.0 + R126f.z);
|
|
PV0f.z = R123f.z;
|
|
R123f.w = (R5f.z * 2.0 + PV1f.y);
|
|
PV0f.w = R123f.w;
|
|
R126f.x = max(PS1f, -(PS1f));
|
|
PS0f = R126f.x;
|
|
// 3
|
|
R124f.x = PV0f.x * intBitsToFloat(0x3e2aaaab);
|
|
PV1f.y = max(R127f.x, -(R127f.x))/3;
|
|
R3f.z = PV0f.y * intBitsToFloat(0x3e2aaaab);
|
|
PV1f.w = max(PV0f.z, -(PV0f.z));
|
|
R4f.z = PV0f.w * intBitsToFloat(0x3e2aaaab);
|
|
PS1f = R4f.z;
|
|
// 4
|
|
backupReg0f = R127f.z;
|
|
R127f.x = PV1f.y * 0.25;
|
|
R126f.y = R126f.x * 0.25;
|
|
R127f.z = PV1f.w * 0.25;
|
|
R123f.w = (-(R5f.x) * 4.0 + R127f.w);
|
|
PV0f.w = R123f.w;
|
|
R126f.x = (-(R5f.y) * 4.0 + backupReg0f);
|
|
PS0f = R126f.x;
|
|
// 5
|
|
backupReg0f = R125f.x;
|
|
backupReg1f = R127f.y;
|
|
R125f.x = (R5f.x * 2.0 + backupReg0f);
|
|
R127f.y = (R5f.y * 2.0 + R126f.w);
|
|
R125f.z = (R5f.z * 2.0 + R126f.z);
|
|
R126f.w = (-(R5f.z) * 4.0 + backupReg1f);
|
|
R124f.z = max(PV0f.w, -(PV0f.w));
|
|
PS1f = R124f.z;
|
|
// 6
|
|
tempf.x = dot(vec4(R124f.x,R3f.z,R4f.z,-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0));
|
|
PV0f.x = tempf.x;
|
|
PV0f.y = tempf.x;
|
|
PV0f.z = tempf.x;
|
|
PV0f.w = tempf.x;
|
|
R126f.z = tempf.x;
|
|
R125f.y = max(R126f.x, -(R126f.x));
|
|
PS0f = R125f.y;
|
|
// 7
|
|
backupReg0f = R126f.w;
|
|
backupReg0f = R126f.w;
|
|
tempf.x = dot(vec4(R127f.x,R126f.y,R127f.z,-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0));
|
|
PV1f.x = tempf.x;
|
|
PV1f.y = tempf.x;
|
|
PV1f.z = tempf.x;
|
|
PV1f.w = tempf.x;
|
|
R126f.w = max(backupReg0f, -(backupReg0f));
|
|
PS1f = R126f.w;
|
|
// 8
|
|
backupReg0f = R125f.x;
|
|
backupReg1f = R127f.y;
|
|
backupReg2f = R126f.z;
|
|
R125f.x = backupReg0f * intBitsToFloat(0x3e2aaaab);
|
|
R127f.y = backupReg1f * intBitsToFloat(0x3e2aaaab);
|
|
R126f.z = R125f.z * intBitsToFloat(0x3e2aaaab);
|
|
R123f.w = (PV1f.x * intBitsToFloat(0x40400000) + intBitsToFloat(0xbdcccccd));
|
|
PV0f.w = R123f.w;
|
|
PS0f = 1.0 / backupReg2f;
|
|
// 9
|
|
PV1f.x = R124f.z * 0.25;
|
|
PV1f.y = R125f.y * 0.25;
|
|
PV1f.z = R126f.w * 0.25;
|
|
R127f.w = mul_nonIEEE(PV0f.w, PS0f);
|
|
R127f.w = clamp(R127f.w, 0.0, 1.0);
|
|
R126f.w = -(R5f.x) + R124f.x;
|
|
PS1f = R126f.w;
|
|
// 10
|
|
tempf.x = dot(vec4(PV1f.x,PV1f.y,PV1f.z,-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0));
|
|
PV0f.x = tempf.x;
|
|
PV0f.y = tempf.x;
|
|
PV0f.z = tempf.x;
|
|
PV0f.w = tempf.x;
|
|
R125f.y = tempf.x;
|
|
R124f.z = -(R5f.y) + R3f.z;
|
|
PS0f = R124f.z;
|
|
// 11
|
|
tempf.x = dot(vec4(R125f.x,R127f.y,R126f.z,-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0));
|
|
PV1f.x = tempf.x;
|
|
PV1f.y = tempf.x;
|
|
PV1f.z = tempf.x;
|
|
PV1f.w = tempf.x;
|
|
PS1f = -(R5f.z) + R4f.z;
|
|
// 12
|
|
backupReg0f = R124f.z;
|
|
backupReg1f = R127f.w;
|
|
R124f.x = (mul_nonIEEE(R126f.w,R127f.w) + R5f.x);
|
|
PV0f.x = R124f.x;
|
|
R123f.y = (R125f.y * intBitsToFloat(0x40400000) + intBitsToFloat(0xbdcccccd));
|
|
PV0f.y = R123f.y;
|
|
R124f.z = (mul_nonIEEE(PS1f,R127f.w) + R5f.z);
|
|
PV0f.z = R124f.z;
|
|
R127f.w = (mul_nonIEEE(backupReg0f,backupReg1f) + R5f.y);
|
|
PV0f.w = R127f.w;
|
|
PS0f = 1.0 / PV1f.x;
|
|
// 13
|
|
PV1f.x = mul_nonIEEE(PV0f.y, PS0f);
|
|
PV1f.x = clamp(PV1f.x, 0.0, 1.0);
|
|
PV1f.y = R125f.x + -(PV0f.x);
|
|
PV1f.z = R127f.y + -(PV0f.w);
|
|
PV1f.w = R126f.z + -(PV0f.z);
|
|
// 14
|
|
R123f.y = (mul_nonIEEE(PV1f.z,PV1f.x) + R127f.w);
|
|
PV0f.y = R123f.y;
|
|
R123f.z = (mul_nonIEEE(PV1f.y,PV1f.x) + R124f.x);
|
|
PV0f.z = R123f.z;
|
|
R123f.w = (mul_nonIEEE(PV1f.w,PV1f.x) + R124f.z);
|
|
PV0f.w = R123f.w;
|
|
// 15
|
|
R123f.y = (mul_nonIEEE(PV0f.w,R0f.w) + R6f.x);
|
|
PV1f.y = R123f.y;
|
|
R123f.z = (mul_nonIEEE(PV0f.y,R1f.x) + R1f.y);
|
|
PV1f.z = R123f.z;
|
|
R123f.w = (mul_nonIEEE(PV0f.z,R6f.y) + R1f.z);
|
|
PV1f.w = R123f.w;
|
|
// 16
|
|
PV0f.x = mul_nonIEEE(PV1f.w, R7f.w);
|
|
PV0f.z = mul_nonIEEE(PV1f.y, R7f.w);
|
|
PV0f.w = mul_nonIEEE(PV1f.z, R7f.w);
|
|
// 17
|
|
R124f.x = (R7f.y * intBitsToFloat(0x40400000) + PV0f.w);
|
|
PV1f.x = R124f.x;
|
|
R127f.y = (R7f.x * intBitsToFloat(0x40400000) + PV0f.x);
|
|
PV1f.y = R127f.y;
|
|
R127f.w = (R7f.z * intBitsToFloat(0x40400000) + PV0f.z);
|
|
PV1f.w = R127f.w;
|
|
// 18
|
|
PV0f.x = R8f.z + -(PV1f.w);
|
|
PV0f.y = R8f.y + -(PV1f.x);
|
|
PV0f.z = R8f.x + -(PV1f.y);
|
|
// 19
|
|
R123f.x = (mul_nonIEEE(PV0f.x,intBitsToFloat(uf_remappedPS[3].x)) + R127f.w);
|
|
PV1f.x = R123f.x;
|
|
R123f.z = (mul_nonIEEE(PV0f.y,intBitsToFloat(uf_remappedPS[3].x)) + R124f.x);
|
|
PV1f.z = R123f.z;
|
|
R123f.w = (mul_nonIEEE(PV0f.z,intBitsToFloat(uf_remappedPS[3].x)) + R127f.y);
|
|
PV1f.w = R123f.w;
|
|
// 20
|
|
PV0f.x = max(PV1f.w, 0.0);
|
|
R127f.y = max(PV1f.z, 0.0);
|
|
PV0f.y = R127f.y;
|
|
R124f.z = max(PV1f.x, 0.0);
|
|
PV0f.z = R124f.z;
|
|
// 21
|
|
tempf.x = dot(vec4(PV0f.x,PV0f.y,PV0f.z,-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0));
|
|
PV1f.x = tempf.x;
|
|
PV1f.y = tempf.x;
|
|
PV1f.z = tempf.x;
|
|
PV1f.w = tempf.x;
|
|
tempResultf = log2(PV0f.x);
|
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
|
PS1f = tempResultf;
|
|
// 22
|
|
PV0f.x = mul_nonIEEE(intBitsToFloat(uf_remappedPS[2].z), PV1f.x);
|
|
R7f.w = PS1f * intBitsToFloat(0x3ee8ba2e);
|
|
tempResultf = log2(R127f.y);
|
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
|
PS0f = tempResultf;
|
|
// 23
|
|
R8f.x = PV0f.x + 1.0;
|
|
R8f.y = PS0f * intBitsToFloat(0x3ee8ba2e);
|
|
R8f.z = (mul_nonIEEE(PV0f.x,R1f.w) + 1.0);
|
|
tempResultf = log2(R124f.z);
|
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
|
R7f.z = tempResultf;
|
|
PS1f = R7f.z;
|
|
// 0
|
|
R124f.x = R7f.z * intBitsToFloat(0x3ee8ba2e);
|
|
PV0f.y = mul_nonIEEE(intBitsToFloat(uf_remappedPS[2].z), R8f.z);
|
|
PS0f = 1.0 / R8f.x;
|
|
// 1
|
|
R123f.z = (mul_nonIEEE(PV0f.y,PS0f) + -(1.0));
|
|
PV1f.z = R123f.z;
|
|
R124f.z = exp2(R7f.w);
|
|
PS1f = R124f.z;
|
|
// 2
|
|
R123f.y = (mul_nonIEEE(intBitsToFloat(uf_remappedPS[2].x),PV1f.z) + 1.0);
|
|
PV0f.y = R123f.y;
|
|
R127f.w = exp2(R8f.y);
|
|
PS0f = R127f.w;
|
|
// 3
|
|
backupReg0f = R124f.x;
|
|
PV1f.x = max(PV0f.y, 0.0);
|
|
R124f.x = exp2(backupReg0f);
|
|
PS1f = R124f.x;
|
|
// 4
|
|
tempResultf = log2(PV1f.x);
|
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
|
PS0f = tempResultf;
|
|
// 5
|
|
PV1f.z = PS0f * intBitsToFloat(0x3ee8ba2e);
|
|
// 6
|
|
PS0f = exp2(PV1f.z);
|
|
// 7
|
|
R9f.x = mul_nonIEEE(PS0f, R124f.z);
|
|
R9f.y = mul_nonIEEE(PS0f, R127f.w);
|
|
R9f.z = mul_nonIEEE(PS0f, R124f.x);
|
|
// export
|
|
passPixelColor0 = vec4(R9f.x, R9f.y, R9f.z, R9f.w);
|
|
}
|