summaryrefslogtreecommitdiffstats
path: root/glow
diff options
context:
space:
mode:
authorLibravatar bungoboingo <shankern@protonmail.com>2022-10-10 20:55:43 -0700
committerLibravatar bungoboingo <shankern@protonmail.com>2022-10-10 20:55:43 -0700
commitbb8d46a3fdf925b4b2fa9e7db76e48caf020b212 (patch)
treecdba40da27d3e2267afd7c3c01bc448ea8136aba /glow
parentaabc4e87b51af8025910681dc427260254877e4c (diff)
downloadiced-bb8d46a3fdf925b4b2fa9e7db76e48caf020b212.tar.gz
iced-bb8d46a3fdf925b4b2fa9e7db76e48caf020b212.tar.bz2
iced-bb8d46a3fdf925b4b2fa9e7db76e48caf020b212.zip
Fixed fragment shader compatibility issues with GLES 3.0+
Diffstat (limited to 'glow')
-rw-r--r--glow/src/shader/common/gradient.frag26
-rw-r--r--glow/src/window/compositor.rs2
2 files changed, 14 insertions, 14 deletions
diff --git a/glow/src/shader/common/gradient.frag b/glow/src/shader/common/gradient.frag
index 82c7e251..42d0201f 100644
--- a/glow/src/shader/common/gradient.frag
+++ b/glow/src/shader/common/gradient.frag
@@ -1,14 +1,14 @@
#ifdef GL_ES
-#ifdef GL_FRAGMENT_PRECISION_HIGH
-precision highp float;
-#else
-precision mediump float;
-#endif
+ #ifdef GL_FRAGMENT_PRECISION_HIGH
+ precision highp float;
+ #else
+ precision mediump float;
+ #endif
#endif
#ifdef HIGHER_THAN_300
-layout (location = 0) out vec4 fragColor;
-#define gl_FragColor fragColor
+ layout (location = 0) out vec4 fragColor;
+ #define gl_FragColor fragColor
#endif
in vec2 raw_position;
@@ -31,11 +31,11 @@ void main() {
fragColor = vec4(0.0, 0.0, 0.0, 0.0);
float min_offset = color_stops[1].x;
- float max_offset = color_stops[color_stops_size - 1].x;
+ float max_offset = color_stops[color_stops_size - 1u].x;
- for (uint i = 0; i < color_stops_size - 2; i += 2) {
- float curr_offset = color_stops[i+1].x;
- float next_offset = color_stops[i+3].x;
+ for (uint i = 0u; i < color_stops_size - 2u; i += 2u) {
+ float curr_offset = color_stops[i+1u].x;
+ float next_offset = color_stops[i+3u].x;
if (coord_offset <= min_offset) {
//current coordinate is before the first defined offset, set it to the start color
@@ -44,7 +44,7 @@ void main() {
if (curr_offset <= coord_offset && coord_offset <= next_offset) {
//current fragment is between the current offset processing & the next one, interpolate colors
- fragColor = mix(color_stops[i], color_stops[i+2], smoothstep(
+ fragColor = mix(color_stops[i], color_stops[i+2u], smoothstep(
curr_offset,
next_offset,
coord_offset
@@ -53,7 +53,7 @@ void main() {
if (coord_offset >= max_offset) {
//current coordinate is before the last defined offset, set it to the last color
- fragColor = color_stops[color_stops_size - 2];
+ fragColor = color_stops[color_stops_size - 2u];
}
}
}
diff --git a/glow/src/window/compositor.rs b/glow/src/window/compositor.rs
index e9cf6015..6459dbce 100644
--- a/glow/src/window/compositor.rs
+++ b/glow/src/window/compositor.rs
@@ -26,7 +26,7 @@ impl<Theme> iced_graphics::window::GLCompositor for Compositor<Theme> {
log::info!("{:#?}", settings);
let version = gl.version();
- log::info!("OpenGL version: {:?} (Embedded: {}", version, version.is_embedded);
+ log::info!("OpenGL version: {:?} (Embedded: {})", version, version.is_embedded);
let renderer = gl.get_parameter_string(glow::RENDERER);
log::info!("Renderer: {}", renderer);