#version 430 #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable // shader d936195db0dd8e7d //crossfade // start of shader inputs/outputs, predetermined by Cemu. Do not touch #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 = 3) uniform ufBlock { uniform ivec4 uf_remappedPS[1]; uniform vec4 uf_fragCoordScale; }; #else uniform ivec4 uf_remappedPS[1]; uniform vec2 uf_fragCoordScale; #endif TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; TEXTURE_LAYOUT(1, 1, 1) uniform sampler3D textureUnitPS1; TEXTURE_LAYOUT(2, 1, 2) uniform sampler3D textureUnitPS2; layout(location = 0) in vec4 passParameterSem0; layout(location = 0) out vec4 passPixelColor0; // end of shader inputs/outputs const float exposure = $exposure; const float vibrance = $vibrance; const float postExposure = $postExposure; const float contrastCurve = $contrastCurve; 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 R5f = 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; float tempResultf2; int tempResulti; ivec4 ARi = ivec4(0); bool predResult = true; vec3 cubeMapSTM; int cubeMapFaceId; R0f = passParameterSem0; R0f.xyz = (texture(textureUnitPS0, R0f.xy).xyz); R5f.xyzw = texture(textureUnitPS0, passParameterSem0.xy); // 0 backupReg0f = R0f.x; tempResultf = clamp(intBitsToFloat(uf_remappedPS[0].x), 0.0, exposure); tempResultf2 = clamp(intBitsToFloat(uf_remappedPS[0].z), 0.0, 1.0); PV0f.x = backupReg0f * tempResultf; //intBitsToFloat(uf_remappedPS[0].x); PV0f.x = clamp(PV0f.x, 0.0, 1.0); R127f.z = R0f.z * tempResultf; R127f.z = clamp(R127f.z, 0.0, 1.0); R127f.w = R0f.y * tempResultf; R127f.w = clamp(R127f.w, 0.0, 1.0); R2f.w = 1.0; PS0f = R2f.w; // 1 tempResultf = max(0.0, PV0f.x); tempResultf = log2(tempResultf); if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F; PS1f = tempResultf; // 2 R127f.x = PS1f * intBitsToFloat(0x3ee8ba2e); tempResultf = max(0.0, R127f.w); tempResultf = log2(tempResultf); if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F; PS0f = tempResultf; // 3 R127f.y = PS0f * intBitsToFloat(0x3ee8ba2e); tempResultf = max(0.0, R127f.z); tempResultf = log2(tempResultf); if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F; PS1f = tempResultf; // 4 R127f.w = PS1f * intBitsToFloat(0x3ee8ba2e); PS0f = exp2(R127f.x); // 5 R0f.x = (PS0f * intBitsToFloat(uf_remappedPS[0].z) + intBitsToFloat(uf_remappedPS[0].w)); PS1f = exp2(R127f.y); // 6 R0f.y = (PS1f * intBitsToFloat(uf_remappedPS[0].z) + intBitsToFloat(uf_remappedPS[0].w)); PS0f = exp2(R127f.w); // 7 R0f.z = (PS0f * intBitsToFloat(uf_remappedPS[0].z) + intBitsToFloat(uf_remappedPS[0].w)); R1f.xyz = (texture(textureUnitPS1, vec3(R0f.x,R0f.y,R0f.z)).xyz); R0f.xyz = (texture(textureUnitPS2, vec3(R0f.x,R0f.y,R0f.z)).xyz); // 0 backupReg0f = R0f.y; backupReg1f = R0f.x; PV0f.x = R1f.z + -(R0f.z); PV0f.y = R1f.y + -(backupReg0f); PV0f.z = R1f.x + -(backupReg1f); // 1 R2f.x = (PV0f.z * intBitsToFloat(uf_remappedPS[0].y) + R0f.x); R2f.y = (PV0f.y * intBitsToFloat(uf_remappedPS[0].y) + R0f.y); R2f.z = (PV0f.x * intBitsToFloat(uf_remappedPS[0].y) + R0f.z); R2f = mix (R2f,R5f,vibrance)*postExposure; R2f.xyz = mix(R2f.xyz, smoothstep(0.0, 1.0, R2f.xyz), contrastCurve); // export passPixelColor0 = vec4(R2f.x, R2f.y, R2f.z, R2f.w); }