mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-23 01:59:18 +01:00
212 lines
7.4 KiB
Plaintext
212 lines
7.4 KiB
Plaintext
#version 400
|
|
#extension GL_ARB_texture_gather : enable //DOF light bath scene
|
|
const float overwriteWidth = 3200.0; //overwidth value.0
|
|
const float overwriteHeight = 1800.0;
|
|
|
|
|
|
// shader 5c8493f4fb8147f3
|
|
uniform ivec4 uf_remappedPS[4];
|
|
uniform sampler3D textureUnitPS1;// Tex1 addr 0x3dd9c800 res 32x32x32 dim 2 tm: 7 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x6) sliceView: 0x0 (num 0x20) Sampler1 ClampX/Y/Z: 0 0 0 border: 1
|
|
in vec4 passParameter0;
|
|
in vec4 passParameter1;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
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()
|
|
{
|
|
ivec4 R0i = ivec4(0);
|
|
ivec4 R1i = ivec4(0);
|
|
ivec4 R2i = ivec4(0);
|
|
ivec4 R3i = ivec4(0);
|
|
ivec4 R123i = ivec4(0);
|
|
ivec4 R126i = ivec4(0);
|
|
ivec4 R127i = ivec4(0);
|
|
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
|
|
ivec4 PV0i = ivec4(0), PV1i = ivec4(0);
|
|
int PS0i = 0, PS1i = 0;
|
|
ivec4 tempi = ivec4(0);
|
|
float tempResultf;
|
|
int tempResulti;
|
|
ivec4 ARi = ivec4(0);
|
|
bool predResult = true;
|
|
bool activeMaskStack[3];
|
|
bool activeMaskStackC[4];
|
|
activeMaskStack[0] = false;
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[0] = false;
|
|
activeMaskStackC[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
activeMaskStack[0] = true;
|
|
activeMaskStackC[0] = true;
|
|
activeMaskStackC[1] = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0i = floatBitsToInt(gl_FragCoord.xyzw);
|
|
R1i = floatBitsToInt(passParameter1);
|
|
|
|
vec2 scaleFactor = vec2(overwriteWidth,overwriteHeight)/vec2(1280.0,720.0); // factor = newResolution / expectedResolution
|
|
// //R4i.xyzw = floatBitsToInt(textureGather(textureUnitPS1, intBitsToFloat(R0i.xy)).wzxy);
|
|
//vec2 scaleFactor = vec2(overwriteWidth,overwriteHeight)/vec2(textureGather(textureUnitPS5.x), textureGather(textureUnitPS5.y));
|
|
R0i.xy = floatBitsToInt(intBitsToFloat(R0i.xy) / scaleFactor);
|
|
|
|
if( activeMaskStackC[1] == true ) {
|
|
activeMaskStack[1] = activeMaskStack[0];
|
|
activeMaskStackC[2] = activeMaskStackC[1];
|
|
// 0
|
|
backupReg0i = R1i.y;
|
|
backupReg1i = R1i.z;
|
|
backupReg2i = R1i.x;
|
|
R1i.x = floatBitsToInt(1.0);
|
|
PV0i.x = R1i.x;
|
|
R1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg0i), intBitsToFloat(uf_remappedPS[0].x)));
|
|
PV0i.y = R1i.y;
|
|
R1i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg1i), intBitsToFloat(uf_remappedPS[0].x)));
|
|
PV0i.z = R1i.z;
|
|
PV0i.w = floatBitsToInt(-(intBitsToFloat(uf_remappedPS[1].w)) + intBitsToFloat(0x3f59999a));
|
|
R3i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg2i), intBitsToFloat(uf_remappedPS[0].x)));
|
|
PS0i = R3i.x;
|
|
// 1
|
|
R0i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(0x3f969696)));
|
|
R0i.z = clampFI32(R0i.z);
|
|
PV1i.z = R0i.z;
|
|
// 2
|
|
predResult = (1.0 > intBitsToFloat(uf_remappedPS[1].w));
|
|
activeMaskStack[1] = predResult;
|
|
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
R2i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R3i.x), intBitsToFloat(uf_remappedPS[2].z)));
|
|
PV0i.x = R2i.x;
|
|
R2i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.y), intBitsToFloat(uf_remappedPS[2].z)));
|
|
PV0i.y = R2i.y;
|
|
R2i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.z), intBitsToFloat(uf_remappedPS[2].z)));
|
|
PV0i.z = R2i.z;
|
|
R3i.y = R1i.z;
|
|
R3i.y = floatBitsToInt(intBitsToFloat(R3i.y) / 2.0);
|
|
PS0i = R3i.y;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
R0i.w = floatBitsToInt(texture(textureUnitPS1, vec3(intBitsToFloat(R2i.x),intBitsToFloat(R2i.y),intBitsToFloat(R2i.z))).x);
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
R2i.x = R3i.x;
|
|
R2i.x = floatBitsToInt(intBitsToFloat(R2i.x) / 2.0);
|
|
PV0i.x = R2i.x;
|
|
R2i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.y), intBitsToFloat(uf_remappedPS[2].y)));
|
|
PV0i.y = R2i.y;
|
|
R2i.z = floatBitsToInt((intBitsToFloat(uf_remappedPS[2].w) * intBitsToFloat(R0i.w) + intBitsToFloat(R3i.y)));
|
|
PV0i.z = R2i.z;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
R1i.z = floatBitsToInt(texture(textureUnitPS1, vec3(intBitsToFloat(R2i.x),intBitsToFloat(R2i.y),intBitsToFloat(R2i.z))).x);
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
if( (intBitsToFloat(R0i.z) > intBitsToFloat(R1i.z))) discard;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
activeMaskStack[2] = activeMaskStack[1];
|
|
activeMaskStackC[3] = activeMaskStackC[2];
|
|
// 0
|
|
predResult = (intBitsToFloat(R0i.z) > intBitsToFloat(R1i.z));
|
|
activeMaskStack[2] = predResult;
|
|
activeMaskStackC[3] = predResult == true && activeMaskStackC[2] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[2] = false;
|
|
activeMaskStackC[3] = false;
|
|
}
|
|
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
|
|
if( activeMaskStackC[1] == true ) {
|
|
activeMaskStack[1] = activeMaskStack[0];
|
|
activeMaskStackC[2] = activeMaskStackC[1];
|
|
// 0
|
|
predResult = (intBitsToFloat(uf_remappedPS[1].w) >= 1.0);
|
|
activeMaskStack[1] = predResult;
|
|
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
backupReg0i = R0i.x;
|
|
backupReg1i = R0i.y;
|
|
PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg0i), intBitsToFloat(0x3e800000)));
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(uf_remappedPS[1].z) + intBitsToFloat(uf_remappedPS[3].w));
|
|
PV0i.y = clampFI32(PV0i.y);
|
|
PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(backupReg1i), intBitsToFloat(0x3e800000)));
|
|
// 1
|
|
PV1i.y = floatBitsToInt(fract(intBitsToFloat(PV0i.w)));
|
|
PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 4.0);
|
|
PV1i.z = floatBitsToInt(fract(intBitsToFloat(PV0i.x)));
|
|
PV1i.z = floatBitsToInt(intBitsToFloat(PV1i.z) * 4.0);
|
|
R123i.w = floatBitsToInt((intBitsToFloat(PV0i.y) * intBitsToFloat(0x40e00000) + 1.0));
|
|
PV1i.w = R123i.w;
|
|
// 2
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(PV1i.z) + intBitsToFloat(PV1i.y));
|
|
R127i.z = int(intBitsToFloat(PV1i.w));
|
|
PS0i = R127i.z;
|
|
// 3
|
|
R127i.x = int(intBitsToFloat(PV0i.y));
|
|
PS1i = R127i.x;
|
|
// 4
|
|
R127i.w = floatBitsToInt(float(R127i.z));
|
|
PS0i = R127i.w;
|
|
// 5
|
|
R127i.z = floatBitsToInt(abs(intBitsToFloat(PS0i)));
|
|
PV1i.z = R127i.z;
|
|
R126i.z = floatBitsToInt(float(R127i.x));
|
|
PS1i = R126i.z;
|
|
// 6
|
|
R127i.y = floatBitsToInt(abs(intBitsToFloat(PS1i)));
|
|
PV0i.y = R127i.y;
|
|
PS0i = floatBitsToInt(1.0 / abs(intBitsToFloat(R127i.w)));
|
|
// 7
|
|
PV1i.x = floatBitsToInt(mul_nonIEEE(abs(intBitsToFloat(R126i.z)), intBitsToFloat(PS0i)));
|
|
// 8
|
|
PV0i.w = floatBitsToInt(trunc(intBitsToFloat(PV1i.x)));
|
|
// 9
|
|
R127i.x = floatBitsToInt((-(intBitsToFloat(PV0i.w)) * intBitsToFloat(R127i.z) + intBitsToFloat(R127i.y)));
|
|
PV1i.x = R127i.x;
|
|
// 10
|
|
PV0i.z = floatBitsToInt((intBitsToFloat(PV1i.x) >= abs(intBitsToFloat(R127i.w)))?1.0:0.0);
|
|
PV0i.w = floatBitsToInt(-(abs(intBitsToFloat(R127i.w))) + intBitsToFloat(PV1i.x));
|
|
// 11
|
|
R127i.y = ((intBitsToFloat(PV0i.z) == 0.0)?(R127i.x):(PV0i.w));
|
|
PV1i.y = R127i.y;
|
|
// 12
|
|
PV0i.x = floatBitsToInt(abs(intBitsToFloat(R127i.w)) + intBitsToFloat(PV1i.y));
|
|
// 13
|
|
R123i.w = ((-(intBitsToFloat(R127i.y)) > 0.0)?(PV0i.x):(R127i.y));
|
|
PV1i.w = R123i.w;
|
|
// 14
|
|
R123i.z = ((-(intBitsToFloat(R126i.z)) > 0.0)?(floatBitsToInt(-(intBitsToFloat(PV1i.w)))):(PV1i.w));
|
|
PV0i.z = R123i.z;
|
|
// 15
|
|
R123i.y = ((intBitsToFloat(R127i.w) == 0.0)?(R126i.z):(PV0i.z));
|
|
PV1i.y = R123i.y;
|
|
// 16
|
|
PS0i = int(intBitsToFloat(PV1i.y));
|
|
// 17
|
|
if( (PS0i == 0)) discard;
|
|
}
|
|
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
|
|
// export
|
|
passPixelColor0 = vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.x), intBitsToFloat(R1i.x), intBitsToFloat(R1i.x));
|
|
}
|