mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-18 14:11:48 +01:00
f3d35c75dc
Didn't update the docs (will do that tomorrow), but I manually checked (didn't verify things, but I basically checked if it contained "uf_windowSpaceToClipSpaceTransform" and if the shader was made after a certain Cemu change was made due to how they're left out) to see if any graphic pack in here was *probably* safe. I also didn't convert 5 graphic packs since they contained signs that needed to be manually checked or at least examined more: - \Enhancements\TwilightPrincessHD_Bicubic - \Resolutions\DevilsThird_Resolution - \Resolutions\TwilightPrincessHD_Resolution (this one just needs to be fully verified since it's popular enough and has like 27 shaders) - \Resolutions\LegoStarWars_Resolution - \Resolutions\TokyoMirage_Resolution (this one could also be manually verified) I hope I didn't make too many mistakes with this one.
281 lines
9.8 KiB
Plaintext
281 lines
9.8 KiB
Plaintext
#version 420
|
|
#extension GL_ARB_texture_gather : enable
|
|
#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 SET_POSITION(_v) gl_Position = _v; gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw)
|
|
#define gl_VertexID gl_VertexIndex
|
|
#define gl_InstanceID gl_InstanceIndex
|
|
#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 SET_POSITION(_v) gl_Position = _v
|
|
#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw)
|
|
#endif
|
|
// This shader was automatically converted to be cross-compatible with Vulkan and OpenGL.
|
|
|
|
// shader b77c717f243c0b08
|
|
#ifdef VULKAN
|
|
layout(set = 1, binding = 5) uniform ufBlock
|
|
{
|
|
uniform ivec4 uf_remappedPS[9];
|
|
uniform vec4 uf_fragCoordScale;
|
|
};
|
|
#else
|
|
uniform ivec4 uf_remappedPS[9];
|
|
uniform vec2 uf_fragCoordScale;
|
|
#endif
|
|
const float skyboxRed = float($skyboxRed);
|
|
const float skyboxGreen = float($skyboxGreen);
|
|
const float skyboxBlue = float($skyboxBlue);
|
|
const float skyboxMix = float($skyboxMix);
|
|
|
|
|
|
TEXTURE_LAYOUT(1, 1, 0) uniform sampler2D textureUnitPS1;
|
|
TEXTURE_LAYOUT(2, 1, 1) uniform sampler2D textureUnitPS2;
|
|
TEXTURE_LAYOUT(3, 1, 2) uniform sampler2D textureUnitPS3;
|
|
TEXTURE_LAYOUT(4, 1, 3) uniform sampler2D textureUnitPS4;
|
|
TEXTURE_LAYOUT(5, 1, 4) uniform sampler2D textureUnitPS5;
|
|
layout(location = 0) in vec4 passParameterSem2;
|
|
layout(location = 1) in vec4 passParameterSem4;
|
|
layout(location = 2) in vec4 passParameterSem5;
|
|
layout(location = 3) in vec4 passParameterSem6;
|
|
layout(location = 4) in vec4 passParameterSem7;
|
|
layout(location = 5) in vec4 passParameterSem8;
|
|
layout(location = 6) in vec4 passParameterSem9;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
layout(location = 1) out vec4 passPixelColor1;
|
|
// uf_fragCoordScale was moved to the ufBlock
|
|
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 R5f = vec4(0.0);
|
|
vec4 R6f = vec4(0.0);
|
|
vec4 R7f = vec4(0.0);
|
|
vec4 R8f = 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 = passParameterSem2;
|
|
R1f = passParameterSem4;
|
|
R2f = passParameterSem5;
|
|
R3f = passParameterSem6;
|
|
R4f = passParameterSem7;
|
|
R5f = passParameterSem8;
|
|
R6f = passParameterSem9;
|
|
R5f.yzw = (texture(textureUnitPS4, R5f.xy).yzw);
|
|
// 0
|
|
R127f.x = R5f.y + -(0.5);
|
|
R127f.y = -(R1f.z) + -(intBitsToFloat(0x42700000));
|
|
PV0f.z = R5f.w + -(0.5);
|
|
R127f.w = R5f.z + -(0.5);
|
|
PS0f = 1.0 / R3f.z;
|
|
// 1
|
|
backupReg0f = R3f.y;
|
|
PV1f.x = mul_nonIEEE(PV0f.z, intBitsToFloat(uf_remappedPS[0].z));
|
|
PV1f.y = mul_nonIEEE(PV0f.z, intBitsToFloat(uf_remappedPS[0].x));
|
|
R3f.z = mul_nonIEEE(R3f.x, PS0f);
|
|
R3f.w = 1.0;
|
|
R3f.y = mul_nonIEEE(backupReg0f, PS0f);
|
|
PS1f = R3f.y;
|
|
// 2
|
|
R126f.x = R127f.y * intBitsToFloat(0x3dcccccd);
|
|
R126f.x = clamp(R126f.x, 0.0, 1.0);
|
|
R8f.y = 0.0;
|
|
R123f.z = (mul_nonIEEE(R127f.w,intBitsToFloat(uf_remappedPS[0].w)) + PV1f.x);
|
|
PV0f.z = R123f.z;
|
|
R123f.w = (mul_nonIEEE(R127f.w,intBitsToFloat(uf_remappedPS[0].y)) + PV1f.y);
|
|
PV0f.w = R123f.w;
|
|
PS0f = 1.0 / R2f.z;
|
|
// 3
|
|
R123f.x = (mul_nonIEEE(R127f.x,intBitsToFloat(uf_remappedPS[1].y)) + PV0f.z);
|
|
PV1f.x = R123f.x;
|
|
R123f.y = (mul_nonIEEE(R127f.x,intBitsToFloat(uf_remappedPS[1].x)) + PV0f.w);
|
|
PV1f.y = R123f.y;
|
|
R5f.z = mul_nonIEEE(R2f.x, PS0f);
|
|
R5f.w = mul_nonIEEE(R2f.y, PS0f);
|
|
PS1f = exp2(intBitsToFloat(uf_remappedPS[1].z));
|
|
PS1f *= 4.0;
|
|
// 4
|
|
PV0f.x = mul_nonIEEE(-(R1f.z), intBitsToFloat(uf_remappedPS[2].y));
|
|
PV0f.y = mul_nonIEEE(PS1f, PV1f.x);
|
|
PV0f.z = mul_nonIEEE(PS1f, PV1f.y);
|
|
PV0f.w = mul_nonIEEE(-(R1f.z), intBitsToFloat(uf_remappedPS[2].w));
|
|
R127f.z = -(R126f.x) + 1.0;
|
|
PS0f = R127f.z;
|
|
// 5
|
|
PV1f.x = PV0f.z * intBitsToFloat(0x3e7f0000);
|
|
R123f.y = (mul_nonIEEE(-(intBitsToFloat(uf_remappedPS[2].z)),intBitsToFloat(uf_remappedPS[2].w)) + PV0f.w);
|
|
R123f.y = clamp(R123f.y, 0.0, 1.0);
|
|
PV1f.y = R123f.y;
|
|
R0f.z = (mul_nonIEEE(-(intBitsToFloat(uf_remappedPS[2].x)),intBitsToFloat(uf_remappedPS[2].y)) + PV0f.x);
|
|
R0f.z = clamp(R0f.z, 0.0, 1.0);
|
|
PV1f.w = PV0f.y * intBitsToFloat(0x3e7f0000);
|
|
R2f.x = mul_nonIEEE(R1f.z, R1f.z);
|
|
PS1f = R2f.x;
|
|
// 6
|
|
backupReg0f = R4f.x;
|
|
backupReg1f = R4f.y;
|
|
R4f.x = backupReg0f + PV1f.x;
|
|
R4f.y = backupReg1f + PV1f.w;
|
|
R2f.z = R6f.x + PV1f.x;
|
|
R2f.w = R6f.y + PV1f.w;
|
|
R6f.y = PV1f.y + R127f.z;
|
|
R6f.y = clamp(R6f.y, 0.0, 1.0);
|
|
PS0f = R6f.y;
|
|
R3f.x = (textureLod(textureUnitPS2, R3f.zy,0.0).x);
|
|
R6f.x = (textureLod(textureUnitPS2, R3f.zy,R3f.w).x);
|
|
R4f.xyzw = (texture(textureUnitPS3, R4f.xy).xyzw);
|
|
R7f.xyz = (texture(textureUnitPS5, R2f.zw).xyz);
|
|
R5f.x = (texture(textureUnitPS1, R5f.zw).x);
|
|
// 0
|
|
PV0f.x = -(R3f.x) + R6f.x;
|
|
R127f.y = (mul_nonIEEE(-(R0f.z),intBitsToFloat(uf_remappedPS[3].w)) + intBitsToFloat(uf_remappedPS[3].z));
|
|
PV0f.y = R127f.y;
|
|
R126f.z = mul_nonIEEE(R4f.w, intBitsToFloat(uf_remappedPS[4].w));
|
|
R126f.z = clamp(R126f.z, 0.0, 1.0);
|
|
R122f.x = (mul_nonIEEE(R1f.y,R1f.y) + R2f.x);
|
|
PS0f = R122f.x;
|
|
// 1
|
|
PV1f.x = -(PV0f.y) + 1.0;
|
|
PV1f.y = -(intBitsToFloat(uf_remappedPS[5].y)) + intBitsToFloat(uf_remappedPS[4].y);
|
|
PV1f.z = -(intBitsToFloat(uf_remappedPS[5].x)) + intBitsToFloat(uf_remappedPS[4].x);
|
|
R123f.w = (mul_nonIEEE(PV0f.x,R6f.y) + R3f.x);
|
|
PV1f.w = R123f.w;
|
|
R122f.x = (mul_nonIEEE(R1f.x,R1f.x) + PS0f);
|
|
PS1f = R122f.x;
|
|
// 2
|
|
R127f.x = (mul_nonIEEE(PV1f.z,R4f.x) + intBitsToFloat(uf_remappedPS[5].x));
|
|
R127f.x = clamp(R127f.x, 0.0, 1.0);
|
|
R126f.y = (mul_nonIEEE(PV1f.y,R4f.y) + intBitsToFloat(uf_remappedPS[5].y));
|
|
R126f.y = clamp(R126f.y, 0.0, 1.0);
|
|
PV0f.z = mul_nonIEEE(PV1f.w, intBitsToFloat(uf_remappedPS[3].y));
|
|
R127f.w = (mul_nonIEEE(PV1f.x,R6f.y) + R127f.y);
|
|
PS0f = sqrt(PS1f);
|
|
// 3
|
|
R126f.x = -(intBitsToFloat(uf_remappedPS[5].z)) + intBitsToFloat(uf_remappedPS[4].z);
|
|
R123f.w = (mul_nonIEEE(R0f.x,PS0f) + R0f.y);
|
|
R123f.w = clamp(R123f.w, 0.0, 1.0);
|
|
PV1f.w = R123f.w;
|
|
tempResultf = log2(PV0f.z);
|
|
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
|
PS1f = tempResultf;
|
|
// 4
|
|
PV0f.x = mul_nonIEEE(R127f.w, PS1f);
|
|
R127f.y = -(intBitsToFloat(uf_remappedPS[5].y)) + intBitsToFloat(uf_remappedPS[6].y);
|
|
R127f.z = -(intBitsToFloat(uf_remappedPS[5].x)) + intBitsToFloat(uf_remappedPS[6].x);
|
|
R0f.w = R126f.z;
|
|
R0f.w = clamp(R0f.w, 0.0, 1.0);
|
|
R1f.z = mul_nonIEEE(PV1f.w, PV1f.w);
|
|
PS0f = R1f.z;
|
|
// 5
|
|
PV1f.x = -(intBitsToFloat(uf_remappedPS[5].z)) + intBitsToFloat(uf_remappedPS[6].z);
|
|
R127f.w = (mul_nonIEEE(R126f.x,R4f.z) + intBitsToFloat(uf_remappedPS[5].z));
|
|
R127f.w = clamp(R127f.w, 0.0, 1.0);
|
|
R126f.x = exp2(PV0f.x);
|
|
PS1f = R126f.x;
|
|
// 6
|
|
backupReg0f = R127f.y;
|
|
backupReg1f = R127f.z;
|
|
R127f.y = (mul_nonIEEE(PV1f.x,R7f.z) + intBitsToFloat(uf_remappedPS[5].z));
|
|
R127f.y = clamp(R127f.y, 0.0, 1.0);
|
|
PV0f.y = R127f.y;
|
|
R127f.z = (mul_nonIEEE(backupReg0f,R7f.y) + intBitsToFloat(uf_remappedPS[5].y));
|
|
R127f.z = clamp(R127f.z, 0.0, 1.0);
|
|
PV0f.z = R127f.z;
|
|
R126f.w = (mul_nonIEEE(backupReg1f,R7f.x) + intBitsToFloat(uf_remappedPS[5].x));
|
|
R126f.w = clamp(R126f.w, 0.0, 1.0);
|
|
PV0f.w = R126f.w;
|
|
R8f.w = R0f.w;
|
|
PS0f = R8f.w;
|
|
// 7
|
|
PV1f.x = mul_nonIEEE(intBitsToFloat(uf_remappedPS[3].x), R126f.x);
|
|
PV1f.x = clamp(PV1f.x, 0.0, 1.0);
|
|
PV1f.y = R127f.w + -(PV0f.y);
|
|
PV1f.z = R126f.y + -(PV0f.z);
|
|
PV1f.w = R127f.x + -(PV0f.w);
|
|
R125f.z = intBitsToFloat(uf_remappedPS[7].y) + R5f.x;
|
|
R125f.z = clamp(R125f.z, 0.0, 1.0);
|
|
PS1f = R125f.z;
|
|
// 8
|
|
backupReg0f = R127f.z;
|
|
R127f.x = (mul_nonIEEE(PV1f.w,R126f.z) + R126f.w);
|
|
R127f.x = clamp(R127f.x, 0.0, 1.0);
|
|
PV0f.x = R127f.x;
|
|
PV0f.y = PV1f.x + intBitsToFloat(uf_remappedPS[7].x);
|
|
PV0f.y = clamp(PV0f.y, 0.0, 1.0);
|
|
R127f.z = (mul_nonIEEE(PV1f.y,R126f.z) + R127f.y);
|
|
R127f.z = clamp(R127f.z, 0.0, 1.0);
|
|
PV0f.z = R127f.z;
|
|
R126f.w = (mul_nonIEEE(PV1f.z,R126f.z) + backupReg0f);
|
|
R126f.w = clamp(R126f.w, 0.0, 1.0);
|
|
PV0f.w = R126f.w;
|
|
// 9
|
|
backupReg0f = R125f.z;
|
|
R126f.x = mul_nonIEEE(intBitsToFloat(uf_remappedPS[7].z), PV0f.w);
|
|
PV1f.x = R126f.x;
|
|
R127f.y = mul_nonIEEE(intBitsToFloat(uf_remappedPS[7].z), PV0f.x);
|
|
PV1f.y = R127f.y;
|
|
R125f.z = mul_nonIEEE(PV0f.y, backupReg0f);
|
|
R127f.w = mul_nonIEEE(intBitsToFloat(uf_remappedPS[7].z), PV0f.z);
|
|
PV1f.w = R127f.w;
|
|
// 10
|
|
PV0f.x = R127f.z + -(PV1f.w);
|
|
PV0f.y = R126f.w + -(PV1f.x);
|
|
PV0f.z = R127f.x + -(PV1f.y);
|
|
// 11
|
|
R5f.x = (mul_nonIEEE(R125f.z,R127f.w) + PV0f.x);
|
|
R7f.y = (mul_nonIEEE(R125f.z,R126f.x) + PV0f.y);
|
|
R7f.z = (mul_nonIEEE(R125f.z,R127f.y) + PV0f.z);
|
|
// 0
|
|
PV0f.x = -(R7f.y) + intBitsToFloat(uf_remappedPS[8].y);
|
|
PV0f.y = -(R7f.z) + intBitsToFloat(uf_remappedPS[8].x);
|
|
PV0f.w = -(R5f.x) + intBitsToFloat(uf_remappedPS[8].z);
|
|
// 1
|
|
R0f.x = (mul_nonIEEE(PV0f.y,R1f.z) + R7f.z);
|
|
PV1f.x = R0f.x;
|
|
R0f.y = (mul_nonIEEE(PV0f.x,R1f.z) + R7f.y);
|
|
PV1f.y = R0f.y;
|
|
R0f.z = (mul_nonIEEE(PV0f.w,R1f.z) + R5f.x);
|
|
PV1f.z = R0f.z;
|
|
// 2
|
|
backupReg0f = R0f.w;
|
|
R0f.xyz = vec3(PV1f.x,PV1f.y,PV1f.z);
|
|
R0f.w = backupReg0f;
|
|
// 3
|
|
R1f.xyz = vec3(R8f.y,R8f.y,R8f.y);
|
|
R1f.w = R8f.w;
|
|
// export
|
|
//passPixelColor0 = vec4(R0f.x, R0f.y*0.9, R0f.z*1.1, R0f.w);
|
|
passPixelColor0 = vec4(R0f.x*skyboxRed, R0f.y*skyboxGreen*0.9, R0f.z*skyboxBlue*1.1, R0f.w)*skyboxMix;
|
|
passPixelColor1 = vec4(R1f.x, R1f.y, R1f.z, R1f.w);
|
|
}
|