Merge pull request #73 from kichikuou/gles

Fix shader compilation errors in OpenGL ES
This commit is contained in:
Nunuhara Cabbage
2022-10-01 10:37:52 -07:00
committed by GitHub
3 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -27,9 +27,9 @@ void main() {
int size = int(floor(threshold));
int cutoff = size + 1;
float edge_weight = fract(threshold);
vec2 tex_size = textureSize(tex, 0).xy;
vec2 tex_size = vec2(textureSize(tex, 0).xy);
float a_out = 0;
float a_out = 0.0;
for (int x = -cutoff; x <= cutoff; x++) {
for (int y = -cutoff; y <= cutoff; y++) {
@@ -37,7 +37,7 @@ void main() {
if (d > threshold)
continue;
float a = texture(tex, tex_coord + vec2(x, y) / tex_size).r;
if (d > size)
if (d > float(size))
a *= edge_weight;
a_out += a;
}
+1 -1
View File
@@ -27,7 +27,7 @@ out vec4 frag_color;
void main() {
vec2 p = tex_coord - center;
float a = atan(p.y, p.x);
a = mod(a - start_angle, 2 * PI);
a = mod(a - start_angle, 2.0 * PI);
if (a > angle)
discard;
frag_color = color;
+2 -1
View File
@@ -36,7 +36,8 @@ struct sdl_private sdl;
static const GLchar glsl_preamble[] =
#ifdef USE_GLES
"#version 300 es\n"
"precision highp float;\n";
"precision highp float;\n"
"precision highp int;\n";
#else
"#version 140\n";
#endif