-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure hello example to run it in the web browser too #55
base: master
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
async fn run(event_loop: EventLoop<()>, window: Window) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have we introduced async
at the top level here?
It looks like we are not awaiting anywhere. In fact, we are running block_on
inside a Future
which is forbidden by contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async
is required for wasm_bindgen_futures::spawn_local
, it's inspired from Wgpu-rs Hello triangle example.
So I have remove the futures::executor::block_on
that's not necessary anymore.
@@ -11,7 +11,7 @@ documentation = "https://docs.rs/wgpu_glyph" | |||
readme = "README.md" | |||
|
|||
[dependencies] | |||
wgpu = "0.7" | |||
wgpu = {version = "0.7", features = ["webgl"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware that wgpu
supported WebGL now! That's very good news!
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] | ||
pollster = "0.2" | ||
wgpu-subscriber = "0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does wgpu-subscriber
do exactly? Does it replace env_logger
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and it's a pretty logger for web env, and more for Chrome as some code is dedicated to that browser.
In Chrome you can select log level, that wgpu-subscriber
detect and print the right log level.
@hecrj ping |
@MarcAntoine-Arnaud May I ask how this example is run? Following the directions mentioned in wgpu-rs's wiki, just modified for your branch, doesn't seem to work; I get errors in Firefox Nightly about |
Hello @smolck, I have tested on Chrome and it works. |
No description provided.