#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:
*/

#define wpnDefault $wpnDefault
const vec3 Color = vec3($wpnR,$wpnG,$wpnB);
const float Light = $wpnL;

// Ancient weapons

// shader 5c4fc00fefe604eb
#ifdef VULKAN
layout(set = 1, binding = 5) uniform ufBlock
{
uniform ivec4 uf_remappedPS[3];
uniform vec4 uf_fragCoordScale;
};
#else
uniform ivec4 uf_remappedPS[3];
uniform vec2 uf_fragCoordScale;
#endif
// uf_fragCoordScale was moved to the ufBlock
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 passParameterSem0;
layout(location = 1) in vec4 passParameterSem3;
layout(location = 2) in vec4 passParameterSem4;
layout(location = 3) in vec4 passParameterSem7;
layout(location = 0) out vec4 passPixelColor0;
layout(location = 1) out vec4 passPixelColor1;
layout(location = 3) out vec4 passPixelColor3;
layout(location = 5) out vec4 passPixelColor5;
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 R1i = ivec4(0);
ivec4 R2i = ivec4(0);
ivec4 R3i = ivec4(0);
ivec4 R4i = ivec4(0);
ivec4 R5i = ivec4(0);
ivec4 R6i = ivec4(0);
ivec4 R7i = ivec4(0);
ivec4 R122i = 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;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0i = floatBitsToInt(passParameterSem0);
R1i = floatBitsToInt(passParameterSem3);
R2i = floatBitsToInt(passParameterSem4);
R3i = floatBitsToInt(passParameterSem7);
R4i.xy = floatBitsToInt(texture(textureUnitPS3, intBitsToFloat(R0i.xy)).xy);
R6i.xy = floatBitsToInt(texture(textureUnitPS2, intBitsToFloat(R0i.xy)).xy);
R5i.xyz = floatBitsToInt(texture(textureUnitPS4, intBitsToFloat(R0i.xy)).xyz);
R7i.xyz = floatBitsToInt(texture(textureUnitPS5, intBitsToFloat(R0i.zw)).xyz);
R0i.xyz = floatBitsToInt(texture(textureUnitPS1, intBitsToFloat(R0i.xy)).xyz);
// 0
R126i.x = floatBitsToInt((intBitsToFloat(R4i.x) * intBitsToFloat(0x40008102) + intBitsToFloat(0xbf810204)));
PV0i.x = R126i.x;
R127i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.y), intBitsToFloat(R2i.z)));
PV0i.z = floatBitsToInt(fract(intBitsToFloat(R3i.y)));
PV0i.w = floatBitsToInt(fract(intBitsToFloat(R3i.x)));
R126i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.z), intBitsToFloat(R2i.x)));
PS0i = R126i.y;
// 1
PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.z) + -(0.5));
PV1i.y = floatBitsToInt(intBitsToFloat(PV0i.w) + -(0.5));
R127i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(R2i.y)));
R127i.w = floatBitsToInt((intBitsToFloat(R4i.y) * intBitsToFloat(0x40008102) + intBitsToFloat(0xbf810204)));
PV1i.w = R127i.w;
PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.x)));
// 2
R127i.x = floatBitsToInt((mul_nonIEEE(-(intBitsToFloat(R2i.y)),intBitsToFloat(R1i.z)) + intBitsToFloat(R127i.y)));
R127i.y = floatBitsToInt((mul_nonIEEE(-(intBitsToFloat(R2i.z)),intBitsToFloat(R1i.x)) + intBitsToFloat(R126i.y)));
R123i.z = floatBitsToInt((mul_nonIEEE(-(intBitsToFloat(PV1i.x)),intBitsToFloat(PV1i.x)) + 1.0));
R123i.z = clampFI32(R123i.z);
PV0i.z = R123i.z;
R123i.w = floatBitsToInt((mul_nonIEEE(-(intBitsToFloat(PV1i.y)),intBitsToFloat(PV1i.y)) + 1.0));
R123i.w = clampFI32(R123i.w);
PV0i.w = R123i.w;
R122i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(PV1i.w),intBitsToFloat(PV1i.w)) + intBitsToFloat(PS1i)));
R122i.x = clampFI32(R122i.x);
PS0i = R122i.x;
// 3
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.w), intBitsToFloat(R127i.w)));
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(PV0i.z)));
PV1i.z = floatBitsToInt(intBitsToFloat(R6i.y) * intBitsToFloat(0x437f0000));
R123i.w = floatBitsToInt((mul_nonIEEE(-(intBitsToFloat(R2i.x)),intBitsToFloat(R1i.y)) + intBitsToFloat(R127i.z)));
PV1i.w = R123i.w;
R127i.w = floatBitsToInt(-(intBitsToFloat(PS0i)) + 1.0);
PS1i = R127i.w;
// 4
R123i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(PV1i.y),intBitsToFloat(PV1i.y)) + intBitsToFloat(R6i.y)));
R123i.x = clampFI32(R123i.x);
PV0i.x = R123i.x;
PV0i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV1i.w), intBitsToFloat(PV1i.x)));
PV0i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV1i.x)));
PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.y), intBitsToFloat(PV1i.x)));
R127i.x = int(intBitsToFloat(PV1i.z));
PS0i = R127i.x;
// 5
R123i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R2i.x),intBitsToFloat(R126i.x)) + intBitsToFloat(PV0i.z)));
PV1i.x = R123i.x;
PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R6i.x), intBitsToFloat(PV0i.x)));
R123i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R2i.y),intBitsToFloat(R126i.x)) + intBitsToFloat(PV0i.w)));
PV1i.z = R123i.z;
R123i.w = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R2i.z),intBitsToFloat(R126i.x)) + intBitsToFloat(PV0i.y)));
PV1i.w = R123i.w;
PS1i = floatBitsToInt(sqrt(intBitsToFloat(R127i.w)));
// 6
R125i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.x),intBitsToFloat(PS1i)) + intBitsToFloat(PV1i.x)));
R125i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.y),intBitsToFloat(PS1i)) + intBitsToFloat(PV1i.z)));
R125i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(PS1i)) + intBitsToFloat(PV1i.w)));
PV0i.w = R127i.x & 0x000000e0;
R127i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * intBitsToFloat(0x427f0000));
PS0i = R127i.y;

