diff --git a/Cargo.toml b/Cargo.toml index 4b4f00b090393..2939793ba13cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2804,28 +2804,6 @@ A shader in its most common usage is a small program that is run by the GPU per- There are also compute shaders which are used for more general processing leveraging the GPU's parallelism. """ -[[example]] -name = "custom_vertex_attribute" -path = "examples/shader/custom_vertex_attribute.rs" -doc-scrape-examples = true - -[package.metadata.example.custom_vertex_attribute] -name = "Custom Vertex Attribute" -description = "A shader that reads a mesh's custom vertex attribute" -category = "Shaders" -wasm = true - -[[example]] -name = "custom_post_processing" -path = "examples/shader/custom_post_processing.rs" -doc-scrape-examples = true - -[package.metadata.example.custom_post_processing] -name = "Post Processing - Custom Render Pass" -description = "A custom post processing effect, using a custom render pass that runs after the main pass" -category = "Shaders" -wasm = true - [[example]] name = "shader_defs" path = "examples/shader/shader_defs.rs" @@ -2916,29 +2894,6 @@ description = "A shader that uses WESL" category = "Shaders" wasm = true -[[example]] -name = "custom_shader_instancing" -path = "examples/shader/custom_shader_instancing.rs" -doc-scrape-examples = true - -[package.metadata.example.custom_shader_instancing] -name = "Instancing" -description = "A shader that renders a mesh multiple times in one draw call using low level rendering api" -category = "Shaders" -wasm = true - -[[example]] -name = "custom_render_phase" -path = "examples/shader/custom_render_phase.rs" -doc-scrape-examples = true - -[package.metadata.example.custom_render_phase] -name = "Custom Render Phase" -description = "Shows how to make a complete render phase" -category = "Shaders" -wasm = true - - [[example]] name = "automatic_instancing" path = "examples/shader/automatic_instancing.rs" @@ -2994,17 +2949,6 @@ description = "A shader that shows how to reuse the core bevy PBR shading functi category = "Shaders" wasm = true -[[example]] -name = "texture_binding_array" -path = "examples/shader/texture_binding_array.rs" -doc-scrape-examples = true - -[package.metadata.example.texture_binding_array] -name = "Texture Binding Array (Bindless Textures)" -description = "A shader that shows how to bind and sample multiple textures as a binding array (a.k.a. bindless textures)." -category = "Shaders" -wasm = false - [[example]] name = "storage_buffer" path = "examples/shader/storage_buffer.rs" @@ -3016,9 +2960,74 @@ description = "A shader that shows how to bind a storage buffer using a custom m category = "Shaders" wasm = true +# Shaders advanced +[[package.metadata.example_category]] +name = "Shaders - advanced" +description = """ +These examples demonstrate how to use the lower level rendering apis exposed from bevy. + +These are generally simplified examples of bevy's own rendering infrastructure. +""" + +[[example]] +name = "custom_vertex_attribute" +path = "examples/shader_advanced/custom_vertex_attribute.rs" +doc-scrape-examples = true + +[package.metadata.example.custom_vertex_attribute] +name = "Custom Vertex Attribute" +description = "A shader that reads a mesh's custom vertex attribute" +category = "Shaders" +wasm = true + +[[example]] +name = "custom_post_processing" +path = "examples/shader_advanced/custom_post_processing.rs" +doc-scrape-examples = true + +[package.metadata.example.custom_post_processing] +name = "Post Processing - Custom Render Pass" +description = "A custom post processing effect, using a custom render pass that runs after the main pass" +category = "Shaders" +wasm = true + +[[example]] +name = "custom_shader_instancing" +path = "examples/shader_advanced/custom_shader_instancing.rs" +doc-scrape-examples = true + +[package.metadata.example.custom_shader_instancing] +name = "Instancing" +description = "A shader that renders a mesh multiple times in one draw call using low level rendering api" +category = "Shaders" +wasm = true + +[[example]] +name = "custom_render_phase" +path = "examples/shader_advanced/custom_render_phase.rs" +doc-scrape-examples = true + +[package.metadata.example.custom_render_phase] +name = "Custom Render Phase" +description = "Shows how to make a complete render phase" +category = "Shaders" +wasm = true + +[[example]] +name = "texture_binding_array" +path = "examples/shader_advanced/texture_binding_array.rs" +doc-scrape-examples = true + +[package.metadata.example.texture_binding_array] +name = "Texture Binding Array (Bindless Textures)" +description = "A shader that shows how to bind and sample multiple textures as a binding array (a.k.a. bindless textures)." +category = "Shaders" +wasm = false + + [[example]] name = "specialized_mesh_pipeline" -path = "examples/shader/specialized_mesh_pipeline.rs" +path = "examples/shader_advanced/specialized_mesh_pipeline.rs" doc-scrape-examples = true [package.metadata.example.specialized_mesh_pipeline] @@ -4187,7 +4196,7 @@ wasm = false [[example]] name = "custom_phase_item" -path = "examples/shader/custom_phase_item.rs" +path = "examples/shader_advanced/custom_phase_item.rs" doc-scrape-examples = true [package.metadata.example.custom_phase_item] diff --git a/examples/README.md b/examples/README.md index 06d79d826288f..e15f8534cc32d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -458,14 +458,14 @@ Example | Description [Animated](../examples/shader/animate_shader.rs) | A shader that uses dynamic data like the time since startup [Array Texture](../examples/shader/array_texture.rs) | A shader that shows how to reuse the core bevy PBR shading functionality in a custom material that obtains the base color from an array texture. [Compute - Game of Life](../examples/shader/compute_shader_game_of_life.rs) | A compute shader that simulates Conway's Game of Life -[Custom Render Phase](../examples/shader/custom_render_phase.rs) | Shows how to make a complete render phase -[Custom Vertex Attribute](../examples/shader/custom_vertex_attribute.rs) | A shader that reads a mesh's custom vertex attribute -[Custom phase item](../examples/shader/custom_phase_item.rs) | Demonstrates how to enqueue custom draw commands in a render phase +[Custom Render Phase](../examples/shader_advanced/custom_render_phase.rs) | Shows how to make a complete render phase +[Custom Vertex Attribute](../examples/shader_advanced/custom_vertex_attribute.rs) | A shader that reads a mesh's custom vertex attribute +[Custom phase item](../examples/shader_advanced/custom_phase_item.rs) | Demonstrates how to enqueue custom draw commands in a render phase [Extended Bindless Material](../examples/shader/extended_material_bindless.rs) | Demonstrates bindless `ExtendedMaterial` [Extended Material](../examples/shader/extended_material.rs) | A custom shader that builds on the standard material [GPU readback](../examples/shader/gpu_readback.rs) | A very simple compute shader that writes to a buffer that is read by the cpu -[Instancing](../examples/shader/custom_shader_instancing.rs) | A shader that renders a mesh multiple times in one draw call using low level rendering api [Instancing](../examples/shader/automatic_instancing.rs) | Shows that multiple instances of a cube are automatically instanced in one draw call +[Instancing](../examples/shader_advanced/custom_shader_instancing.rs) | A shader that renders a mesh multiple times in one draw call using low level rendering api [Material](../examples/shader/shader_material.rs) | A shader and a material that uses it [Material](../examples/shader/shader_material_2d.rs) | A shader and a material that uses it on a 2d mesh [Material - Bindless](../examples/shader/shader_material_bindless.rs) | Demonstrates how to make materials that use bindless textures @@ -473,11 +473,11 @@ Example | Description [Material - Screenspace Texture](../examples/shader/shader_material_screenspace_texture.rs) | A shader that samples a texture with view-independent UV coordinates [Material - WESL](../examples/shader/shader_material_wesl.rs) | A shader that uses WESL [Material Prepass](../examples/shader/shader_prepass.rs) | A shader that uses the various textures generated by the prepass -[Post Processing - Custom Render Pass](../examples/shader/custom_post_processing.rs) | A custom post processing effect, using a custom render pass that runs after the main pass +[Post Processing - Custom Render Pass](../examples/shader_advanced/custom_post_processing.rs) | A custom post processing effect, using a custom render pass that runs after the main pass [Shader Defs](../examples/shader/shader_defs.rs) | A shader that uses "shaders defs" (a bevy tool to selectively toggle parts of a shader) -[Specialized Mesh Pipeline](../examples/shader/specialized_mesh_pipeline.rs) | Demonstrates how to write a specialized mesh pipeline +[Specialized Mesh Pipeline](../examples/shader_advanced/specialized_mesh_pipeline.rs) | Demonstrates how to write a specialized mesh pipeline [Storage Buffer](../examples/shader/storage_buffer.rs) | A shader that shows how to bind a storage buffer using a custom material. -[Texture Binding Array (Bindless Textures)](../examples/shader/texture_binding_array.rs) | A shader that shows how to bind and sample multiple textures as a binding array (a.k.a. bindless textures). +[Texture Binding Array (Bindless Textures)](../examples/shader_advanced/texture_binding_array.rs) | A shader that shows how to bind and sample multiple textures as a binding array (a.k.a. bindless textures). ### State diff --git a/examples/shader/custom_phase_item.rs b/examples/shader_advanced/custom_phase_item.rs similarity index 100% rename from examples/shader/custom_phase_item.rs rename to examples/shader_advanced/custom_phase_item.rs diff --git a/examples/shader/custom_post_processing.rs b/examples/shader_advanced/custom_post_processing.rs similarity index 100% rename from examples/shader/custom_post_processing.rs rename to examples/shader_advanced/custom_post_processing.rs diff --git a/examples/shader/custom_render_phase.rs b/examples/shader_advanced/custom_render_phase.rs similarity index 100% rename from examples/shader/custom_render_phase.rs rename to examples/shader_advanced/custom_render_phase.rs diff --git a/examples/shader/custom_shader_instancing.rs b/examples/shader_advanced/custom_shader_instancing.rs similarity index 100% rename from examples/shader/custom_shader_instancing.rs rename to examples/shader_advanced/custom_shader_instancing.rs diff --git a/examples/shader/custom_vertex_attribute.rs b/examples/shader_advanced/custom_vertex_attribute.rs similarity index 100% rename from examples/shader/custom_vertex_attribute.rs rename to examples/shader_advanced/custom_vertex_attribute.rs diff --git a/examples/shader/specialized_mesh_pipeline.rs b/examples/shader_advanced/specialized_mesh_pipeline.rs similarity index 100% rename from examples/shader/specialized_mesh_pipeline.rs rename to examples/shader_advanced/specialized_mesh_pipeline.rs diff --git a/examples/shader/texture_binding_array.rs b/examples/shader_advanced/texture_binding_array.rs similarity index 100% rename from examples/shader/texture_binding_array.rs rename to examples/shader_advanced/texture_binding_array.rs