#version 420 #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : 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 shaders was auto-converted from OpenGL to Cemu. Conversion output: */ // shader 2f7ecb9f0022d8ca -- Pixel shader for Links Cel Shading World & Menu - Texture format 0x005d #define mode $mode TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; layout(location = 0) in vec4 passParameterSem0; #ifdef VULKAN layout(set = 1, binding = 1) uniform ufBlock { uniform vec4 uf_fragCoordScale; }; #else uniform vec2 uf_fragCoordScale; #endif 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 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(passParameterSem0); // comes from 3 vertex shaders, one of them handles the lighting that glitches the sky(314b77349f0636db), so lets exclude it if (passParameterSem0.w == 4.0) { R0i.w = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R0i.xy)).x); // 0 PV0i.x = floatBitsToInt(intBitsToFloat(R0i.w) * intBitsToFloat(0x437f0000)); R127i.y = int(uint(intBitsToFloat(R0i.z))); PS0i = R127i.y; // 1 if ( mode > 1) // if mode is greater than 1 then run our own code { // very interesting - Replace PS1i(which is integer) with any of these numbers, there are like 4 diff modes that repeat through diff integers, [4,6,7,8,10,11] [-5 -9 -10 -12 -18 -19 -25 -26 -28 -34 -40 -41 -42] PS1i = int(mode); } else { PS1i = int(uint(intBitsToFloat(PV0i.x))); // orignal code } // 2 PV0i.z = R127i.y & PS1i; // 3 PS1i = floatBitsToInt(float(uint(PV0i.z))); // 4 R0i.x = floatBitsToInt(intBitsToFloat(PS1i) * intBitsToFloat(0x3b808081)); } else { R0i.w = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R0i.xy)).x); // 0 PV0i.x = floatBitsToInt(intBitsToFloat(R0i.w) * intBitsToFloat(0x437f0000)); R127i.y = int(uint(intBitsToFloat(R0i.z))); PS0i = R127i.y; // 1 PS1i = int(uint(intBitsToFloat(PV0i.x))); // orignal code // 2 PV0i.z = R127i.y & PS1i; // 3 PS1i = floatBitsToInt(float(uint(PV0i.z))); // 4 R0i.x = floatBitsToInt(intBitsToFloat(PS1i) * intBitsToFloat(0x3b808081)); } // export gl_FragDepth = vec4(intBitsToFloat(R0i.x), 0, 0, 0).x; }