-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Experimental WebGL wgpu backend support #1096
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
bdca20f
Experimental wgpu WebGL backend support
pacmancoder 9f47ac8
Use instant instead of std::instant
9082596
Remove wasm-specific clipboard
beebf25
Re-add docs for clipboard
f3fb00f
Use glow_glyp in opengl_integration example
f39147d
Always use event_loop.run
1e3feee
Reduce diff
825c774
Replace `iced_web` with WebGL support in `wgpu` :tada:
hecrj 26d95fd
Append `Canvas` to `<body>` when targetting Wasm in `iced_winit`
hecrj 7767241
Use WebGL2 limits for `Compositor` in `iced_wgpu`
hecrj 87b3e03
Enable `instant` only for `wasm32` targets
hecrj 83c649b
Move `time` module from `iced_native` to `iced_core`
hecrj 5dab5a3
Introduce `MaybeSend` trait in `iced_futures`
hecrj 167be45
Split `iced_futures` into different `backend` implementations
hecrj e730d97
Implement `time` module for `wasm-bindgen` backend in `iced_futures`
hecrj 90afd1d
Use `MaybeSend` in `perform` and `map` for `Command`
hecrj 2f57051
Add `index.html` for `todos` and `tour` example
hecrj 6f604ab
Allow `Application::run` to return on native platforms
hecrj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
pub mod alignment; | ||
pub mod keyboard; | ||
pub mod mouse; | ||
pub mod time; | ||
|
||
mod background; | ||
mod color; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! Keep track of time, both in native and web platforms! | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
pub use wasm_timer::Instant; | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
pub use std::time::Instant; | ||
|
||
pub use std::time::Duration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.wasm | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | ||
<title>Iced - wgpu + WebGL integration</title> | ||
</head> | ||
<body> | ||
<h1>integration_wgpu</h1> | ||
<canvas id="iced_canvas"></canvas> | ||
<script type="module"> | ||
import init from "./integration_wgpu.js"; | ||
init('./integration_wgpu_bg.wasm'); | ||
</script> | ||
<style> | ||
body { | ||
width: 100%; | ||
text-align: center; | ||
} | ||
</style> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[[stage(fragment)]] | ||
fn main() -> [[location(0)]] vec4<f32> { | ||
return vec4<f32>(1.0, 0.0, 0.0, 1.0); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[[stage(vertex)]] | ||
fn main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4<f32> { | ||
let x = f32(1 - i32(in_vertex_index)) * 0.5; | ||
let y = f32(1 - i32(in_vertex_index & 1u) * 2) * 0.5; | ||
return vec4<f32>(x, y, 0.0, 1.0); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think you can to save some
cfg
by doing:unless the
Window::new()
method returns separate types