mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-27 06:35:37 +00:00
Fix white gfx on linux / intel gpus. These optimisations originally came from toxieainc
This commit is contained in:
parent
c5f9a3ad26
commit
f89da17f17
|
@ -337,6 +337,16 @@ float CalcFog()
|
||||||
return fog;
|
return fog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Sqr(float a)
|
||||||
|
{
|
||||||
|
return a*a;
|
||||||
|
}
|
||||||
|
|
||||||
|
float SqrLength(vec2 a)
|
||||||
|
{
|
||||||
|
return a.x*a.x + a.y*a.y;
|
||||||
|
}
|
||||||
|
|
||||||
void WriteOutputs(vec4 colour, int layer)
|
void WriteOutputs(vec4 colour, int layer)
|
||||||
{
|
{
|
||||||
vec4 blank = vec4(0.0);
|
vec4 blank = vec4(0.0);
|
||||||
|
|
|
@ -249,6 +249,8 @@ float CalcFog();
|
||||||
void Step15Luminous(inout vec4 colour);
|
void Step15Luminous(inout vec4 colour);
|
||||||
vec4 GetTextureValue();
|
vec4 GetTextureValue();
|
||||||
void WriteOutputs(vec4 colour, int layer);
|
void WriteOutputs(vec4 colour, int layer);
|
||||||
|
float Sqr(float a);
|
||||||
|
float SqrLength(vec2 a);
|
||||||
|
|
||||||
void QuadraticInterpolation()
|
void QuadraticInterpolation()
|
||||||
{
|
{
|
||||||
|
@ -354,16 +356,6 @@ void QuadraticInterpolation()
|
||||||
gl_FragDepth = depth * 0.5 + 0.5;
|
gl_FragDepth = depth * 0.5 + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
float sqr(float a)
|
|
||||||
{
|
|
||||||
return a*a;
|
|
||||||
}
|
|
||||||
|
|
||||||
float sqr_length(vec2 a)
|
|
||||||
{
|
|
||||||
return a.x*a.x + a.y*a.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 tex1Data;
|
vec4 tex1Data;
|
||||||
|
@ -389,7 +381,7 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
float ellipse;
|
float ellipse;
|
||||||
ellipse = sqr_length((gl_FragCoord.xy - spotEllipse.xy) / spotEllipse.zw); // decay rate = square of distance from center
|
ellipse = SqrLength((gl_FragCoord.xy - spotEllipse.xy) / spotEllipse.zw); // decay rate = square of distance from center
|
||||||
ellipse = 1.0 - ellipse; // invert
|
ellipse = 1.0 - ellipse; // invert
|
||||||
ellipse = max(0.0, ellipse); // clamp
|
ellipse = max(0.0, ellipse); // clamp
|
||||||
|
|
||||||
|
@ -414,7 +406,7 @@ void main()
|
||||||
// inverse-linear falloff
|
// inverse-linear falloff
|
||||||
// Reference: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/
|
// Reference: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/
|
||||||
// y = 1 / (d/r + 1)^2
|
// y = 1 / (d/r + 1)^2
|
||||||
range = 1.0 / sqr(d * inv_r - 1.0);
|
range = 1.0 / Sqr(d * inv_r - 1.0);
|
||||||
range *= enable;
|
range *= enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,8 @@ float CalcFog();
|
||||||
void Step15Luminous(inout vec4 colour);
|
void Step15Luminous(inout vec4 colour);
|
||||||
vec4 GetTextureValue();
|
vec4 GetTextureValue();
|
||||||
void WriteOutputs(vec4 colour, int layer);
|
void WriteOutputs(vec4 colour, int layer);
|
||||||
|
float Sqr(float a);
|
||||||
|
float SqrLength(vec2 a);
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -150,8 +152,7 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
float ellipse;
|
float ellipse;
|
||||||
ellipse = length((gl_FragCoord.xy - spotEllipse.xy) / spotEllipse.zw);
|
ellipse = SqrLength((gl_FragCoord.xy - spotEllipse.xy) / spotEllipse.zw); // decay rate = square of distance from center
|
||||||
ellipse = pow(ellipse, 2.0); // decay rate = square of distance from center
|
|
||||||
ellipse = 1.0 - ellipse; // invert
|
ellipse = 1.0 - ellipse; // invert
|
||||||
ellipse = max(0.0, ellipse); // clamp
|
ellipse = max(0.0, ellipse); // clamp
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ void main()
|
||||||
// inverse-linear falloff
|
// inverse-linear falloff
|
||||||
// Reference: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/
|
// Reference: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/
|
||||||
// y = 1 / (d/r + 1)^2
|
// y = 1 / (d/r + 1)^2
|
||||||
range = 1.0 / pow(d * inv_r - 1.0, 2.0);
|
range = 1.0 / Sqr(d * inv_r - 1.0);
|
||||||
range *= enable;
|
range *= enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue