 		
 		rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
 		rgb.g = HueToRGB(f1, f2, hsl.x);
-		rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));
+		rgb.b = HueToRGB(f1, f2, hsl.x - (1.0/3.0));
 	}
 	
 	return rgb;

//------------------------------------


void SGX_blend_normal(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendNormal(basePixel, blendPixel);
}


void SGX_blend_lighten(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_lighten(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_lighten(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendLightenf(basePixel, blendPixel);
}


void SGX_blend_darken(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_darken(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_darken(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendDarkenf(basePixel, blendPixel);
}


void SGX_blend_multiply(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendMultiply(basePixel, blendPixel);
}


void SGX_blend_average(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendAverage(basePixel, blendPixel);
}


void SGX_blend_add(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendAdd(basePixel, blendPixel);
}



void SGX_blend_subtract(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendSubtract(basePixel, blendPixel);
}


void SGX_blend_difference(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendDifference(basePixel, blendPixel);
}


void SGX_blend_negation(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendNegation(basePixel, blendPixel);
}


void SGX_blend_exclusion(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendExclusion(basePixel, blendPixel);
}


void SGX_blend_screen(vec4 s1, vec4 s2, out vec4 oColor)
{	
	oColor = vec4(BlendScreenf(s1.r, s2.r), 
		BlendScreenf(s1.g, s2.g), 
		BlendScreenf(s1.b, s2.b), 
		BlendScreenf(s1.a, s2.a));
}
void SGX_blend_screen(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendScreenf(s1.r, s2.r), 
		BlendScreenf(s1.g, s2.g), 
		BlendScreenf(s1.b, s2.b));
}
void SGX_blend_screen(float s1, float s2, out float oColor)
{
	oColor = BlendScreenf(s1, s2);
}


void SGX_blend_overlay(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendOverlayf(s1.r, s2.r), 
		BlendOverlayf(s1.g, s2.g), 
		BlendOverlayf(s1.b, s2.b), 
		BlendOverlayf(s1.a, s2.a));
}
void SGX_blend_overlay(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendOverlayf(s1.r, s2.r), 
		BlendOverlayf(s1.g, s2.g), 
		BlendOverlayf(s1.b, s2.b));
}
void SGX_blend_overlay(float s1, float s2, out float oColor)
{
	oColor = BlendOverlayf(s1, s2);
}


void SGX_blend_softLight(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendSoftLightf(s1.r, s2.r), 
		BlendSoftLightf(s1.g, s2.g), 
		BlendSoftLightf(s1.b, s2.b), 
		BlendSoftLightf(s1.a, s2.a));
}
void SGX_blend_softLight(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendSoftLightf(s1.r, s2.r), 
		BlendSoftLightf(s1.g, s2.g), 
		BlendSoftLightf(s1.b, s2.b));
}
void SGX_blend_softLight(float s1, float s2, out float oColor)
{
	oColor = BlendSoftLightf(s1, s2);
}


void SGX_blend_hardLight(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendOverlayf(s1.r, s2.r), 
		BlendOverlayf(s1.g, s2.g), 
		BlendOverlayf(s1.b, s2.b), 
		BlendOverlayf(s1.a, s2.a));
}
void SGX_blend_hardLight(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendOverlayf(s1.r, s2.r), 
		BlendOverlayf(s1.g, s2.g), 
		BlendOverlayf(s1.b, s2.b));
}
void SGX_blend_hardLight(float s1, float s2, out float oColor)
{
	oColor = BlendOverlayf(s1, s2);
}


void SGX_blend_colorDodge(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendColorDodgef(s1.r, s2.r), 
		BlendColorDodgef(s1.g, s2.g), 
		BlendColorDodgef(s1.b, s2.b), 
		BlendColorDodgef(s1.a, s2.a));
}
void SGX_blend_colorDodge(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendColorDodgef(s1.r, s2.r), 
		BlendColorDodgef(s1.g, s2.g), 
		BlendColorDodgef(s1.b, s2.b));
}
void SGX_blend_colorDodge(float s1, float s2, out float oColor)
{
	oColor = BlendColorDodgef(s1, s2);
}


void SGX_blend_colorBurn(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendColorBurnf(s1.r, s2.r), 
		BlendColorBurnf(s1.g, s2.g), 
		BlendColorBurnf(s1.b, s2.b), 
		BlendColorBurnf(s1.a, s2.a));
}
void SGX_blend_colorBurn(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendColorBurnf(s1.r, s2.r), 
		BlendColorBurnf(s1.g, s2.g), 
		BlendColorBurnf(s1.b, s2.b));
}
void SGX_blend_colorBurn(float s1, float s2, out float oColor)
{
	oColor = BlendColorBurnf(s1, s2);
}


