mirror of https://github.com/mgba-emu/mgba.git
Fix Wii U shader for OpenGL ES 2.0/OpenGL 2.1.
This commit is contained in:
parent
40ff1ea0c4
commit
e511610426
|
@ -2,21 +2,28 @@ varying vec2 texCoord;
|
|||
uniform sampler2D tex;
|
||||
uniform vec2 texSize;
|
||||
|
||||
const float scale[32] = float[](
|
||||
0.0/255.0, 6.0/255.0, 12.0/255.0, 18.0/255.0, 24.0/255.0, 31.0/255.0, 37.0/255.0, 43.0/255.0,
|
||||
49.0/255.0, 55.0/255.0, 61.0/255.0, 67.0/255.0, 73.0/255.0, 79.0/255.0, 86.0/255.0, 92.0/255.0,
|
||||
98.0/255.0, 104.0/255.0, 111.0/255.0, 117.0/255.0, 123.0/255.0, 129.0/255.0, 135.0/255.0, 141.0/255.0,
|
||||
148.0/255.0, 154.0/255.0, 159.0/255.0, 166.0/255.0, 172.0/255.0, 178.0/255.0, 184.0/255.0, 191.0/255.0
|
||||
);
|
||||
|
||||
void main() {
|
||||
float scale[32];
|
||||
scale[ 0] = 0.0/255.0; scale[ 1] = 6.0/255.0;
|
||||
scale[ 2] = 12.0/255.0; scale[ 3] = 18.0/255.0;
|
||||
scale[ 4] = 24.0/255.0; scale[ 5] = 31.0/255.0;
|
||||
scale[ 6] = 37.0/255.0; scale[ 7] = 43.0/255.0;
|
||||
scale[ 8] = 49.0/255.0; scale[ 9] = 55.0/255.0;
|
||||
scale[10] = 61.0/255.0; scale[11] = 67.0/255.0;
|
||||
scale[12] = 73.0/255.0; scale[13] = 79.0/255.0;
|
||||
scale[14] = 86.0/255.0; scale[15] = 92.0/255.0;
|
||||
scale[16] = 98.0/255.0; scale[17] = 104.0/255.0;
|
||||
scale[18] = 111.0/255.0; scale[19] = 117.0/255.0;
|
||||
scale[20] = 123.0/255.0; scale[21] = 129.0/255.0;
|
||||
scale[22] = 135.0/255.0; scale[23] = 141.0/255.0;
|
||||
scale[24] = 148.0/255.0; scale[25] = 154.0/255.0;
|
||||
scale[26] = 159.0/255.0; scale[27] = 166.0/255.0;
|
||||
scale[28] = 172.0/255.0; scale[29] = 178.0/255.0;
|
||||
scale[30] = 184.0/255.0; scale[31] = 191.0/255.0;
|
||||
|
||||
vec4 color = texture2D(tex, texCoord);
|
||||
color.rgb = round(color.rgb * 31.0);
|
||||
color = vec4(
|
||||
scale[int(color.r)],
|
||||
scale[int(color.g)],
|
||||
scale[int(color.b)],
|
||||
1.0
|
||||
);
|
||||
color.r = scale[int(floor(color.r * 31.0 + 0.5))];
|
||||
color.g = scale[int(floor(color.g * 31.0 + 0.5))];
|
||||
color.b = scale[int(floor(color.b * 31.0 + 0.5))];
|
||||
gl_FragColor = color;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue