Fix web shaders

Got broken in https://github.com/emilk/egui/pull/187
This commit is contained in:
Emil Ernerfeldt 2021-02-28 19:47:01 +01:00
parent a9a49f19ca
commit e417fac52e
4 changed files with 5 additions and 8 deletions

View file

@ -1,5 +1,3 @@
#version 100 es
precision mediump float;
uniform sampler2D u_sampler;
varying vec4 v_rgba;
@ -13,6 +11,7 @@ vec3 srgb_from_linear(vec3 rgb) {
return mix(higher, lower, vec3(cutoff));
}
// 0-255 sRGB from 0-1 linear
vec4 srgba_from_linear(vec4 rgba) {
return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a);
}
@ -25,6 +24,7 @@ vec3 linear_from_srgb(vec3 srgb) {
return mix(higher, lower, vec3(cutoff));
}
// 0-1 linear from 0-255 sRGBA
vec4 linear_from_srgba(vec4 srgba) {
return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0);
}

View file

@ -1,5 +1,3 @@
#version 300 es
precision mediump float;
uniform sampler2D u_sampler;
varying vec4 v_rgba;
@ -13,6 +11,7 @@ vec3 srgb_from_linear(vec3 rgb) {
return mix(higher, lower, vec3(cutoff));
}
// 0-255 sRGBA from 0-1 linear
vec4 srgba_from_linear(vec4 rgba) {
return vec4(srgb_from_linear(rgba.rgb), 255.0 * rgba.a);
}

View file

@ -1,5 +1,3 @@
#version 100 es
precision mediump float;
uniform vec2 u_screen_size;
attribute vec2 a_pos;
@ -16,6 +14,7 @@ vec3 linear_from_srgb(vec3 srgb) {
return mix(higher, lower, vec3(cutoff));
}
// 0-1 linear from 0-255 sRGBA
vec4 linear_from_srgba(vec4 srgba) {
return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0);
}

View file

@ -1,5 +1,3 @@
#version 300 es
precision mediump float;
uniform vec2 u_screen_size;
attribute vec2 a_pos;
@ -16,6 +14,7 @@ vec3 linear_from_srgb(vec3 srgb) {
return mix(higher, lower, vec3(cutoff));
}
// 0-1 linear from 0-255 sRGBA
vec4 linear_from_srgba(vec4 srgba) {
return vec4(linear_from_srgb(srgba.rgb), srgba.a / 255.0);
}