mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-28 12:24:14 +01:00
267 lines
11 KiB
Plaintext
267 lines
11 KiB
Plaintext
#version 430
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
// shader bc4963809a75b736
|
|
// Used for: Changing the brightness of the game's rendering for japanese copies of the game
|
|
|
|
|
|
#ifdef VULKAN
|
|
#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location)
|
|
#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140)
|
|
#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation)
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw)
|
|
#else
|
|
#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location)
|
|
#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140)
|
|
#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation)
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw)
|
|
#endif
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 2) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_remappedPS[3];
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform ivec4 uf_remappedPS[3];
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
|
TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1;
|
|
layout(location = 0) in vec4 passParameterSem128;
|
|
layout(location = 1) in vec4 passParameterSem129;
|
|
layout(location = 2) in vec4 passParameterSem130;
|
|
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){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));}
|
|
void main()
|
|
{
|
|
ivec4 R0i = ivec4(0);
|
|
ivec4 R1i = ivec4(0);
|
|
ivec4 R2i = ivec4(0);
|
|
ivec4 R3i = ivec4(0);
|
|
ivec4 R4i = ivec4(0);
|
|
ivec4 R123i = ivec4(0);
|
|
ivec4 R125i = 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[2];
|
|
bool activeMaskStackC[3];
|
|
activeMaskStack[0] = false;
|
|
activeMaskStackC[0] = false;
|
|
activeMaskStackC[1] = false;
|
|
activeMaskStack[0] = true;
|
|
activeMaskStackC[0] = true;
|
|
activeMaskStackC[1] = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0i = floatBitsToInt(passParameterSem128);
|
|
R1i = floatBitsToInt(passParameterSem129);
|
|
R2i = floatBitsToInt(passParameterSem130);
|
|
if( activeMaskStackC[1] == true ) {
|
|
R4i.xyz = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R1i.zw)).xyz);
|
|
R3i.xyzw = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R0i.xy),0.0).xyzw);
|
|
R1i.xzw = floatBitsToInt(textureGather(textureUnitPS0, intBitsToFloat(R1i.xy)).xzw);
|
|
}
|
|
if( activeMaskStackC[1] == true ) {
|
|
activeMaskStack[1] = activeMaskStack[0];
|
|
activeMaskStackC[2] = activeMaskStackC[1];
|
|
// 0
|
|
R127i.x = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)));
|
|
PV0i.y = floatBitsToInt(max(intBitsToFloat(R4i.z), intBitsToFloat(R3i.w)));
|
|
PV0i.z = floatBitsToInt(min(intBitsToFloat(R4i.z), intBitsToFloat(R3i.w)));
|
|
R127i.w = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)));
|
|
// 1
|
|
PV1i.x = floatBitsToInt(max(intBitsToFloat(R4i.x), intBitsToFloat(PV0i.y)));
|
|
PV1i.w = floatBitsToInt(min(intBitsToFloat(R4i.x), intBitsToFloat(PV0i.z)));
|
|
// 2
|
|
PV0i.x = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(R127i.x)));
|
|
PV0i.w = floatBitsToInt(min(intBitsToFloat(PV1i.w), intBitsToFloat(R127i.w)));
|
|
// 3
|
|
R127i.x = floatBitsToInt(intBitsToFloat(PV0i.x) + -(intBitsToFloat(PV0i.w)));
|
|
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.x), intBitsToFloat(uf_remappedPS[0].y)));
|
|
// 4
|
|
PV0i.z = floatBitsToInt(max(intBitsToFloat(PV1i.y), intBitsToFloat(uf_remappedPS[0].z)));
|
|
// 5
|
|
PV1i.w = ((intBitsToFloat(PV0i.z) > intBitsToFloat(R127i.x))?int(0xFFFFFFFF):int(0x0));
|
|
// 6
|
|
backupReg0i = R3i.y;
|
|
R1i.x = ((PV1i.w == 0)?(0):(R3i.x));
|
|
R3i.y = ((PV1i.w == 0)?(0):(0x3f800000));
|
|
R1i.z = ((PV1i.w == 0)?(0):(R3i.z));
|
|
R1i.y = ((PV1i.w == 0)?(0):(backupReg0i));
|
|
PS0i = R1i.y;
|
|
// 7
|
|
predResult = (R3i.y == 0);
|
|
activeMaskStack[1] = predResult;
|
|
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
|
|
}
|
|
else {
|
|
activeMaskStack[1] = false;
|
|
activeMaskStackC[2] = false;
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
R1i.y = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R2i.xy),0.0).w);
|
|
R2i.z = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R2i.zw),0.0).w);
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
R127i.x = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(0x3b2aaaab));
|
|
PV0i.x = R127i.x;
|
|
R127i.y = R4i.y;
|
|
PV0i.y = R127i.y;
|
|
R127i.z = 0;
|
|
PV0i.w = R1i.w;
|
|
// 1
|
|
PV1i.x = floatBitsToInt(-(intBitsToFloat(R1i.w)) + intBitsToFloat(PV0i.y));
|
|
PV1i.y = floatBitsToInt(intBitsToFloat(R2i.z) + -(intBitsToFloat(PV0i.x)));
|
|
PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.w), intBitsToFloat(R2i.z)));
|
|
PV1i.w = floatBitsToInt(max(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.y)));
|
|
R127i.w = floatBitsToInt(min(intBitsToFloat(PV0i.w), intBitsToFloat(R2i.z)));
|
|
PS1i = R127i.w;
|
|
// 2
|
|
backupReg0i = R127i.x;
|
|
backupReg1i = R127i.y;
|
|
R127i.x = floatBitsToInt(intBitsToFloat(PV1i.y) + intBitsToFloat(PV1i.x));
|
|
PV0i.x = R127i.x;
|
|
R127i.y = floatBitsToInt(intBitsToFloat(PV1i.y) + -(intBitsToFloat(PV1i.x)));
|
|
PV0i.y = R127i.y;
|
|
R4i.z = floatBitsToInt(max(intBitsToFloat(PV1i.z), intBitsToFloat(PV1i.w)));
|
|
PV0i.w = floatBitsToInt(min(intBitsToFloat(backupReg0i), intBitsToFloat(backupReg1i)));
|
|
// 3
|
|
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(PV0i.x),intBitsToFloat(PV0i.y),intBitsToFloat(R127i.z),-0.0),vec4(intBitsToFloat(PV0i.x),intBitsToFloat(PV0i.y),intBitsToFloat(R127i.z),0.0)));
|
|
PV1i.x = tempi.x;
|
|
PV1i.y = tempi.x;
|
|
PV1i.z = tempi.x;
|
|
PV1i.w = tempi.x;
|
|
R4i.w = floatBitsToInt(min(intBitsToFloat(R127i.w), intBitsToFloat(PV0i.w)));
|
|
PS1i = R4i.w;
|
|
// 4
|
|
tempResultf = 1.0 / sqrt(intBitsToFloat(PV1i.x));
|
|
PS0i = floatBitsToInt(tempResultf);
|
|
// 5
|
|
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.y), intBitsToFloat(PS0i)));
|
|
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PS0i)));
|
|
// 6
|
|
PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.y), intBitsToFloat(uf_remappedPS[1].z)));
|
|
PV0i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[1].w)));
|
|
R127i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[1].y)));
|
|
PV0i.z = R127i.z;
|
|
R127i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.y), intBitsToFloat(uf_remappedPS[1].x)));
|
|
PV0i.w = R127i.w;
|
|
// 7
|
|
backupReg0i = R0i.x;
|
|
backupReg1i = R0i.y;
|
|
backupReg0i = R0i.x;
|
|
PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), -(intBitsToFloat(PV0i.z))));
|
|
PV1i.y = floatBitsToInt(max(intBitsToFloat(PV0i.w), -(intBitsToFloat(PV0i.w))));
|
|
R2i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.x));
|
|
R2i.w = floatBitsToInt(intBitsToFloat(backupReg1i) + intBitsToFloat(PV0i.y));
|
|
R1i.x = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w));
|
|
PS1i = R1i.x;
|
|
// 8
|
|
R1i.y = floatBitsToInt(intBitsToFloat(R0i.y) + intBitsToFloat(R127i.z));
|
|
PV0i.w = floatBitsToInt(min(intBitsToFloat(PV1i.y), intBitsToFloat(PV1i.x)));
|
|
// 9
|
|
PV1i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x)));
|
|
// 10
|
|
PS0i = floatBitsToInt(1.0 / intBitsToFloat(PV1i.z));
|
|
// 11
|
|
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.w), intBitsToFloat(PS0i)));
|
|
PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.z), intBitsToFloat(PS0i)));
|
|
// 12
|
|
PV0i.y = floatBitsToInt(max(intBitsToFloat(PV1i.w), intBitsToFloat(0xc0000000)));
|
|
PV0i.z = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(0xc0000000)));
|
|
// 13
|
|
PV1i.x = floatBitsToInt(min(intBitsToFloat(PV0i.z), 2.0));
|
|
PV1i.w = floatBitsToInt(min(intBitsToFloat(PV0i.y), 2.0));
|
|
// 14
|
|
PV0i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[2].z)));
|
|
PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.w), intBitsToFloat(uf_remappedPS[2].w)));
|
|
// 15
|
|
backupReg0i = R0i.x;
|
|
backupReg1i = R0i.y;
|
|
backupReg0i = R0i.x;
|
|
backupReg1i = R0i.y;
|
|
R0i.xyz = floatBitsToInt(vec3(intBitsToFloat(backupReg0i),intBitsToFloat(backupReg1i),intBitsToFloat(backupReg0i)) + vec3(-(intBitsToFloat(PV0i.z)),-(intBitsToFloat(PV0i.w)),intBitsToFloat(PV0i.z)));
|
|
R0i.w = floatBitsToInt(intBitsToFloat(backupReg1i) + intBitsToFloat(PV0i.w));
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
R1i.xyzw = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R1i.xy),0.0).xyzw);
|
|
R2i.xyzw = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R2i.zw),0.0).xyzw);
|
|
R3i.xyzw = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R0i.xy),0.0).xyzw);
|
|
R0i.xyzw = floatBitsToInt(textureLod(textureUnitPS1, intBitsToFloat(R0i.zw),0.0).xyzw);
|
|
}
|
|
if( activeMaskStackC[2] == true ) {
|
|
// 0
|
|
R127i.x = floatBitsToInt(intBitsToFloat(R1i.z) + intBitsToFloat(R2i.z));
|
|
PV0i.x = R127i.x;
|
|
R127i.y = floatBitsToInt(intBitsToFloat(R1i.y) + intBitsToFloat(R2i.y));
|
|
PV0i.y = R127i.y;
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(R1i.x) + intBitsToFloat(R2i.x));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(R1i.w) + intBitsToFloat(R2i.w));
|
|
// 1
|
|
PV1i.x = floatBitsToInt(intBitsToFloat(R3i.w) + intBitsToFloat(PV0i.w));
|
|
PV1i.y = floatBitsToInt(intBitsToFloat(R3i.z) + intBitsToFloat(PV0i.x));
|
|
PV1i.z = floatBitsToInt(intBitsToFloat(R3i.y) + intBitsToFloat(PV0i.y));
|
|
PV1i.w = floatBitsToInt(intBitsToFloat(R3i.x) + intBitsToFloat(PV0i.z));
|
|
R126i.z = PV0i.z;
|
|
R126i.z = floatBitsToInt(intBitsToFloat(R126i.z) / 2.0);
|
|
PS1i = R126i.z;
|
|
// 2
|
|
backupReg0i = R0i.y;
|
|
backupReg1i = R0i.x;
|
|
PV0i.x = floatBitsToInt(intBitsToFloat(R0i.w) + intBitsToFloat(PV1i.x));
|
|
PV0i.y = floatBitsToInt(intBitsToFloat(R0i.z) + intBitsToFloat(PV1i.y));
|
|
PV0i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV1i.z));
|
|
PV0i.w = floatBitsToInt(intBitsToFloat(backupReg1i) + intBitsToFloat(PV1i.w));
|
|
R126i.y = R127i.y;
|
|
R126i.y = floatBitsToInt(intBitsToFloat(R126i.y) / 2.0);
|
|
PS0i = R126i.y;
|
|
// 3
|
|
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.x) * 0.25);
|
|
R125i.y = R127i.x;
|
|
R125i.y = floatBitsToInt(intBitsToFloat(R125i.y) / 2.0);
|
|
R127i.z = floatBitsToInt(intBitsToFloat(PV0i.z) * 0.25);
|
|
R127i.w = floatBitsToInt(intBitsToFloat(PV0i.w) * 0.25);
|
|
R127i.y = floatBitsToInt(intBitsToFloat(PV0i.y) * 0.25);
|
|
PS1i = R127i.y;
|
|
// 4
|
|
R127i.x = ((intBitsToFloat(PV1i.x) > intBitsToFloat(R4i.w))?int(0xFFFFFFFF):int(0x0));
|
|
PV0i.w = ((intBitsToFloat(PV1i.x) > intBitsToFloat(R4i.z))?int(0xFFFFFFFF):int(0x0));
|
|
// 5
|
|
R123i.x = ((PV0i.w == 0)?(R127i.y):(R125i.y));
|
|
PV1i.x = R123i.x;
|
|
R123i.y = ((PV0i.w == 0)?(R127i.z):(R126i.y));
|
|
PV1i.y = R123i.y;
|
|
R123i.z = ((PV0i.w == 0)?(R127i.w):(R126i.z));
|
|
PV1i.z = R123i.z;
|
|
// 6
|
|
R1i.x = ((R127i.x == 0)?(R126i.z):(PV1i.z));
|
|
R1i.y = ((R127i.x == 0)?(R126i.y):(PV1i.y));
|
|
R1i.z = ((R127i.x == 0)?(R125i.y):(PV1i.x));
|
|
}
|
|
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
|
|
if( activeMaskStackC[1] == true ) {
|
|
// 0
|
|
R1i.w = 0x3f800000;
|
|
}
|
|
// export
|
|
passPixelColor0 = clamp(vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w))*$brightness, 0.0, 1.0);
|
|
}
|