From b0df3fb4d0f7d847a1bad646805dc93ae897582b Mon Sep 17 00:00:00 2001 From: TimJentzsch Date: Mon, 7 Jul 2025 22:02:21 +0200 Subject: [PATCH] Document why examples are disabled on the web, pass 1 (#19262) # Objective With the Bevy CLI, we now have an easy way to locally test if examples work on the web. We should start to explicitly document why examples don't work on the web to keep track and to ensure that as many examples are enabled as possible. ## Solution - Go through the examples with `wasm = false` and check if they really don't work - If they don't work, try to figure out why by looking through the code and announcement posts (we need better docs for this please) and add a comment explaining it - The `lightmap` example seemed to work without problems, so I enabled it ## Testing Install the [Bevy CLI](https://github.com/TheBevyFlock/bevy_cli) and run: ``` bevy run --example={example_name} web --open ``` # Future Work - There are about 100 more examples with `wasm = false` that also need to be documeneted - Also improve the documentation on the related features/plugins/types to make it easier for users to determine what they can use --------- Co-authored-by: Alice Cecile Co-authored-by: IceSentry --- Cargo.toml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 25abca725b..f047040bdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -868,6 +868,7 @@ doc-scrape-examples = true name = "Texture Atlas" description = "Generates a texture atlas (sprite sheet) from individual sprites" category = "2D Rendering" +# Loading asset folders is not supported in Wasm, but required to create the atlas. wasm = false [[example]] @@ -945,6 +946,7 @@ doc-scrape-examples = true name = "2D Wireframe" description = "Showcases wireframes for 2d meshes" category = "2D Rendering" +# PolygonMode::Line wireframes are not supported by WebGL wasm = false # 3D Rendering @@ -1012,6 +1014,7 @@ doc-scrape-examples = true name = "Anti-aliasing" description = "Compares different anti-aliasing methods" category = "3D Rendering" +# TAA not supported by WebGL wasm = false [[example]] @@ -1056,6 +1059,7 @@ doc-scrape-examples = true name = "Auto Exposure" description = "A scene showcasing auto exposure" category = "3D Rendering" +# Requires compute shaders, which are not supported by WebGL. wasm = false [[example]] @@ -1123,6 +1127,7 @@ doc-scrape-examples = true name = "Screen Space Ambient Occlusion" description = "A scene showcasing screen space ambient occlusion" category = "3D Rendering" +# Requires compute shaders, which are not supported by WebGL. wasm = false [[example]] @@ -1222,6 +1227,7 @@ doc-scrape-examples = true name = "Order Independent Transparency" description = "Demonstrates how to use OIT" category = "3D Rendering" +# Not supported by WebGL wasm = false [[example]] @@ -1321,7 +1327,7 @@ doc-scrape-examples = true name = "Skybox" description = "Load a cubemap texture onto a cube like a skybox and cycle through different compressed texture formats." category = "3D Rendering" -wasm = false +wasm = true [[example]] name = "solari" @@ -1432,6 +1438,7 @@ doc-scrape-examples = true name = "Wireframe" description = "Showcases wireframe rendering" category = "3D Rendering" +# Not supported on WebGL wasm = false [[example]] @@ -1443,6 +1450,8 @@ doc-scrape-examples = true name = "Irradiance Volumes" description = "Demonstrates irradiance volumes" category = "3D Rendering" +# On WebGL and WebGPU, the number of texture bindings is too low +# See wasm = false [[example]] @@ -1455,6 +1464,7 @@ required-features = ["meshlet"] name = "Meshlet" description = "Meshlet rendering for dense high-poly scenes (experimental)" category = "3D Rendering" +# Requires compute shaders and WGPU extensions, not supported by WebGL nor WebGPU. wasm = false setup = [ [ @@ -1490,7 +1500,7 @@ doc-scrape-examples = true name = "Lightmaps" description = "Rendering a scene with baked lightmaps" category = "3D Rendering" -wasm = false +wasm = true [[example]] name = "no_prepass" @@ -1643,6 +1653,7 @@ doc-scrape-examples = true name = "Custom Loop" description = "Demonstrates how to create a custom runner (to update an app manually)" category = "Application" +# Doesn't render anything, doesn't create a canvas wasm = false [[example]] @@ -1654,6 +1665,7 @@ doc-scrape-examples = true name = "Drag and Drop" description = "An example that shows how to handle drag and drop in an app" category = "Application" +# Browser drag and drop is not supported wasm = false [[example]] @@ -1665,6 +1677,7 @@ doc-scrape-examples = true name = "Empty" description = "An empty application (does nothing)" category = "Application" +# Doesn't render anything, doesn't create a canvas wasm = false [[example]] @@ -1688,6 +1701,7 @@ required-features = ["bevy_log"] name = "Headless" description = "An application that runs without default plugins" category = "Application" +# Doesn't render anything, doesn't create a canvas wasm = false [[example]] @@ -1710,6 +1724,8 @@ doc-scrape-examples = true name = "Log layers" description = "Illustrate how to add custom log layers" category = "Application" +# Accesses `time`, which is not available on the web +# Also doesn't render anything wasm = false [[example]] @@ -1721,6 +1737,7 @@ doc-scrape-examples = true name = "Advanced log layers" description = "Illustrate how to transfer data between log layers and Bevy's ECS" category = "Application" +# Doesn't render anything, doesn't create a canvas wasm = false [[example]]