#if (wpnDefault == 1) // Default section 7

// 7
R127i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[0].y), intBitsToFloat(R5i.y)));
R126i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[0].z), intBitsToFloat(R5i.z)));
R127i.z = PV0i.w >> 0x00000003;
R127i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[0].x), intBitsToFloat(R5i.x)));
R126i.w = ((intBitsToFloat(R6i.y) > 0.5)?int(0xFFFFFFFF):int(0x0));
PS1i = R126i.w;

#elif (wpnDefault == 0) // Modified section 7

// 7
R127i.x = floatBitsToInt(mul_nonIEEE(Color.g, intBitsToFloat(R5i.y)));
R126i.y = floatBitsToInt(mul_nonIEEE(Color.b, intBitsToFloat(R5i.z)));
R127i.z = PV0i.w >> 0x00000003;
R127i.w = floatBitsToInt(mul_nonIEEE(Color.r, intBitsToFloat(R5i.x)));
R126i.w = ((intBitsToFloat(R6i.y) > 0.5)?int(0xFFFFFFFF):int(0x0));
PS1i = R126i.w;

#endif

// 8
backupReg0i = R127i.y;
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R125i.x),intBitsToFloat(R125i.y),intBitsToFloat(R125i.z),-0.0),vec4(intBitsToFloat(R125i.x),intBitsToFloat(R125i.y),intBitsToFloat(R125i.z),0.0)));
PV0i.x = tempi.x;
PV0i.y = tempi.x;
PV0i.z = tempi.x;
PV0i.w = tempi.x;
R127i.y = tempi.x;
R126i.x = floatBitsToInt(floor(intBitsToFloat(backupReg0i)));
R126i.x = floatBitsToInt(intBitsToFloat(R126i.x) * 4.0);
PS0i = R126i.x;
// 9
backupReg0i = R126i.y;
backupReg1i = R127i.z;
PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R7i.x), intBitsToFloat(R127i.w)));
R126i.y = ((R126i.w == 0)?(0x3d008081):(0x3d20a0a1));
R127i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R7i.z), intBitsToFloat(backupReg0i)));
PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R7i.y), intBitsToFloat(R127i.x)));
PS1i = floatBitsToInt(float(backupReg1i));

