Skip to content

Commit e34f01e

Browse files
committed
plugins: s/mediump/highp/
This fixes various rendering oddities, such as unintentional wind in water and tearing in vortex animation.
1 parent 40b1d9c commit e34f01e

File tree

8 files changed

+40
-41
lines changed

8 files changed

+40
-41
lines changed

src/extra-animations/blinds.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static const char *blinds_vert_source =
4343
R"(
4444
#version 100
4545
46-
attribute mediump vec3 position;
47-
attribute mediump vec2 uv_in;
46+
attribute highp vec3 position;
47+
attribute highp vec2 uv_in;
4848
4949
uniform mat4 matrix;
5050
@@ -62,7 +62,7 @@ static const char *blinds_frag_source =
6262
@builtin_ext@
6363
@builtin@
6464
65-
precision mediump float;
65+
precision highp float;
6666
6767
varying highp vec2 uv;
6868

src/extra-animations/helix.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static const char *helix_vert_source =
4343
R"(
4444
#version 100
4545
46-
attribute mediump vec3 position;
47-
attribute mediump vec2 uv_in;
46+
attribute highp vec3 position;
47+
attribute highp vec2 uv_in;
4848
4949
uniform mat4 matrix;
5050
@@ -62,7 +62,7 @@ static const char *helix_frag_source =
6262
@builtin_ext@
6363
@builtin@
6464
65-
precision mediump float;
65+
precision highp float;
6666
6767
varying highp vec2 uv;
6868

src/extra-animations/shatter.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ static const char *shatter_vert_source =
4848
R"(
4949
#version 100
5050
51-
attribute mediump vec2 position;
52-
attribute mediump vec2 uv_in;
51+
attribute highp vec2 position;
52+
attribute highp vec2 uv_in;
5353
5454
uniform mat4 matrix;
5555
@@ -67,10 +67,10 @@ static const char *shatter_frag_source =
6767
@builtin_ext@
6868
@builtin@
6969
70-
precision mediump float;
70+
precision highp float;
7171
7272
varying highp vec2 uv;
73-
uniform mediump float alpha;
73+
uniform highp float alpha;
7474
7575
void main()
7676
{

src/extra-animations/vortex.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static const char *vortex_vert_source =
4343
R"(
4444
#version 100
4545
46-
attribute mediump vec2 position;
47-
attribute mediump vec2 uv_in;
46+
attribute highp vec2 position;
47+
attribute highp vec2 uv_in;
4848
4949
uniform mat4 matrix;
5050
@@ -62,10 +62,10 @@ static const char *vortex_frag_source =
6262
@builtin_ext@
6363
@builtin@
6464
65-
precision mediump float;
65+
precision highp float;
6666
6767
varying highp vec2 uv;
68-
uniform mediump float progress;
68+
uniform highp float progress;
6969
7070
const float PI = 3.1415926535897932384626433832795;
7171

src/keycolor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ static const char *vertex_shader =
3636
R"(
3737
#version 100
3838
39-
attribute mediump vec2 position;
40-
attribute mediump vec2 texcoord;
39+
attribute highp vec2 position;
40+
attribute highp vec2 texcoord;
4141
42-
varying mediump vec2 uvpos;
42+
varying highp vec2 uvpos;
4343
4444
uniform mat4 mvp;
4545
@@ -56,12 +56,12 @@ static const char *fragment_shader =
5656
@builtin_ext@
5757
@builtin@
5858
59-
precision mediump float;
59+
precision highp float;
6060
61-
uniform mediump vec4 color;
61+
uniform highp vec4 color;
6262
uniform float threshold;
6363
64-
varying mediump vec2 uvpos;
64+
varying highp vec2 uvpos;
6565
6666
void main()
6767
{

src/obs.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ static const char *vertex_shader =
4141
R"(
4242
#version 100
4343
44-
attribute mediump vec2 position;
45-
attribute mediump vec2 texcoord;
44+
attribute highp vec2 position;
45+
attribute highp vec2 texcoord;
4646
47-
varying mediump vec2 uvpos;
47+
varying highp vec2 uvpos;
4848
4949
uniform mat4 mvp;
5050
@@ -61,14 +61,14 @@ static const char *fragment_shader =
6161
@builtin_ext@
6262
@builtin@
6363
64-
precision mediump float;
64+
precision highp float;
6565
6666
/* Input uniforms are 0-1 range. */
67-
uniform mediump float opacity;
68-
uniform mediump float brightness;
69-
uniform mediump float saturation;
67+
uniform highp float opacity;
68+
uniform highp float brightness;
69+
uniform highp float saturation;
7070
71-
varying mediump vec2 uvpos;
71+
varying highp vec2 uvpos;
7272
7373
vec3 saturate(vec3 rgb, float adjustment)
7474
{

src/showtouch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ static const char *vertex_shader =
4040
R"(
4141
#version 300 es
4242
43-
in mediump vec2 position;
44-
in mediump vec2 texcoord;
43+
in highp vec2 position;
44+
in highp vec2 texcoord;
4545
46-
out mediump vec2 uvpos;
46+
out highp vec2 uvpos;
4747
4848
void main() {
4949
@@ -58,10 +58,10 @@ static const char *fragment_shader =
5858
@builtin_ext@
5959
@builtin@
6060
61-
precision mediump float;
61+
precision highp float;
6262
6363
out vec4 out_color;
64-
in mediump vec2 uvpos;
64+
in highp vec2 uvpos;
6565
uniform vec2 resolution;
6666
uniform vec2 finger0;
6767
uniform vec2 finger1;

src/water.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static const char *vertex_shader =
3939
R"(
4040
#version 100
4141
42-
attribute mediump vec2 position;
42+
attribute highp vec2 position;
4343
attribute highp vec2 uvPosition;
4444
4545
varying highp vec2 uvpos;
@@ -54,7 +54,7 @@ void main()
5454
static const char *fragment_shader_a =
5555
R"(
5656
#version 100
57-
precision mediump float;
57+
precision highp float;
5858
5959
uniform int num_points;
6060
uniform vec2 points[64];
@@ -65,11 +65,10 @@ uniform sampler2D u_texture;
6565
void main()
6666
{
6767
int i;
68-
for (i = 0; i < num_points; i++)
68+
for (i = 0; button_down == 1 && i < num_points; i++)
6969
{
70-
vec2 r = gl_FragCoord.xy - points[i];
71-
float d = 0.005 * dot(r, r);
72-
if (button_down == 1 && d < 0.05)
70+
float d = length(gl_FragCoord.xy - points[i]);
71+
if (d < 3.)
7372
{
7473
gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
7574
return;
@@ -83,7 +82,7 @@ void main()
8382
static const char *fragment_shader_b =
8483
R"(
8584
#version 100
86-
precision mediump float;
85+
precision highp float;
8786
8887
uniform vec2 resolution;
8988
varying highp vec2 uvpos;
@@ -125,7 +124,7 @@ void main()
125124
static const char *fragment_shader_c =
126125
R"(
127126
#version 100
128-
precision mediump float;
127+
precision highp float;
129128
130129
#define DEBUG 0
131130

0 commit comments

Comments
 (0)