Skip to content

Commit 5100cae

Browse files
committed
migrate to webgl instead of webgpu (for better compatability)
1 parent c41d6e1 commit 5100cae

11 files changed

Lines changed: 811 additions & 261 deletions

File tree

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ eframe = { version = "0.32", default-features = false, features = [
2323
egui_extras = { version = "0.32", features = ["svg"] }
2424
log = "0.4.27"
2525
egui-wgpu = "0.32.1"
26-
wgpu = "25.0"
26+
wgpu = { version = "25.0", default-features = false, features = ["wgsl"] }
2727
bytemuck = { version = "1.16", features = ["derive"] }
2828
image = { version = "0.25.6", features = ["serde"] }
2929

@@ -53,13 +53,17 @@ env_logger = "0.11.8"
5353
wasm-bindgen-futures = "0.4.50"
5454
web-sys = { version = "0.3.70", features = [
5555
"DedicatedWorkerGlobalScope", "Worker", "WorkerOptions", "WorkerType", "MessageEvent", "ErrorEvent",
56+
"HtmlScriptElement", "HtmlCollection", "Element", "NodeList", "Blob", "BlobPropertyBag", "Url", "Window", "Document",
5657
] } # to access the DOM (to hide the loading text)
5758
# gloo = { version = "0.11.0", features = ["futures"] }
5859
serde-wasm-bindgen = "0.6"
5960
futures = "0.3.31"
6061
wasm-bindgen = "0.2"
6162
console_error_panic_hook = "0.1.7"
6263

64+
# Override wgpu for WASM to use only WebGL backend
65+
wgpu = { version = "25.0", features = ["webgl"] }
66+
6367
[profile.release]
6468
opt-level = 3 # fast and small wasm
6569

index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
left: 0;
9494
width: 100%;
9595
height: 100%;
96+
/* Limit canvas size for WebGL compatibility (max 4096x4096) */
97+
max-width: 4096px;
98+
max-height: 4096px;
9699
}
97100

98101
.centered {
@@ -256,7 +259,6 @@
256259
<span class="icon-text">my website</span>
257260
</a>
258261
</div>
259-
260262
<!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
261263
<!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files -->
262264
<script>

0 commit comments

Comments
 (0)