Skip to content

Commit

Permalink
My attempt to make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7CFE committed Jul 17, 2020
1 parent b5d842f commit 6ff29ef
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ categories = ["gui"]

[features]
default = ["wgpu", "default_system_font"]
#default = ["wgpu", "default_system_font", "glow", "glow_canvas"]
# Enables the `iced_wgpu` renderer
wgpu = ["iced_wgpu"]
# Enables the `Image` widget
Expand Down Expand Up @@ -90,3 +91,6 @@ iced_web = { version = "0.2", path = "web" }
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = ["image", "svg", "canvas"]

[patch.crates-io]
glow_glyph = { path = '../glow_glyph' }
2 changes: 1 addition & 1 deletion examples/counter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"
publish = false

[dependencies]
iced = { path = "../.." }
iced = { path = "../..", features = ["glow"] }
2 changes: 1 addition & 1 deletion examples/stopwatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ edition = "2018"
publish = false

[dependencies]
iced = { path = "../..", features = ["tokio"] }
iced = { path = "../..", features = ["tokio", "glow"] }
11 changes: 6 additions & 5 deletions glow/src/shader/quad.frag
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#version 330
#version 300 es
precision highp float;

uniform float u_ScreenHeight;

Expand All @@ -11,7 +12,7 @@ in float v_BorderWidth;

out vec4 o_Color;

float distance(in vec2 frag_coord, in vec2 position, in vec2 size, float radius)
float distance1(in vec2 frag_coord, in vec2 position, in vec2 size, float radius)
{
// TODO: Try SDF approach: https://www.shadertoy.com/view/wd3XRN
vec2 inner_size = size - vec2(radius, radius) * 2.0;
Expand All @@ -35,10 +36,10 @@ void main() {
vec2 fragCoord = vec2(gl_FragCoord.x, u_ScreenHeight - gl_FragCoord.y);

// TODO: Remove branching (?)
if(v_BorderWidth > 0) {
if(v_BorderWidth > 0.) {
float internal_border = max(v_BorderRadius - v_BorderWidth, 0.0);

float internal_distance = distance(
float internal_distance = distance1(
fragCoord,
v_Pos + vec2(v_BorderWidth),
v_Scale - vec2(v_BorderWidth * 2.0),
Expand All @@ -56,7 +57,7 @@ void main() {
mixed_color = v_Color;
}

float d = distance(
float d = distance1(
fragCoord,
v_Pos,
v_Scale,
Expand Down
3 changes: 2 additions & 1 deletion glow/src/shader/quad.vert
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#version 330
#version 300 es
precision highp float;

uniform mat4 u_Transform;
uniform float u_Scale;
Expand Down
3 changes: 2 additions & 1 deletion glow/src/shader/triangle.frag
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#version 330
#version 300 es
precision highp float;

in vec4 v_Color;

Expand Down
3 changes: 2 additions & 1 deletion glow/src/shader/triangle.vert
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#version 330
#version 300 es
precision highp float;

uniform mat4 u_Transform;

Expand Down
2 changes: 1 addition & 1 deletion graphics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ version = "0.15"
optional = true

[dependencies.font-kit]
version = "0.6"
version = "0.9"
optional = true

[package.metadata.docs.rs]
Expand Down
5 changes: 5 additions & 0 deletions log
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Finished dev [unoptimized + debuginfo] target(s) in 0.52s
Running `target/debug/stopwatch`
thread 'main' panicked at '0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.00 ES, and 3.00 ES
', /home/pi/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/glow_glyph-0.2.0/src/pipeline.rs:287:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
4 changes: 4 additions & 0 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ guillotiere = "0.5"
# resolved
gfx-memory = "=0.1.1"

[dependencies.wgpu-native]
version = "0.5"
features = ["vulkan-portability"]

[dependencies.iced_native]
version = "0.2"
path = "../native"
Expand Down

0 comments on commit 6ff29ef

Please sign in to comment.