Improve shader version selection

This commit is contained in:
Richard 2021-11-11 01:10:47 -03:00
parent afdf3e799a
commit e31566d430
17 changed files with 179 additions and 69 deletions

View file

@ -1,5 +1,10 @@
#version 100
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#endif
uniform float u_ScreenHeight;
@ -10,7 +15,7 @@ varying vec2 v_Scale;
varying float v_BorderRadius;
varying float v_BorderWidth;
float _distance(in vec2 frag_coord, in vec2 position, in vec2 size, float radius)
float _distance(vec2 frag_coord, vec2 position, vec2 size, float radius)
{
// TODO: Try SDF approach: https://www.shadertoy.com/view/wd3XRN
vec2 inner_size = size - vec2(radius, radius) * 2.0;

View file

@ -1,5 +1,3 @@
#version 100
uniform mat4 u_Transform;
uniform float u_Scale;

View file

@ -1,8 +0,0 @@
#version 100
precision mediump float;
varying vec4 v_Color;
void main() {
gl_FragColor = v_Color;
}

View file

@ -1,13 +0,0 @@
#version 100
uniform mat4 u_Transform;
attribute vec2 i_Position;
attribute vec4 i_Color;
varying vec4 v_Color;
void main() {
v_Color = i_Color;
gl_Position = u_Transform * vec4(i_Position, 0.0, 1.0);
}