iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.08k stars 1.12k forks source link

SVG Example not loading the SVG(tiger) image in other system except the one it which it is built #1817

Open mayankjoshii opened 1 year ago

mayankjoshii commented 1 year ago

Is there an existing issue for this?

Is this issue related to iced?

What happened?

I tried building the svg example present in the iced libaray. The system in which it was build, it is working as exepected (i.e., the tiger SVG image is loading) but if I'm trying to run it in different machine(laptop), then the SVG image is not loading and only white screen is created.

This issue is occurring whenever I'm trying to load SVG in my application. This issue also exits with the existing example/svg/ (app) present in the iced library

What is the expected behavior?

The expectation was the application to load and display SVG image in all the system it was running.

Working case: Machine 1( where this app was built) image

Failure case: Machine 2(where I was testing this app) image

Version

master

Operative System

Windows

Do you have any log output?

No response

lvella commented 1 year ago

Can you please try with iced_glow ? Like cargo build --features iced/glow?

I have encountered what I believe to be the same bug. SVG is rendered as a black square in my application, but it works fine if I run with --features iced/glow.

This is a screenshot with wgpu: iced_wgpu

This is a screenshot with glow: iced_glow

lvella commented 1 year ago

But there is more: both applications runs under OpenGL. wgpu executes my vulkan loader, ignores both of my vulkan devices, and falls back to an OpenGL implementation where SVG is broken.

But there is even more: if I run the same application on my NVidia GPU (same PC, just select it with and environment variable), then it renders properly. It seems to be broken on the Intel OpenGL implementation, and in some arm64 GPU, as reported in here. I guess, from experience, that Nvidia's OpenGL is more lenient to buggy code, and works where other implementations fails.

So, I think there are two bugs here: on Linux X11, vulkan is not being selected when it should, and iced_wgpu is falling back to a broken implementation of Svg over OpenGL (but still happens to work on Nvidia).

lvella commented 1 year ago

Weirdly, if I cross compile my project to Windows using wgpu, and execute it under wine, the SVGs are rendered properly.

hecrj commented 1 year ago

The svg example uses CARGO_MANIFEST_DIR to hardcode the absolute path to the tiger.svg in the binary. The resulting binary isn't expected to be portable.

FuzzyLitchi commented 11 months ago

maybe a good solution would be to add a warn! log message when iced can't find an image. The second issue by Ivella seems to be #1774