mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-27 18:31:50 +01:00
1e84898525
anti-aliasing is still a work in progress, need to figure out how to properly fix it
227 lines
10 KiB
Plaintext
227 lines
10 KiB
Plaintext
#version 420
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
#extension GL_EXT_gpu_shader4 : enable
|
|
// shader 9e9abde99f9510dc
|
|
uniform float uf_alphaTestRef;
|
|
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf489e000 res 1280x720x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 0 border: 0
|
|
layout(location = 0) in vec4 passParameterSem129;
|
|
layout(location = 1) in vec4 passParameterSem128;
|
|
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()
|
|
{
|
|
ivec4 R0i = ivec4(0);
|
|
ivec4 R1i = ivec4(0);
|
|
ivec4 R2i = ivec4(0);
|
|
ivec4 R3i = ivec4(0);
|
|
ivec4 R4i = ivec4(0);
|
|
ivec4 R5i = ivec4(0);
|
|
ivec4 R6i = ivec4(0);
|
|
ivec4 R7i = ivec4(0);
|
|
ivec4 R8i = ivec4(0);
|
|
ivec4 R122i = 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;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0i = floatBitsToInt(passParameterSem129);
|
|
R1i = floatBitsToInt(passParameterSem128);
|
|
R5i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.zw)).xyz);
|
|
R6i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).xyz);
|
|
|
|
ivec2 resolution = textureSize2D(textureUnitPS0,0);
|
|
float iresX = float(resolution.x)/float(1280);
|
|
float iresY = float(resolution.y)/float(720);
|
|
|
|
// 0
|
|
backupReg0i = R0i.y;
|
|
backupReg1i = R0i.x;
|
|
PV0i.x = 0;
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(backupReg0i) / iresY);
|
|
PV0i.z = 0;
|
|
R127i.w = floatBitsToInt(intBitsToFloat(backupReg1i) / iresX);
|
|
PV0i.w = R127i.w;
|
|
R8i.w = 0x3f800000;
|
|
PS0i = R8i.w;
|
|
// 1
|
|
R2i.x = floatBitsToInt(intBitsToFloat(R1i.z) + intBitsToFloat(PV0i.w));
|
|
R2i.y = floatBitsToInt(intBitsToFloat(R1i.w) + intBitsToFloat(PV0i.x));
|
|
R3i.z = floatBitsToInt(intBitsToFloat(PV0i.z) + intBitsToFloat(R1i.z));
|
|
PV1i.w = PV0i.y;
|
|
R3i.y = floatBitsToInt(intBitsToFloat(PV0i.y) + intBitsToFloat(R1i.w));
|
|
PS1i = R3i.y;
|
|
// 2
|
|
R4i.x = floatBitsToInt(intBitsToFloat(R1i.z) + intBitsToFloat(R127i.w));
|
|
R4i.y = floatBitsToInt(intBitsToFloat(R1i.w) + intBitsToFloat(PV1i.w));
|
|
R0i.z = floatBitsToInt(intBitsToFloat(R6i.z) * intBitsToFloat(0x3de978d5));
|
|
R3i.x = floatBitsToInt(intBitsToFloat(R5i.z) * intBitsToFloat(0x3de978d5));
|
|
PS0i = R3i.x;
|
|
R2i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R2i.xy)).xyz);
|
|
R7i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R3i.zy)).xyz);
|
|
R4i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R4i.xy)).xyz);
|
|
// 0
|
|
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R5i.x),intBitsToFloat(R5i.y),intBitsToFloat(R3i.x),-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),1.0,0.0)));
|
|
PV0i.x = tempi.x;
|
|
PV0i.y = tempi.x;
|
|
PV0i.z = tempi.x;
|
|
PV0i.w = tempi.x;
|
|
R127i.z = tempi.x;
|
|
R122i.x = floatBitsToInt((intBitsToFloat(R6i.y) * intBitsToFloat(0x3f1645a2) + intBitsToFloat(R0i.z)));
|
|
PS0i = R122i.x;
|
|
// 1
|
|
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R2i.x),intBitsToFloat(R2i.y),intBitsToFloat(R2i.z),-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0)));
|
|
PV1i.x = tempi.x;
|
|
PV1i.y = tempi.x;
|
|
PV1i.z = tempi.x;
|
|
PV1i.w = tempi.x;
|
|
R127i.y = tempi.x;
|
|
R126i.z = floatBitsToInt((intBitsToFloat(R6i.x) * intBitsToFloat(0x3e991687) + intBitsToFloat(PS0i)));
|
|
PS1i = R126i.z;
|
|
// 2
|
|
R126i.x = floatBitsToInt(dot(vec4(intBitsToFloat(R7i.x),intBitsToFloat(R7i.y),intBitsToFloat(R7i.z),-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0)));
|
|
PV0i.x = R126i.x;
|
|
PV0i.y = R126i.x;
|
|
PV0i.z = R126i.x;
|
|
PV0i.w = R126i.x;
|
|
R127i.x = floatBitsToInt(intBitsToFloat(R127i.z) + intBitsToFloat(PV1i.x));
|
|
PS0i = R127i.x;
|
|
// 3
|
|
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R4i.x),intBitsToFloat(R4i.y),intBitsToFloat(R4i.z),-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0)));
|
|
PV1i.x = tempi.x;
|
|
PV1i.y = tempi.x;
|
|
PV1i.z = tempi.x;
|
|
PV1i.w = tempi.x;
|
|
R127i.w = tempi.x;
|
|
PS1i = floatBitsToInt(intBitsToFloat(PV0i.x) + intBitsToFloat(PS0i));
|
|
// 4
|
|
PV0i.x = floatBitsToInt(intBitsToFloat(R127i.y) + intBitsToFloat(PV1i.x));
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(R126i.x) + intBitsToFloat(PV1i.x));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R127i.z) + intBitsToFloat(R126i.x));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(PV1i.x) + intBitsToFloat(PS1i));
|
|
R126i.y = floatBitsToInt(min(intBitsToFloat(R127i.z), intBitsToFloat(R127i.y)));
|
|
PS0i = R126i.y;
|
|
// 5
|
|
backupReg0i = R127i.x;
|
|
backupReg1i = R127i.z;
|
|
backupReg2i = R127i.y;
|
|
R127i.x = floatBitsToInt(-(intBitsToFloat(PV0i.x)) + intBitsToFloat(PV0i.z));
|
|
PV1i.x = R127i.x;
|
|
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.w) * intBitsToFloat(0x3d000000));
|
|
R127i.z = floatBitsToInt(min(intBitsToFloat(R126i.x), intBitsToFloat(R127i.w)));
|
|
PV1i.w = floatBitsToInt(-(intBitsToFloat(PV0i.y)) + intBitsToFloat(backupReg0i));
|
|
R127i.y = floatBitsToInt(max(intBitsToFloat(backupReg1i), intBitsToFloat(backupReg2i)));
|
|
PS1i = R127i.y;
|
|
// 6
|
|
backupReg0i = R126i.x;
|
|
backupReg1i = R127i.w;
|
|
R126i.x = floatBitsToInt(-(intBitsToFloat(PV1i.w)));
|
|
PV0i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), -(intBitsToFloat(PV1i.x))));
|
|
PV0i.z = floatBitsToInt(max(-(intBitsToFloat(PV1i.w)), intBitsToFloat(PV1i.w)));
|
|
R127i.w = floatBitsToInt(max(intBitsToFloat(PV1i.y), intBitsToFloat(0x3c000000)));
|
|
PS0i = floatBitsToInt(max(intBitsToFloat(backupReg0i), intBitsToFloat(backupReg1i)));
|
|
// 7
|
|
PV1i.x = floatBitsToInt(min(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y)));
|
|
PV1i.y = floatBitsToInt(max(intBitsToFloat(R127i.y), intBitsToFloat(PS0i)));
|
|
PV1i.w = floatBitsToInt(min(intBitsToFloat(R126i.y), intBitsToFloat(R127i.z)));
|
|
// 8
|
|
R2i.x = floatBitsToInt(max(intBitsToFloat(R126i.z), intBitsToFloat(PV1i.y)));
|
|
R2i.z = floatBitsToInt(min(intBitsToFloat(R126i.z), intBitsToFloat(PV1i.w)));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(PV1i.x));
|
|
// 9
|
|
PS1i = floatBitsToInt(1.0 / intBitsToFloat(PV0i.w));
|
|
// 10
|
|
PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PS1i)));
|
|
PV0i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R126i.x), intBitsToFloat(PS1i)));
|
|
// 11
|
|
PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), intBitsToFloat(0xc1000000)));
|
|
PV1i.w = floatBitsToInt(max(intBitsToFloat(PV0i.y), intBitsToFloat(0xc1000000)));
|
|
// 12
|
|
PV0i.y = floatBitsToInt(min(intBitsToFloat(PV1i.w), intBitsToFloat(0x41000000)));
|
|
PV0i.w = floatBitsToInt(min(intBitsToFloat(PV1i.z), intBitsToFloat(0x41000000)));
|
|
// 13
|
|
R126i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R0i.x), intBitsToFloat(PV0i.y)));
|
|
PV1i.z = R126i.z;
|
|
R127i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R0i.y), intBitsToFloat(PV0i.w)));
|
|
PV1i.w = R127i.w;
|
|
// 14
|
|
R0i.x = floatBitsToInt((intBitsToFloat(PV1i.z) * intBitsToFloat(0x3e2aaaac) + intBitsToFloat(R1i.x)));
|
|
R0i.y = floatBitsToInt((intBitsToFloat(PV1i.w) * intBitsToFloat(0x3e2aaaac) + intBitsToFloat(R1i.y)));
|
|
R4i.z = floatBitsToInt((intBitsToFloat(PV1i.z) * intBitsToFloat(0xbe2aaaaa) + intBitsToFloat(R1i.x)));
|
|
R4i.w = floatBitsToInt((intBitsToFloat(PV1i.w) * intBitsToFloat(0xbe2aaaaa) + intBitsToFloat(R1i.y)));
|
|
R4i.x = floatBitsToInt((intBitsToFloat(PV1i.z) * 0.5 + intBitsToFloat(R1i.x)));
|
|
PS0i = R4i.x;
|
|
// 15
|
|
backupReg0i = R1i.x;
|
|
R1i.x = floatBitsToInt((-(intBitsToFloat(R126i.z)) * 0.5 + intBitsToFloat(backupReg0i)));
|
|
R4i.y = floatBitsToInt((intBitsToFloat(R127i.w) * 0.5 + intBitsToFloat(R1i.y)));
|
|
R1i.z = floatBitsToInt((-(intBitsToFloat(R127i.w)) * 0.5 + intBitsToFloat(R1i.y)));
|
|
R0i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R0i.xy)).xyz);
|
|
R7i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R4i.zw)).xyz);
|
|
R4i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R4i.xy)).xyz);
|
|
R1i.xyz = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xz)).xyz);
|
|
// 0
|
|
R126i.x = floatBitsToInt(intBitsToFloat(R0i.z) + intBitsToFloat(R7i.z));
|
|
R126i.x = floatBitsToInt(intBitsToFloat(R126i.x) / 2.0);
|
|
R127i.z = floatBitsToInt(intBitsToFloat(R0i.y) + intBitsToFloat(R7i.y));
|
|
R127i.z = floatBitsToInt(intBitsToFloat(R127i.z) / 2.0);
|
|
PV0i.z = R127i.z;
|
|
R127i.w = floatBitsToInt(intBitsToFloat(R0i.x) + intBitsToFloat(R7i.x));
|
|
R127i.w = floatBitsToInt(intBitsToFloat(R127i.w) / 2.0);
|
|
PV0i.w = R127i.w;
|
|
// 1
|
|
PV1i.x = floatBitsToInt(intBitsToFloat(R4i.x) + intBitsToFloat(R1i.x));
|
|
PV1i.y = PV0i.w;
|
|
PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) / 2.0);
|
|
R126i.z = floatBitsToInt(intBitsToFloat(R4i.z) + intBitsToFloat(R1i.z));
|
|
PV1i.w = floatBitsToInt(intBitsToFloat(R4i.y) + intBitsToFloat(R1i.y));
|
|
PS1i = PV0i.z;
|
|
PS1i = floatBitsToInt(intBitsToFloat(PS1i) / 2.0);
|
|
// 2
|
|
R127i.x = floatBitsToInt((intBitsToFloat(PV1i.x) * 0.25 + intBitsToFloat(PV1i.y)));
|
|
R127i.y = floatBitsToInt((intBitsToFloat(PV1i.w) * 0.25 + intBitsToFloat(PS1i)));
|
|
PV0i.w = R126i.x;
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(PV0i.w) / 2.0);
|
|
// 3
|
|
backupReg0i = R126i.z;
|
|
R126i.z = floatBitsToInt((intBitsToFloat(backupReg0i) * 0.25 + intBitsToFloat(PV0i.w)));
|
|
PV1i.z = R126i.z;
|
|
// 4
|
|
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R127i.x),intBitsToFloat(R127i.y),intBitsToFloat(PV1i.z),-0.0),vec4(intBitsToFloat(0x3e991687),intBitsToFloat(0x3f1645a2),intBitsToFloat(0x3de978d5),0.0)));
|
|
PV0i.x = tempi.x;
|
|
PV0i.y = tempi.x;
|
|
PV0i.z = tempi.x;
|
|
PV0i.w = tempi.x;
|
|
// 5
|
|
PV1i.y = ((intBitsToFloat(PV0i.x) > intBitsToFloat(R2i.x))?int(0xFFFFFFFF):int(0x0));
|
|
PV1i.z = ((intBitsToFloat(R2i.z) > intBitsToFloat(PV0i.x))?int(0xFFFFFFFF):int(0x0));
|
|
// 6
|
|
R123i.x = ((PV1i.z == 0)?(PV1i.y):(int(-1)));
|
|
PV0i.x = R123i.x;
|
|
// 7
|
|
R8i.x = ((PV0i.x == 0)?(R127i.x):(R127i.w));
|
|
R8i.y = ((PV0i.x == 0)?(R127i.y):(R127i.z));
|
|
R8i.z = ((PV0i.x == 0)?(R126i.z):(R126i.x));
|
|
// export
|
|
if( ((vec4(intBitsToFloat(R8i.x), intBitsToFloat(R8i.y), intBitsToFloat(R8i.z), intBitsToFloat(R8i.w))).a > uf_alphaTestRef) == false) discard;
|
|
passPixelColor0 = vec4(intBitsToFloat(R8i.x), intBitsToFloat(R8i.y), intBitsToFloat(R8i.z), intBitsToFloat(R8i.w));
|
|
}
|