mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-27 12:04:14 +01:00
293 lines
8.9 KiB
Plaintext
293 lines
8.9 KiB
Plaintext
#version 430
|
|
#extension GL_ARB_texture_gather : enable
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
// shader d388f32cb9be9a7a
|
|
// Used for: Ambient-occlusion
|
|
float resScale = float($width)/float($gameWidth);
|
|
|
|
|
|
#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 = 4) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_remappedPS[8];
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform ivec4 uf_remappedPS[8];
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0;
|
|
TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1;
|
|
TEXTURE_LAYOUT(2, 1, 2) uniform sampler2D textureUnitPS2;
|
|
TEXTURE_LAYOUT(3, 1, 3) uniform sampler2D textureUnitPS3;
|
|
layout(location = 0) in vec4 passParameterSem0;
|
|
layout(location = 1) in vec4 passParameterSem1;
|
|
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 min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
|
|
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 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 = passParameterSem0;
|
|
R1f = passParameterSem1;
|
|
R7f.x = (texture(textureUnitPS0, R1f.xy).x);
|
|
R2f.xy = (texture(textureUnitPS3, R1f.zw).xy);
|
|
// 0
|
|
R5f.x = (R2f.y * 2.0 + -(1.0));
|
|
PV0f.x = R5f.x;
|
|
R4f.y = R7f.x * intBitsToFloat(uf_remappedPS[0].z);
|
|
R123f.z = (-(R7f.x) * intBitsToFloat(uf_remappedPS[1].y) + 1.0);
|
|
R123f.z = clamp(R123f.z, 0.0, 1.0);
|
|
PV0f.z = R123f.z;
|
|
R0f.w = (R2f.x * 2.0 + -(1.0));
|
|
PV0f.w = R0f.w;
|
|
// 1
|
|
R4f.x = PV0f.w * intBitsToFloat(uf_remappedPS[2].z)/resScale;
|
|
R125f.y = PV0f.z * intBitsToFloat(uf_remappedPS[1].x)/resScale;
|
|
PV1f.y = R125f.y;
|
|
R4f.z = -(PV0f.x) * intBitsToFloat(uf_remappedPS[2].z)/resScale;
|
|
// 2
|
|
R127f.x = PV1f.y * intBitsToFloat(uf_remappedPS[3].x)/resScale;
|
|
PV0f.x = R127f.x;
|
|
R127f.y = PV1f.y * intBitsToFloat(uf_remappedPS[3].y)/resScale;
|
|
R127f.z = PV1f.y * intBitsToFloat(uf_remappedPS[4].y)/resScale;
|
|
PV0f.w = PV1f.y * intBitsToFloat(uf_remappedPS[4].x)/resScale;
|
|
PS0f = 1.0 / PV1f.y;
|
|
// 3
|
|
PV1f.x = R5f.x * PV0f.w;
|
|
PV1f.y = R4f.x * PV0f.w;
|
|
R5f.z = intBitsToFloat(uf_remappedPS[5].z) * PS0f;
|
|
R5f.w = intBitsToFloat(uf_remappedPS[5].z) * PS0f;
|
|
PS1f = R4f.x * PV0f.x;
|
|
// 4
|
|
PV0f.x = R5f.x * R127f.x;
|
|
R126f.y = (R4f.z * R127f.y + PS1f);
|
|
R123f.z = (R0f.w * R127f.z + PV1f.x);
|
|
PV0f.z = R123f.z;
|
|
R123f.w = (R4f.z * R127f.z + PV1f.y);
|
|
PV0f.w = R123f.w;
|
|
R6f.x = R125f.y * intBitsToFloat(uf_remappedPS[6].x)/resScale;
|
|
PS0f = R6f.x;
|
|
// 5
|
|
R2f.xyz = vec3(R1f.x,R1f.y,R1f.x) + vec3(PV0f.w,PV0f.z,-(PV0f.w));
|
|
R2f.w = R1f.y + -(PV0f.z);
|
|
R122f.x = (R0f.w * R127f.y + PV0f.x);
|
|
PS1f = R122f.x;
|
|
// 6
|
|
R3f.xyz = vec3(R1f.x,R1f.y,R1f.x) + vec3(R126f.y,PS1f,-(R126f.y));
|
|
R3f.w = R1f.y + -(PS1f);
|
|
R4f.w = R125f.y * intBitsToFloat(uf_remappedPS[6].y)/resScale;
|
|
PS0f = R4f.w;
|
|
R2f.x = (texture(textureUnitPS1, R2f.xy).x);
|
|
R2f.y = (texture(textureUnitPS1, R2f.zw).x);
|
|
R3f.x = (texture(textureUnitPS1, R3f.xy).x);
|
|
R3f.y = (texture(textureUnitPS1, R3f.zw).x);
|
|
// 0
|
|
R127f.x = R4f.y + -(R3f.x);
|
|
PV0f.x = R127f.x;
|
|
PV0f.y = -(R2f.y) + R4f.y;
|
|
PV0f.z = -(R2f.x) + R4f.y;
|
|
R127f.w = R4f.y + -(R3f.y);
|
|
// 1
|
|
PV1f.x = PV0f.z * R5f.w;
|
|
PV1f.x /= 2.0;
|
|
R125f.y = (-(PV0f.z) * intBitsToFloat(uf_remappedPS[1].z) + 1.0);
|
|
R125f.y = clamp(R125f.y, 0.0, 1.0);
|
|
R126f.z = (-(PV0f.y) * intBitsToFloat(uf_remappedPS[1].z) + 1.0);
|
|
R126f.z = clamp(R126f.z, 0.0, 1.0);
|
|
PV1f.w = PV0f.y * R5f.z;
|
|
PV1f.w /= 2.0;
|
|
PS1f = PV0f.x * R5f.w;
|
|
PS1f /= 2.0;
|
|
// 2
|
|
PV0f.x = R127f.w * R5f.z;
|
|
PV0f.x /= 2.0;
|
|
R126f.y = (PV1f.w * intBitsToFloat(uf_remappedPS[4].z) + 0.5);
|
|
R126f.y = clamp(R126f.y, 0.0, 1.0);
|
|
PV0f.y = R126f.y;
|
|
R127f.z = (PV1f.x * intBitsToFloat(uf_remappedPS[4].z) + 0.5);
|
|
R127f.z = clamp(R127f.z, 0.0, 1.0);
|
|
PV0f.z = R127f.z;
|
|
R125f.w = (PS1f * intBitsToFloat(uf_remappedPS[3].z) + 0.5);
|
|
R125f.w = clamp(R125f.w, 0.0, 1.0);
|
|
PS0f = R4f.x * R6f.x;
|
|
// 3
|
|
R126f.x = (PV0f.x * intBitsToFloat(uf_remappedPS[3].z) + 0.5);
|
|
R126f.x = clamp(R126f.x, 0.0, 1.0);
|
|
PV1f.x = R126f.x;
|
|
PV1f.y = 0.5 + -(PV0f.z);
|
|
PV1f.z = 0.5 + -(PV0f.y);
|
|
R124f.w = (R4f.z * R4f.w + PS0f);
|
|
R125f.z = (-(R127f.x) * intBitsToFloat(uf_remappedPS[1].z) + 1.0);
|
|
R125f.z = clamp(R125f.z, 0.0, 1.0);
|
|
PS1f = R125f.z;
|
|
// 4
|
|
R127f.x = (PV1f.z * R126f.z + 0.5);
|
|
PV0f.x = R127f.x;
|
|
R127f.y = (-(R127f.w) * intBitsToFloat(uf_remappedPS[1].z) + 1.0);
|
|
R127f.y = clamp(R127f.y, 0.0, 1.0);
|
|
PV0f.y = R127f.y;
|
|
PV0f.z = 0.5 + -(PV1f.x);
|
|
R127f.w = (PV1f.y * R125f.y + 0.5);
|
|
PV0f.w = R127f.w;
|
|
PS0f = 0.5 + -(R125f.w);
|
|
// 5
|
|
R125f.x = (PV0f.z * PV0f.y + 0.5);
|
|
PV1f.y = R126f.y + -(PV0f.w);
|
|
PV1f.z = R127f.z + -(PV0f.x);
|
|
R126f.w = (PS0f * R125f.z + 0.5);
|
|
PV1f.w = R126f.w;
|
|
PS1f = R5f.x * R6f.x;
|
|
// 6
|
|
backupReg0f = R127f.x;
|
|
backupReg1f = R126f.z;
|
|
backupReg2f = R127f.w;
|
|
R127f.x = (PV1f.z * R125f.y + backupReg0f);
|
|
PV0f.y = R126f.x + -(PV1f.w);
|
|
R126f.z = (R0f.w * R4f.w + PS1f);
|
|
PV0f.z = R126f.z;
|
|
R127f.w = (PV1f.y * backupReg1f + backupReg2f);
|
|
// 7
|
|
PV1f.x = R125f.w + -(R125f.x);
|
|
R123f.y = (PV0f.y * R127f.y + R126f.w);
|
|
PV1f.y = R123f.y;
|
|
R4f.z = R1f.x + R124f.w;
|
|
R4f.w = R1f.y + PV0f.z;
|
|
R5f.x = R1f.x + -(R124f.w);
|
|
PS1f = R5f.x;
|
|
// 8
|
|
backupReg0f = R125f.x;
|
|
R125f.x = R7f.x * intBitsToFloat(uf_remappedPS[5].y);
|
|
R5f.y = R1f.y + -(R126f.z);
|
|
R123f.z = (PV1f.x * R125f.z + backupReg0f);
|
|
PV0f.z = R123f.z;
|
|
PV0f.w = PV1f.y * intBitsToFloat(uf_remappedPS[3].w);
|
|
R6f.z = 0.0;
|
|
PS0f = R6f.z;
|
|
// 9
|
|
PV1f.x = PV0f.z * intBitsToFloat(uf_remappedPS[3].w);
|
|
R1f.y = (R127f.w * intBitsToFloat(uf_remappedPS[4].w) + PV0f.w);
|
|
R6f.w = 1.0;
|
|
// 10
|
|
R1f.z = (R127f.x * intBitsToFloat(uf_remappedPS[4].w) + PV1f.x);
|
|
// 11
|
|
R123f.z = (R7f.x * intBitsToFloat(uf_remappedPS[5].z) + intBitsToFloat(uf_remappedPS[5].x)/3);
|
|
PV1f.z = R123f.z;
|
|
// 12
|
|
backupReg0f = R0f.x;
|
|
backupReg1f = R0f.z;
|
|
PV0f.x = backupReg0f * PV1f.z;
|
|
PV0f.z = backupReg1f * PV1f.z;
|
|
PV0f.w = R0f.y * PV1f.z;
|
|
// 13
|
|
backupReg0f = R125f.x;
|
|
backupReg0f = R125f.x;
|
|
backupReg0f = R125f.x;
|
|
R125f.x = (backupReg0f * intBitsToFloat(uf_remappedPS[7].y) + PV0f.w);
|
|
R127f.y = (backupReg0f * intBitsToFloat(uf_remappedPS[7].x) + PV0f.x);
|
|
R123f.w = (backupReg0f * intBitsToFloat(uf_remappedPS[7].z) + PV0f.z);
|
|
PV1f.w = R123f.w;
|
|
// 14
|
|
PS0f = 1.0 / PV1f.w;
|
|
// 15
|
|
R0f.x = R127f.y * PS0f;
|
|
R0f.y = R125f.x * PS0f;
|
|
R7f.x = (texture(textureUnitPS1, R4f.zw).x);
|
|
R5f.y = (texture(textureUnitPS1, R5f.xy).x);
|
|
R6f.y = (texture(textureUnitPS2, R0f.xy).x);
|
|
// 0
|
|
PV0f.x = R4f.y + -(R7f.x);
|
|
PV0f.w = R4f.y + -(R5f.y);
|
|
// 1
|
|
R127f.x = (-(PV0f.x) * intBitsToFloat(uf_remappedPS[1].z) + 1.0);
|
|
R127f.x = clamp(R127f.x, 0.0, 1.0);
|
|
PV1f.y = PV0f.w * R5f.z;
|
|
PV1f.y /= 2.0;
|
|
PV1f.z = PV0f.x * R5f.w;
|
|
PV1f.z /= 2.0;
|
|
R126f.w = (-(PV0f.w) * intBitsToFloat(uf_remappedPS[1].z) + 1.0);
|
|
R126f.w = clamp(R126f.w, 0.0, 1.0);
|
|
// 2
|
|
R125f.x = (PV1f.z * intBitsToFloat(uf_remappedPS[6].z) + 0.5);
|
|
R125f.x = clamp(R125f.x, 0.0, 1.0);
|
|
PV0f.x = R125f.x;
|
|
R127f.w = (PV1f.y * intBitsToFloat(uf_remappedPS[6].z) + 0.5);
|
|
R127f.w = clamp(R127f.w, 0.0, 1.0);
|
|
PV0f.w = R127f.w;
|
|
// 3
|
|
PV1f.x = 0.5 + -(PV0f.w);
|
|
PV1f.w = 0.5 + -(PV0f.x);
|
|
// 4
|
|
R127f.y = (PV1f.w * R127f.x + 0.5);
|
|
PV0f.y = R127f.y;
|
|
R126f.z = (PV1f.x * R126f.w + 0.5);
|
|
PV0f.z = R126f.z;
|
|
// 5
|
|
PV1f.x = R125f.x + -(PV0f.z);
|
|
PV1f.w = R127f.w + -(PV0f.y);
|
|
// 6
|
|
R123f.y = (PV1f.w * R126f.w + R127f.y);
|
|
PV0f.y = R123f.y;
|
|
R123f.z = (PV1f.x * R127f.x + R126f.z);
|
|
PV0f.z = R123f.z;
|
|
// 7
|
|
R123f.x = (PV0f.z * intBitsToFloat(uf_remappedPS[6].w) + R1f.z);
|
|
PV1f.x = R123f.x;
|
|
R123f.w = (PV0f.y * intBitsToFloat(uf_remappedPS[6].w) + R1f.y);
|
|
PV1f.w = R123f.w;
|
|
// 8
|
|
PV0f.z = PV1f.x + PV1f.w;
|
|
// 9
|
|
PV1f.y = PV0f.z + intBitsToFloat(uf_remappedPS[1].w);
|
|
// 10
|
|
PV0f.x = PV1f.y + -(0.5);
|
|
// 11
|
|
PV1f.w = PV0f.x * intBitsToFloat(uf_remappedPS[0].y);
|
|
PV1f.w = clamp(PV1f.w, 0.0, 1.0);
|
|
// 12
|
|
R6f.x = -(PV1f.w) + 1.0;
|
|
// export
|
|
passPixelColor0 = vec4(R6f.x, R6f.y, R6f.z, R6f.w);
|
|
}
|