#version 420
#extension GL_ARB_texture_gather : enable
// shader 91f557914ed24b44 
// re-alignt off axis bloom  
//To-do  Re-do whole chain with centered viewport values. 
uniform ivec4 uf_remappedPS[1];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4386000 res 1280x720x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf5376000 res 640x360x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0
layout(location = 0) in vec4 passParameterSem0;
layout(location = 1) in vec4 passParameterSem1;
layout(location = 2) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
const float repositionBloom = 1.00225;
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);
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;
R2f = passParameterSem2;
vec2 scaleFactor = vec2(repositionBloom, repositionBloom); //Added
R2f.xy = R2f.xy * scaleFactor;// re-align bloom.. hack until issue source is found. 

R1f.xyz = (texture(textureUnitPS0, R1f.xy).xyz);
R2f.xyz = (texture(textureUnitPS1, R2f.xy).xyz);
// 0
tempf.x = dot(vec4(R1f.x,R1f.y,R1f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
PV0f.x = tempf.x;
PV0f.y = tempf.x;
PV0f.z = tempf.x;
PV0f.w = tempf.x;
// 1
PV1f.y = -(R0f.x) + PV0f.x;
// 2
PV0f.x = max(PV1f.y, -(PV1f.y));
// 3
PV1f.w = R0f.y * PV0f.x;
PV1f.w = clamp(PV1f.w, 0.0, 1.0);
// 4
tempResultf = log2(PV1f.w);
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
PS0f = tempResultf;
// 5
PV1f.y = PS0f * intBitsToFloat(uf_remappedPS[0].w);
// 6
PS0f = exp2(PV1f.y);
// 7
R2f.w = PS0f * intBitsToFloat(uf_remappedPS[0].z); //sharpen
// export
passPixelColor0 = vec4(R2f.x, R2f.y, R2f.z, R2f.w);
}