#if (wpnDefault == 1) // Default section 10 + half of 11

// 10
backupReg0i = R126i.x;
R126i.x = floatBitsToInt(intBitsToFloat(PS1i) + intBitsToFloat(0x42820000));
R7i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[1].x), intBitsToFloat(PV1i.w)));
R126i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + 2.0);
PV0i.w = uf_remappedPS[2].z;
R7i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[1].x), intBitsToFloat(PV1i.x)));
PS0i = R7i.x;
// 11
R6i.x = R126i.y;
R6i.y = PV0i.w;
R7i.z = floatBitsToInt(mul_nonIEEE(intBitsToFloat(uf_remappedPS[1].x), intBitsToFloat(R127i.z)));

#elif (wpnDefault == 0) // Modified section 10 + half of 11

// 10
backupReg0i = R126i.x;
R126i.x = floatBitsToInt(intBitsToFloat(PS1i) + intBitsToFloat(0x42820000));
R7i.y = floatBitsToInt(mul_nonIEEE(Light, intBitsToFloat(PV1i.w)));
R126i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + 2.0);
PV0i.w = uf_remappedPS[2].z;
R7i.x = floatBitsToInt(mul_nonIEEE(Light, intBitsToFloat(PV1i.x)));
PS0i = R7i.x;
// 11
R6i.x = R126i.y;
R6i.y = PV0i.w;
R7i.z = floatBitsToInt(mul_nonIEEE(Light, intBitsToFloat(R127i.z)));

#endif

R6i.w = floatBitsToInt(1.0);
R7i.w = 0x3f800000;
PS1i = R7i.w;
// 12
R5i.w = floatBitsToInt(intBitsToFloat(R126i.z) * intBitsToFloat(0x3b808081));
R0i.w = floatBitsToInt(intBitsToFloat(R126i.x) * intBitsToFloat(0x3b808081));
PS0i = R0i.w;
// 13
tempResultf = 1.0 / sqrt(intBitsToFloat(R127i.y));
PS1i = floatBitsToInt(tempResultf);
PS1i = floatBitsToInt(intBitsToFloat(PS1i) / 2.0);
// 14
R5i.x = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R125i.x),intBitsToFloat(PS1i)) + 0.5));
R5i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R125i.y),intBitsToFloat(PS1i)) + 0.5));
R5i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R125i.z),intBitsToFloat(PS1i)) + 0.5));
// 15
R4i.xyz = ivec3(R7i.x,R7i.y,R7i.z);
R4i.w = R7i.w;
// 16
R3i.xyz = ivec3(R5i.x,R5i.y,R5i.z);
R3i.w = R5i.w;
// 17
R2i.xyz = ivec3(R0i.x,R0i.y,R0i.z);
R2i.w = R0i.w;
// 18
R1i.xyz = ivec3(R6i.x,R6i.y,R6i.z);
R1i.w = R6i.w;
// export
passPixelColor0 = vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w));
passPixelColor1 = vec4(intBitsToFloat(R2i.x), intBitsToFloat(R2i.y), intBitsToFloat(R2i.z), intBitsToFloat(R2i.w));
passPixelColor3 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFloat(R3i.z), intBitsToFloat(R3i.w));
passPixelColor5 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w));
}