void SGX_blend_linearDodge(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearDodge(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearDodge(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendAddf(basePixel, blendPixel);
}
 

void SGX_blend_linearBurn(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendSubtractf(basePixel, blendPixel);
}


void SGX_blend_linearLight(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendLinearLightf(s1.r, s2.r), 
		BlendLinearLightf(s1.g, s2.g), 
		BlendLinearLightf(s1.b, s2.b), 
		BlendLinearLightf(s1.a, s2.a));
}
void SGX_blend_linearLight(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendLinearLightf(s1.r, s2.r), 
		BlendLinearLightf(s1.g, s2.g), 
		BlendLinearLightf(s1.b, s2.b));
}
void SGX_blend_linearLight(float s1, float s2, out float oColor)
{
	oColor = BlendLinearLightf(s1, s2);
}


void SGX_blend_vividLight(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendVividLightf(s1.r, s2.r), 
		BlendVividLightf(s1.g, s2.g), 
		BlendVividLightf(s1.b, s2.b), 
		BlendVividLightf(s1.a, s2.a));
}
void SGX_blend_vividLight(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendVividLightf(s1.r, s2.r), 
		BlendVividLightf(s1.g, s2.g), 
		BlendVividLightf(s1.b, s2.b));
}
void SGX_blend_vividLight(float s1, float s2, out float oColor)
{
	oColor = BlendVividLightf(s1, s2);
}


void SGX_blend_pinLight(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendPinLightf(s1.r, s2.r), 
		BlendPinLightf(s1.g, s2.g), 
		BlendPinLightf(s1.b, s2.b), 
		BlendPinLightf(s1.a, s2.a));
}
void SGX_blend_pinLight(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendPinLightf(s1.r, s2.r), 
		BlendPinLightf(s1.g, s2.g), 
		BlendPinLightf(s1.b, s2.b));
}
void SGX_blend_pinLight(float s1, float s2, out float oColor)
{
	oColor = BlendPinLightf(s1, s2);
}


void SGX_blend_hardMix(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendHardMixf(s1.r, s2.r), 
		BlendHardMixf(s1.g, s2.g), 
		BlendHardMixf(s1.b, s2.b), 
		BlendHardMixf(s1.a, s2.a));
}
void SGX_blend_hardMix(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendHardMixf(s1.r, s2.r), 
		BlendHardMixf(s1.g, s2.g), 
		BlendHardMixf(s1.b, s2.b));
}
void SGX_blend_hardMix(float s1, float s2, out float oColor)
{
	oColor = BlendHardMixf(s1, s2);
}

void SGX_blend_reflect(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendReflectf(s1.r, s2.r), 
		BlendReflectf(s1.g, s2.g), 
		BlendReflectf(s1.b, s2.b), 
		BlendReflectf(s1.a, s2.a));
}
void SGX_blend_reflect(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendReflectf(s1.r, s2.r), 
		BlendReflectf(s1.g, s2.g), 
		BlendReflectf(s1.b, s2.b));
}
void SGX_blend_reflect(float s1, float s2, out float oColor)
{
	oColor = BlendReflectf(s1, s2);
}


void SGX_blend_glow(vec4 s1, vec4 s2, out vec4 oColor)
{
	oColor = vec4(BlendReflectf(s1.r, s2.r), 
		BlendReflectf(s1.g, s2.g), 
		BlendReflectf(s1.b, s2.b), 
		BlendReflectf(s1.a, s2.a));
}
void SGX_blend_glow(vec3 s1, vec3 s2, out vec3 oColor)
{
	oColor = vec3(BlendReflectf(s1.r, s2.r), 
		BlendReflectf(s1.g, s2.g), 
		BlendReflectf(s1.b, s2.b));
}
void SGX_blend_glow(float s1, float s2, out float oColor)
{
	oColor = BlendReflectf(s1, s2);
}


void SGX_blend_phoenix(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendPhoenix(basePixel, blendPixel);
}


void SGX_blend_saturation(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendSaturation4(basePixel, blendPixel);
}
void SGX_blend_saturation(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendSaturation3(basePixel, blendPixel);
}
void SGX_blend_saturation(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendSaturation1(basePixel, blendPixel);
}


void SGX_blend_color(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendColor4(basePixel, blendPixel);
}
void SGX_blend_color(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendColor3(basePixel, blendPixel);
}
void SGX_blend_color(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendColor1(basePixel, blendPixel);
}


void SGX_blend_luminosity(vec4 basePixel, vec4 blendPixel, out vec4 oColor)
{
	oColor = BlendLuminosity4(basePixel, blendPixel);
}
void SGX_blend_luminosity(vec3 basePixel, vec3 blendPixel, out vec3 oColor)
{
	oColor = BlendLuminosity3(basePixel, blendPixel);
}
void SGX_blend_luminosity(float basePixel, float blendPixel, out float oColor)
{
	oColor = BlendLuminosity1(basePixel, blendPixel);
}

	return hsl;
}

float HueToRGB(in float f1, in float f2, in float hue)
{
	if (hue < 0.0)
		hue += 1.0;
