Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MarcAntoine-Arnaud
Copy link

No description provided.

}
}

async fn run(event_loop: EventLoop<()>, window: Window) {
Copy link
Owner

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.

Copy link
Author

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"]}
Copy link
Owner

@hecrj hecrj Feb 6, 2021

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"
Copy link
Owner

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?

Copy link
Author

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 hecrj added the enhancement New feature or request label Feb 6, 2021
@MarcAntoine-Arnaud
Copy link
Author

@hecrj ping

@smolck
Copy link

smolck commented Mar 10, 2021

@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 Unsupported usage: TRANSFER_DST | UNIFORM, and it appears the wasm can't even be instantiated in Chrome Canary. This is the case when running it via WebGL or WebGPU.

@MarcAntoine-Arnaud
Copy link
Author

Hello @smolck,
The example cannot run on firefox right now due to unsupport of textures by wgpu 0.7.
The master branch will solve that for the next release.

I have tested on Chrome and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants