mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Fixes our post processing shaders so they work under OpenGL ES 3.0
Most of our shaders relied on implicit int->float conversions. This fixes the assumption that this is allowed
This commit is contained in:
@ -8,19 +8,19 @@ uniform vec4 resolution;
|
||||
void main()
|
||||
{
|
||||
//variables
|
||||
int internalresolution = 1278;
|
||||
float internalresolution = 1278.0;
|
||||
float4 c0 = texture(samp9, uv0).rgba;
|
||||
//blur
|
||||
float4 blurtotal = float4(0, 0, 0, 0);
|
||||
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
|
||||
float blursize = 1.5;
|
||||
blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2(-blursize, blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( blursize, -blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( blursize, blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2(-blursize, 0)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( blursize, 0)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( 0, -blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( 0, blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2(-blursize, 0.0)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( blursize, 0.0)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize)*resolution.zw);
|
||||
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw);
|
||||
blurtotal *= 0.125;
|
||||
c0 = blurtotal;
|
||||
//greyscale
|
||||
@ -30,27 +30,27 @@ void main()
|
||||
// darken edges
|
||||
float x = uv0.x * resolution.x;
|
||||
float y = uv0.y * resolution.y;
|
||||
if (x > internalresolution/2) x = internalresolution-x;
|
||||
if (y > internalresolution/2) y = internalresolution-y;
|
||||
if (x > internalresolution/2*0.95) x = internalresolution/2*0.95;
|
||||
if (y > internalresolution/2*0.95) y = internalresolution/2*0.95;
|
||||
x = -x+641;
|
||||
y = -y+641;
|
||||
if (x > internalresolution/2.0) x = internalresolution-x;
|
||||
if (y > internalresolution/2.0) y = internalresolution-y;
|
||||
if (x > internalresolution/2.0*0.95) x = internalresolution/2.0*0.95;
|
||||
if (y > internalresolution/2.0*0.95) y = internalresolution/2.0*0.95;
|
||||
x = -x+641.0;
|
||||
y = -y+641.0;
|
||||
/*****inline square root routines*****/
|
||||
// bit of a performance bottleneck.
|
||||
// neccessary to make the darkened area rounded
|
||||
// instead of rhombus-shaped.
|
||||
float sqrt=x/10;
|
||||
float sqrt = x / 10.0;
|
||||
while((sqrt*sqrt) < x) sqrt+=0.1;
|
||||
x = sqrt;
|
||||
sqrt=y/10;
|
||||
sqrt = y / 10.0;
|
||||
while((sqrt*sqrt) < y) sqrt+=0.1;
|
||||
y = sqrt;
|
||||
/*****end of inline square root routines*****/
|
||||
x *= 2;
|
||||
y *= 2;
|
||||
grey -= x/200;
|
||||
grey -= y/200;
|
||||
x *= 2.0;
|
||||
y *= 2.0;
|
||||
grey -= x / 200.0;
|
||||
grey -= y / 200.0;
|
||||
// output
|
||||
ocol0 = float4(0, grey, 0, 1.0);
|
||||
}
|
||||
ocol0 = float4(0.0, grey, 0.0, 1.0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user