mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-30 05:14:14 +01:00
183 lines
5.4 KiB
Plaintext
183 lines
5.4 KiB
Plaintext
|
#version 400
|
||
|
#extension GL_ARB_texture_gather : enable
|
||
|
// shader ceba17482659c1bd //temple of time light fix.
|
||
|
const float overwriteWidth = 640.0; //overwidth value.0
|
||
|
const float overwriteHeight = 480.0;
|
||
|
uniform ivec4 uf_remappedPS[6];
|
||
|
uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5054000 res 640x360x1 dim 1 tm: 4 format 080e compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
|
||
|
uniform sampler2D textureUnitPS1;// Tex1 addr 0xf494a800 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: 1
|
||
|
in vec4 passParameter0;
|
||
|
noperspective in vec4 passParameter1;
|
||
|
layout(location = 0) out vec4 passPixelColor0;
|
||
|
layout(location = 1) out vec4 passPixelColor1;
|
||
|
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 R122f = 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 = gl_FragCoord.xyzw;
|
||
|
R1f = passParameter1;
|
||
|
vec2 scaleFactor = vec2(overwriteWidth,overwriteHeight)/vec2(1280.0,720.0);
|
||
|
R0f.xy = R0f.xy / scaleFactor;
|
||
|
// 0
|
||
|
R4f.x = 0.0;
|
||
|
PV0f.x = R4f.x;
|
||
|
R3f.w = 0.0;
|
||
|
PV0f.w = R3f.w;
|
||
|
PS0f = 1.0 / intBitsToFloat(uf_remappedPS[0].x);
|
||
|
// 1
|
||
|
R2f.x = R0f.x * PS0f;
|
||
|
PV1f.x = R2f.x;
|
||
|
PS1f = 1.0 / intBitsToFloat(uf_remappedPS[0].y);
|
||
|
// 2
|
||
|
R2f.y = R0f.y * PS1f;
|
||
|
PV0f.y = R2f.y;
|
||
|
R0f.w = (texture(textureUnitPS0, R2f.xy).x);
|
||
|
R2f.xyz = (texture(textureUnitPS1, R2f.xy).xyz);
|
||
|
// 0
|
||
|
R126f.x = (R2f.x * intBitsToFloat(0x40000000) + -(1.0));
|
||
|
PV0f.x = R126f.x;
|
||
|
R126f.y = (R2f.y * intBitsToFloat(0x40000000) + -(1.0));
|
||
|
PV0f.y = R126f.y;
|
||
|
R125f.z = (R2f.z * intBitsToFloat(0x40000000) + -(1.0));
|
||
|
PV0f.z = R125f.z;
|
||
|
R123f.w = (intBitsToFloat(uf_remappedPS[1].y) * R0f.w + intBitsToFloat(uf_remappedPS[1].x));
|
||
|
PV0f.w = R123f.w;
|
||
|
// 1
|
||
|
R127f.x = (R1f.x * -(PV0f.w) + -(intBitsToFloat(uf_remappedPS[2].x)));
|
||
|
PV1f.x = R127f.x;
|
||
|
R127f.y = (R1f.y * -(PV0f.w) + -(intBitsToFloat(uf_remappedPS[2].y)));
|
||
|
PV1f.y = R127f.y;
|
||
|
R127f.z = (R1f.z * -(PV0f.w) + -(intBitsToFloat(uf_remappedPS[2].z)));
|
||
|
PV1f.z = R127f.z;
|
||
|
PS1f = PV0f.z * PV0f.z;
|
||
|
// 2
|
||
|
tempf.x = PV1f.x * PV1f.x + PV1f.y * PV1f.y + PV1f.z * PV1f.z + intBitsToFloat(0x80000000) * 0.0;
|
||
|
PV0f.x = tempf.x;
|
||
|
PV0f.y = tempf.x;
|
||
|
PV0f.z = tempf.x;
|
||
|
PV0f.w = tempf.x;
|
||
|
R122f.x = (R126f.y * R126f.y + PS1f);
|
||
|
PS0f = R122f.x;
|
||
|
// 3
|
||
|
R126f.z = (R126f.x * R126f.x + PS0f);
|
||
|
PV1f.z = R126f.z;
|
||
|
tempResultf = 1.0 / sqrt(PV0f.x);
|
||
|
PS1f = tempResultf;
|
||
|
// 4
|
||
|
backupReg0f = R127f.x;
|
||
|
backupReg1f = R127f.y;
|
||
|
backupReg2f = R127f.z;
|
||
|
R127f.x = mul_nonIEEE(backupReg0f, PS1f);
|
||
|
PV0f.x = R127f.x;
|
||
|
R127f.y = mul_nonIEEE(backupReg1f, PS1f);
|
||
|
PV0f.y = R127f.y;
|
||
|
R127f.z = mul_nonIEEE(backupReg2f, PS1f);
|
||
|
PV0f.z = R127f.z;
|
||
|
PS0f = 1.0 / PS1f;
|
||
|
// 5
|
||
|
PV1f.x = mul_nonIEEE(PV0f.z, intBitsToFloat(uf_remappedPS[3].z));
|
||
|
PV1f.w = intBitsToFloat(uf_remappedPS[4].w) * PS0f;
|
||
|
PV1f.w = clamp(PV1f.w, 0.0, 1.0);
|
||
|
tempResultf = 1.0 / sqrt(R126f.z);
|
||
|
PS1f = tempResultf;
|
||
|
// 6
|
||
|
backupReg0f = R126f.x;
|
||
|
backupReg1f = R126f.y;
|
||
|
R126f.x = mul_nonIEEE(backupReg0f, PS1f);
|
||
|
PV0f.x = R126f.x;
|
||
|
R126f.y = mul_nonIEEE(backupReg1f, PS1f);
|
||
|
PV0f.y = R126f.y;
|
||
|
PV0f.z = mul_nonIEEE(R125f.z, PS1f);
|
||
|
PV0f.w = -(PV1f.w) + 1.0;
|
||
|
R122f.x = (R127f.y * intBitsToFloat(uf_remappedPS[3].y) + PV1f.x);
|
||
|
PS0f = R122f.x;
|
||
|
// 7
|
||
|
PV1f.x = mul_nonIEEE(PV0f.z, R127f.z);
|
||
|
R123f.w = (R127f.x * intBitsToFloat(uf_remappedPS[3].x) + PS0f);
|
||
|
PV1f.w = R123f.w;
|
||
|
tempResultf = log2(PV0f.w);
|
||
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
||
|
R125f.y = tempResultf;
|
||
|
PS1f = R125f.y;
|
||
|
// 8
|
||
|
tempf.x = R126f.x * R127f.x + R126f.y * R127f.y + PV1f.x * 1.0 + intBitsToFloat(0x80000000) * 0.0;
|
||
|
PV0f.x = tempf.x;
|
||
|
PV0f.y = tempf.x;
|
||
|
PV0f.z = tempf.x;
|
||
|
PV0f.w = tempf.x;
|
||
|
R122f.x = (PV1f.w * intBitsToFloat(uf_remappedPS[5].y) + -(intBitsToFloat(uf_remappedPS[5].z)));
|
||
|
R122f.x = clamp(R122f.x, 0.0, 1.0);
|
||
|
PS0f = R122f.x;
|
||
|
// 9
|
||
|
PV1f.x = mul_nonIEEE(intBitsToFloat(uf_remappedPS[2].w), R125f.y);
|
||
|
PV1f.y = max(-(PV0f.x), 0.0);
|
||
|
tempResultf = log2(PS0f);
|
||
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
||
|
PS1f = tempResultf;
|
||
|
// 10
|
||
|
PV0f.x = min(PV1f.y, 1.0);
|
||
|
PV0f.y = mul_nonIEEE(intBitsToFloat(uf_remappedPS[3].w), PS1f);
|
||
|
PS0f = exp2(PV1f.x);
|
||
|
// 11
|
||
|
PV1f.z = mul_nonIEEE(PS0f, PV0f.x);
|
||
|
PS1f = exp2(PV0f.y);
|
||
|
// 12
|
||
|
PV0f.y = mul_nonIEEE(PS1f, PV1f.z);
|
||
|
PV0f.y = clamp(PV0f.y, 0.0, 1.0);
|
||
|
// 13
|
||
|
R3f.x = mul_nonIEEE(intBitsToFloat(uf_remappedPS[4].x), PV0f.y);
|
||
|
PV1f.x = R3f.x;
|
||
|
R3f.y = mul_nonIEEE(intBitsToFloat(uf_remappedPS[4].y), PV0f.y);
|
||
|
PV1f.y = R3f.y;
|
||
|
R3f.z = mul_nonIEEE(intBitsToFloat(uf_remappedPS[4].z), PV0f.y);
|
||
|
PV1f.z = R3f.z;
|
||
|
// 14
|
||
|
R0f.x = PV1f.x;
|
||
|
PV0f.x = R0f.x;
|
||
|
R0f.y = PV1f.y;
|
||
|
PV0f.y = R0f.y;
|
||
|
R0f.z = PV1f.z;
|
||
|
PV0f.z = R0f.z;
|
||
|
R0f.w = R3f.w;
|
||
|
PV0f.w = R0f.w;
|
||
|
// 15
|
||
|
R1f.x = R4f.x;
|
||
|
PV1f.x = R1f.x;
|
||
|
R1f.y = R4f.x;
|
||
|
PV1f.y = R1f.y;
|
||
|
R1f.z = R4f.x;
|
||
|
PV1f.z = R1f.z;
|
||
|
R1f.w = R4f.w;
|
||
|
PV1f.w = R1f.w;
|
||
|
// export
|
||
|
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
|
||
|
passPixelColor1 = vec4(R1f.x, R1f.y, R1f.z, R1f.w);
|
||
|
}
|